fcntl.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <Kernel/API/POSIX/sys/types.h>
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. #define F_DUPFD 0
  12. #define F_GETFD 1
  13. #define F_SETFD 2
  14. #define F_GETFL 3
  15. #define F_SETFL 4
  16. #define F_ISTTY 5
  17. #define F_GETLK 6
  18. #define F_SETLK 7
  19. #define F_SETLKW 8
  20. #define FD_CLOEXEC 1
  21. #define O_RDONLY (1 << 0)
  22. #define O_WRONLY (1 << 1)
  23. #define O_RDWR (O_RDONLY | O_WRONLY)
  24. #define O_ACCMODE (O_RDONLY | O_WRONLY)
  25. #define O_EXEC (1 << 2)
  26. #define O_CREAT (1 << 3)
  27. #define O_EXCL (1 << 4)
  28. #define O_NOCTTY (1 << 5)
  29. #define O_TRUNC (1 << 6)
  30. #define O_APPEND (1 << 7)
  31. #define O_NONBLOCK (1 << 8)
  32. #define O_DIRECTORY (1 << 9)
  33. #define O_NOFOLLOW (1 << 10)
  34. #define O_CLOEXEC (1 << 11)
  35. #define O_DIRECT (1 << 12)
  36. #define F_RDLCK ((short)0)
  37. #define F_WRLCK ((short)1)
  38. #define F_UNLCK ((short)2)
  39. #define AT_FDCWD -100
  40. #define AT_SYMLINK_NOFOLLOW 0x100
  41. struct flock {
  42. short l_type;
  43. short l_whence;
  44. off_t l_start;
  45. off_t l_len;
  46. pid_t l_pid;
  47. };
  48. #ifdef __cplusplus
  49. }
  50. #endif