linux_types.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /* -*- mode:c; c-file-style:"k&r"; c-basic-offset: 4; tab-width:4; indent-tabs-mode:nil; mode:auto-fill; fill-column:78; -*- */
  2. /* vim: set ts=4 sw=4 et tw=78 fo=cqt wm=0: */
  3. #ifndef __LINUX_TYPES_H__
  4. #define __LINUX_TYPES_H__
  5. #include <linux/socket.h>
  6. #include <linux/time.h>
  7. #define __timespec_defined
  8. #undef __USE_POSIX199309
  9. #include <linux/poll.h>
  10. #include <linux/sched.h>
  11. #include <asm/posix_types.h>
  12. #include <asm/stat.h>
  13. #include <asm/fcntl.h>
  14. #include <sigset.h>
  15. #ifndef size_t
  16. typedef __kernel_size_t size_t;
  17. #endif
  18. struct linux_dirent64 {
  19. unsigned long d_ino;
  20. unsigned long d_off;
  21. unsigned short d_reclen;
  22. unsigned char d_type;
  23. char d_name[];
  24. };
  25. #define DT_UNKNOWN 0
  26. #define DT_FIFO 1
  27. #define DT_CHR 2
  28. #define DT_DIR 4
  29. #define DT_BLK 6
  30. #define DT_REG 8
  31. #define DT_LNK 10
  32. #define DT_SOCK 12
  33. #define DT_WHT 14
  34. typedef unsigned short int sa_family_t;
  35. struct sockaddr {
  36. sa_family_t sa_family;
  37. char sa_data[128 - sizeof(unsigned short)];
  38. };
  39. #ifndef AF_UNIX
  40. # define AF_UNIX 1
  41. #endif
  42. #ifndef AF_INET
  43. # define AF_INET 2
  44. #endif
  45. #ifndef AF_INET6
  46. # define AF_INET6 10
  47. #endif
  48. #ifndef SOCK_STREAM
  49. # define SOCK_STREAM 1
  50. #endif
  51. #ifndef SOCK_DGRAM
  52. # define SOCK_DGRAM 2
  53. #endif
  54. #ifndef SOCK_NONBLOCK
  55. # define SOCK_NONBLOCK 04000
  56. #endif
  57. #ifndef SOCK_CLOEXEC
  58. # define SOCK_CLOEXEC 02000000
  59. #endif
  60. #ifndef MSG_NOSIGNAL
  61. # define MSG_NOSIGNAL 0x4000
  62. #endif
  63. #ifndef SHUT_RD
  64. # define SHUT_RD 0
  65. #endif
  66. #ifndef SHUT_WR
  67. # define SHUT_WR 1
  68. #endif
  69. #ifndef SHUT_RDWR
  70. # define SHUT_RDWR 2
  71. #endif
  72. typedef unsigned int socklen_t;
  73. struct msghdr {
  74. void *msg_name;
  75. socklen_t msg_namelen;
  76. struct iovec *msg_iov;
  77. size_t msg_iovlen;
  78. void *msg_control;
  79. size_t msg_controllen;
  80. int msg_flags;
  81. };
  82. struct cmsghdr {
  83. size_t cmsg_len;
  84. int cmsg_level;
  85. int cmsg_type;
  86. };
  87. #ifndef SCM_RIGHTS
  88. # define SCM_RIGHTS 1
  89. #endif
  90. #define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
  91. #define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
  92. #define CMSG_FIRSTHDR(mhdr) \
  93. ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \
  94. ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)
  95. #define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
  96. & (size_t) ~(sizeof (size_t) - 1))
  97. #define CMSG_SPACE(len) (CMSG_ALIGN (len) \
  98. + CMSG_ALIGN (sizeof (struct cmsghdr)))
  99. #define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
  100. #include <linux/uio.h>
  101. struct sockopt {
  102. int receivebuf, sendbuf;
  103. int receivetimeout, sendtimeout;
  104. int linger;
  105. int reuseaddr:1;
  106. int tcp_cork:1;
  107. int tcp_keepalive:1;
  108. int tcp_nodelay:1;
  109. };
  110. #endif