The document discusses Unix processes and process control functions. It covers process identifiers, the fork function for creating new processes, wait and exit functions for process termination, and exec functions for replacing the current process with a new program. Race conditions that can occur with shared resources between processes are also discussed.
24. WIFSIGNALED TRUE – if child terminated abnormally WTERMSIG – is used to fetch the signal number that caused termination WCOREDUMP – is true is core file was generated WIFSTOPPED TRUE – for a child that is currently stopped WSTOPSIG -- is used to fetch the signal number that caused child to stop
49. ID exec Set-user-ID bit off exec Set-user-Id bit on Real user ID Effective user ID Saved set user ID unchanged unchanged copied from effective user ID unchanged Set from user ID of program file copied from effective user ID
50. ID Super user Un privileged user Real user ID Effective user ID Saved set-user ID Set to uid Set to uid Set to uid unchanged Set to uid unchanged
51. setreuid and setregid #include <sys/types.h> #include <unistd.h> int setreuid (uid_t ruid, uid_t euid); int setregid (gid_t rgid,gid_t egid);
52. seteuid and setegid #include <sys/types.h> #include <unistd.h> int seteuid (uid_t euid); int setegid (gid_t egid);
53. Real user ID Effective User ID Saved Set-user-ID Superuser setreuid Superuser setuid Superuser seteuid euid uid uid uid uid Unprivileged Setuid or seteuid Unprivileged Setuid or seteuid Exec of set-user-id Unprivileged setreuid Unprivileged setreuid
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80. init init getty login fork Reads /etc/ttys Forks once per terminal creats empty environment opens terminal device reads user name exec exec
81. user at a terminal terminal device driver login shell init through login and getty fd 0,1,2 RS – 232 connection process ID 1
82. network login inetd init inetd telnetd fork/exec of/bin/sh which executes shell script /etc/rc when connection request arives from telnet user fork exec proces ID 1
83. pseudo-terminal device driver user at a terminal login shell init through inetd, telenetd and login fd 0, 1, 2 network connection through telnetd server and telnetd client process ID 1
84.
85.
86.
87.
88.
89.
90. Login shell proc1 proc2 proc3 proc4 proc5 Process group process group Process group session Arrangement of processes into process groups and sessions
91.
92.
93.
94. session modem disconnect ( hangup signal) Terminal input and Terminal-generated signals Process groups and sessions showing controlling terminal Login shell proc1 proc2 proc3 proc4 proc5 background process group Session leader = Controlling process background process group foreground process group Controlling terminal
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109. Login shell(PID 442) Parent( PID 512) Child(PID 513) Process group 512 Process group 442 Fork/exec session fork