summaryrefslogtreecommitdiff
path: root/src/user/lib/stdlib.c
diff options
context:
space:
mode:
authordzwdz2023-01-25 19:22:18 +0100
committerdzwdz2023-01-25 19:22:18 +0100
commit2ad6ee8ed15d1bf898645a16dbc06991a3c1425e (patch)
tree9e9d50d7447da03a0ff898bf9b268d26ef343702 /src/user/lib/stdlib.c
parent2a2fc4dffe0117ce874a6cf1dcc34321ed8add77 (diff)
user: process titles, /bin/ps
Diffstat (limited to 'src/user/lib/stdlib.c')
-rw-r--r--src/user/lib/stdlib.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/user/lib/stdlib.c b/src/user/lib/stdlib.c
index 5d1b09f..4e471ba 100644
--- a/src/user/lib/stdlib.c
+++ b/src/user/lib/stdlib.c
@@ -1,3 +1,4 @@
+#include <_proc.h>
#include <camellia.h>
#include <camellia/syscalls.h>
#include <errno.h>
@@ -16,6 +17,19 @@ void setprogname(const char *pg) {
progname = pg;
}
+void setproctitle(const char *fmt, ...) {
+ if (!fmt) {
+ strcpy(_libc_psdata, progname);
+ return;
+ }
+ sprintf(_libc_psdata, "%s: ", progname);
+
+ va_list argp;
+ va_start(argp, fmt);
+ vsnprintf(_libc_psdata + strlen(_libc_psdata), 128, fmt, argp);
+ va_end(argp);
+}
+
int mkstemp(char *template) {
// TODO randomize template
handle_t h = camellia_open(template, OPEN_CREATE | OPEN_RW);