types.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #pragma once
  2. #include <sys/cdefs.h>
  3. #include <stdint.h>
  4. __BEGIN_DECLS
  5. typedef unsigned int u_int;
  6. typedef unsigned long u_long;
  7. typedef uint32_t uid_t;
  8. typedef uint32_t gid_t;
  9. typedef int __pid_t;
  10. #define pid_t __pid_t
  11. typedef __SIZE_TYPE__ size_t;
  12. typedef int __ssize_t;
  13. #define ssize_t __ssize_t
  14. typedef __WINT_TYPE__ wint_t;
  15. typedef uint32_t ino_t;
  16. typedef int32_t off_t;
  17. typedef uint32_t dev_t;
  18. typedef uint16_t mode_t;
  19. typedef uint32_t nlink_t;
  20. typedef uint32_t blksize_t;
  21. typedef uint32_t blkcnt_t;
  22. typedef uint32_t time_t;
  23. typedef uint32_t useconds_t;
  24. typedef uint32_t suseconds_t;
  25. typedef uint32_t clock_t;
  26. typedef uint32_t socklen_t;
  27. struct timeval {
  28. time_t tv_sec;
  29. suseconds_t tv_usec;
  30. };
  31. struct stat {
  32. dev_t st_dev; /* ID of device containing file */
  33. ino_t st_ino; /* inode number */
  34. mode_t st_mode; /* protection */
  35. nlink_t st_nlink; /* number of hard links */
  36. uid_t st_uid; /* user ID of owner */
  37. gid_t st_gid; /* group ID of owner */
  38. dev_t st_rdev; /* device ID (if special file) */
  39. off_t st_size; /* total size, in bytes */
  40. blksize_t st_blksize; /* blocksize for file system I/O */
  41. blkcnt_t st_blocks; /* number of 512B blocks allocated */
  42. time_t st_atime; /* time of last access */
  43. time_t st_mtime; /* time of last modification */
  44. time_t st_ctime; /* time of last status change */
  45. };
  46. struct utimbuf {
  47. time_t actime;
  48. time_t modtime;
  49. };
  50. #ifdef __cplusplus
  51. #define NULL nullptr
  52. #else
  53. #define NULL 0
  54. #endif
  55. __END_DECLS