From 8a0efa53e44919bcf5ccb1d3353618a82afdf8bc Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 17 Feb 2000 19:39:52 +0000 Subject: import newlib-2000-02-17 snapshot --- newlib/libc/sys/rtems/include/limits.h | 178 +++++++++++++++++++++++++++ newlib/libc/sys/rtems/include/signal.h | 142 +++++++++++++++++++++ newlib/libc/sys/rtems/include/time.h | 218 +++++++++++++++++++++++++++++++++ 3 files changed, 538 insertions(+) create mode 100644 newlib/libc/sys/rtems/include/limits.h create mode 100644 newlib/libc/sys/rtems/include/signal.h create mode 100644 newlib/libc/sys/rtems/include/time.h (limited to 'newlib/libc/sys/rtems/include') diff --git a/newlib/libc/sys/rtems/include/limits.h b/newlib/libc/sys/rtems/include/limits.h new file mode 100644 index 000000000..e9f45e44c --- /dev/null +++ b/newlib/libc/sys/rtems/include/limits.h @@ -0,0 +1,178 @@ +/* + * This file lists the minimums for the limits set by each of + * the POSIX features subsets. + * + * XXX: Careful attention needs to be paid to section 2.8 in 1003.1b-1993 + * to segregrate the variables below based on their "class" according + * to our implementation. We also need to set the Run-Time Invariant + * and other related values. + * + * $Id$ + */ + +#ifndef _GCC_LIMITS_H_ /* if we have not seen gcc's limits.h yet */ +#include_next +#endif + +#ifndef __POSIX_LIMITS_h +#define __POSIX_LIMITS_h + +/**************************************************************************** + **************************************************************************** + * * + * P1003.1b-1993 defines the constants below this comment. * + * * + **************************************************************************** + ****************************************************************************/ + +#define _POSIX_AIO_LISTIO_MAX 2 +#define _POSIX_AIO_MAX 1 +#define _POSIX_ARG_MAX 4096 +#define _POSIX_CHILD_MAX 6 +#define _POSIX_DELAYTIMER_MAX 32 +#define _POSIX_LINK_MAX 8 +#define _POSIX_MAX_CANON 255 +#define _POSIX_MAX_INPUT 255 +#define _POSIX_MQ_OPEN_MAX 8 +#define _POSIX_MQ_PRIO_MAX 32 +#define _POSIX_NAME_MAX 255 +#define _POSIX_NGROUPS_MAX 0 +#define _POSIX_OPEN_MAX 16 +#define _POSIX_PATH_MAX 255 +#define _POSIX_PIPE_BUF 512 +#define _POSIX_RTSIG_MAX 8 +#define _POSIX_SEM_NSEMS_MAX 256 +#define _POSIX_SEM_VALUE_MAX 32767 +#define _POSIX_SIGQUEUE_MAX 32 +#define _POSIX_SSIZE_MAX 32767 +#define _POSIX_STREAM_MAX 8 +#define _POSIX_TIMER_MAX 32 +#define _POSIX_TZNAME_MAX 3 + +/* + * Definitions of the following may be omitted if the value is >= stated + * minimum but is indeterminate. + */ + +#define AIO_LISTIO_MAX 2 +#define AIO_MAX 1 +#define AIO_PRIO_DELTA_MAX 0 +#define ARG_MAX 4096 +#define CHILD_MAX 6 +#define DELAYTIMER_MAX 32 +#define MQ_OPEN_MAX 8 +#define MQ_PRIO_MAX 32 +#define OPEN_MAX 16 +#define PAGESIZE 1 +#define RTSIG_MAX 8 +#define SEM_NSEMS_MAX 256 +#define SEM_VALUE_MAX 32767 +#define SIGQUEUE_MAX 32 +#define STREAM_MAX 8 +#define TIMER_MAX 32 +#define TZNAME_MAX 3 + +/* + * Pathname Variables + */ + +#define LINK_MAX 8 +#define MAX_CANON 255 +#define MAX_INPUT 255 +#define NAME_MAX 255 +#define PATH_MAX 255 +#define PIPE_BUF 512 + +/* + * Invariant values + */ + +#define SSIZE_MAX 32767 + +/* + * Maximum Values + */ + +#define _POSIX_CLOCKRES_MIN 0 /* in nanoseconds */ + +/**************************************************************************** + **************************************************************************** + * * + * P1003.1c/D10 defines the constants below this comment. * + * + * XXX: doc seems to have printing problems in this table :( + * * + **************************************************************************** + ****************************************************************************/ + +#define _POSIX_LOGIN_NAME_MAX 9 +#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 +#define _POSIX_THREAD_KEYS_MAX 28 +#define _POSIX_THREAD_THREADS_MAX 64 +#define _POSIX_TTY_NAME_MAX 9 + +/* + * Definitions of the following may be omitted if the value is >= stated + * minimum but is indeterminate. + * + * NOTE: LOGIN_NAME_MAX is named LOGNAME_MAX under Solaris 2.x. Perhaps + * the draft specification will be changing. jrs 05/24/96 + */ + +#define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX +#define TTY_NAME_MAX _POSIX_TTY_NAME_MAX +#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS + +/* + * RTEMS is smart enough to give us the minimum stack size if we ask + * for too little. Because the real RTEMS limit for this is cpu dependent + * AND rtems header files are not installed yet, we cannot use the cpu + * dependent constant CPU_STACK_MINIMUM_SIZE. Moreover, we do not want + * to duplicate that information here so we will just let RTEMS magically + * give us its minimum stack size. + * + * NOTE: The other alternative is to have this be a macro for a + * routine in RTEMS which returns the constant. + */ + +#define PTHREAD_STACK_MIN 0 + +/* + * The maximum number of keys (PTHREAD_KEYS_MAX) and threads + * (PTHREAD_THREADS_MAX) are configurable and may exceed the minimum. + * +#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX +#define PTHREAD_THREADS_MAX _POSIX_THREAD_THREADS_MAX +*/ + + +/**************************************************************************** + **************************************************************************** + * * + * P1003.4b/D8 defines the constants below this comment. * + * * + **************************************************************************** + ****************************************************************************/ + +#define _POSIX_INTERRUPT_OVERRUN_MAX 32 + +/* + * Definitions of the following may be omitted if the value is >= stated + * minimum but is indeterminate. + */ + +#define INTERRUPT_OVERRUN_MAX 32 + +/* + * Pathname Variables + */ + +#define MIN_ALLOC_SIZE +#define REC_MIN_XFER_SIZE +#define REC_MAX_XFER_SIZE +#define REC_INCR_XFER_SIZE +#define REC_XFER_ALIGN +#define MAX_ATOMIC_SIZE + +#endif +/* end of include file */ diff --git a/newlib/libc/sys/rtems/include/signal.h b/newlib/libc/sys/rtems/include/signal.h new file mode 100644 index 000000000..bb61b0c17 --- /dev/null +++ b/newlib/libc/sys/rtems/include/signal.h @@ -0,0 +1,142 @@ +/* + * $Id$ + */ + +#ifndef __POSIX_SIGNALS_h +#define __POSIX_SIGNALS_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "_ansi.h" + +#include +#include +#include /* only for reentrant signal() and raise() */ + +/* + * 7.7 Signal handling , ANSI C Standard. + */ + +typedef int sig_atomic_t; + +/* + * ANSI C Signal Handling Functions + */ + +typedef void (*_sig_func_ptr) (); + +_sig_func_ptr _EXFUN(_signal_r, (struct _reent *, int, _sig_func_ptr)); +int _EXFUN(_raise_r, (struct _reent *, int)); + +#ifndef _REENT_ONLY +_sig_func_ptr _EXFUN(signal, (int, _sig_func_ptr)); +int _EXFUN(raise, (int)); +#endif + +/* + * 3.3.2 Send a Signal to a Process, P1003.1b-1993, p. 68 + * + * NOTE: Behavior of kill() depends on _POSIX_SAVED_IDS. + */ + +int _EXFUN(kill, (pid_t pid, int sig)); + +/* + * 3.3.3 Manipulate Signal Sets, P1003.1b-1993, p. 69 + */ + +int _EXFUN(sigemptyset, (sigset_t *set)); +int _EXFUN(sigfillset, (sigset_t *set)); +int _EXFUN(sigaddset, (sigset_t *set, int signo)); +int _EXFUN(sigdelset, (sigset_t *set, int signo)); +int _EXFUN(sigismember, (const sigset_t *set, int signo)); + +/* + * 3.3.4 Examine and Change Signal Action, P1003.1b-1993, p. 70 + */ + +int _EXFUN(sigaction, + (int sig, const struct sigaction *act, struct sigaction *oact) +); + +/* + * 3.3.5 Examine and Change Blocked Signals, P1003.1b-1993, p. 73 + * + * NOTE: P1003.1c/D10, p. 37 adds pthread_sigmask(). + */ + +/* values for how */ + +#define SIG_BLOCK 1 /* resulting_set = (current_set | set) */ +#define SIG_UNBLOCK 2 /* resulting_set = (current_set & ~set) */ +#define SIG_SETMASK 3 /* resulting_set = set */ + +int _EXFUN(sigprocmask, (int how, const sigset_t *set, sigset_t *oset)); + +#if defined(_POSIX_THREADS) +int _EXFUN(pthread_sigmask, (int how, const sigset_t *set, sigset_t *oset)); +#endif + +/* + * 3.3.6 Examine Pending Signals, P1003.1b-1993, p. 75 + */ + +int _EXFUN(sigpending, (sigset_t *set)); + +/* + * 3.3.7 Wait for a Signal, P1003.1b-1993, p. 75 + */ + +int _EXFUN(sigsuspend, (const sigset_t *sigmask)); + +#if defined(_POSIX_REALTIME_SIGNALS) + +/* + * 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76 + * + * NOTE: P1003.1c/D10, p. 39 adds sigwait(). + */ + +int _EXFUN(sigwaitinfo, (const sigset_t *set, siginfo_t *info)); +int _EXFUN(sigtimedwait, + (const sigset_t *set, siginfo_t *info, const struct timespec *timeout) +); +int _EXFUN(sigwait, (const sigset_t *set, int *sig)); + +/* + * 3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78 + */ + +int _EXFUN(sigqueue, (pid_t pid, int signo, const union sigval value)); + +#endif + +/* + * 3.3.10 Send a Signal to a Thread, P1003.1c/D10, p. 43 + */ + +#if defined(_POSIX_THREADS) +int _EXFUN(pthread_kill, (pthread_t thread, int sig)); +#endif + +/* + * 3.4.1 Schedule Alarm, P1003.1b-1993, p. 79 + */ + +unsigned int _EXFUN(alarm, (unsigned int seconds)); + +/* + * 3.4.2 Suspend Process Execution, P1003.1b-1993, p. 80 + */ + +int _EXFUN(pause, (void)); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/newlib/libc/sys/rtems/include/time.h b/newlib/libc/sys/rtems/include/time.h new file mode 100644 index 000000000..647adc6d5 --- /dev/null +++ b/newlib/libc/sys/rtems/include/time.h @@ -0,0 +1,218 @@ +/* + * $Id$ + */ + + +#ifndef __POSIX_TIME_h +#define __POSIX_TIME_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "_ansi.h" +#include +#include +#include + +/* + * 4.8.1.5 Special Symbol {CLK_TCK}, P1003.1b-1993, p. 97 + */ + +#define CLK_TCK sysconf(_SC_CLK_TCK) + +/* + * Get size_t from the GNU C version of stddef.h + */ + +#define __need_size_t +#include + +/* + * ANSI C Time Conversion Structure + * + * XXX reference + */ + +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +}; + +/* + * ANSI C Time Conversion Routines + * + * XXX reference + */ + +clock_t _EXFUN(clock, (void)); +double _EXFUN(difftime, (time_t _time2, time_t _time1)); +time_t _EXFUN(mktime, (struct tm *_timeptr)); +time_t _EXFUN(time, (time_t *_timer)); +size_t _EXFUN(strftime, + (char *_s, size_t _maxsize, const char *_fmt, const struct tm *_t)); + +#ifndef _REENT_ONLY +char *_EXFUN(asctime, (const struct tm *_tblock)); +char *_EXFUN(ctime, (const time_t *_time)); +struct tm *_EXFUN(gmtime, (const time_t *_timer)); +struct tm *_EXFUN(localtime,(const time_t *_timer)); +#endif + +/* + * Added by 8.3.5 - 8.3.8, P1002.1c/D10, p. 66-69. + */ + +char *_EXFUN(asctime_r, (const struct tm *, char *)); +char *_EXFUN(ctime_r, (const time_t *, char *)); +struct tm *_EXFUN(gmtime_r, (const time_t *, struct tm *)); +struct tm *_EXFUN(localtime_r, (const time_t *, struct tm *)); + +/* + * 4.5.1 Get System Time, P1003.1b-1993, p. 91 + */ + +time_t _EXFUN(time, (time_t *tloc)); + +#if defined(_POSIX_TIMERS) + +/* + * 14.2.1 Clocks, P1003.1b-1993, p. 263 + */ + +int _EXFUN(clock_settime, (clockid_t clock_id, const struct timespec *tp)); +int _EXFUN(clock_gettime, (clockid_t clock_id, struct timespec *tp)); +int _EXFUN(clock_getres, (clockid_t clock_id, struct timespec *res)); + +/* + * 14.2.2 Create a Per-Process Timer, P1003.1b-1993, p. 264 + */ + +int _EXFUN(timer_create, + (clockid_t clock_id, struct sigevent *evp, timer_t *timerid) +); + +/* + * 14.2.3 Delete a Per_process Timer, P1003.1b-1993, p. 266 + */ + +int _EXFUN(timer_delete, (timer_t timerid)); + +/* + * 14.2.4 Per-Process Timers, P1003.1b-1993, p. 267 + */ + +int _EXFUN(timer_settime, + (timer_t timerid, + int flags, + const struct itimerspec *value, + struct itimerspec *ovalue) +); + +int _EXFUN(timer_gettime, (timer_t timerid, struct itimerspec *value)); +int _EXFUN(timer_getoverrun, (timer_t timerid)); + +/* + * 14.2.5 High Resolution Sleep, P1003.1b-1993, p. 269 + */ + +int _EXFUN(nanosleep, (const struct timespec *rqtp, struct timespec *rmtp)); + +#endif /* _POSIX_TIMERS */ + +/* + * 20.1.1 CPU-time Clock Attributes, P1003.4b/D8, p. 54 + */ + +/* values for the clock enable attribute */ + +#define CLOCK_ENABLED 1 /* clock is enabled, i.e. counting execution time */ +#define CLOCK_DISABLED 0 /* clock is disabled */ + +/* values for the pthread cputime_clock_allowed attribute */ + +#define CLOCK_ALLOWED 1 /* If a thread is created with this value a */ + /* CPU-time clock attached to that thread */ + /* shall be accessible. */ +#define CLOCK_DISALLOWED 0 /* If a thread is created with this value, the */ + /* thread shall not have a CPU-time clock */ + /* accessible. */ + +/* + * 14.1.3 Manifest Constants, P1003.1b-1993, p. 262 + */ + +#define CLOCK_REALTIME (clockid_t)1 + +/* + * Flag indicating time is "absolute" with respect to the clock + * associated with a time + */ + +#define TIMER_ABSTIME 4 + +/* + * 20.1.2 Manifest Constants, P1003.4b/D8, p. 55 + */ + +#if defined(_POSIX_CPUTIME) + +/* + * When used in a clock or timer function call, this is interpreted as + * the identifier of the CPU_time clock associated with the PROCESS + * making the function call. + */ + +#define CLOCK_PROCESS_CPUTIME (clockid_t)2 + +#endif + +#if defined(_POSIX_THREAD_CPUTIME) + +/* + * When used in a clock or timer function call, this is interpreted as + * the identifier of the CPU_time clock associated with the THREAD + * making the function call. + */ + +#define CLOCK_THREAD_CPUTIME (clockid_t)3 + +#endif + +#if defined(_POSIX_CPUTIME) + +/* + * 20.1.3 Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55 + */ + +int _EXFUN(clock_getcpuclockid, (pid_t pid, clockid_t *clock_id)); + +#endif /* _POSIX_CPUTIME */ + +#if defined(_POSIX_CPUTIME) || defined(_POSIX_THREAD_CPUTIME) + +/* + * 20.1.5 CPU-time Clock Attribute Access, P1003.4b/D8, p. 56 + */ + +int _EXFUN(clock_setenable_attr, (clockid_t clock_id, int attr)); + +int _EXFUN(clock_getenable_attr, (clockid_t clock_id, int *attr)); + +#endif /* _POSIX_CPUTIME or _POSIX_THREAD_CPUTIME */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ -- cgit v1.2.3