SlideShare a Scribd company logo
1 of 1
Download to read offline
Write and set up signal handlers for each of the following signals: SIGUSR1, SIGUSR2, and
SIGHUP, Set up SIGIO as a signal to be ignored. (6 marks) a. The initial handler you should
write for each of them should be stub routines that output a message: "Signal # (SIGxxxx)
received in function__FUNCTION_. Use strsignal to output the name of the signal using dprintf
to send the output to a file. (The tail -f & command will be demonstrated to allow you to follow
text output to a file while a program is running. Take notes!) Display the name of the file, when
it was compiled and the line # of the output message. (2 marks) b. Test all of the above signal
handlers. ( 2 marks) i. Verify that all of your signal handlers work sending your command
servers each of the above signals from a 2nd terminal. ii. To set up a log file to record the output
of dprintf(fd, fmtstr, argsl) use one of more of the following before running your command
server: exec fd>/dev/tty #isplays the messages on the current terminal exec fd>/dev/pts/n
#display on a different terminal that you own exec fd> logfile #writes to a file tail -f logfile &
#displays new data as it is appended to logfile tail f logfile >/dev/pts/n & #displays new data
on an alternate terminal Hand in a log file (as opposed to a screen shot) showing that you tested
all of the signals c. In a 3rd terminal attach strace to the pid of your command server. (2) i. Send
each of the 4 signals to the pid of the command server. How does strace respond to each signal.
Summarize the result. ii. Send each of the 4 signals to the parent pid of the command server.
Answer the same question and hilite/describe any difference.

More Related Content

Similar to Write and set up signal handlers for each of the following signals S.pdf

Unit1 jwfiles
Unit1 jwfilesUnit1 jwfiles
Unit1 jwfiles
mrecedu
 
a. Modify the C program ex.9 so that it simulates the Unix pipe comm.pdf
a. Modify the C program ex.9 so that it simulates the Unix pipe comm.pdfa. Modify the C program ex.9 so that it simulates the Unix pipe comm.pdf
a. Modify the C program ex.9 so that it simulates the Unix pipe comm.pdf
ebrahimbadushata00
 
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
venkatapranaykumarGa
 
Ui disk & terminal drivers
Ui disk & terminal driversUi disk & terminal drivers
Ui disk & terminal drivers
Sarang Ananda Rao
 
Debug tutorial
Debug tutorialDebug tutorial
Debug tutorial
Defri N
 
C programming session 08
C programming session 08C programming session 08
C programming session 08
Dushmanta Nath
 

Similar to Write and set up signal handlers for each of the following signals S.pdf (20)

Unit1 jwfiles
Unit1 jwfilesUnit1 jwfiles
Unit1 jwfiles
 
a. Modify the C program ex.9 so that it simulates the Unix pipe comm.pdf
a. Modify the C program ex.9 so that it simulates the Unix pipe comm.pdfa. Modify the C program ex.9 so that it simulates the Unix pipe comm.pdf
a. Modify the C program ex.9 so that it simulates the Unix pipe comm.pdf
 
Alp 05
Alp 05Alp 05
Alp 05
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpoint
 
Linux IO
Linux IOLinux IO
Linux IO
 
Project report
Project reportProject report
Project report
 
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using PipesLinux Systems Programming: Inter Process Communication (IPC) using Pipes
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
 
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
 
Linux_C_LabBasics.ppt
Linux_C_LabBasics.pptLinux_C_LabBasics.ppt
Linux_C_LabBasics.ppt
 
Ui disk & terminal drivers
Ui disk & terminal driversUi disk & terminal drivers
Ui disk & terminal drivers
 
Linux
LinuxLinux
Linux
 
Linux
LinuxLinux
Linux
 
Linux
LinuxLinux
Linux
 
Linux
LinuxLinux
Linux
 
Debug tutorial
Debug tutorialDebug tutorial
Debug tutorial
 
Introduction to C Unit 1
Introduction to C Unit 1Introduction to C Unit 1
Introduction to C Unit 1
 
Rpc mechanism
Rpc mechanismRpc mechanism
Rpc mechanism
 
Unix system programming
Unix system programmingUnix system programming
Unix system programming
 
C programming session 08
C programming session 08C programming session 08
C programming session 08
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial
 

More from ssuser8308881

Which types of communities are most susceptible to ecological drift s.pdf
 Which types of communities are most susceptible to ecological drift s.pdf Which types of communities are most susceptible to ecological drift s.pdf
Which types of communities are most susceptible to ecological drift s.pdf
ssuser8308881
 

More from ssuser8308881 (20)

White blood cells are produced in bone marrow and circulate in blood .pdf
 White blood cells are produced in bone marrow and circulate in blood .pdf White blood cells are produced in bone marrow and circulate in blood .pdf
White blood cells are produced in bone marrow and circulate in blood .pdf
 
Which two of the following technologies are examples of different tim.pdf
 Which two of the following technologies are examples of different tim.pdf Which two of the following technologies are examples of different tim.pdf
Which two of the following technologies are examples of different tim.pdf
 
Which two items in the following list are identified in the block as .pdf
 Which two items in the following list are identified in the block as .pdf Which two items in the following list are identified in the block as .pdf
Which two items in the following list are identified in the block as .pdf
 
Which types of communities are most susceptible to ecological drift s.pdf
 Which types of communities are most susceptible to ecological drift s.pdf Which types of communities are most susceptible to ecological drift s.pdf
Which types of communities are most susceptible to ecological drift s.pdf
 
Which statement is not true about repressors in eukaryotic cells A. .pdf
 Which statement is not true about repressors in eukaryotic cells A. .pdf Which statement is not true about repressors in eukaryotic cells A. .pdf
Which statement is not true about repressors in eukaryotic cells A. .pdf
 
Which of the following would be a violation of the chain of custody.pdf
 Which of the following would be a violation of the chain of custody.pdf Which of the following would be a violation of the chain of custody.pdf
Which of the following would be a violation of the chain of custody.pdf
 
Which of the following statements regarding acute respiratory distres.pdf
 Which of the following statements regarding acute respiratory distres.pdf Which of the following statements regarding acute respiratory distres.pdf
Which of the following statements regarding acute respiratory distres.pdf
 
Which of the following statements is the most correct The expected r.pdf
 Which of the following statements is the most correct The expected r.pdf Which of the following statements is the most correct The expected r.pdf
Which of the following statements is the most correct The expected r.pdf
 
Which of the following statements is not correct about the population.pdf
 Which of the following statements is not correct about the population.pdf Which of the following statements is not correct about the population.pdf
Which of the following statements is not correct about the population.pdf
 
Which of the following statements are true for the TCPIP context. a..pdf
 Which of the following statements are true for the TCPIP context. a..pdf Which of the following statements are true for the TCPIP context. a..pdf
Which of the following statements are true for the TCPIP context. a..pdf
 
Which of the following statements about merit goods is correct Emerg.pdf
 Which of the following statements about merit goods is correct Emerg.pdf Which of the following statements about merit goods is correct Emerg.pdf
Which of the following statements about merit goods is correct Emerg.pdf
 
Which of the following statement(s) isare NOT true regarding mon.pdf
 Which of the following statement(s) isare NOT true regarding mon.pdf Which of the following statement(s) isare NOT true regarding mon.pdf
Which of the following statement(s) isare NOT true regarding mon.pdf
 
Which of the following statements about arthropods is false Terrestr.pdf
 Which of the following statements about arthropods is false Terrestr.pdf Which of the following statements about arthropods is false Terrestr.pdf
Which of the following statements about arthropods is false Terrestr.pdf
 
Which of the following pieces of audit evidence would most likely be .pdf
 Which of the following pieces of audit evidence would most likely be .pdf Which of the following pieces of audit evidence would most likely be .pdf
Which of the following pieces of audit evidence would most likely be .pdf
 
Which of the following phrases does not describe a function of the pr.pdf
 Which of the following phrases does not describe a function of the pr.pdf Which of the following phrases does not describe a function of the pr.pdf
Which of the following phrases does not describe a function of the pr.pdf
 
Which of the following is true of the liability of a common carrier o.pdf
 Which of the following is true of the liability of a common carrier o.pdf Which of the following is true of the liability of a common carrier o.pdf
Which of the following is true of the liability of a common carrier o.pdf
 
Which of the following is true of FST, a measure of genetic distanc.pdf
 Which of the following is true of FST, a measure of genetic distanc.pdf Which of the following is true of FST, a measure of genetic distanc.pdf
Which of the following is true of FST, a measure of genetic distanc.pdf
 
Which of the following is TRUE about bank runs FDIC insurance makes .pdf
 Which of the following is TRUE about bank runs FDIC insurance makes .pdf Which of the following is TRUE about bank runs FDIC insurance makes .pdf
Which of the following is TRUE about bank runs FDIC insurance makes .pdf
 
Which of the following is the correct sequence in the development of .pdf
 Which of the following is the correct sequence in the development of .pdf Which of the following is the correct sequence in the development of .pdf
Which of the following is the correct sequence in the development of .pdf
 
Which of the following is the first valueadding step of information s.pdf
 Which of the following is the first valueadding step of information s.pdf Which of the following is the first valueadding step of information s.pdf
Which of the following is the first valueadding step of information s.pdf
 

Recently uploaded

e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
EADTU
 

Recently uploaded (20)

The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
Scopus Indexed Journals 2024 - ISCOPUS Publications
Scopus Indexed Journals 2024 - ISCOPUS PublicationsScopus Indexed Journals 2024 - ISCOPUS Publications
Scopus Indexed Journals 2024 - ISCOPUS Publications
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 

Write and set up signal handlers for each of the following signals S.pdf

  • 1. Write and set up signal handlers for each of the following signals: SIGUSR1, SIGUSR2, and SIGHUP, Set up SIGIO as a signal to be ignored. (6 marks) a. The initial handler you should write for each of them should be stub routines that output a message: "Signal # (SIGxxxx) received in function__FUNCTION_. Use strsignal to output the name of the signal using dprintf to send the output to a file. (The tail -f & command will be demonstrated to allow you to follow text output to a file while a program is running. Take notes!) Display the name of the file, when it was compiled and the line # of the output message. (2 marks) b. Test all of the above signal handlers. ( 2 marks) i. Verify that all of your signal handlers work sending your command servers each of the above signals from a 2nd terminal. ii. To set up a log file to record the output of dprintf(fd, fmtstr, argsl) use one of more of the following before running your command server: exec fd>/dev/tty #isplays the messages on the current terminal exec fd>/dev/pts/n #display on a different terminal that you own exec fd> logfile #writes to a file tail -f logfile & #displays new data as it is appended to logfile tail f logfile >/dev/pts/n & #displays new data on an alternate terminal Hand in a log file (as opposed to a screen shot) showing that you tested all of the signals c. In a 3rd terminal attach strace to the pid of your command server. (2) i. Send each of the 4 signals to the pid of the command server. How does strace respond to each signal. Summarize the result. ii. Send each of the 4 signals to the parent pid of the command server. Answer the same question and hilite/describe any difference.