summaryrefslogtreecommitdiff
path: root/lib/libc/include
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/include')
-rw-r--r--lib/libc/include/__alpha.h233
-rw-r--r--lib/libc/include/__dirent.h25
-rw-r--r--lib/libc/include/__locale.h41
-rw-r--r--lib/libc/include/__select.h8
-rw-r--r--lib/libc/include/__signal.h12
-rw-r--r--lib/libc/include/__statvfs.h21
-rw-r--r--lib/libc/include/atomic.h23
-rw-r--r--lib/libc/include/byteswap.h8
-rw-r--r--lib/libc/include/features.h6
-rw-r--r--lib/libc/include/io.h55
-rw-r--r--lib/libc/include/libc.h27
-rw-r--r--lib/libc/include/libc/dirent.h6
-rw-r--r--lib/libc/include/malloc.h98
-rw-r--r--lib/libc/include/syscall.h59
-rw-r--r--lib/libc/include/thread.h9
15 files changed, 631 insertions, 0 deletions
diff --git a/lib/libc/include/__alpha.h b/lib/libc/include/__alpha.h
new file mode 100644
index 00000000..f2e8bfb1
--- /dev/null
+++ b/lib/libc/include/__alpha.h
@@ -0,0 +1,233 @@
+/* Alpha ISO8859-1 font data */
+18, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 17, 34, 35,
+ 36, 17, 37, 38, 39, 40, 41, 42, 43, 44, 17, 45, 46, 47, 16, 16, 48, 16,
+ 16, 16, 16, 16, 16, 16, 49, 50, 51, 16, 52, 53, 16, 16, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 54, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 55, 17, 17, 17, 17,
+ 56, 17, 57, 58, 59, 60, 61, 62, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 63, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 64, 65, 17, 66,
+ 67, 68, 69, 70, 71, 72, 73, 74, 17, 75, 76, 77, 78, 79, 80, 81, 16, 82,
+ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 16, 94, 95, 96, 16, 17, 17,
+ 17, 97, 98, 99, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17,
+ 100, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17,
+ 101, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17,
+ 102, 103, 16, 16, 104, 105, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 106, 17, 17, 107, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 17, 108, 109, 16, 16, 16, 16, 16, 16, 16, 16, 16, 110, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 111, 112, 113, 114, 16, 16, 16, 16, 16, 16, 16, 16, 115, 116, 117,
+ 16, 16, 16, 16, 16, 118, 119, 16, 16, 16, 16, 120, 16, 16, 121, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 254, 255, 255, 7, 254, 255,
+ 255, 7, 0, 0, 0, 0, 0, 4, 32, 4, 255, 255, 127, 255, 255, 255, 127, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 195, 255, 3, 0, 31,
+ 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 223, 188, 64, 215,
+ 255, 255, 251, 255, 255, 255, 255, 255, 255, 255, 255, 255, 191, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 3, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 255, 255, 255, 127, 2,
+ 255, 255, 255, 255, 255, 1, 0, 0, 0, 0, 255, 191, 182, 0, 255, 255, 255,
+ 135, 7, 0, 0, 0, 255, 7, 255, 255, 255, 255, 255, 255, 255, 254, 255,
+ 195, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 239,
+ 31, 254, 225, 255, 159, 0, 0, 255, 255, 255, 255, 255, 255, 0, 224, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 3, 0, 255, 255,
+ 255, 255, 255, 7, 48, 4, 255, 255, 255, 252, 255, 31, 0, 0, 255, 255,
+ 255, 1, 255, 7, 0, 0, 0, 0, 0, 0, 255, 255, 223, 63, 0, 0, 240, 255,
+ 248, 3, 255, 255, 255, 255, 255, 255, 255, 255, 255, 239, 255, 223, 225,
+ 255, 207, 255, 254, 255, 239, 159, 249, 255, 255, 253, 197, 227, 159,
+ 89, 128, 176, 207, 255, 3, 16, 238, 135, 249, 255, 255, 253, 109, 195,
+ 135, 25, 2, 94, 192, 255, 63, 0, 238, 191, 251, 255, 255, 253, 237, 227,
+ 191, 27, 1, 0, 207, 255, 0, 30, 238, 159, 249, 255, 255, 253, 237, 227,
+ 159, 25, 192, 176, 207, 255, 2, 0, 236, 199, 61, 214, 24, 199, 255, 195,
+ 199, 29, 129, 0, 192, 255, 0, 0, 239, 223, 253, 255, 255, 253, 255, 227,
+ 223, 29, 96, 7, 207, 255, 0, 0, 239, 223, 253, 255, 255, 253, 239, 227,
+ 223, 29, 96, 64, 207, 255, 6, 0, 239, 223, 253, 255, 255, 255, 255, 231,
+ 223, 93, 240, 128, 207, 255, 0, 252, 236, 255, 127, 252, 255, 255, 251,
+ 47, 127, 128, 95, 255, 192, 255, 12, 0, 254, 255, 255, 255, 255, 127,
+ 255, 7, 63, 32, 255, 3, 0, 0, 0, 0, 214, 247, 255, 255, 175, 255, 255,
+ 59, 95, 32, 255, 243, 0, 0, 0, 0, 1, 0, 0, 0, 255, 3, 0, 0, 255, 254,
+ 255, 255, 255, 31, 254, 255, 3, 255, 255, 254, 255, 255, 255, 31, 0, 0,
+ 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 127, 249, 255, 3, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 63, 255, 255, 255, 255, 191, 32,
+ 255, 255, 255, 255, 255, 247, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 61, 127, 61, 255, 255, 255, 255, 255, 61, 255, 255, 255, 255, 61,
+ 127, 61, 255, 127, 255, 255, 255, 255, 255, 255, 255, 61, 255, 255, 255,
+ 255, 255, 255, 255, 255, 7, 0, 0, 0, 0, 255, 255, 0, 0, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 63, 63, 254, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 159, 255, 255,
+ 254, 255, 255, 7, 255, 255, 255, 255, 255, 255, 255, 255, 255, 199, 255,
+ 1, 255, 223, 15, 0, 255, 255, 15, 0, 255, 255, 15, 0, 255, 223, 13, 0,
+ 255, 255, 255, 255, 255, 255, 207, 255, 255, 1, 128, 16, 255, 3, 0, 0,
+ 0, 0, 255, 3, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 1,
+ 255, 255, 255, 255, 255, 7, 255, 255, 255, 255, 255, 255, 255, 255, 63,
+ 0, 255, 255, 255, 127, 255, 15, 255, 1, 192, 255, 255, 255, 255, 63, 31,
+ 0, 255, 255, 255, 255, 255, 15, 255, 255, 255, 3, 255, 3, 0, 0, 0, 0,
+ 255, 255, 255, 15, 255, 255, 255, 255, 255, 255, 255, 127, 254, 255, 31,
+ 0, 255, 3, 255, 3, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255,
+ 255, 255, 255, 239, 255, 239, 15, 255, 3, 0, 0, 0, 0, 255, 255, 255,
+ 255, 255, 243, 255, 255, 255, 255, 255, 255, 191, 255, 3, 0, 255, 255,
+ 255, 255, 255, 255, 127, 0, 255, 227, 255, 255, 255, 255, 255, 63, 255,
+ 1, 255, 255, 255, 255, 255, 231, 0, 0, 0, 0, 0, 222, 111, 4, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 128, 255, 31, 0,
+ 255, 255, 63, 63, 255, 255, 255, 255, 63, 63, 255, 170, 255, 255, 255,
+ 63, 255, 255, 255, 255, 255, 255, 223, 95, 220, 31, 207, 15, 255, 31,
+ 220, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 128, 0, 0, 255,
+ 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 252, 47, 62, 80, 189, 255,
+ 243, 224, 67, 0, 0, 255, 255, 255, 255, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 192, 255, 255, 255, 255, 255, 255, 3, 0, 0, 255, 255, 255,
+ 255, 255, 127, 255, 255, 255, 255, 255, 127, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 31, 120, 12, 0,
+ 255, 255, 255, 255, 191, 32, 255, 255, 255, 255, 255, 255, 255, 128, 0,
+ 0, 255, 255, 127, 0, 127, 127, 127, 127, 127, 127, 127, 127, 255, 255,
+ 255, 255, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 224, 0, 0, 0, 254, 3, 62, 31, 254,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 224, 254, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 247, 224, 255, 255, 255, 255,
+ 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 127, 0, 0,
+ 255, 255, 255, 7, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 31, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 63, 255, 31,
+ 255, 255, 255, 15, 0, 0, 255, 255, 255, 255, 255, 127, 240, 143, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0,
+ 0, 0, 128, 255, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 249, 255, 255, 255, 255, 255, 255, 124, 0, 0, 0, 0, 0, 128,
+ 255, 191, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 15,
+ 0, 255, 255, 255, 255, 255, 255, 255, 255, 47, 0, 255, 3, 0, 0, 252,
+ 232, 255, 255, 255, 255, 255, 7, 255, 255, 255, 255, 7, 0, 255, 255,
+ 255, 31, 255, 255, 255, 255, 255, 255, 247, 255, 0, 128, 255, 3, 255,
+ 255, 255, 127, 255, 255, 255, 255, 255, 255, 127, 0, 255, 63, 255, 3,
+ 255, 255, 127, 252, 255, 255, 255, 255, 255, 255, 255, 127, 5, 0, 0, 56,
+ 255, 255, 60, 0, 126, 126, 126, 0, 127, 127, 255, 255, 255, 255, 255,
+ 247, 255, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 7, 255, 3, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15, 0, 255, 255,
+ 127, 248, 255, 255, 255, 255, 255, 15, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 63, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 3, 0, 0, 0, 0, 127, 0, 248, 224, 255,
+ 253, 127, 95, 219, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 3, 0, 0, 0, 248, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 63, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255,
+ 252, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 255, 15, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 223, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 31, 0, 0, 255, 3, 254, 255,
+ 255, 7, 254, 255, 255, 7, 192, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 127, 252, 252, 252, 28, 0, 0, 0, 0, 255, 239, 255, 255, 127,
+ 255, 255, 183, 255, 63, 255, 63, 0, 0, 0, 0, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 7, 0, 0, 0, 0, 0, 0,
+ 0, 0, 255, 255, 255, 255, 255, 255, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255,
+ 255, 255, 31, 255, 255, 255, 255, 255, 255, 1, 0, 0, 0, 0, 0, 255, 255,
+ 255, 255, 0, 224, 255, 255, 255, 7, 255, 255, 255, 255, 255, 7, 255,
+ 255, 255, 63, 255, 255, 255, 255, 15, 255, 62, 0, 0, 0, 0, 0, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 63, 255, 3, 255, 255, 255, 255, 15, 255, 255, 255, 255,
+ 15, 255, 255, 255, 255, 255, 0, 255, 255, 255, 255, 255, 255, 15, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255,
+ 255, 255, 127, 0, 255, 255, 63, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 63, 253, 255, 255, 255, 255, 191, 145, 255, 255,
+ 63, 0, 255, 255, 127, 0, 255, 255, 255, 127, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255, 255, 55, 0, 255, 255, 63, 0, 255, 255, 255, 3, 0, 0, 0, 0, 0, 0, 0,
+ 0, 255, 255, 255, 255, 255, 255, 255, 192, 0, 0, 0, 0, 0, 0, 0, 0, 111,
+ 240, 239, 254, 255, 255, 63, 0, 0, 0, 0, 0, 255, 255, 255, 31, 255, 255,
+ 255, 31, 0, 0, 0, 0, 255, 254, 255, 255, 31, 0, 0, 0, 255, 255, 255,
+ 255, 255, 255, 63, 0, 255, 255, 63, 0, 255, 255, 7, 0, 255, 255, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 1, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 7, 0, 255,
+ 255, 255, 255, 255, 255, 7, 0, 255, 255, 255, 255, 255, 0, 255, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255,
+ 255, 255, 31, 128, 0, 255, 255, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 255, 255, 127, 0, 255, 255, 255, 255, 255, 255,
+ 255, 255, 63, 0, 0, 0, 192, 255, 0, 0, 252, 255, 255, 255, 255, 255,
+ 255, 1, 0, 0, 255, 255, 255, 1, 255, 3, 255, 255, 255, 255, 255, 255,
+ 199, 255, 112, 0, 255, 255, 255, 255, 71, 0, 255, 255, 255, 255, 255,
+ 255, 255, 255, 30, 0, 255, 23, 0, 0, 0, 0, 255, 255, 251, 255, 255, 255,
+ 159, 64, 0, 0, 0, 0, 0, 0, 0, 0, 127, 189, 255, 191, 255, 1, 255, 255,
+ 255, 255, 255, 255, 255, 1, 255, 3, 239, 159, 249, 255, 255, 253, 237,
+ 227, 159, 25, 129, 224, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 187, 7, 255, 131, 0,
+ 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 179, 0, 255, 3, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255,
+ 255, 255, 255, 63, 127, 0, 0, 0, 63, 0, 0, 0, 0, 255, 255, 255, 255,
+ 255, 255, 255, 127, 17, 0, 255, 3, 0, 0, 0, 0, 255, 255, 255, 255, 255,
+ 255, 63, 1, 255, 3, 0, 0, 0, 0, 0, 0, 255, 255, 255, 231, 255, 7, 255,
+ 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 255, 255, 255, 255, 255, 255, 255, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 3, 0, 128, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 252, 255, 255,
+ 255, 255, 255, 252, 26, 0, 0, 0, 255, 255, 255, 255, 255, 255, 231, 127,
+ 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 32, 0, 0, 0, 0, 255,
+ 255, 255, 255, 255, 255, 255, 1, 255, 253, 255, 255, 255, 255, 127, 127,
+ 1, 0, 255, 3, 0, 0, 252, 255, 255, 255, 252, 255, 255, 254, 127, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 127, 251, 255, 255, 255, 255, 127, 180, 203, 0,
+ 255, 3, 191, 253, 255, 255, 255, 127, 123, 1, 255, 3, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 127, 0, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 127, 0, 0, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255,
+ 255, 255, 255, 255, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 1, 255, 255,
+ 255, 127, 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 63,
+ 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 15, 0, 255, 3, 248, 255, 255,
+ 224, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 135, 255, 255, 255, 255, 255, 255, 255, 128, 255, 255, 0, 0, 0, 0, 0, 0,
+ 0, 0, 11, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 0, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 7, 0, 255, 255, 255, 127,
+ 0, 0, 0, 0, 0, 0, 7, 0, 240, 0, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 15,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 7, 255,
+ 31, 255, 1, 255, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 223, 255, 255, 255, 255, 255, 255,
+ 255, 255, 223, 100, 222, 255, 235, 239, 255, 255, 255, 255, 255, 255,
+ 255, 191, 231, 223, 223, 255, 255, 255, 123, 95, 252, 253, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 63, 255, 255,
+ 255, 253, 255, 255, 247, 255, 255, 255, 247, 255, 255, 223, 255, 255,
+ 255, 223, 255, 255, 127, 255, 255, 255, 127, 255, 255, 255, 253, 255,
+ 255, 255, 253, 255, 255, 247, 207, 255, 255, 255, 255, 255, 255, 127,
+ 255, 255, 249, 219, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 31, 128, 63, 255,
+ 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 255, 255, 255, 255, 255, 15, 255, 3, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 31, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255,
+ 255, 255, 143, 8, 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 239, 255, 255, 255, 150, 254, 247, 10, 132, 234, 150,
+ 170, 150, 247, 247, 94, 255, 251, 255, 15, 238, 251, 255, 15, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 3, 255, 255, 255, 3,
+ 255, 255, 255, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/lib/libc/include/__dirent.h b/lib/libc/include/__dirent.h
new file mode 100644
index 00000000..9b23c9d2
--- /dev/null
+++ b/lib/libc/include/__dirent.h
@@ -0,0 +1,25 @@
+#ifndef __LIBC_DIRENT_H
+#define __LIBC_DIRENT_H
+
+#include <libc.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <stdint.h>
+
+struct linux_dirent64 {
+ uint64_t d_ino;
+ int64_t d_off;
+ unsigned short d_reclen;
+ unsigned char d_type;
+ char d_name[];
+};
+
+struct __DIR {
+ int fildes;
+ int cached;
+ off_t tell;
+ off_t offset;
+ char buffer[BUFSIZ] __attribute__((__aligned__(8)));
+};
+
+#endif
diff --git a/lib/libc/include/__locale.h b/lib/libc/include/__locale.h
new file mode 100644
index 00000000..0a709c78
--- /dev/null
+++ b/lib/libc/include/__locale.h
@@ -0,0 +1,41 @@
+#ifndef __LIBC_LOCALE_H
+#define __LIBC_LOCALE_H
+
+#include <locale.h>
+#include <stdint.h>
+
+typedef __SIZE_TYPE__ size_t;
+
+struct __locale_t {
+ struct __locale_map {
+ const void *map;
+ size_t map_size;
+ char name[24];
+ } maps[6];
+};
+
+typedef struct __locale_t *locale_t;
+
+static const struct __locale_t __c_locale = { 0 };
+
+static const struct __locale_t __utf8_locale = {
+ .maps[LC_CTYPE] = { .map = &((const uint32_t[]){ 0x950412de, 0, -1, -1,
+ -1 }),
+ .map_size = sizeof(uint32_t) * 5,
+ .name = "C.UTF-8" },
+};
+
+#undef MB_CUR_MAX
+#define MB_CUR_MAX (((locale_t) & __utf8_locale) ? 4 : 1)
+
+static inline int __mb_cur_max(void)
+{
+ return MB_CUR_MAX;
+}
+
+static inline int __locale_allocated(locale_t loc)
+{
+ return loc != (locale_t)&__c_locale && loc != (locale_t)&__utf8_locale;
+}
+
+#endif
diff --git a/lib/libc/include/__select.h b/lib/libc/include/__select.h
new file mode 100644
index 00000000..a38bbdce
--- /dev/null
+++ b/lib/libc/include/__select.h
@@ -0,0 +1,8 @@
+#ifndef __LIBC_SELECT_H
+#define __LIBC_SELECT_H
+
+struct __fd_set {
+ unsigned long fds_bits[16];
+};
+
+#endif
diff --git a/lib/libc/include/__signal.h b/lib/libc/include/__signal.h
new file mode 100644
index 00000000..6b762dee
--- /dev/null
+++ b/lib/libc/include/__signal.h
@@ -0,0 +1,12 @@
+#ifndef __LIBC_SIGNAL_H
+#define __LIBC_SIGNAL_H
+
+static const char *__sys_signame[] = {
+ "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGTRAP", "SIGABRT",
+ "SIGBUS", "SIGFPE", "SIGKILL", "SIGUSR1", "SIGSEGV", "SIGUSR2",
+ "SIGPIPE", "SIGALRM", "SIGTERM", "SIGCHLD", "SIGCONT", "SIGSTOP",
+ "SIGTSTP", "SIGTTIN", "SIGTTOU", "SIGURG", "SIGXCPU", "SIGXFSZ",
+ "SIGVTALRM", "SIGPROF", "SIGWINCH", "SIGIO", "SIGSYS"
+};
+
+#endif
diff --git a/lib/libc/include/__statvfs.h b/lib/libc/include/__statvfs.h
new file mode 100644
index 00000000..c8a746d4
--- /dev/null
+++ b/lib/libc/include/__statvfs.h
@@ -0,0 +1,21 @@
+#ifndef __LIBC_STATVFS_H__
+#define __LIBC_STATVFS_H__
+
+typedef __UINT64_TYPE__ fsblkcnt_t;
+typedef __UINT64_TYPE__ fsfilcnt_t;
+
+struct __statvfs {
+ unsigned long f_bsize;
+ unsigned long f_frsize;
+ fsblkcnt_t f_blocks;
+ fsblkcnt_t f_bfree;
+ fsblkcnt_t f_bavail;
+ fsfilcnt_t f_files;
+ fsfilcnt_t f_ffree;
+ fsfilcnt_t f_favail;
+ unsigned long f_fsid;
+ unsigned long f_flag;
+ unsigned long f_namemax;
+};
+
+#endif
diff --git a/lib/libc/include/atomic.h b/lib/libc/include/atomic.h
new file mode 100644
index 00000000..94cd34db
--- /dev/null
+++ b/lib/libc/include/atomic.h
@@ -0,0 +1,23 @@
+#ifndef __LIBC_ATOMIC_H
+#define __LIBC_ATOMIC_H
+
+#include <stdatomic.h>
+
+#define LIBC_LOCK(__lock) __libc_lock(&__lock)
+#define LIBC_UNLOCK(__lock) atomic_flag_clear(&__lock)
+
+static __inline void __libc_lock(volatile atomic_flag *lock)
+{
+ while (atomic_flag_test_and_set_explicit(lock, memory_order_acquire)) {
+ unsigned int spins = 1;
+ do {
+ for (unsigned int i = 0; i < spins; i++)
+ __asm__ volatile("pause");
+ if (spins < 64)
+ spins *= 2;
+ } while (atomic_flag_test_and_set_explicit(
+ lock, memory_order_relaxed));
+ }
+}
+
+#endif
diff --git a/lib/libc/include/byteswap.h b/lib/libc/include/byteswap.h
new file mode 100644
index 00000000..9dfe6520
--- /dev/null
+++ b/lib/libc/include/byteswap.h
@@ -0,0 +1,8 @@
+#ifndef __LIBC_BYTESWAP_H
+#define __LIBC_BYTESWAP_H
+
+#define bswap16(x) __builtin_bswap16(x)
+#define bswap32(x) __builtin_bswap32(x)
+#define bswap64(x) __builtin_bswap64(x)
+
+#endif
diff --git a/lib/libc/include/features.h b/lib/libc/include/features.h
new file mode 100644
index 00000000..62472259
--- /dev/null
+++ b/lib/libc/include/features.h
@@ -0,0 +1,6 @@
+#ifndef __LIBC_FEATURES_H
+#define __LIBC_FEATURES_H
+
+#define weak extern __attribute__((weak))
+
+#endif
diff --git a/lib/libc/include/io.h b/lib/libc/include/io.h
new file mode 100644
index 00000000..675a3cc3
--- /dev/null
+++ b/lib/libc/include/io.h
@@ -0,0 +1,55 @@
+#ifndef __LIBC_IO
+#define __LIBC_IO
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <stdatomic.h>
+
+typedef __SIZE_TYPE__ size_t;
+
+#define _IO_ERR 0x4
+#define _IO_EOF 0x8
+#define _IO_WIDE 0x10
+
+/* Buffering modes */
+#define _IOFBF 0 /* Full buffering */
+#define _IOLBF 1 /* Line buffering */
+#define _IONBF 2 /* No buffering */
+
+/* File access modes */
+#ifndef O_RDONLY
+#define O_RDONLY 0
+#define O_WRONLY 1
+#define O_RDWR 2
+#define O_ACCMODE 3
+#endif
+
+/* Atomic operations for threading */
+#define LIBC_LOCK(x) \
+ while (atomic_flag_test_and_set(&(x))) { \
+ }
+#define LIBC_UNLOCK(x) atomic_flag_clear(&(x))
+
+struct __FILE {
+ int fd;
+ uint32_t flags;
+ int type;
+ pid_t pid;
+ atomic_flag lock;
+ char *buf;
+ int eof;
+ size_t buf_size;
+ size_t buf_pos;
+ size_t buf_len;
+ unsigned char unget_buf[16];
+ size_t unget_cnt;
+ off_t offset;
+ struct __FILE *next;
+};
+
+void __libc_fadd(struct __FILE *f);
+
+#endif
diff --git a/lib/libc/include/libc.h b/lib/libc/include/libc.h
new file mode 100644
index 00000000..3f5f2644
--- /dev/null
+++ b/lib/libc/include/libc.h
@@ -0,0 +1,27 @@
+#ifndef __LIBC_LIBC_H
+#define __LIBC_LIBC_H
+
+#include <__locale.h>
+#include <stdatomic.h>
+
+#define likely(x) __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+#define unused __attribute__((unused))
+#define aligned(type) __attribute__((aligned(__alignof__(type))))
+#define weak __attribute__((__weak__))
+#define weak_reference(old, new) \
+ extern __typeof(old) new __attribute__((__weak__, __alias__(#old)))
+
+static struct {
+ enum {
+ LIBC_ENVP_TOUCHED = 1 << 0,
+ } flags;
+ struct {
+ volatile atomic_flag abort;
+ volatile atomic_flag malloc;
+ volatile atomic_flag environ;
+ } lock;
+ struct __locale_t locale;
+} libc = { .lock = { ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT } };
+
+#endif
diff --git a/lib/libc/include/libc/dirent.h b/lib/libc/include/libc/dirent.h
new file mode 100644
index 00000000..296cc91e
--- /dev/null
+++ b/lib/libc/include/libc/dirent.h
@@ -0,0 +1,6 @@
+#ifndef __LIBC_DIRENT_H
+#define __LIBC_DIRENT_H
+
+struct __DIR {};
+
+#endif
diff --git a/lib/libc/include/malloc.h b/lib/libc/include/malloc.h
new file mode 100644
index 00000000..ba2755b0
--- /dev/null
+++ b/lib/libc/include/malloc.h
@@ -0,0 +1,98 @@
+#ifndef __LIBC_MALLOC_H
+#define __LIBC_MALLOC_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdatomic.h>
+
+struct class {
+ uint32_t size;
+ uint32_t count;
+};
+
+struct page {
+ volatile atomic_flag lock;
+
+ enum {
+ PAGE_SMALL = 0x0,
+ PAGE_MEDIUM = 0x1,
+ PAGE_LARGE = 0x2,
+ } flags;
+
+ struct {
+ uint32_t size;
+ uint32_t used;
+ uint32_t count;
+ } block;
+
+ uint8_t *bitmap;
+ uint8_t *heap;
+
+ struct page *next;
+ struct page *prev;
+};
+
+extern struct page *__malloc_pvec;
+
+#define SMALL_PAGE_SIZE_SHIFT 16
+#define SMALL_PAGE_SIZE (1 << SMALL_PAGE_SIZE_SHIFT)
+#define SMALL_PAGE_MASK (~((uintptr_t)SMALL_PAGE_SIZE - 1))
+
+#define MEDIUM_PAGE_SIZE_SHIFT 22
+#define MEDIUM_PAGE_SIZE (1 << MEDIUM_PAGE_SIZE_SHIFT)
+#define MEDIUM_PAGE_MASK (~((uintptr_t)MEDIUM_PAGE_SIZE - 1))
+
+#define LARGE_PAGE_SIZE_SHIFT 26
+#define LARGE_PAGE_SIZE (1 << LARGE_PAGE_SIZE_SHIFT)
+#define LARGE_PAGE_MASK (~((uintptr_t)LARGE_PAGE_SIZE - 1))
+
+#define SMALL_CLASS(n) \
+ { (n * 16), (SMALL_PAGE_SIZE - sizeof(struct page)) / (n * 16) }
+#define MEDIUM_CLASS(n) \
+ { (n * 16), (MEDIUM_PAGE_SIZE - sizeof(struct page)) / (n * 16) }
+#define LARGE_CLASS(n) \
+ { (n * 16), (LARGE_PAGE_SIZE - sizeof(struct page)) / (n * 16) }
+
+static const struct class global_size_class[] = {
+ SMALL_CLASS(1), SMALL_CLASS(1), SMALL_CLASS(2),
+ SMALL_CLASS(3), SMALL_CLASS(4), SMALL_CLASS(5),
+ SMALL_CLASS(6), SMALL_CLASS(7), SMALL_CLASS(8),
+ SMALL_CLASS(9), SMALL_CLASS(10), SMALL_CLASS(11),
+ SMALL_CLASS(12), SMALL_CLASS(13), SMALL_CLASS(14),
+ SMALL_CLASS(15), SMALL_CLASS(16), SMALL_CLASS(17),
+ SMALL_CLASS(18), SMALL_CLASS(19), SMALL_CLASS(20),
+ SMALL_CLASS(21), SMALL_CLASS(22), SMALL_CLASS(23),
+ SMALL_CLASS(24), SMALL_CLASS(25), SMALL_CLASS(26),
+ SMALL_CLASS(27), SMALL_CLASS(28), SMALL_CLASS(29),
+ SMALL_CLASS(30), SMALL_CLASS(31), SMALL_CLASS(32),
+ SMALL_CLASS(33), SMALL_CLASS(34), SMALL_CLASS(35),
+ SMALL_CLASS(36), SMALL_CLASS(37), SMALL_CLASS(38),
+ SMALL_CLASS(39), SMALL_CLASS(40), SMALL_CLASS(41),
+ SMALL_CLASS(42), SMALL_CLASS(43), SMALL_CLASS(44),
+ SMALL_CLASS(45), SMALL_CLASS(46), SMALL_CLASS(47),
+ SMALL_CLASS(48), SMALL_CLASS(49), SMALL_CLASS(50),
+ SMALL_CLASS(51), SMALL_CLASS(52), SMALL_CLASS(53),
+ SMALL_CLASS(54), SMALL_CLASS(55), SMALL_CLASS(56),
+ SMALL_CLASS(57), SMALL_CLASS(58), SMALL_CLASS(59),
+ SMALL_CLASS(60), SMALL_CLASS(61), SMALL_CLASS(62),
+ SMALL_CLASS(63), SMALL_CLASS(64), SMALL_CLASS(80),
+ SMALL_CLASS(96), SMALL_CLASS(112), SMALL_CLASS(128),
+ SMALL_CLASS(160), SMALL_CLASS(192), SMALL_CLASS(224),
+ SMALL_CLASS(256), MEDIUM_CLASS(320), MEDIUM_CLASS(384),
+ MEDIUM_CLASS(448), MEDIUM_CLASS(512), MEDIUM_CLASS(640),
+ MEDIUM_CLASS(768), MEDIUM_CLASS(896), MEDIUM_CLASS(1024),
+ MEDIUM_CLASS(1280), MEDIUM_CLASS(1536), MEDIUM_CLASS(1792),
+ MEDIUM_CLASS(2048), MEDIUM_CLASS(2560), MEDIUM_CLASS(3072),
+ MEDIUM_CLASS(3584), MEDIUM_CLASS(4096), MEDIUM_CLASS(5120),
+ MEDIUM_CLASS(6144), MEDIUM_CLASS(7168), MEDIUM_CLASS(8192),
+ MEDIUM_CLASS(10240), MEDIUM_CLASS(12288), MEDIUM_CLASS(14336),
+ MEDIUM_CLASS(16384), LARGE_CLASS(20480), LARGE_CLASS(24576),
+ LARGE_CLASS(28672), LARGE_CLASS(32768), LARGE_CLASS(40960),
+ LARGE_CLASS(49152), LARGE_CLASS(57344), LARGE_CLASS(65536),
+ LARGE_CLASS(81920), LARGE_CLASS(98304), LARGE_CLASS(114688),
+ LARGE_CLASS(131072), LARGE_CLASS(163840), LARGE_CLASS(196608),
+ LARGE_CLASS(229376), LARGE_CLASS(262144), LARGE_CLASS(327680),
+ LARGE_CLASS(393216), LARGE_CLASS(458752), LARGE_CLASS(524288)
+};
+
+#endif
diff --git a/lib/libc/include/syscall.h b/lib/libc/include/syscall.h
new file mode 100644
index 00000000..645c4bcd
--- /dev/null
+++ b/lib/libc/include/syscall.h
@@ -0,0 +1,59 @@
+#ifndef __LIBC_SYSCALL_H
+#define __LIBC_SYSCALL_H
+
+#include <asm/syscall.h>
+#include <asm/unistd_64.h>
+#include <errno.h>
+
+typedef long syscall_arg_t;
+
+#define __SYSCALL_NARGS_(a, b, c, d, e, f, g, h, n, ...) n
+#define __SYSCALL_NARGS(...) \
+ __SYSCALL_NARGS_(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1, 0, )
+
+#define __SYSCALL_CONCAT_(a, b) a##b
+#define __SYSCALL_CONCAT(a, b) __SYSCALL_CONCAT_(a, b)
+
+#define __SYSCALL_(b, ...) \
+ __SYSCALL_CONCAT(b, __SYSCALL_NARGS(__VA_ARGS__))(__VA_ARGS__)
+
+#define __syscall(...) __SYSCALL_(__syscall_, __VA_ARGS__)
+#define syscall(...) __syscall_ret(__syscall(__VA_ARGS__))
+
+#define __sa(x) ((syscall_arg_t)(x))
+
+#define __syscall_0(n) __syscall0(__NR_##n)
+#define __syscall_1(n, a) __syscall1(__NR_##n, __sa(a))
+#define __syscall_2(n, a, b) __syscall2(__NR_##n, __sa(a), __sa(b))
+#define __syscall_3(n, a, b, c) __syscall3(__NR_##n, __sa(a), __sa(b), __sa(c))
+#define __syscall_4(n, a, b, c, d) \
+ __syscall4(__NR_##n, __sa(a), __sa(b), __sa(c), __sa(d))
+#define __syscall_5(n, a, b, c, d, e) \
+ __syscall5(__NR_##n, __sa(a), __sa(b), __sa(c), __sa(d), __sa(e))
+#define __syscall_6(n, a, b, c, d, e, f) \
+ __syscall6(__NR_##n, __sa(a), __sa(b), __sa(c), __sa(d), __sa(e), \
+ __sa(f))
+#define __syscall_7(n, a, b, c, d, e, f, g) \
+ __syscall7(__NR_##n, __sa(a), __sa(b), __sa(c), __sa(d), __sa(e), \
+ __sa(f), __sa(g))
+
+static __inline long __syscall_ret(long ret)
+{
+ if (ret > -4096 && ret < 0) {
+ errno = -ret;
+ ret = -1;
+ }
+ return ret;
+}
+
+#ifdef __NR_pread64
+#undef __NR_pread
+#define __NR_pread __NR_pread64
+#endif
+
+#ifdef __NR_pwrite64
+#undef __NR_pwrite
+#define __NR_pwrite __NR_pwrite64
+#endif
+
+#endif
diff --git a/lib/libc/include/thread.h b/lib/libc/include/thread.h
new file mode 100644
index 00000000..662f1dc1
--- /dev/null
+++ b/lib/libc/include/thread.h
@@ -0,0 +1,9 @@
+#ifndef __LIBC_THREAD_H
+#define __LIBC_THREAD_H
+
+struct __thread_self {
+ int tid;
+ int _errno;
+};
+
+#endif