28 lines
947 B
C
28 lines
947 B
C
#include <stdio.h>
|
|
|
|
int main() {
|
|
/*
|
|
* Write a C program that prints “Hello world!” an infinite number
|
|
of times.
|
|
Run the program, and kill it by pressing (Ctrl+C). Which signal
|
|
did the process receive? Can we handle it? Can the process ignore
|
|
the signal?
|
|
Run the program, and kill it by pressing (Ctrl+\). Which signal
|
|
did the process receive? Can we handle it? Can the process ignore
|
|
the signal? In Ubuntu, set core dump size via ulimit -c
|
|
unlimited. The core dump file is in /var/lib/apport/coredump/.
|
|
Check the log file /var/log/apport.log for core dump file name.
|
|
Run the program in the background (&) and redirect stdout to a
|
|
file output.txt, kill the process by sending the signal “SIGTERM”
|
|
via “kill -s SIGTERM pid ” command. Can we handle the
|
|
signal? Can the process ignore the signal? Send the signal
|
|
“SIGKILL” if the program does not terminate politely.
|
|
30 / 58
|
|
*/
|
|
|
|
|
|
while (1)
|
|
printf("Hello world!\n");
|
|
|
|
return 0;
|
|
} |