Course: CS510 Advanced UNIX/Linux Prog’g 1. In apue.3e/environ a. Compile & link
ID: 665671 • Letter: C
Question
Course: CS510
Advanced UNIX/Linux Prog’g
1. In apue.3e/environ
a. Compile & link doatexit.c
i. Run doatexit
ii. Capture output
b. Try adding two more exits
i. Make a copy
1. cp doatexit.c doatexit2.c
2. check permissions for new file [751 OR rwxr-x—x]
ii. Compil e
iii. Run
iv. Capture output
radii@Develop:~/CS510/apue.3e/environ$ ./doatexit2
main is done
first exit handler
second exit handler
third exit handler
fourth exit handler
fifth exit handler
2. In apue.3e/environ
a. Compile & link echoarg.c
i. Run echoarg
ii. Capture output
b. How do you increase the number of arguments?
3. In apue.3e/exercises
a. Compile & link zombie.c
i. Run zombie
1. Capture output
2. Any zombie processes?
ii. Wait twenty minutes
1. Rerun zombie
a. Capture output
b. Any zombie processes?
2. If things changed, why?
b. Compile & link vfork3
i. Run vfork3
1. Capture output
2. What’s the structure address?
4. In apue.3e/proc
a. Compile & link fork1
i. Run fork1
ii. Capture output
b. Compile & link times1
i. Run times1 [e.g.: ./runtimes1 ls]
ii. Capture output
c. Compile & link wait1
i. Run wait1
ii. Capture output
iii. Where do the ‘Signals’ come from?
radii@Develop:~/CS510/apue.3e/proc$ ./wait1
normal termination, exit status = 7
abnormal termination, signal number = 6
abnormal termination, signal number = 8
radii@Develop:~/CS510/apue.3e/proc$
Explanation / Answer
1) a) i) Successfully run doatexit.c
1) a) ii) Output:-
main is done
first exit handler
second exit handler
third exit handler
fourth exit handler
fifth exit handler
1) b) i) 1)successfully copied doatexit.c to doatexit2.c
1) b) i) 2) permission 751 is given to doatexit2.c
1) b) ii) successfully compiled doatexit2.c
1) b) iii) successfully run doatexit2.c
1) b) iv) Output:-
main is done
first exit handler
second exit handler
third exit handler
fourth exit handler
fifth exit handler
2) a) i) successfully run echoarg.c
command:-
echoarg.o abc def
2) a) ii) output:-
abc
def
2) b) we need to pass more arguments to the program at command line like below:-
echoarg.o abc def ghi jkl
3) a) i) 1) Output:-
3) a) i) 2) Yes
3) a) ii) 1) a) Output:-
3) a) ii) 1) b) Yes
3) a) ii) 2) No
3) b) i) 1) Output:-
No output on screen as nothing is displayed in the code
3) b) i) 2) structure's adress: 0xffef03