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