Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
can you please help me complete implementations for this function.
the instructions are to create a child process (calling fork()) and override the default SIGSEGV handler in that child
process. After the child process sets up the signal handler, call sem_post
(start); then trigger a segmentation fault. For instance, declare an invalid
pointer and dereference it. The parent should just return to main().
child_runing (size_t number_of_signals, int signals[], char *semname)
{
// Dont change
sem_unlink (semname);
sem_t *start = sem_open (semname, O_CREAT, 0644, 0);
if (start == NULL)
return EXIT_FAILURE;
// TODO: for number 3.

 

// crate child that first use sigaction()
// to override the default signal handlers to use unknownsignal(). Then,
// use sigaction() again to override the signals specified on the command
// line to use handle_sig().
//
// NOTE: We are only dealing with SEGV, HUP, and INT. Only these three
// signals should be overriden.
//
pid_t child = -1;
// CRITICAL: The code for the child process should end with these two
// lines of code. The will let the parent know that the child has started,
// then enter an infinite loop until the signal arrives. The child should
// not do anything after this code.
//
sem_post (start);
while (1) ;

 

// Dont change
sem_wait (start);
sem_unlink (semname);
return child;
}
/// below are the methods called in child_run
unknownsignal (int numofsig)
{
write (STDOUT_FILENO, "NOT OVERRIDEN\n", 14);
exit (EXIT_SUCCESS);
}
 
void
handle_sig (int numofsig)
{
write (STDOUT_FILENO, "change this", 0);
exit (EXIT_SUCCESS);
}
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education