fcntl.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2021, sin-ack <sin-ack@protonmail.com>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <sys/cdefs.h>
  9. #include <sys/types.h>
  10. __BEGIN_DECLS
  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 FD_CLOEXEC 1
  18. #define O_RDONLY (1 << 0)
  19. #define O_WRONLY (1 << 1)
  20. #define O_RDWR (O_RDONLY | O_WRONLY)
  21. #define O_ACCMODE (O_RDONLY | O_WRONLY)
  22. #define O_EXEC (1 << 2)
  23. #define O_CREAT (1 << 3)
  24. #define O_EXCL (1 << 4)
  25. #define O_NOCTTY (1 << 5)
  26. #define O_TRUNC (1 << 6)
  27. #define O_APPEND (1 << 7)
  28. #define O_NONBLOCK (1 << 8)
  29. #define O_DIRECTORY (1 << 9)
  30. #define O_NOFOLLOW (1 << 10)
  31. #define O_CLOEXEC (1 << 11)
  32. #define O_DIRECT (1 << 12)
  33. int creat(const char* path, mode_t);
  34. int open(const char* path, int options, ...);
  35. #define AT_FDCWD -100
  36. #define AT_SYMLINK_NOFOLLOW 0x100
  37. int openat(int dirfd, const char* path, int options, ...);
  38. int fcntl(int fd, int cmd, ...);
  39. int create_inode_watcher(unsigned flags);
  40. int inode_watcher_add_watch(int fd, const char* path, size_t path_length, unsigned event_mask);
  41. int inode_watcher_remove_watch(int fd, int wd);
  42. #define F_RDLCK 0
  43. #define F_WRLCK 1
  44. #define F_UNLCK 2
  45. #define F_GETLK 5
  46. #define F_SETLK 6
  47. #define F_SETLKW 7
  48. struct flock {
  49. short l_type;
  50. short l_whence;
  51. off_t l_start;
  52. off_t l_len;
  53. pid_t l_pid;
  54. };
  55. __END_DECLS