From 1c55d2e868d6f7d22da5fa986a0359ede8793178 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 5 Nov 1999 19:38:37 +0000 Subject: Split unistd.c file into sysconf.c and sleep.c. --- c/src/exec/posix/src/Makefile.in | 4 ++-- c/src/exec/posix/src/sleep.c | 27 ++++++++++++++++++++++++++ c/src/exec/posix/src/sysconf.c | 41 ++++++++++++++++++++++++++++++++++++++++ c/src/exec/posix/src/unistd.c | 41 ---------------------------------------- 4 files changed, 70 insertions(+), 43 deletions(-) create mode 100644 c/src/exec/posix/src/sleep.c create mode 100644 c/src/exec/posix/src/sysconf.c delete mode 100644 c/src/exec/posix/src/unistd.c (limited to 'c') diff --git a/c/src/exec/posix/src/Makefile.in b/c/src/exec/posix/src/Makefile.in index a815a6943a..8a5098394d 100644 --- a/c/src/exec/posix/src/Makefile.in +++ b/c/src/exec/posix/src/Makefile.in @@ -83,8 +83,8 @@ TIMER_C_PIECES=ptimer ptimer1 C_PIECES = adasupp $(CANCEL_C_PIECES) $(CONDITION_VARIABLE_C_PIECES) \ $(ID_C_PIECES) $(KEY_C_PIECES) $(MESSAGE_QUEUE_C_PIECES) \ $(MUTEX_C_PIECES) $(PTHREAD_C_PIECES) \ - $(PSIGNAL_C_PIECES) sched $(SEMAPHORE_C_PIECES) \ - $(TIME_C_PIECES) $(TIMER_C_PIECES) types unistd $(ENOSYS_C_PIECES) \ + $(PSIGNAL_C_PIECES) sched $(SEMAPHORE_C_PIECES) sleep sysconf \ + $(TIME_C_PIECES) $(TIMER_C_PIECES) types $(ENOSYS_C_PIECES) \ $(BUILD_FOR_NOW_C_PIECES) C_FILES = $(C_PIECES:%=%.c) diff --git a/c/src/exec/posix/src/sleep.c b/c/src/exec/posix/src/sleep.c new file mode 100644 index 0000000000..dec0ed0a54 --- /dev/null +++ b/c/src/exec/posix/src/sleep.c @@ -0,0 +1,27 @@ +/* + * 3.4.3 Delay Process Execution, P1003.1b-1993, p. 81 + * + * $Id$ + */ + +#include +#include + +#include + + +unsigned int sleep( + unsigned int seconds +) +{ + /* XXX can we get away with this implementation? */ + struct timespec tp; + struct timespec tm; + + tp.tv_sec = seconds; + tp.tv_nsec = 0; + + nanosleep( &tp, &tm ); + + return tm.tv_sec; /* seconds remaining */ +} diff --git a/c/src/exec/posix/src/sysconf.c b/c/src/exec/posix/src/sysconf.c new file mode 100644 index 0000000000..8d930ce33c --- /dev/null +++ b/c/src/exec/posix/src/sysconf.c @@ -0,0 +1,41 @@ +/* + * $Id$ + */ + +#include +#include + +#include + + +/* + * 3.4.3 Delay Process Execution, P1003.1b-1993, p. 81 + */ + +unsigned int sleep( + unsigned int seconds +) +{ + /* XXX can we get away with this implementation? */ + struct timespec tp; + struct timespec tm; + + tp.tv_sec = seconds; + tp.tv_nsec = 0; + + nanosleep( &tp, &tm ); + + return tm.tv_sec; /* seconds remaining */ +} + +/*PAGE + * + * 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 95 + */ + +long sysconf( + int name +) +{ + return POSIX_NOT_IMPLEMENTED(); +} diff --git a/c/src/exec/posix/src/unistd.c b/c/src/exec/posix/src/unistd.c deleted file mode 100644 index 8d930ce33c..0000000000 --- a/c/src/exec/posix/src/unistd.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * $Id$ - */ - -#include -#include - -#include - - -/* - * 3.4.3 Delay Process Execution, P1003.1b-1993, p. 81 - */ - -unsigned int sleep( - unsigned int seconds -) -{ - /* XXX can we get away with this implementation? */ - struct timespec tp; - struct timespec tm; - - tp.tv_sec = seconds; - tp.tv_nsec = 0; - - nanosleep( &tp, &tm ); - - return tm.tv_sec; /* seconds remaining */ -} - -/*PAGE - * - * 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 95 - */ - -long sysconf( - int name -) -{ - return POSIX_NOT_IMPLEMENTED(); -} -- cgit v1.2.3