+ 2

Simple Shell

Does anyone has tipps how to implement sigint handler in C or to change a process from fg to bg and otherwise? Thanks for your help

20th Apr 2022, 2:49 PM
Manfred h
1 Odpowiedź
+ 1
1. Implementing a SIGINT Handler in C • Create a signal handler function that will handle the SIGINT signal. This function should have the following prototype: void sigint_handler(int sig). • Register the signal handler with the system using the signal() function. The syntax for this is: signal(SIGINT, sigint_handler). • Within the signal handler, you can write code to handle the SIGINT signal. This could include things such as setting a global variable to indicate that the program has received a SIGINT or even terminating the process. 2. Changing a Process from FG to BG and Otherwise • To change a process from foreground to background, you can use the bg command. This command takes the job ID of the process you want to move to background and moves it to background. • To move a process from background to foreground, you can use the fg command. This command takes the job ID of the process you want to move to foreground and moves it to foreground.
15th Feb 2023, 6:47 PM
Last
Last - avatar