Commit | Line | Data |
---|---|---|
f240aacb LC |
1 | /* Provide a more complete sys/file.h. |
2 | ||
61cd9dc9 | 3 | Copyright (C) 2007-2010 Free Software Foundation, Inc. |
f240aacb LC |
4 | |
5 | This program is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU Lesser General Public License as published by | |
7 | the Free Software Foundation; either version 2, or (at your option) | |
8 | any later version. | |
9 | ||
10 | This program is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public License | |
16 | along with this program; if not, write to the Free Software Foundation, | |
17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | |
18 | ||
19 | /* Written by Richard W.M. Jones. */ | |
20 | #ifndef _GL_SYS_FILE_H | |
21 | ||
22 | # if __GNUC__ >= 3 | |
23 | @PRAGMA_SYSTEM_HEADER@ | |
24 | # endif | |
25 | ||
26 | /* The include_next requires a split double-inclusion guard. */ | |
27 | # if @HAVE_SYS_FILE_H@ | |
28 | # @INCLUDE_NEXT@ @NEXT_SYS_FILE_H@ | |
29 | # endif | |
30 | ||
31 | #ifndef _GL_SYS_FILE_H | |
32 | #define _GL_SYS_FILE_H | |
33 | ||
61cd9dc9 LC |
34 | #ifndef LOCK_SH |
35 | /* Operations for the 'flock' call (same as Linux kernel constants). */ | |
36 | # define LOCK_SH 1 /* Shared lock. */ | |
37 | # define LOCK_EX 2 /* Exclusive lock. */ | |
38 | # define LOCK_UN 8 /* Unlock. */ | |
39 | ||
40 | /* Can be OR'd in to one of the above. */ | |
41 | # define LOCK_NB 4 /* Don't block when locking. */ | |
42 | #endif | |
43 | ||
44 | /* The definition of _GL_WARN_ON_USE is copied here. */ | |
f240aacb LC |
45 | |
46 | #if @GNULIB_FLOCK@ | |
47 | /* Apply or remove advisory locks on an open file. | |
48 | Return 0 if successful, otherwise -1 and errno set. */ | |
49 | # if !@HAVE_FLOCK@ | |
50 | extern int flock (int fd, int operation); | |
f240aacb LC |
51 | # endif |
52 | #elif defined GNULIB_POSIXCHECK | |
53 | # undef flock | |
61cd9dc9 LC |
54 | # if HAVE_RAW_DECL_FLOCK |
55 | _GL_WARN_ON_USE (flock, "flock is unportable - " | |
56 | "use gnulib module flock for portability"); | |
57 | # endif | |
f240aacb LC |
58 | #endif |
59 | ||
60 | ||
61 | #endif /* _GL_SYS_FILE_H */ | |
62 | #endif /* _GL_SYS_FILE_H */ |