Skip to content

Instantly share code, notes, and snippets.

@mlouielu
Created August 21, 2017 05:17
Show Gist options
  • Save mlouielu/68b18d19ea672a8e6d0922b7072f5c7b to your computer and use it in GitHub Desktop.
Save mlouielu/68b18d19ea672a8e6d0922b7072f5c7b to your computer and use it in GitHub Desktop.
#include <stdlib.h>
#include <kernel/syscalls.h>
#include "sh.h"
int _sleep(int ms) {
return do_syscall1((void *) ms, SYS_MSLEEP);
}
int sleep(int argc, char *argv[]) {
int ms;
if (argc == 2)
ms = atoi(argv[1]);
else
return 0;
printk("Hello\n");
_sleep(ms);
printk("Wake up\n");
return 0;
}
HOOK_BUILTIN_CMD(sleep, sleep);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment