unistd.h 2.3 KB

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