unistd.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (c) 2006-2022, 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. * 2021-09-11 Meco Man move functions from dfs_posix.h to unistd.h
  10. */
  11. #ifndef __SYS_UNISTD_H__
  12. #define __SYS_UNISTD_H__
  13. #include <stddef.h>
  14. #include <sys/types.h>
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #define _POSIX_VDISABLE 0
  19. #define STDIN_FILENO 0 /* standard input file descriptor */
  20. #define STDOUT_FILENO 1 /* standard output file descriptor */
  21. #define STDERR_FILENO 2 /* standard error file descriptor */
  22. #define F_OK 0
  23. #define X_OK 1
  24. #define W_OK 2
  25. #define R_OK 4
  26. unsigned alarm(unsigned __secs);
  27. ssize_t read(int fd, void *buf, size_t len);
  28. ssize_t write(int fd, const void *buf, size_t len);
  29. off_t lseek(int fd, off_t offset, int whence);
  30. int pause(void);
  31. int fsync(int fildes);
  32. long sysconf(int __name);
  33. int unlink(const char *pathname);
  34. int close(int d);
  35. int ftruncate(int fd, off_t length);
  36. int rmdir(const char *path);
  37. int chdir(const char *path);
  38. char *getcwd(char *buf, size_t size);
  39. int access(const char *path, int amode);
  40. int pipe(int fildes[2]);
  41. int isatty(int fd);
  42. char *ttyname(int desc);
  43. unsigned int sleep(unsigned int seconds);
  44. int usleep(useconds_t usec);
  45. pid_t gettid(void);
  46. pid_t getpid(void);
  47. pid_t getppid(void);
  48. uid_t getuid(void);
  49. uid_t geteuid(void);
  50. gid_t getgid(void);
  51. gid_t getegid(void);
  52. #ifdef __cplusplus
  53. }
  54. #endif
  55. #endif /* _SYS_UNISTD_H */