Question: void f1( int s ) { fprintf(stderr, -I-LIKE- ); } void f2( int s ) { printf( -MOUSE- ); fflush( stdout ); } int main()

 void f1( int s ) { fprintf(stderr, "-I-LIKE-" ); } void

void f1( int s ) { fprintf(stderr, "-I-LIKE-" ); } void f2( int s ) { printf( "-MOUSE-" ); fflush( stdout ); } int main() { int p[2]; pipe(p); dup2( p[1], 1); signal( SIGUSR1, f1 ); signal( SIGUSR2, f2 ); printf("COFFEE" ); fflush(stdout); sleep( 1 ); printf( "K-A" ); fflush(stdout); sleep( 1 ); char * buffer = calloc( 3, sizeof( char ) ); close( p[1] ); char * ptr = buffer; read( p[0], buffer, 2); fprintf(stderr, "%s%SA-PU", buffer, ptr++ ); read( p[0], buffer, 2); fprintf(stderr, "%s ", buffer); free buffer); close( p[0] ); return EXIT_SUCCESS; } (a) What is the exact terminal output of this code if a SIGUSR1 signal is sent to this process during the first sleep() call, then a SIGUSR2 signal is sent to this process during the second sleep() call? If no terminal output occurs, write

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!