diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-11-05 19:02:03 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-11-05 19:02:03 +0000 |
commit | 7edb9281a2e9da28fdaa64a7a71905a24e0dc6f8 (patch) | |
tree | f401ae5204e4f045b1788bbdad709bbf85e0ab2b /c/src/lib/libc/no_posix.c | |
parent | Patch from Eric Valette <valette@crf.canon.fr> so this will build (diff) | |
download | rtems-7edb9281a2e9da28fdaa64a7a71905a24e0dc6f8.tar.bz2 |
Following comments from Eric Norum <eric@cls.usask.ca>, a fairly
substantial upgrade of newlibc.c occurred. Now the user extension
data area is used rather than notepads and as many routines as possible
were split into other files further reducing the minimum footprint
of an RTEMS executable.
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libc/no_posix.c | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/c/src/lib/libc/no_posix.c b/c/src/lib/libc/no_posix.c new file mode 100644 index 0000000000..9973230e44 --- /dev/null +++ b/c/src/lib/libc/no_posix.c @@ -0,0 +1,101 @@ +/* + * Marginal implementations of some POSIX API routines + * to be used when POSIX is disabled. + * + * + getpid + * + _getpid_r + * + 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.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include <rtems.h> + +#include <unistd.h> + +/* + * These are directly supported (and completely correct) in the posix api. + */ + +#if !defined(RTEMS_POSIX_API) +pid_t getpid(void) +{ + return 0; +} + +#if defined(RTEMS_NEWLIB) +#include <sys/reent.h> + +pid_t _getpid_r( + struct _reent *ptr +) +{ + return getpid(); +} +#endif + +#endif + +#if !defined(RTEMS_POSIX_API) +int kill( pid_t pid, int sig ) +{ + return 0; +} + +int _kill_r( pid_t pid, int sig ) +{ + return 0; +} +#endif + +int __kill( pid_t pid, int sig ) +{ + return 0; +} + + +/* + * 3.4.3 Delay Process Execution, P1003.1b-1993, p. 81 + * + * $Id$ + */ + +#include <time.h> +#include <unistd.h> + +#include <rtems.h> + +#if !defined(RTEMS_POSIX_API) +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 + |