You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
272 B

#include <linux/sched.h>
#include <unistd.h>
#include <linux/kernel.h>
#include <time.h>
int sys_sleep(unsigned int seconds)
{
long t = CURRENT_TIME;
current->state = TASK_INTERRUPTIBLE;
while(CURRENT_TIME - t < seconds){}
current->state = TASK_RUNNING;
return 0;
}