getid.c 409 B

12345678910111213141516
  1. #include <unistd.h>
  2. #include <stdio.h>
  3. #include "test_helpers.h"
  4. int main(void) {
  5. gid_t egid = getegid();
  6. uid_t euid = geteuid();
  7. gid_t gid = getgid();
  8. pid_t pgid = getpgid(0);
  9. pid_t pid = getpid();
  10. pid_t ppid = getppid();
  11. uid_t uid = getuid();
  12. printf("egid: %d, euid: %d, gid: %d, pgid: %d, pid: %d, ppid %d, uid %d\n",
  13. egid, euid, gid, pgid, pid, ppid, uid);
  14. }