summaryrefslogtreecommitdiff
path: root/src/user/lib/_start2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/lib/_start2.c')
-rw-r--r--src/user/lib/_start2.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/user/lib/_start2.c b/src/user/lib/_start2.c
index 495f046..2cf8667 100644
--- a/src/user/lib/_start2.c
+++ b/src/user/lib/_start2.c
@@ -1,3 +1,5 @@
+#include <_proc.h>
+#include <camellia/flags.h>
#include <camellia/syscalls.h>
#include <stdio.h>
#include <stdlib.h>
@@ -22,6 +24,15 @@ void intr_trampoline(void); /* intr.s */
_Noreturn void _start2(struct execdata *ed) {
const char *progname;
elf_selfreloc();
+
+ /* done first so it isn't allocated elsewhere by accident */
+ _syscall_memflag(_libc_psdata, 1, MEMFLAG_PRESENT);
+ if (ed->argv[0]) {
+ strcpy(_libc_psdata, ed->argv[0]);
+ } else {
+ strcpy(_libc_psdata, "?");
+ }
+
_syscall_intr_set(intr_trampoline);
intr_set(intr_default);
__setinitialcwd(ed->cwd);