Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void exit1(void);
- static void exit2(void);
- main() {
- pid_t pid;
- atexit(exit1);
- pid=fork();
- if(pid==0) {
- atexit(exit2);
- write(1,"figlio",6);
- printf("mio padre %d ", getppid());
- exit(0);
- }
- else {
- wait( );
- write(1,"padre",5);
- printf("esce %d ", getpid());
- exit(0);
- }
- }
- static void exit1(void) {
- printf("sono il primo handler");
- return;
- }
- static void exit2(void) {
- printf("sono il secondo handler");
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement