From 37a8bebd1bae626657634b193166d0d5a2a9b685 Mon Sep 17 00:00:00 2001 From: Ali Mashtizadeh Date: Fri, 16 Jan 2015 14:51:03 -0800 Subject: [PATCH] Expose POSIX sleep --- include/unistd.h | 1 + lib/libc/SConscript | 5 +++-- lib/libc/process.c | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 lib/libc/process.c diff --git a/include/unistd.h b/include/unistd.h index 37c2a54..4782b53 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -7,6 +7,7 @@ #define STDERR_FILENO 2 int syscall(int number, ...); +unsigned int sleep(unsigned int seconds); #endif /* __UNISTD_H__ */ diff --git a/lib/libc/SConscript b/lib/libc/SConscript index 473c13e..4d44201 100644 --- a/lib/libc/SConscript +++ b/lib/libc/SConscript @@ -13,11 +13,12 @@ src_common = [ "exit.c", "file.c", "malloc.c", + "printf.c", + "process.c", + "posix/mman.c", "string.c", "syscall.c", "time.c", - "printf.c", - "posix/mman.c", ] src_amd64 = [ diff --git a/lib/libc/process.c b/lib/libc/process.c new file mode 100644 index 0000000..67b1f14 --- /dev/null +++ b/lib/libc/process.c @@ -0,0 +1,15 @@ + +#include + +#include +#include + +unsigned int +sleep(unsigned int seconds) +{ + OSThreadSleep(seconds); + + // Should return left over time if woke up early + return 0; +} +