blob: 31d38c1997f1aff99ac8225c326e642a1ff7ce5d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
void pid1(void) {
ssize_t in;
char buf[2] = { 0, 0 };
printf("We did it ma!\n");
while(1) {
in = read(buf, 1);
if(in > 0)
puts(buf);
}
}
void pid2(void) {
int x = 0;
printf("We did it ma!\n");
while(1) {
sleep(1);
printf("0x%04x:0x%08x: 0x%08x, 0x%08x\n", getpid(), (uint32_t) getpdir(), time(), x++);
}
}
void main(void) {
if(getpid() == 1) {
ctty(1);
pid1();
}
pid2();
}
|