libc_fcntl.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. */
  24. #ifndef LIBC_FCNTL_H__
  25. #define LIBC_FCNTL_H__
  26. #if defined(RT_USING_NEWLIB) || defined(_WIN32)
  27. #include <fcntl.h>
  28. #ifndef O_NONBLOCK
  29. #define O_NONBLOCK 0x4000
  30. #endif
  31. #if defined(_WIN32)
  32. #define O_ACCMODE (_O_RDONLY | _O_WRONLY | _O_RDWR)
  33. #endif
  34. #ifndef F_GETFL
  35. #define F_GETFL 3
  36. #endif
  37. #ifndef F_SETFL
  38. #define F_SETFL 4
  39. #endif
  40. #ifndef O_DIRECTORY
  41. #define O_DIRECTORY 0x200000
  42. #endif
  43. #else
  44. #define O_RDONLY 00
  45. #define O_WRONLY 01
  46. #define O_RDWR 02
  47. #define O_CREAT 0100
  48. #define O_EXCL 0200
  49. #define O_NOCTTY 0400
  50. #define O_TRUNC 01000
  51. #define O_APPEND 02000
  52. #define O_NONBLOCK 04000
  53. #define O_DSYNC 010000
  54. #define O_SYNC 04010000
  55. #define O_RSYNC 04010000
  56. #define O_BINARY 0100000
  57. #define O_DIRECTORY 0200000
  58. #define O_NOFOLLOW 0400000
  59. #define O_CLOEXEC 02000000
  60. #define O_ASYNC 020000
  61. #define O_DIRECT 040000
  62. #define O_LARGEFILE 0100000
  63. #define O_NOATIME 01000000
  64. #define O_PATH 010000000
  65. #define O_TMPFILE 020200000
  66. #define O_NDELAY O_NONBLOCK
  67. #define O_SEARCH O_PATH
  68. #define O_EXEC O_PATH
  69. #define O_ACCMODE (03|O_SEARCH)
  70. #define F_DUPFD 0
  71. #define F_GETFD 1
  72. #define F_SETFD 2
  73. #define F_GETFL 3
  74. #define F_SETFL 4
  75. #define F_SETOWN 8
  76. #define F_GETOWN 9
  77. #define F_SETSIG 10
  78. #define F_GETSIG 11
  79. #define F_GETLK 12
  80. #define F_SETLK 13
  81. #define F_SETLKW 14
  82. #define F_SETOWN_EX 15
  83. #define F_GETOWN_EX 16
  84. #define F_GETOWNER_UIDS 17
  85. #endif
  86. #endif