diff options
Diffstat (limited to 'usrbin/main.c')
| -rw-r--r-- | usrbin/main.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/usrbin/main.c b/usrbin/main.c index 2afcf0e..8c8d2dc 100644 --- a/usrbin/main.c +++ b/usrbin/main.c @@ -1,15 +1,37 @@ +#include <signal.h> #include <stdint.h> #include <stdio.h> #include <time.h> #include <unistd.h> -void main(void) { - int x = 0; +void sighandler(int sig) { + printf("Caught SIGALRM!\n"); +} - printf("We did it ma!\n"); +void pid1(void) { + signal(SIGALRM, &sighandler); + alarm(2); + pause(); + printf("Alarm expired!\n"); + pause(); + + while(1) + printf("It's didn't work!\n"); +} + +void pid2(void) { + int x = 0; while(1) { sleep(1); printf("0x%04x:0x%08x: 0x%08x, 0x%08x\n", getpid(), (uint32_t) getpdir(), time(), x++); } } + +void main(void) { + printf("We did it ma!\n"); + + if(getpid() == 1) + pid1(); + pid2(); +} |
