From 14934ee51fe71664a0e5b054db6247e442c9c588 Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Sun, 30 Apr 2017 16:49:50 +0200 Subject: [PATCH] libposix: sleep and pipe --- sys/include/posix.h | 2 ++ sys/src/lib/posix/files.c | 10 ++++++++++ sys/src/lib/posix/others.c | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/sys/include/posix.h b/sys/include/posix.h index 3a513fd..589932d 100644 --- a/sys/include/posix.h +++ b/sys/include/posix.h @@ -59,6 +59,8 @@ extern void * POSIX_malloc(int *errnop, size_t size); extern void *POSIX_realloc(int *errnop, void *ptr, size_t size); extern void *POSIX_calloc(int *errnop, size_t nelem, size_t size); extern void POSIX_free(void *ptr); +extern unsigned int POSIX_sleep(unsigned int seconds); +extern int POSIX_pipe(int *errnop, int fildes[2]); /* Library initialization */ diff --git a/sys/src/lib/posix/files.c b/sys/src/lib/posix/files.c index b2429cf..9aec161 100644 --- a/sys/src/lib/posix/files.c +++ b/sys/src/lib/posix/files.c @@ -97,6 +97,16 @@ find_seek_type(int whence) return -1; } +int +POSIX_pipe(int *errnop, int fildes[2]) +{ + int res; + res = jehanne_pipe(fildes); + if(res == -1) + *errnop = __libposix_get_errno(PosixEMFILE); + return res; +} + int POSIX_open(int *errnop, const char *name, int flags, int mode) { diff --git a/sys/src/lib/posix/others.c b/sys/src/lib/posix/others.c index fc4bed6..c092129 100644 --- a/sys/src/lib/posix/others.c +++ b/sys/src/lib/posix/others.c @@ -41,6 +41,13 @@ POSIX_isatty(int *errnop, int fd) return 0; } +unsigned int +POSIX_sleep(unsigned int seconds) +{ + sleep(seconds*1000); + return 0; +} + clock_t POSIX_times(int *errnop, void *buf) {