ref: 0196ca7536c295b42e1d27ab8187a3d8e1bda328
dir: /sys/src/libc/9sys/getuser.c/
#include <u.h> #include <libc.h> char * getuser(void) { static char user[64]; char name[32]; Dir *dir; snprint(name, sizeof(name), "/proc/%lud/status", (ulong)getpid()); if((dir = dirstat(name)) == nil) return "none"; snprint(user, sizeof(user), "%s", dir->uid); free(dir); return user; }