Commit | Line | Data |
---|---|---|
f240aacb LC |
1 | /* Provide a more complete sys/file.h. |
2 | ||
af07e104 | 3 | Copyright (C) 2007-2013 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 | |
005de2e8 | 16 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ |
f240aacb LC |
17 | |
18 | /* Written by Richard W.M. Jones. */ | |
a927b6c1 | 19 | |
3d458a81 | 20 | #ifndef _@GUARD_PREFIX@_SYS_FILE_H |
f240aacb | 21 | |
a927b6c1 | 22 | #if __GNUC__ >= 3 |
f240aacb | 23 | @PRAGMA_SYSTEM_HEADER@ |
a927b6c1 | 24 | #endif |
0f00f2c3 | 25 | @PRAGMA_COLUMNS@ |
f240aacb LC |
26 | |
27 | /* The include_next requires a split double-inclusion guard. */ | |
a927b6c1 LC |
28 | #if @HAVE_SYS_FILE_H@ |
29 | # @INCLUDE_NEXT@ @NEXT_SYS_FILE_H@ | |
30 | #endif | |
f240aacb | 31 | |
3d458a81 AW |
32 | #ifndef _@GUARD_PREFIX@_SYS_FILE_H |
33 | #define _@GUARD_PREFIX@_SYS_FILE_H | |
f240aacb | 34 | |
61cd9dc9 LC |
35 | #ifndef LOCK_SH |
36 | /* Operations for the 'flock' call (same as Linux kernel constants). */ | |
37 | # define LOCK_SH 1 /* Shared lock. */ | |
38 | # define LOCK_EX 2 /* Exclusive lock. */ | |
39 | # define LOCK_UN 8 /* Unlock. */ | |
40 | ||
41 | /* Can be OR'd in to one of the above. */ | |
42 | # define LOCK_NB 4 /* Don't block when locking. */ | |
43 | #endif | |
44 | ||
45 | /* The definition of _GL_WARN_ON_USE is copied here. */ | |
f240aacb LC |
46 | |
47 | #if @GNULIB_FLOCK@ | |
48 | /* Apply or remove advisory locks on an open file. | |
49 | Return 0 if successful, otherwise -1 and errno set. */ | |
50 | # if !@HAVE_FLOCK@ | |
51 | extern int flock (int fd, int operation); | |
f240aacb LC |
52 | # endif |
53 | #elif defined GNULIB_POSIXCHECK | |
54 | # undef flock | |
61cd9dc9 LC |
55 | # if HAVE_RAW_DECL_FLOCK |
56 | _GL_WARN_ON_USE (flock, "flock is unportable - " | |
57 | "use gnulib module flock for portability"); | |
58 | # endif | |
f240aacb LC |
59 | #endif |
60 | ||
61 | ||
3d458a81 AW |
62 | #endif /* _@GUARD_PREFIX@_SYS_FILE_H */ |
63 | #endif /* _@GUARD_PREFIX@_SYS_FILE_H */ |