kern

diff src/timer.c @ 72:3941e82b07f2

- implemented syscalls: exit, waitpid, getppid - moved sys_whatever functions out of syscall.c into more reasonable files - putting all the definitions that must be synced with userland to include/kdef.h
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 15 Oct 2011 07:45:56 +0300
parents f44bec97a0ec
children
line diff
     1.1 --- a/src/timer.c	Thu Oct 13 05:22:35 2011 +0300
     1.2 +++ b/src/timer.c	Sat Oct 15 07:45:56 2011 +0300
     1.3 @@ -75,13 +75,20 @@
     1.4  	interrupt(IRQ_TO_INTR(0), timer_handler);
     1.5  }
     1.6  
     1.7 +int sys_sleep(int sec)
     1.8 +{
     1.9 +	printf("process %d will sleep for %d seconds\n", get_current_pid(), sec);
    1.10 +	sleep(sec * 1000); /* timer.c */
    1.11 +
    1.12 +	/* TODO if interrupted, return the remaining seconds */
    1.13 +	return 0;
    1.14 +}
    1.15 +
    1.16  void sleep(unsigned long msec)
    1.17  {
    1.18  	int ticks, tsum, istate;
    1.19  	struct timer_event *ev, *node;
    1.20  
    1.21 -	printf("sleep(%lu)\n", msec);
    1.22 -
    1.23  	if((ticks = MSEC_TO_TICKS(msec)) <= 0) {
    1.24  		return;
    1.25  	}