操作系统复习 MITS6.1810 lab util 记录
lab utilsleep
[*]介绍:主要用来熟悉下环境以及代码结构。
[*]See kernel/sysproc.c for the xv6 kernel code that implements the sleep system call (look for sys_sleep), user/user.h for the C definition of sleep callable from a user program, and user/usys.S for the assembler code that jumps from user code into the kernel for sleep.
[*]代码:
#include "kernel/types.h"
#include "user/user.h"
int main(int argc, char *argv[])
{
if (argc <= 1) {
fprintf(2, "usage: sleep `time`...\n");
}
int tick_num = atoi(argv);
sleep(tick_num);
exit(0);
}
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
页:
[1]