summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1996-06-03 18:59:24 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1996-06-03 18:59:24 +0000
commit685f4d65d49627d3ecfb101e1d679a03e504f8f8 (patch)
treef0efb8880cbbadb5551989489cf50ad5a0f167d8
parentadded test case for nanosleep filling in the time remaining structure. (diff)
downloadrtems-685f4d65d49627d3ecfb101e1d679a03e504f8f8.tar.bz2
sleep moved into newlibc.c so the sleep.o object would not be in the library.
This implementation of sleep is now only used when the POSIX API is not configured.
-rw-r--r--c/src/exec/libcsupport/src/newlibc.c27
-rw-r--r--c/src/lib/libc/newlibc.c27
-rw-r--r--cpukit/libcsupport/src/newlibc.c27
3 files changed, 78 insertions, 3 deletions
diff --git a/c/src/exec/libcsupport/src/newlibc.c b/c/src/exec/libcsupport/src/newlibc.c
index 6a80d4944b..81b7ea5c5d 100644
--- a/c/src/exec/libcsupport/src/newlibc.c
+++ b/c/src/exec/libcsupport/src/newlibc.c
@@ -335,7 +335,7 @@ void _exit(int status)
/*
- * These are only supported in the posix api.
+ * These are directly supported (and completely correct) in the posix api.
*/
#ifndef RTEMS_POSIX_API
@@ -354,6 +354,31 @@ int __kill( pid_t pid, int sig )
return 0;
}
+unsigned int sleep(
+ unsigned int seconds
+)
+{
+ rtems_status_code status;
+ 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;
+
+ status = rtems_task_wake_after( ticks );
+
+ /*
+ * Returns the "unslept" amount of time. In RTEMS signals are not
+ * interruptable, so tasks really sleep all of the requested time.
+ */
+
+ return 0;
+}
+
#endif
#endif
diff --git a/c/src/lib/libc/newlibc.c b/c/src/lib/libc/newlibc.c
index 6a80d4944b..81b7ea5c5d 100644
--- a/c/src/lib/libc/newlibc.c
+++ b/c/src/lib/libc/newlibc.c
@@ -335,7 +335,7 @@ void _exit(int status)
/*
- * These are only supported in the posix api.
+ * These are directly supported (and completely correct) in the posix api.
*/
#ifndef RTEMS_POSIX_API
@@ -354,6 +354,31 @@ int __kill( pid_t pid, int sig )
return 0;
}
+unsigned int sleep(
+ unsigned int seconds
+)
+{
+ rtems_status_code status;
+ 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;
+
+ status = rtems_task_wake_after( ticks );
+
+ /*
+ * Returns the "unslept" amount of time. In RTEMS signals are not
+ * interruptable, so tasks really sleep all of the requested time.
+ */
+
+ return 0;
+}
+
#endif
#endif
diff --git a/cpukit/libcsupport/src/newlibc.c b/cpukit/libcsupport/src/newlibc.c
index 6a80d4944b..81b7ea5c5d 100644
--- a/cpukit/libcsupport/src/newlibc.c
+++ b/cpukit/libcsupport/src/newlibc.c
@@ -335,7 +335,7 @@ void _exit(int status)
/*
- * These are only supported in the posix api.
+ * These are directly supported (and completely correct) in the posix api.
*/
#ifndef RTEMS_POSIX_API
@@ -354,6 +354,31 @@ int __kill( pid_t pid, int sig )
return 0;
}
+unsigned int sleep(
+ unsigned int seconds
+)
+{
+ rtems_status_code status;
+ 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;
+
+ status = rtems_task_wake_after( ticks );
+
+ /*
+ * Returns the "unslept" amount of time. In RTEMS signals are not
+ * interruptable, so tasks really sleep all of the requested time.
+ */
+
+ return 0;
+}
+
#endif
#endif