New module 'close'.
[pspp] / lib / sys_file.in.h
1 /* Provide a more complete sys/file.h.
2
3    Copyright (C) 2007-2008 Free Software Foundation, Inc.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU 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 General Public License for more details.
14
15    You should have received a copy of the GNU 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 @PRAGMA_SYSTEM_HEADER@
23
24 /* The include_next requires a split double-inclusion guard.  */
25 # if @HAVE_SYS_FILE_H@
26 #  @INCLUDE_NEXT@ @NEXT_SYS_FILE_H@
27 # endif
28
29 #ifndef _GL_SYS_FILE_H
30 #define _GL_SYS_FILE_H
31
32
33 #if @GNULIB_FLOCK@
34 /* Apply or remove advisory locks on an open file.
35    Return 0 if successful, otherwise -1 and errno set.  */
36 # if !@HAVE_FLOCK@
37 extern int flock (int fd, int operation);
38
39 /* Operations for the 'flock' call (same as Linux kernel constants).  */
40 #define LOCK_SH 1       /* Shared lock.  */
41 #define LOCK_EX 2       /* Exclusive lock.  */
42 #define LOCK_UN 8       /* Unlock.  */
43
44 /* Can be OR'd in to one of the above.  */
45 #define LOCK_NB 4       /* Don't block when locking.  */
46
47 # endif
48 #elif defined GNULIB_POSIXCHECK
49 # undef flock
50 # define flock(fd,op)                          \
51     (GL_LINK_WARNING ("flock is unportable - " \
52                       "use gnulib module flock for portability"), \
53      flock ((fd), (op)))
54 #endif
55
56
57 #endif /* _GL_SYS_FILE_H */
58 #endif /* _GL_SYS_FILE_H */