| 1 |
/* Provide a more complete sys/file.h. |
| 2 |
|
| 3 |
Copyright (C) 2007-2024 Free Software Foundation, Inc. |
| 4 |
|
| 5 |
This file is free software: you can redistribute it and/or modify |
| 6 |
it under the terms of the GNU Lesser General Public License as |
| 7 |
published by the Free Software Foundation; either version 2.1 of the |
| 8 |
License, or (at your option) any later version. |
| 9 |
|
| 10 |
This file 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, see <https://www.gnu.org/licenses/>. */ |
| 17 |
|
| 18 |
/* Written by Richard W.M. Jones. */ |
| 19 |
|
| 20 |
#ifndef _@GUARD_PREFIX@_SYS_FILE_H |
| 21 |
|
| 22 |
#if __GNUC__ >= 3 |
| 23 |
@PRAGMA_SYSTEM_HEADER@ |
| 24 |
#endif |
| 25 |
@PRAGMA_COLUMNS@ |
| 26 |
|
| 27 |
/* The include_next requires a split double-inclusion guard. */ |
| 28 |
#if @HAVE_SYS_FILE_H@ |
| 29 |
# @INCLUDE_NEXT@ @NEXT_SYS_FILE_H@ |
| 30 |
#endif |
| 31 |
|
| 32 |
#ifndef _@GUARD_PREFIX@_SYS_FILE_H |
| 33 |
#define _@GUARD_PREFIX@_SYS_FILE_H |
| 34 |
|
| 35 |
/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ |
| 36 |
#if !_GL_CONFIG_H_INCLUDED |
| 37 |
#error "Please include config.h first." |
| 38 |
#endif |
| 39 |
|
| 40 |
#ifndef LOCK_SH |
| 41 |
/* Operations for the 'flock' call (same as Linux kernel constants). */ |
| 42 |
# define LOCK_SH 1 /* Shared lock. */ |
| 43 |
# define LOCK_EX 2 /* Exclusive lock. */ |
| 44 |
# define LOCK_UN 8 /* Unlock. */ |
| 45 |
|
| 46 |
/* Can be OR'd into one of the above. */ |
| 47 |
# define LOCK_NB 4 /* Don't block when locking. */ |
| 48 |
#endif |
| 49 |
|
| 50 |
/* The definition of _GL_WARN_ON_USE is copied here. */ |
| 51 |
|
| 52 |
#if @GNULIB_FLOCK@ |
| 53 |
/* Apply or remove advisory locks on an open file. |
| 54 |
Return 0 if successful, otherwise -1 and errno set. */ |
| 55 |
# if !@HAVE_FLOCK@ |
| 56 |
extern int flock (int fd, int operation); |
| 57 |
# endif |
| 58 |
#elif defined GNULIB_POSIXCHECK |
| 59 |
# undef flock |
| 60 |
# if HAVE_RAW_DECL_FLOCK |
| 61 |
_GL_WARN_ON_USE (flock, "flock is unportable - " |
| 62 |
"use gnulib module flock for portability"); |
| 63 |
# endif |
| 64 |
#endif |
| 65 |
|
| 66 |
|
| 67 |
#endif /* _@GUARD_PREFIX@_SYS_FILE_H */ |
| 68 |
#endif /* _@GUARD_PREFIX@_SYS_FILE_H */ |