summaryrefslogtreecommitdiff
path: root/include/bits
diff options
context:
space:
mode:
Diffstat (limited to 'include/bits')
-rw-r--r--include/bits/rsize.h12
-rw-r--r--include/bits/select.h27
-rw-r--r--include/bits/siginfo.h28
-rw-r--r--include/bits/stat.h4
4 files changed, 56 insertions, 15 deletions
diff --git a/include/bits/rsize.h b/include/bits/rsize.h
new file mode 100644
index 00000000..1a552fa3
--- /dev/null
+++ b/include/bits/rsize.h
@@ -0,0 +1,12 @@
+#ifndef __BITS_RSIZE_H
+#define __BITS_RSIZE_H
+
+#ifndef __BITS_RSIZE_H_
+#error "Internal header — include the public API header instead."
+#else
+#undef __BITS_RSIZE_H_
+#endif
+
+typedef __SIZE_TYPE__ rsize_t;
+
+#endif
diff --git a/include/bits/select.h b/include/bits/select.h
index f1f952ab..f5b63ccc 100644
--- a/include/bits/select.h
+++ b/include/bits/select.h
@@ -3,28 +3,25 @@
#ifndef __BITS_SELECT_H_
#error "Internal header — include the public API header instead."
+#else
+#undef __BITS_SELECT_H_
#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_ZERO(set) __builtin_memset((set), 0, sizeof(*(set)))
-#define FD_SET(fd, set) \
- ((set)->fds_bits[(fd) / (8 * sizeof(fd_mask))] |= \
- (1UL << ((fd) % (8 * sizeof(fd_mask)))))
+#define FD_SET(fd, set) \
+ ((set)->fds_bits[(fd) / (8 * sizeof(unsigned long))] |= \
+ 1UL << ((fd) % (8 * sizeof(unsigned long))))
-#define FD_CLR(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(unsigned long))] &= \
+ ~(1UL << ((fd) % (8 * sizeof(unsigned long)))))
-#define FD_ISSET(fd, set) \
- (((set)->fds_bits[(fd) / (8 * sizeof(fd_mask))] & \
- (1UL << ((fd) % (8 * sizeof(fd_mask))))) != 0)
+#define FD_ISSET(fd, set) \
+ ((set)->fds_bits[(fd) / (8 * sizeof(unsigned long))] & \
+ (1UL << ((fd) % (8 * sizeof(unsigned long)))))
typedef __INT64_TYPE__ time_t;
typedef __INT64_TYPE__ suseconds_t;
diff --git a/include/bits/siginfo.h b/include/bits/siginfo.h
new file mode 100644
index 00000000..6a254596
--- /dev/null
+++ b/include/bits/siginfo.h
@@ -0,0 +1,28 @@
+#ifndef __BITS_SIGINFO_H
+#define __BITS_SIGINFO_H
+
+#ifndef __BITS_SIGINFO_H_
+#error "Internal header — include the public API header instead."
+#else
+#undef __BITS_SIGINFO_H_
+#endif
+
+#define __BITS_SIGEVENT_H_
+#include <bits/sigevent.h>
+
+typedef __UINT32_TYPE__ id_t;
+typedef __INT64_TYPE__ pid_t;
+typedef __UINT32_TYPE__ uid_t;
+
+typedef struct {
+ int si_signo;
+ int si_code;
+ int si_errno;
+ pid_t si_pid;
+ uid_t si_uid;
+ void *si_addr;
+ int si_status;
+ union sigval si_value;
+} siginfo_t;
+
+#endif
diff --git a/include/bits/stat.h b/include/bits/stat.h
index faa23771..ba43e695 100644
--- a/include/bits/stat.h
+++ b/include/bits/stat.h
@@ -35,4 +35,8 @@ struct stat {
blkcnt_t st_blocks;
};
+#define st_atime st_atim.tv_sec
+#define st_mtime st_mtim.tv_sec
+#define st_ctime st_ctim.tv_sec
+
#endif