2018-10-22 15:06:22 +03:00
|
|
|
#include <LibC/unistd.h>
|
|
|
|
#include <LibC/stdio.h>
|
2018-10-31 21:49:22 +03:00
|
|
|
#include <LibC/pwd.h>
|
2018-11-07 00:27:51 +03:00
|
|
|
#include <LibC/grp.h>
|
2018-10-22 15:06:22 +03:00
|
|
|
|
|
|
|
int main(int c, char** v)
|
|
|
|
{
|
|
|
|
uid_t uid = getuid();
|
|
|
|
gid_t gid = getgid();
|
2018-10-31 21:49:22 +03:00
|
|
|
|
|
|
|
struct passwd* pw = getpwuid(uid);
|
2018-11-07 00:27:51 +03:00
|
|
|
struct group* gr = getgrgid(gid);
|
2018-10-31 21:49:22 +03:00
|
|
|
|
2018-11-07 00:27:51 +03:00
|
|
|
printf("uid=%u(%s), gid=%u(%s)\n", uid, pw ? pw->pw_name : "n/a", gid, gr ? gr->gr_name : "n/a", getpid());
|
2018-10-22 15:06:22 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|