summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-08-14 19:52:29 -0400
committerJakob Kaivo <jkk@ung.org>2020-08-14 19:52:29 -0400
commitfed8d9b70d23675323a54d40ed600fe8f73dfaa3 (patch)
treeb89da9e8a9dbde34d82765cd9bc4ac4603ecc64b
parent103cddc545885b35ad1240d5fbf1e3c2b2ae7811 (diff)
add internal state for <unistd.h>
-rw-r--r--.deps.mk4
-rw-r--r--.deps/all.c1
-rw-r--r--.deps/libc.POSIX_11
-rw-r--r--src/unistd/__unistd.c7
-rw-r--r--src/unistd/_unistd.h18
5 files changed, 31 insertions, 0 deletions
diff --git a/.deps.mk b/.deps.mk
index faecadc3..ade0c2ed 100644
--- a/.deps.mk
+++ b/.deps.mk
@@ -1129,6 +1129,10 @@ libc.a(confstr.o): $(OBJDIR)/confstr.o
$(OBJDIR)/confstr.o: ./src/unistd/confstr.c
$(CC) $(BASE_CFLAGS) $(CFLAGS) -c ./src/unistd/confstr.c -o $@
echo [CC] $@
+libc.a(__unistd.o): $(OBJDIR)/__unistd.o
+$(OBJDIR)/__unistd.o: ./src/unistd/__unistd.c
+ $(CC) $(BASE_CFLAGS) $(CFLAGS) -c ./src/unistd/__unistd.c -o $@
+ echo [CC] $@
libc.a(getgroups.o): $(OBJDIR)/getgroups.o
$(OBJDIR)/getgroups.o: ./src/unistd/getgroups.c
$(CC) $(BASE_CFLAGS) $(CFLAGS) -c ./src/unistd/getgroups.c -o $@
diff --git a/.deps/all.c b/.deps/all.c
index aa025ba6..d0f899f8 100644
--- a/.deps/all.c
+++ b/.deps/all.c
@@ -888,6 +888,7 @@
./src/unistd/_POSIX_JOB_CONTROL.c
./src/unistd/_PC_LINK_MAX.c
./src/unistd/_POSIX2_VERSION.c
+./src/unistd/__unistd.c
./src/unistd/_PC_PIPE_BUF.c
./src/unistd/STDIN_FILENO.c
./src/unistd/_SC_ASYNCHRONOUS_IO.c
diff --git a/.deps/libc.POSIX_1 b/.deps/libc.POSIX_1
index f1e730c4..41b523a0 100644
--- a/.deps/libc.POSIX_1
+++ b/.deps/libc.POSIX_1
@@ -61,6 +61,7 @@ libc_POSIX_1_OBJS= \
libc.a($(OBJDIR)/execlp.o) \
libc.a($(OBJDIR)/pipe.o) \
libc.a($(OBJDIR)/cuserid.o) \
+ libc.a($(OBJDIR)/__unistd.o) \
libc.a($(OBJDIR)/getgroups.o) \
libc.a($(OBJDIR)/chown.o) \
libc.a($(OBJDIR)/getpid.o) \
diff --git a/src/unistd/__unistd.c b/src/unistd/__unistd.c
new file mode 100644
index 00000000..eaed9522
--- /dev/null
+++ b/src/unistd/__unistd.c
@@ -0,0 +1,7 @@
+#include "_unistd.h"
+
+struct __unistd __unistd;
+
+/*
+POSIX(1)
+*/
diff --git a/src/unistd/_unistd.h b/src/unistd/_unistd.h
new file mode 100644
index 00000000..87cdd8f1
--- /dev/null
+++ b/src/unistd/_unistd.h
@@ -0,0 +1,18 @@
+#ifndef ___UNISTD_H__
+#define ___UNISTD_H__
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <limits.h>
+
+#ifndef PATH_MAX
+#define PATH_MAX _POSIX_PATH_MAX
+#endif
+
+struct __unistd {
+ char ttyname[PATH_MAX + 1];
+};
+
+extern struct __unistd __unistd;
+
+#endif