xv6-cs450/user1.c

37 lines
341 B
C
Raw Normal View History

int
2006-06-22 22:47:23 +02:00
fork()
{
asm("mov $1, %eax");
asm("int $48");
}
2006-06-26 17:11:19 +02:00
void
cons_putc(int c)
{
asm("mov $4, %eax");
asm("int $48");
}
int
2006-06-26 17:11:19 +02:00
puts(char *s)
{
int i;
for(i = 0; s[i]; i++)
cons_putc(s[i]);
return i;
2006-06-26 17:11:19 +02:00
}
2006-06-22 22:47:23 +02:00
main()
{
int pid;
pid = fork();
if(pid == 0){
cons_putc('C');
} else {
cons_putc('P');
}
2006-06-22 22:47:23 +02:00
while(1)
;
}