SlideShare a Scribd company logo
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

PDF
#define LOGFILE signal_log.txt Signal handlers void sigusr1.pdf
PDF
Mp lab manual
DOCX
lec4.docx
PDF
Ch02.pdf
PDF
Pascal script maxbox_ekon_14_2
PPT
C Language Unit-1
PPTX
Micro c lab2(led patterns)
PPTX
#define LOGFILE signal_log.txt Signal handlers void sigusr1.pdf
Mp lab manual
lec4.docx
Ch02.pdf
Pascal script maxbox_ekon_14_2
C Language Unit-1
Micro c lab2(led patterns)

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

DOCX
CS3451-INTRODUCTION TO OPERATING SYSTEM-91035556-OS LAB CSE (1).docx
PPT
Unit1 jwfiles
PDF
a. Modify the C program ex.9 so that it simulates the Unix pipe comm.pdf
PDF
Alp 05
PPTX
C Programming Language Tutorial for beginners - JavaTpoint
DOCX
CS3451-INTRODUCTION TO OPERATING SYSTEM-91035556-OS LAB CSE.docx
PDF
Programming exercises I2C for STM32mp157
PPTX
Linux IO
DOC
Project report
PPTX
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
DOCX
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
PPT
Linux_C_LabBasics.ppt
PDF
Ui disk & terminal drivers
PPT
ODP
ODP
PDF
Debug tutorial
PPTX
Introduction to C Unit 1
DOCX
Rpc mechanism
CS3451-INTRODUCTION TO OPERATING SYSTEM-91035556-OS LAB CSE (1).docx
Unit1 jwfiles
a. Modify the C program ex.9 so that it simulates the Unix pipe comm.pdf
Alp 05
C Programming Language Tutorial for beginners - JavaTpoint
CS3451-INTRODUCTION TO OPERATING SYSTEM-91035556-OS LAB CSE.docx
Programming exercises I2C for STM32mp157
Linux IO
Project report
Linux Systems Programming: Inter Process Communication (IPC) using Pipes
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
Linux_C_LabBasics.ppt
Ui disk & terminal drivers
Debug tutorial
Introduction to C Unit 1
Rpc mechanism
Ad

More from ssuser8308881 (20)

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

Recently uploaded (20)

PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
PPTX
Digestion and Absorption of Carbohydrates, Proteina and Fats
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
IGGE1 Understanding the Self1234567891011
PPTX
Cell Types and Its function , kingdom of life
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
PDF
1_English_Language_Set_2.pdf probationary
PDF
Complications of Minimal Access Surgery at WLH
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PPTX
Lesson notes of climatology university.
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
PDF
Indian roads congress 037 - 2012 Flexible pavement
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
UNIT III MENTAL HEALTH NURSING ASSESSMENT
Digestion and Absorption of Carbohydrates, Proteina and Fats
Practical Manual AGRO-233 Principles and Practices of Natural Farming
Supply Chain Operations Speaking Notes -ICLT Program
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
IGGE1 Understanding the Self1234567891011
Cell Types and Its function , kingdom of life
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
1_English_Language_Set_2.pdf probationary
Complications of Minimal Access Surgery at WLH
LDMMIA Reiki Yoga Finals Review Spring Summer
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
Lesson notes of climatology university.
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
Weekly quiz Compilation Jan -July 25.pdf
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
Indian roads congress 037 - 2012 Flexible pavement
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf

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.