diff options
Diffstat (limited to 'include/bits')
| -rw-r--r-- | include/bits/in_addr.h | 14 | ||||
| -rw-r--r-- | include/bits/select.h | 41 | ||||
| -rw-r--r-- | include/bits/sigevent.h | 20 | ||||
| -rw-r--r-- | include/bits/stat.h | 38 | ||||
| -rw-r--r-- | include/bits/timespec.h | 15 |
5 files changed, 128 insertions, 0 deletions
diff --git a/include/bits/in_addr.h b/include/bits/in_addr.h new file mode 100644 index 00000000..1d7ac0af --- /dev/null +++ b/include/bits/in_addr.h @@ -0,0 +1,14 @@ +#ifndef __BITS_IN_ADDR_H +#define __BITS_IN_ADDR_H + +#ifndef __BITS_IN_ADDR_H_ +#error "Internal header — include the public API header instead." +#endif + +typedef __UINT32_TYPE__ in_addr_t; + +struct in_addr { + in_addr_t s_addr; +}; + +#endif diff --git a/include/bits/select.h b/include/bits/select.h new file mode 100644 index 00000000..f1f952ab --- /dev/null +++ b/include/bits/select.h @@ -0,0 +1,41 @@ +#ifndef __BITS_SELECT_H +#define __BITS_SELECT_H + +#ifndef __BITS_SELECT_H_ +#error "Internal header — include the public API header instead." +#endif + +#define FD_SETSIZE 1024 + +#define FD_ZERO(set) \ + do { \ + for (size_t i = 0; \ + i < sizeof((set)->fds_bits) / sizeof(fd_mask); i++) \ + (set)->fds_bits[i] = 0; \ + } while (0) + +#define FD_SET(fd, set) \ + ((set)->fds_bits[(fd) / (8 * sizeof(fd_mask))] |= \ + (1UL << ((fd) % (8 * sizeof(fd_mask))))) + +#define FD_CLR(fd, set) \ + ((set)->fds_bits[(fd) / (8 * sizeof(fd_mask))] &= \ + ~(1UL << ((fd) % (8 * sizeof(fd_mask))))) + +#define FD_ISSET(fd, set) \ + (((set)->fds_bits[(fd) / (8 * sizeof(fd_mask))] & \ + (1UL << ((fd) % (8 * sizeof(fd_mask))))) != 0) + +typedef __INT64_TYPE__ time_t; +typedef __INT64_TYPE__ suseconds_t; + +typedef struct { + unsigned long fds_bits[1024 / (8 * sizeof(unsigned long))]; +} fd_set; + +struct timeval { + time_t tv_sec; + suseconds_t tv_usec; +}; + +#endif diff --git a/include/bits/sigevent.h b/include/bits/sigevent.h new file mode 100644 index 00000000..b36e676c --- /dev/null +++ b/include/bits/sigevent.h @@ -0,0 +1,20 @@ +#ifndef __BITS_SIGEVENT_H +#define __BITS_SIGEVENT_H + +#ifndef __BITS_SIGEVENT_H_ +#error "Internal header — include the public API header instead." +#endif + +union sigval { + int sival_int; + void *sival_ptr; +}; + +struct sigevent { + int sigev_notify; + int sigev_signo; + union sigval sigev_value; + void (*sigev_notify_function)(union sigval); +}; + +#endif diff --git a/include/bits/stat.h b/include/bits/stat.h new file mode 100644 index 00000000..faa23771 --- /dev/null +++ b/include/bits/stat.h @@ -0,0 +1,38 @@ +#ifndef __BITS_STAT_H +#define __BITS_STAT_H + +#ifndef __BITS_STAT_H_ +#error "Internal header — include the public API header instead." +#endif + +#define __BITS_TIMESPEC_H_ +#include <bits/timespec.h> +#undef __BITS_TIMESPEC_H_ + +typedef __UINT64_TYPE__ dev_t; +typedef __UINT64_TYPE__ ino_t; +typedef __UINT32_TYPE__ mode_t; +typedef __UINT32_TYPE__ nlink_t; +typedef __UINT32_TYPE__ uid_t; +typedef __UINT32_TYPE__ gid_t; +typedef __INT64_TYPE__ off_t; +typedef __INT32_TYPE__ blksize_t; +typedef __INT64_TYPE__ blkcnt_t; + +struct stat { + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + off_t st_size; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + blksize_t st_blksize; + blkcnt_t st_blocks; +}; + +#endif diff --git a/include/bits/timespec.h b/include/bits/timespec.h new file mode 100644 index 00000000..ebcacf76 --- /dev/null +++ b/include/bits/timespec.h @@ -0,0 +1,15 @@ +#ifndef __BITS_TIMESPEC_H +#define __BITS_TIMESPEC_H + +#ifndef __BITS_TIMESPEC_H_ +#error "Never include <bits/timespec.h> directly; use <time.h> instead." +#endif + +typedef __INT64_TYPE__ time_t; + +struct timespec { + time_t tv_sec; + long tv_nsec; +}; + +#endif |
