summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-12-01 14:22:58 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-12-01 14:22:58 +0000
commit1eb97ad84063ae276330c6f4b6c4638cea1154d3 (patch)
treea3af5c089e44f5e4acf1cd04c284e93e0667c12f /cpukit/libcsupport
parentFixed usage of va_arg(). (diff)
downloadrtems-1eb97ad84063ae276330c6f4b6c4638cea1154d3.tar.bz2
2009-12-01 Joel Sherrill <joel.sherrill@oarcorp.com>
* libcsupport/Makefile.am: Split no_posix.c so using sleep() does not pull in kill() stubs. * libcsupport/src/kill_noposix.c, libcsupport/src/sleep_noposix.c: New files. * libcsupport/src/no_posix.c: Removed.
Diffstat (limited to 'cpukit/libcsupport')
-rw-r--r--cpukit/libcsupport/Makefile.am4
-rw-r--r--cpukit/libcsupport/src/kill_noposix.c48
-rw-r--r--cpukit/libcsupport/src/sleep_noposix.c (renamed from cpukit/libcsupport/src/no_posix.c)33
3 files changed, 51 insertions, 34 deletions
diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am
index 609fd6e6d7..181358063d 100644
--- a/cpukit/libcsupport/Makefile.am
+++ b/cpukit/libcsupport/Makefile.am
@@ -103,8 +103,8 @@ TERMINAL_IDENTIFICATION_C_FILES += src/ttyname.c
LIBC_GLUE_C_FILES = src/__getpid.c src/__gettod.c src/__times.c \
src/truncate.c src/access.c src/stat.c src/lstat.c src/pathconf.c \
- src/newlibc_reent.c src/newlibc_init.c src/newlibc_exit.c src/no_posix.c \
- src/utsname.c
+ src/newlibc_reent.c src/newlibc_init.c src/newlibc_exit.c \
+ src/kill_noposix.c src/sleep_noposix.c src/utsname.c
BSD_LIBC_C_FILES = src/strlcpy.c src/strlcat.c src/issetugid.c
diff --git a/cpukit/libcsupport/src/kill_noposix.c b/cpukit/libcsupport/src/kill_noposix.c
new file mode 100644
index 0000000000..8b7898b3f8
--- /dev/null
+++ b/cpukit/libcsupport/src/kill_noposix.c
@@ -0,0 +1,48 @@
+/*
+ * Marginal implementations of some POSIX API routines
+ * to be used when POSIX is disabled.
+ *
+ * + kill
+ * + _kill_r
+ * + __kill
+ * + sleep
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+
+#include <unistd.h>
+
+/*
+ * These are directly supported (and completely correct) in the posix api.
+ */
+
+#if !defined(RTEMS_POSIX_API)
+int kill( pid_t pid, int sig )
+{
+ return 0;
+}
+
+#if defined(RTEMS_NEWLIB)
+#include <reent.h>
+
+int _kill_r( struct _reent *ptr, pid_t pid, int sig )
+{
+ return 0;
+}
+#endif
+
+int __kill( pid_t pid, int sig )
+{
+ return 0;
+}
+#endif
diff --git a/cpukit/libcsupport/src/no_posix.c b/cpukit/libcsupport/src/sleep_noposix.c
index 1b3bf35c21..8fc932fe98 100644
--- a/cpukit/libcsupport/src/no_posix.c
+++ b/cpukit/libcsupport/src/sleep_noposix.c
@@ -23,32 +23,6 @@
#include <unistd.h>
/*
- * These are directly supported (and completely correct) in the posix api.
- */
-
-#if !defined(RTEMS_POSIX_API)
-int kill( pid_t pid, int sig )
-{
- return 0;
-}
-
-#if defined(RTEMS_NEWLIB)
-#include <reent.h>
-
-int _kill_r( struct _reent *ptr, pid_t pid, int sig )
-{
- return 0;
-}
-#endif
-#endif
-
-int __kill( pid_t pid, int sig )
-{
- return 0;
-}
-
-
-/*
* 3.4.3 Delay Process Execution, P1003.1b-1993, p. 81
*
* $Id$
@@ -68,12 +42,7 @@ unsigned int sleep(
rtems_interval ticks_per_second;
rtems_interval ticks;
- status = rtems_clock_get(
- RTEMS_CLOCK_GET_TICKS_PER_SECOND,
- &ticks_per_second
- );
-
- ticks = seconds * ticks_per_second;
+ ticks_per_second = rtems_clock_get_ticks_per_second() * seconds;
status = rtems_task_wake_after( ticks );