summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-02-22 01:55:22 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-02-22 01:55:22 +0100
commit6d3e12899b8b0a3ddc6062fc43b18cba0c788920 (patch)
tree02692f889820a183b6ed3b5b2fc3683b897e913e /Userland
parente96941920209434ebaf76d6c6b1dc24f18026352 (diff)
downloadserenity-6d3e12899b8b0a3ddc6062fc43b18cba0c788920.zip
Kernel: Pass process arguments directly on the stack.
Get rid of the convoluted get_arguments and get_environment syscalls. This patch also adds a simple /bin/env that just prints its environment.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/.gitignore1
-rw-r--r--Userland/Makefile5
-rw-r--r--Userland/env.cpp9
3 files changed, 15 insertions, 0 deletions
diff --git a/Userland/.gitignore b/Userland/.gitignore
index 53b51e01f4..ccbf5ecba9 100644
--- a/Userland/.gitignore
+++ b/Userland/.gitignore
@@ -34,3 +34,4 @@ pape
ln
df
su
+env
diff --git a/Userland/Makefile b/Userland/Makefile
index 76a1f97720..ee357c30d7 100644
--- a/Userland/Makefile
+++ b/Userland/Makefile
@@ -30,6 +30,7 @@ OBJS = \
df.o \
ln.o \
su.o \
+ env.o \
rm.o
APPS = \
@@ -65,6 +66,7 @@ APPS = \
ln \
df \
su \
+ env \
rm
ARCH_FLAGS =
@@ -184,6 +186,9 @@ df: df.o
su: su.o
$(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
+env: env.o
+ $(LD) -o $@ $(LDFLAGS) $< ../LibC/LibC.a
+
.cpp.o:
@echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $<
diff --git a/Userland/env.cpp b/Userland/env.cpp
new file mode 100644
index 0000000000..0a2a0e39d5
--- /dev/null
+++ b/Userland/env.cpp
@@ -0,0 +1,9 @@
+#include <unistd.h>
+#include <stdio.h>
+
+int main(int, char**)
+{
+ for (size_t i = 0; environ[i]; ++i)
+ printf("%s\n", environ[i]);
+ return 0;
+}