summaryrefslogtreecommitdiff
path: root/Libraries/LibC/fd_set.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-07-04 16:16:50 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-07-04 16:16:50 +0200
commit04b9dc2d30cfc9b383029f6a4b02e2725108b0ae (patch)
treee117a998173b767f9fd009d49c4f8573d8b85432 /Libraries/LibC/fd_set.h
parent63814ffebf16291419745cd8ba29a4d2fd888563 (diff)
downloadserenity-04b9dc2d30cfc9b383029f6a4b02e2725108b0ae.zip
Libraries: Create top level directory for libraries.
Things were getting a little crowded in the project root, so this patch moves the Lib*/ directories into Libraries/.
Diffstat (limited to 'Libraries/LibC/fd_set.h')
-rw-r--r--Libraries/LibC/fd_set.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/Libraries/LibC/fd_set.h b/Libraries/LibC/fd_set.h
new file mode 100644
index 0000000000..802c0b3385
--- /dev/null
+++ b/Libraries/LibC/fd_set.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#define FD_SETSIZE 64
+#define FD_ZERO(set) memset((set), 0, sizeof(fd_set));
+#define FD_CLR(fd, set) ((set)->bits[(fd / 8)] &= ~(1 << (fd) % 8))
+#define FD_SET(fd, set) ((set)->bits[(fd / 8)] |= (1 << (fd) % 8))
+#define FD_ISSET(fd, set) ((set)->bits[(fd / 8)] & (1 << (fd) % 8))
+
+struct __fd_set {
+ unsigned char bits[FD_SETSIZE / 8];
+};
+
+typedef struct __fd_set fd_set;