17 lines
341 B
C
17 lines
341 B
C
#include <stdio.h>
|
|
#include <signal.h>
|
|
#include <unistd.h>
|
|
|
|
void handle_sigint(int sig) {
|
|
printf("Caught signal %d\n", sig);
|
|
}
|
|
|
|
int main() {
|
|
signal(SIGINT, handle_sigint); // Register signal handler
|
|
while (1) {
|
|
sleep(1); // Sleep for 1 second
|
|
printf("Process ID %d running...\n", getpid());
|
|
}
|
|
return 0;
|
|
}
|