sys_file.in.h 1.9 KB

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