Write a test program to handle SIGBUS, SIGFPE,and SIGSEGV.I n the signal handler,use the siginfo_t structure to print the reason for the signal. In your main function, generate each of these signals without using kill(2). Describe the address stored in the si_addr ?eld of the siginfo_t structure.
What will be an ideal response?
ne solution is shown in Figure30. It shows several things. First, platforms differ on what events generate SIGBUS (the events might vary by hardwarea rchitecture, too). This leads us to use a different technique for FreeBSD 8.0 than compared to the other platforms. Second, we use sigsetjmp and siglongjmp to prevent an in?nite stream of signals from being generated. Third, we place the code to generate an integer divide-by-zerofault in its own function so that we can help identify the si_addr ?eld. Running the program shows that the address associated with SIGFPE is the address of the instruction that caused the fault, but the address associated with SIGBUS and SIGSEGV is the address we weretrying to reference. However, on FreeBSD 8.0, the address associated with SIGBUS is the address of the instruction we wereexecuting when the fault occurred.
You might also like to view...
By default, Windows hides file name extensions to make file names easier to read
Indicate whether the statement is true or false
____________is the practice to share patient information among multiple providers
a. Health information exchange b. Health interface c. Electronic medical records d. None of the above
An example of _________ data is the 1 million transactions generated by Walmart sales registers every hour.?
Fill in the blank(s) with the appropriate word(s).
The ____ string function scans a string under the control of a format conversion specification and stores the results in one or more variables.
A. sscanf B. scanf C. sprintf D. printf E. strtok