Тексты программ process.c 1 #define NUMGROUPS 16 2 #include <sys/types.h> 3 #include <stdlib.h> 4 #include <stdio.h> 5 #include <unistd.h> 6 #include <grp.h> 7 #include <sys/resource.h> 8 #include <sys/time.h> 9 10 main() 11 { 12 gid_t groups[NUMGROUPS]; 13 struct group *grp; 14 int i, num; 15 gid_t gid; 16 struct rlimit rlp; 17 18 printf("terminal is: %s\n",ttyname(0)); 19 printf("pid = %ld, ppid = %ld\n", getpid(), getppid()); 20 printf("uid = %ld, euid = %ld\n\n", getuid(), geteuid()); 21 22 gid = getgid(); 23 grp = getgrgid(gid); 24 printf("primary group is: %s\n", grp->gr_name); 25 26 num = getgroups(NUMGROUPS, groups); 27 printf("all groups: "); 28 for(i = 0; i < num; i++) { 29 grp = getgrgid(groups[i]); 30 printf("%s ", grp->gr_name); 31 } 32 33 getrlimit(RLIMIT_NOFILE, &rlp); 34 printf("open files soft limit: %4ld\n", rlp.rlim_cur); 35 printf("open files hard limit: %4ld\n", rlp.rlim_max); 36 rlp.rlim_cur = 5; 37 setrlimit(RLIMIT_NOFILE, &rlp); 38 getrlimit(RLIMIT_NOFILE, &rlp); 39 printf("new soft limit: %4ld\n", rlp.rlim_cur); 40 exit(0); 41 }