📄 test4.c
字号:
#include <stdio.h>#include <sys/types.h>#include <unistd.h>#include <string.h>#include <errno.h>int main(int argc, char **argv){ fprintf(stdout, "Self process id(pid) = %d\n", getpid()); fprintf(stdout, "Parent process id(ppid) = %d\n", getppid());#if 0 // Upon successful completion, 0 shall be returned. Otherwise, -1 shall be returned and errno set to indicate the error. if (setuid(0) == 0) { fprintf(stdout, "setuid(0) successed."); } else { fprintf(stdout, "setuid(0) failed: %s\n", strerror(errno)); }#endif fprintf(stdout, "uid = %d\n", getuid()); fprintf(stdout, "euid = %d\n", geteuid()); fprintf(stdout, "gid = %d\n", getgid()); fprintf(stdout, "egid = %d\n", getegid()); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -