diff options
Diffstat (limited to 'src/user/lib/stdlib.c')
-rw-r--r-- | src/user/lib/stdlib.c | 14 |
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); |