libc_fcntl.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * File : libc_fcntl.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2017 - 2018, RT-Thread Development Team
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. * Change Logs:
  21. * Date Author Notes
  22. * 2018-02-07 Bernard Add O_DIRECTORY definition in NEWLIB mode.
  23. * 2018-02-09 Bernard Add O_BINARY definition
  24. */
  25. #ifndef LIBC_FCNTL_H__
  26. #define LIBC_FCNTL_H__
  27. #if defined(RT_USING_NEWLIB) || defined(_WIN32)
  28. #include <fcntl.h>
  29. #ifndef O_NONBLOCK
  30. #define O_NONBLOCK 0x4000
  31. #endif
  32. #if defined(_WIN32)
  33. #define O_ACCMODE (_O_RDONLY | _O_WRONLY | _O_RDWR)
  34. #endif
  35. #ifndef F_GETFL
  36. #define F_GETFL 3
  37. #endif
  38. #ifndef F_SETFL
  39. #define F_SETFL 4
  40. #endif
  41. #ifndef O_DIRECTORY
  42. #define O_DIRECTORY 0x200000
  43. #endif
  44. #ifndef O_BINARY
  45. #ifdef _O_BINARY
  46. #define O_BINARY _O_BINARY
  47. #else
  48. #define O_BINARY 0
  49. #endif
  50. #endif
  51. #else
  52. #define O_RDONLY 00
  53. #define O_WRONLY 01
  54. #define O_RDWR 02
  55. #define O_CREAT 0100
  56. #define O_EXCL 0200
  57. #define O_NOCTTY 0400
  58. #define O_TRUNC 01000
  59. #define O_APPEND 02000
  60. #define O_NONBLOCK 04000
  61. #define O_DSYNC 010000
  62. #define O_SYNC 04010000
  63. #define O_RSYNC 04010000
  64. #define O_BINARY 0100000
  65. #define O_DIRECTORY 0200000
  66. #define O_NOFOLLOW 0400000
  67. #define O_CLOEXEC 02000000
  68. #define O_ASYNC 020000
  69. #define O_DIRECT 040000
  70. #define O_LARGEFILE 0100000
  71. #define O_NOATIME 01000000
  72. #define O_PATH 010000000
  73. #define O_TMPFILE 020200000
  74. #define O_NDELAY O_NONBLOCK
  75. #define O_SEARCH O_PATH
  76. #define O_EXEC O_PATH
  77. #define O_ACCMODE (03|O_SEARCH)
  78. #define F_DUPFD 0
  79. #define F_GETFD 1
  80. #define F_SETFD 2
  81. #define F_GETFL 3
  82. #define F_SETFL 4
  83. #define F_SETOWN 8
  84. #define F_GETOWN 9
  85. #define F_SETSIG 10
  86. #define F_GETSIG 11
  87. #define F_GETLK 12
  88. #define F_SETLK 13
  89. #define F_SETLKW 14
  90. #define F_SETOWN_EX 15
  91. #define F_GETOWN_EX 16
  92. #define F_GETOWNER_UIDS 17
  93. #endif
  94. #endif