unistd.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. */
  9. #ifndef _SYS_UNISTD_H
  10. #define _SYS_UNISTD_H
  11. #include <rtconfig.h>
  12. #include "types.h"
  13. #ifdef RT_USING_DFS
  14. #define STDIN_FILENO 0 /* standard input file descriptor */
  15. #define STDOUT_FILENO 1 /* standard output file descriptor */
  16. #define STDERR_FILENO 2 /* standard error file descriptor */
  17. #include <dfs_posix.h>
  18. #else
  19. #define _FREAD 0x0001 /* read enabled */
  20. #define _FWRITE 0x0002 /* write enabled */
  21. #define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */
  22. #define _FMARK 0x0010 /* internal; mark during gc() */
  23. #define _FDEFER 0x0020 /* internal; defer for next gc pass */
  24. #define _FASYNC 0x0040 /* signal pgrp when data ready */
  25. #define _FSHLOCK 0x0080 /* BSD flock() shared lock present */
  26. #define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */
  27. #define _FCREAT 0x0200 /* open with file create */
  28. #define _FTRUNC 0x0400 /* open with truncation */
  29. #define _FEXCL 0x0800 /* error on open if file exists */
  30. #define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */
  31. #define _FSYNC 0x2000 /* do all writes synchronously */
  32. #define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */
  33. #define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */
  34. #define _FNOCTTY 0x8000 /* don't assign a ctty on this open */
  35. #ifndef O_RDONLY
  36. #define O_RDONLY 0 /* +1 == FREAD */
  37. #endif
  38. #ifndef O_WRONLY
  39. #define O_WRONLY 1 /* +1 == FWRITE */
  40. #endif
  41. #ifndef O_RDWR
  42. #define O_RDWR 2 /* +1 == FREAD|FWRITE */
  43. #endif
  44. #ifndef O_APPEND
  45. #define O_APPEND _FAPPEND
  46. #endif
  47. #ifndef O_CREAT
  48. #define O_CREAT _FCREAT
  49. #endif
  50. #ifndef O_TRUNC
  51. #define O_TRUNC _FTRUNC
  52. #endif
  53. #ifndef O_EXCL
  54. #define O_EXCL _FEXCL
  55. #endif
  56. #ifndef O_SYNC
  57. #define O_SYNC _FSYNC
  58. #endif
  59. #endif
  60. int isatty (int fd);
  61. char * ttyname (int desc);
  62. unsigned int sleep(unsigned int seconds);
  63. int usleep(useconds_t usec);
  64. #endif /* _SYS_UNISTD_H */