summaryrefslogtreecommitdiffstats
path: root/c/src/exec/posix/base
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--c/src/exec/posix/base/aio.h136
-rw-r--r--c/src/exec/posix/base/devctl.h29
-rw-r--r--c/src/exec/posix/base/intr.h70
-rw-r--r--c/src/exec/posix/base/limits.h152
-rw-r--r--c/src/exec/posix/base/mqueue.h144
-rw-r--r--c/src/exec/posix/base/pthread.h501
-rw-r--r--c/src/exec/posix/base/sched.h87
-rw-r--r--c/src/exec/posix/base/semaphore.h107
-rw-r--r--c/src/exec/posix/base/unistd.h84
9 files changed, 1310 insertions, 0 deletions
diff --git a/c/src/exec/posix/base/aio.h b/c/src/exec/posix/base/aio.h
new file mode 100644
index 0000000000..2fbb8ad925
--- /dev/null
+++ b/c/src/exec/posix/base/aio.h
@@ -0,0 +1,136 @@
+/* aio.h
+ *
+ */
+
+#ifndef __POSIX_ASYNCHRONOUS_IO_h
+#define __POSIX_ASYNCHRONOUS_IO_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_ASYNCHRONOUS_IO)
+
+/*
+ * 6.7.1 Data Definitions for Asynchronous Input and Output,
+ * P1003.1b-1993, p. 151
+ */
+
+#include <sys/types.h>
+#include <signal.h>
+#include <time.h>
+#include <fcntl.h>
+
+/*
+ * 6.7.1.2 Manifest Constants, P1003.1b-1993, p. 153
+ */
+
+#define AIO_CANCELED 0 /* all requested operations have been canceled */
+#define AIO_NOTCANCELED 0 /* some of the operations could not be canceled */
+ /* since they are in progress */
+#define AIO_ALLDONE 0 /* none of the requested operations could be */
+ /* canceled since they are already complete */
+
+/* lio_listio() options */
+
+#define LIO_WAIT 0 /* calling process is to suspend until the */
+ /* operation is complete */
+#define LIO_NOWAIT 0 /* calling process is to continue execution while */
+ /* the operation is performed and no notification */
+ /* shall be given when the operation is completed */
+#define LIO_READ 0 /* request a read() */
+#define LIO_WRITE 0 /* request a write() */
+#define LIO_NOP 0 /* no transfer is requested */
+
+/*
+ * 6.7.1.1 Asynchronous I/O Control Block, P1003.1b-1993, p. 151
+ */
+
+struct aiocb {
+ int aio_fildes; /* File descriptor */
+ off_t aio_offset; /* File offset */
+ volatile void *aio_buf; /* Location of buffer */
+ size_t aio_nbytes; /* Length of transfer */
+ int aio_reqprio; /* Request priority offset */
+ struct sigevent aio_sigevent; /* Signal number and value */
+ int aoi_lio_opcode; /* Operation to be performed */
+};
+
+/*
+ * 6.7.2 Asynchronous Read, P1003.1b-1993, p. 154
+ */
+
+int aio_read(
+ struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.3 Asynchronous Write, P1003.1b-1993, p. 155
+ */
+
+int aio_write(
+ struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.4 List Directed I/O, P1003.1b-1993, p. 158
+ */
+
+int lio_listio(
+ int mode,
+ struct aiocb * const list[],
+ int nent,
+ struct sigevent *sig
+);
+
+/*
+ * 6.7.5 Retrieve Error of Asynchronous I/O Operation, P1003.1b-1993, p. 161
+ */
+
+int aio_error(
+ const struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.6 Retrieve Return Status of Asynchronous I/O Operation,
+ * P1003.1b-1993, p. 162
+ */
+
+int aio_return(
+ const struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.7 Cancel Asynchronous I/O Operation, P1003.1b-1993, p. 163
+ */
+
+int aio_cancel(
+ int filedes,
+ struct aiocb *aiocbp
+);
+
+/*
+ * 6.7.7 Wait for Asynchronous I/O Request, P1003.1b-1993, p. 164
+ */
+
+int aio_suspend(
+ struct aiocb * const list[],
+ int nent,
+ const struct timespec *timeout
+);
+
+#if defined(_POSIX_SYNCHRONIZED_IO)
+
+/*
+ * 6.7.9 Asynchronous File Synchronization, P1003.1b-1993, p. 166
+ */
+
+int aio_fsync(
+ int op,
+ struct aiocb *aiocbp
+);
+
+#endif /* _POSIX_SYNCHRONIZED_IO */
+
+#endif /* _POSIX_ASYNCHRONOUS_IO */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/base/devctl.h b/c/src/exec/posix/base/devctl.h
new file mode 100644
index 0000000000..e3fd39128f
--- /dev/null
+++ b/c/src/exec/posix/base/devctl.h
@@ -0,0 +1,29 @@
+/* devctl.h
+ *
+ */
+
+#ifndef __POSIX_DEVICE_CONTROL_h
+#define __POSIX_DEVICE_CONTROL_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_DEVICE_CONTROL)
+
+#include <sys/types.h>
+#include <unistd.h>
+
+/*
+ * 21.2.1 Control a Device, P1003.4b/D8, p. 65
+ */
+
+int devctl(
+ int filedes,
+ void *dev_data_ptr,
+ size_t nbyte,
+ int *dev_info_ptr
+);
+
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/base/intr.h b/c/src/exec/posix/base/intr.h
new file mode 100644
index 0000000000..9394ab22a3
--- /dev/null
+++ b/c/src/exec/posix/base/intr.h
@@ -0,0 +1,70 @@
+/* intr.h
+ *
+ * XXX: It is unclear if the type "intr_t" should be defined when
+ * _POSIX_INTERRUPT_CONTROL is not.
+ */
+
+#ifndef __POSIX_INTERRUPTS_h
+#define __POSIX_INTERRUPTS_h
+
+#include <rtems/posix/features.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
+#if defined(_POSIX_INTERRUPT_CONTROL)
+
+/*
+ * 22.2 Concepts, P1003.4b/D8, p. 73
+ */
+
+typedef int intr_t;
+
+/*
+ * 22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
+ */
+
+/*
+ * Return codes from an interrupt handler
+ */
+
+#define INTR_HANDLED_NOTIFY 0 /* ISR handled this interrupt, notify */
+ /* the thread that registered the */
+ /* ISR that the interrupt occurred. */
+#define INTR_HANDLED_DO_NOT_NOTIFY 1 /* ISR handled this interrupt, but */
+ /* do NOT perform notification. */
+#define INTR_NOT_HANDLED 2 /* ISR did not handle this interrupt, */
+ /* let the next handler try. */
+
+int intr_capture(
+ intr_t intr,
+ int (*intr_handler)( void *area ),
+ volatile void *area,
+ size_t areasize
+);
+
+int intr_release(
+ intr_t intr,
+ int (*intr_handler)( void *area )
+);
+
+int intr_lock(
+ intr_t intr
+);
+
+int intr_unlock(
+ intr_t intr
+);
+
+/*
+ * 22.3.2 Await Interrupt Notification, P1003.4b/D8, p. 76
+ */
+
+int intr_timed_wait(
+ int flags,
+ const struct timespec *timeout
+);
+
+#endif
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/base/limits.h b/c/src/exec/posix/base/limits.h
new file mode 100644
index 0000000000..363b955d45
--- /dev/null
+++ b/c/src/exec/posix/base/limits.h
@@ -0,0 +1,152 @@
+/* limits.h
+ *
+ * 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.
+ */
+
+#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 14
+#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 14
+#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.
+ */
+
+#define LOGIN_NAME_MAX 9
+#define PTHREAD_DESTRUCTOR_ITERATIONS 4
+/*
+ * The maximum number of keys (PTHREAD_KEYS_MAX) and threads
+ * (PTHREAD_THREADS_MAX) are configurable and may exceed the minimum.
+ */
+
+#define TTY_NAME_MAX 9
+
+/****************************************************************************
+ ****************************************************************************
+ * *
+ * 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/c/src/exec/posix/base/mqueue.h b/c/src/exec/posix/base/mqueue.h
new file mode 100644
index 0000000000..f40381c5f5
--- /dev/null
+++ b/c/src/exec/posix/base/mqueue.h
@@ -0,0 +1,144 @@
+/* mqueue.h
+ *
+ */
+
+#ifndef __POSIX_MESSAGE_QUEUE_h
+#define __POSIX_MESSAGE_QUEUE_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_MESSAGE_PASSING)
+
+#include <sys/types.h>
+
+#include <rtems/system.h>
+#include <rtems/score/object.h>
+
+/*
+ * 15.1.1 Data Structures, P1003.1b-1993, p. 271
+ */
+
+typedef Objects_Id mqd_t;
+
+struct mq_attr {
+ long mq_flags; /* Message queue flags */
+ long mq_maxmsg; /* Maximum number of messages */
+ long mq_msgsize; /* Maximum message size */
+ long mq_curmsgs; /* Number of messages currently queued */
+};
+
+/*
+ * 15.2.2 Open a Message Queue, P1003.1b-1993, p. 272
+ */
+
+mqd_t mq_open(
+ const char *name,
+ int oflag,
+ ...
+);
+
+/*
+ * 15.2.2 Close a Message Queue, P1003.1b-1993, p. 275
+ */
+
+int mq_close(
+ mqd_t mqdes
+);
+
+/*
+ * 15.2.2 Remove a Message Queue, P1003.1b-1993, p. 276
+ */
+
+int mq_unlink(
+ const char *name
+);
+
+/*
+ * 15.2.4 Send a Message to a Message Queue, P1003.1b-1993, p. 277
+ *
+ * NOTE: P1003.4b/D8, p. 45 adds mq_timedsend().
+ */
+
+int mq_send(
+ mqd_t mqdes,
+ const char *msg_ptr,
+ size_t msg_len,
+ unsigned int msg_prio
+);
+
+#if defined(_POSIX_TIMEOUTS)
+
+#include <time.h>
+
+int mq_timedsend(
+ mqd_t mqdes,
+ const char *msg_ptr,
+ size_t msg_len,
+ unsigned int msg_prio,
+ const struct timespec *timeout
+);
+
+#endif /* _POSIX_TIMEOUTS */
+
+/*
+ * 15.2.5 Receive a Message From a Message Queue, P1003.1b-1993, p. 279
+ *
+ * NOTE: P1003.4b/D8, p. 45 adds mq_timedreceive().
+ */
+
+ssize_t mq_receive(
+ mqd_t mqdes,
+ char *msg_ptr,
+ size_t msg_len,
+ unsigned int *msg_prio
+);
+
+#if defined(_POSIX_TIMEOUTS)
+
+int mq_timedreceive( /* XXX: should this be ssize_t */
+ mqd_t mqdes,
+ char *msg_ptr,
+ size_t msg_len,
+ unsigned int *msg_prio,
+ const struct timespec *timeout
+);
+
+#endif /* _POSIX_TIMEOUTS */
+
+#if defined(_POSIX_REALTIME_SIGNALS)
+
+/*
+ * 15.2.6 Notify Process that a Message is Available on a Queue,
+ * P1003.1b-1993, p. 280
+ */
+
+int mq_notify(
+ mqd_t mqdes,
+ const struct sigevent *notification
+);
+
+#endif /* _POSIX_REALTIME_SIGNALS */
+
+/*
+ * 15.2.7 Set Message Queue Attributes, P1003.1b-1993, p. 281
+ */
+
+int mq_setattr(
+ mqd_t mqdes,
+ const struct mq_attr *mqstat,
+ struct mq_attr *omqstat
+);
+
+/*
+ * 15.2.8 Get Message Queue Attributes, P1003.1b-1993, p. 283
+ */
+
+int mq_getattr(
+ mqd_t mqdes,
+ struct mq_attr *mqstat
+);
+
+#endif /* _POSIX_MESSAGE_PASSING */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/base/pthread.h b/c/src/exec/posix/base/pthread.h
new file mode 100644
index 0000000000..16e42e73ca
--- /dev/null
+++ b/c/src/exec/posix/base/pthread.h
@@ -0,0 +1,501 @@
+/* pthread.h
+ *
+ */
+
+#ifndef __PTHREAD_h
+#define __PTHREAD_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_THREADS)
+
+#include <sys/types.h>
+#include <time.h>
+#include <sys/sched.h>
+
+/*
+ * 3.1.3 Register Fork Handlers, P1003.1c/Draft 10, P1003.1c/Draft 10, p. 27
+ */
+
+int pthread_atfork(
+ void (*prepare)(void),
+ void (*parent)(void),
+ void (*child)(void)
+);
+
+/*
+ * 11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
+ */
+
+int pthread_mutexattr_init(
+ pthread_mutexattr_t *attr
+);
+
+int pthread_mutexattr_destroy(
+ pthread_mutexattr_t *attr
+);
+
+int pthread_mutexattr_getpshared(
+ const pthread_mutexattr_t *attr,
+ int *pshared
+);
+
+int pthread_mutexattr_setpshared(
+ pthread_mutexattr_t *attr,
+ int pshared
+);
+
+/*
+ * 11.3.2 Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87
+ */
+
+int pthread_mutex_init(
+ pthread_mutex_t *mutex,
+ const pthread_mutexattr_t *attr
+);
+
+int pthread_mutex_destroy(
+ pthread_mutex_t *mutex
+);
+
+/*
+ * This is used to statically initialize a pthread_mutex_t. Example:
+ *
+ * pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+ */
+
+#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) 0xFFFFFFFF)
+
+/*
+ * 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
+ *
+ * NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
+ */
+
+int pthread_mutex_lock(
+ pthread_mutex_t *mutex
+);
+
+int pthread_mutex_trylock(
+ pthread_mutex_t *mutex
+);
+
+int pthread_mutex_unlock(
+ pthread_mutex_t *mutex
+);
+
+#if defined(_POSIX_TIMEOUTS)
+
+int pthread_mutex_timedlock(
+ pthread_mutex_t *mutex,
+ const struct timespec *timeout
+);
+
+#endif /* _POSIX_TIMEOUTS */
+
+/*
+ * 11.4.1 Condition Variable Initialization Attributes,
+ * P1003.1c/Draft 10, p. 96
+ */
+
+int pthread_condattr_init(
+ pthread_condattr_t *attr
+);
+
+int pthread_condattr_destroy(
+ pthread_condattr_t *attr
+);
+
+int pthread_condattr_getpshared(
+ const pthread_condattr_t *attr,
+ int *pshared
+);
+
+int pthread_condattr_setpshared(
+ pthread_condattr_t *attr,
+ int pshared
+);
+
+/*
+ * 11.4.2 Initializing and Destroying a Condition Variable,
+ * P1003.1c/Draft 10, p. 87
+ */
+
+int pthread_cond_init(
+ pthread_cond_t *cond,
+ const pthread_condattr_t *attr
+);
+
+int pthread_cond_destroy(
+ pthread_cond_t *mutex
+);
+
+/*
+ * This is used to statically initialize a pthread_cond_t. Example:
+ *
+ * pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+ */
+
+#define PTHREAD_COND_INITIALIZER ((pthread_mutex_t) 0xFFFFFFFF)
+
+/*
+ * 11.4.3 Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101
+ */
+
+int pthread_cond_signal(
+ pthread_cond_t *cond
+);
+
+int pthread_cond_broadcast(
+ pthread_cond_t *cond
+);
+
+/*
+ * 11.4.4 Waiting on a Condition, P1003.1c/Draft 10, p. 105
+ */
+
+int pthread_cond_wait(
+ pthread_cond_t *cond,
+ pthread_mutex_t *mutex
+);
+
+int pthread_cond_timedwait(
+ pthread_cond_t *cond,
+ pthread_mutex_t *mutex,
+ const struct timespec *abstime
+);
+
+#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
+
+/*
+ * 13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
+ */
+
+int pthread_attr_setscope(
+ pthread_attr_t *attr,
+ int contentionscope
+);
+
+int pthread_attr_getscope(
+ const pthread_attr_t *attr,
+ int *contentionscope
+);
+
+#define PTHREAD_INHERIT_SCHED 0 /* scheduling policy and associated */
+ /* attributes are inherited from */
+ /* the calling thread. */
+#define PTHREAD_EXPLICIT_SCHED 0 /* set from provided attribute object */
+
+int pthread_attr_setinheritsched(
+ pthread_attr_t *attr,
+ int inheritsched
+);
+
+int pthread_attr_getinheritsched(
+ const pthread_attr_t *attr,
+ int *inheritsched
+);
+
+int pthread_attr_setschedpolicy(
+ pthread_attr_t *attr,
+ int policy
+);
+
+int pthread_attr_getschedpolicy(
+ const pthread_attr_t *attr,
+ int *policy
+);
+
+#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
+
+int pthread_attr_setschedparam(
+ pthread_attr_t *attr,
+ const struct sched_param param
+);
+
+int pthread_attr_getschedparam(
+ const pthread_attr_t *attr,
+ struct sched_param *param
+);
+
+#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
+
+/*
+ * 13.5.2 Dynamic Thread Scheduling Parameters Access,
+ * P1003.1c/Draft 10, p. 124
+ */
+
+int pthread_getschedparam(
+ pthread_t thread,
+ int *policy,
+ struct sched_param *param
+);
+
+int pthread_setschedparam(
+ pthread_t thread,
+ int policy,
+ struct sched_param *param
+);
+
+#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
+
+#if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT)
+
+/*
+ * 13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
+ */
+
+/*
+ * Values for protocol.
+ */
+
+#define PTHREAD_PRIO_NONE 0
+#define PTHREAD_PRIO_INHERIT 1
+#define PTHREAD_PRIO_PROTECT 2
+
+int pthread_mutexattr_setprotocol(
+ pthread_mutexattr_t *attr,
+ int protocol
+);
+
+int pthread_mutexattr_getprotocol(
+ const pthread_mutexattr_t *attr,
+ int *protocol
+);
+
+int pthread_mutexattr_setprioceiling(
+ pthread_mutexattr_t *attr,
+ int prioceiling
+);
+
+int pthread_mutexattr_getprioceiling(
+ const pthread_mutexattr_t *attr,
+ int *prioceiling
+);
+
+#endif /* _POSIX_THREAD_PRIO_INHERIT || _POSIX_THREAD_PRIO_PROTECT */
+
+#if defined(_POSIX_THREAD_PRIO_PROTECT)
+
+/*
+ * 13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
+ */
+
+int pthread_mutex_setprioceiling(
+ pthread_mutex_t *mutex,
+ int prioceiling,
+ int *old_ceiling
+);
+
+int pthread_mutex_getprioceiling(
+ pthread_mutex_t *mutex,
+ int *prioceiling
+);
+
+#endif /* _POSIX_THREAD_PRIO_PROTECT */
+
+/*
+ * 16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
+ */
+
+int pthread_attr_init(
+ pthread_attr_t *attr
+);
+
+int pthread_attr_destroy(
+ pthread_attr_t *attr
+);
+
+int pthread_attr_getstacksize(
+ const pthread_attr_t *attr,
+ size_t *stacksize
+);
+
+int pthread_attr_setstacksize(
+ pthread_attr_t *attr,
+ size_t stacksize
+);
+
+int pthread_attr_getstackaddr(
+ const pthread_attr_t *attr,
+ void **stackaddr
+);
+
+int pthread_attr_setstackaddr(
+ pthread_attr_t *attr,
+ void *stackaddr
+);
+
+int pthread_attr_getdetachstate(
+ const pthread_attr_t *attr,
+ int *detachstate
+);
+
+int pthread_attr_setdetachstate(
+ pthread_attr_t *attr,
+ int detachstate
+);
+
+/*
+ * 16.1.2 Thread Creation, P1003.1c/Draft 10, p. 144
+ */
+
+int pthread_create(
+ pthread_t *thread,
+ const pthread_attr_t *attr,
+ void (*start_routine)( void * ),
+ void *arg
+);
+
+/*
+ * 16.1.3 Wait for Thread Termination, P1003.1c/Draft 10, p. 147
+ */
+
+int pthread_join(
+ pthread_t thread,
+ void **value_ptr
+);
+
+/*
+ * 16.1.4 Detaching a Thread, P1003.1c/Draft 10, p. 149
+ */
+
+int pthread_detach(
+ pthread_t thread
+);
+
+/*
+ * 16.1.6 Get Calling Thread's ID, p1003.1c/Draft 10, p. XXX
+ */
+
+pthread_t pthread_self( void );
+
+/*
+ * 16.1.7 Compare Thread IDs, p1003.1c/Draft 10, p. 153
+ */
+
+int pthread_equal(
+ pthread_t t1,
+ pthread_t t2
+);
+
+/*
+ * 16.1.8 Dynamic Package Initialization
+ */
+
+/*
+ * This is used to statically initialize a pthread_once_t. Example:
+ *
+ * pthread_once_t once = PTHREAD_ONCE_INITIALIZER;
+ */
+
+#define PTHREAD_ONCE_INITIALIZER { TRUE, FALSE }
+
+int pthread_once(
+ pthread_once_t *once_control,
+ void (*init_routine)(void)
+);
+
+/*
+ * 17.1.1 Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163
+ */
+
+int pthread_key_create(
+ pthread_key_t *key,
+ void (*destructor)( void * )
+);
+
+/*
+ * 17.1.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
+ */
+
+int pthread_setspecific(
+ pthread_key_t key,
+ const void *value
+);
+
+void *pthread_getspecific(
+ pthread_key_t key
+);
+
+/*
+ * 17.1.3 Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167
+ */
+
+int pthread_key_delete(
+ pthread_key_t key
+);
+
+/*
+ * 18.2.1 Canceling Execution of a Thread, P1003.1c/Draft 10, p. 181
+ */
+
+#define PTHREAD_CANCEL_ENABLE 0
+#define PTHREAD_CANCEL_DISABLE 1
+
+#define PTHREAD_CANCEL_DEFERRED 0
+#define PTHREAD_CANCEL_ASYNCHRONOUS 1
+
+int pthread_cancel(
+ pthread_t thread
+);
+
+/*
+ * 18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
+ */
+
+int pthread_setcancelstate(
+ int state,
+ int *oldstate
+);
+
+int pthread_setcanceltype(
+ int type,
+ int *oldtype
+);
+
+void pthread_testcancel( void );
+
+/*
+ * 18.2.3.1 Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184
+ */
+
+void pthread_cleanup_push(
+ void (*routine)( void * ),
+ void *arg
+);
+
+void pthread_cleanup_pop(
+ int execute
+);
+
+#if defined(_POSIX_THREAD_CPUTIME)
+
+/*
+ * 20.1.6 Accessing a Thread CPU-time Clock, P1003.4b/D8, p. 58
+ */
+
+int pthread_getcpuclockid(
+ pthread_t pid,
+ clockid_t *clock_id
+);
+
+/*
+ * 20.1.7 CPU-time Clock Thread Creation Attribute, P1003.4b/D8, p. 59
+ */
+
+int pthread_attr_setcputime(
+ pthread_attr_t *attr,
+ int clock_allowed
+);
+
+int pthread_attr_getcputime(
+ pthread_attr_t *attr,
+ int *clock_allowed
+);
+
+#endif /* defined(_POSIX_THREAD_CPUTIME) */
+
+#endif /* defined(_POSIX_THREADS) */
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/base/sched.h b/c/src/exec/posix/base/sched.h
new file mode 100644
index 0000000000..415663db6c
--- /dev/null
+++ b/c/src/exec/posix/base/sched.h
@@ -0,0 +1,87 @@
+/* sched.h
+ *
+ */
+
+
+#ifndef __POSIX_SCHEDULING_h
+#define __POSIX_SCHEDULING_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_PRIORITY_SCHEDULING)
+
+#include <sys/types.h>
+#include <time.h>
+#include <sys/sched.h>
+#include <pthread.h>
+
+/*
+ * 13.3.1 Set Scheduling Parameters, P1003.1b-1993, p. 252
+ *
+ */
+
+int sched_setparam(
+ pid_t pid,
+ const struct sched_param *param
+);
+
+/*
+ * 13.3.2 Set Scheduling Parameters, P1003.1b-1993, p. 253
+ */
+
+int sched_getparam(
+ pid_t pid,
+ const struct sched_param *param
+);
+
+/*
+ * 13.3.3 Set Scheduling Policy and Scheduling Parameters,
+ * P1003.1b-1993, p. 254
+ */
+
+int sched_setscheduler(
+ pid_t pid,
+ int policy,
+ const struct sched_param *param
+);
+
+/*
+ * 13.3.4 Get Scheduling Policy, P1003.1b-1993, p. 256
+ */
+
+int sched_getscheduler(
+ pid_t pid
+);
+
+/*
+ * 13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
+ */
+
+int sched_get_priority_max(
+ int policy
+);
+
+int sched_get_priority_min(
+ int policy
+);
+
+int sched_rr_get_interval(
+ pid_t pid,
+ struct timespec *interval
+);
+
+#endif /* _POSIX_PRIORITY_SCHEDULING */
+
+#if defined(_POSIX_THREADS) || defined(_POSIX_PRIORITY_SCHEDULING)
+
+/*
+ * 13.3.5 Yield Processor, P1003.1b-1993, p. 257
+ */
+
+int sched_yield( void );
+
+#endif /* _POSIX_THREADS or _POSIX_PRIORITY_SCHEDULING */
+
+#endif
+/* end of include file */
+
diff --git a/c/src/exec/posix/base/semaphore.h b/c/src/exec/posix/base/semaphore.h
new file mode 100644
index 0000000000..fed03f7da3
--- /dev/null
+++ b/c/src/exec/posix/base/semaphore.h
@@ -0,0 +1,107 @@
+/* semaphore.h
+ *
+ */
+
+#ifndef __POSIX_SEMAPHORE_h
+#define __POSIX_SEMAPHORE_h
+
+#include <rtems/posix/features.h>
+
+#if defined(_POSIX_SEMAPHORES)
+
+#include <sys/time.h>
+
+/*
+ * 11.1 Semaphore Characteristics, P1003.1b-1993, p.219
+ */
+
+typedef int sem_t;
+
+/*
+ * 11.2.1 Initialize an Unnamed Semaphore, P1003.1b-1993, p.219
+ */
+
+int sem_init(
+ sem_t *sem,
+ int pshared,
+ unsigned int value
+);
+
+/*
+ * 11.2.2 Destroy an Unnamed Semaphore, P1003.1b-1993, p.220
+ */
+
+int sem_destroy(
+ sem_t *sem
+);
+
+/*
+ * 11.2.3 Initialize/Open a Named Semaphore, P1003.1b-1993, p.221
+ *
+ * NOTE: Follows open() calling conventions.
+ */
+
+sem_t *sem_open(
+ const char *name,
+ int oflag,
+ ...
+);
+
+/*
+ * 11.2.4 Close a Named Semaphore, P1003.1b-1993, p.224
+ */
+
+int sem_close(
+ sem_t *sem
+);
+
+/*
+ * 11.2.5 Remove a Named Semaphore, P1003.1b-1993, p.225
+ */
+
+int sem_unlink(
+ const char *name
+);
+
+/*
+ * 11.2.6 Lock a Semaphore, P1003.1b-1993, p.226
+ *
+ * NOTE: P1003.4b/D8 adds sem_timedwait(), p. 27
+ */
+
+int sem_wait(
+ sem_t *sem
+);
+
+int sem_trywait(
+ sem_t *sem
+);
+
+#if defined(_POSIX_TIMEOUTS)
+int sem_timedwait(
+ sem_t *sem,
+ const struct timespec *timeout
+);
+#endif
+
+/*
+ * 11.2.7 Unlock a Semaphore, P1003.1b-1993, p.227
+ */
+
+int sem_post(
+ sem_t *sem
+);
+
+/*
+ * 11.2.8 Get the Value of a Semaphore, P1003.1b-1993, p.229
+ */
+
+int sem_getvalue(
+ sem_t *sem,
+ int *sval
+);
+
+#endif /* _POSIX_SEMAPHORES */
+
+#endif
+/* end of include file */
diff --git a/c/src/exec/posix/base/unistd.h b/c/src/exec/posix/base/unistd.h
new file mode 100644
index 0000000000..b81a8061fa
--- /dev/null
+++ b/c/src/exec/posix/base/unistd.h
@@ -0,0 +1,84 @@
+/* unistd.h
+ *
+ */
+
+#ifndef __POSIX_UNISTD_h
+#define __POSIX_UNISTD_h
+
+#include <rtems/posix/features.h>
+
+/*
+ * 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 96
+ *
+ * NOTE: Table 4-2, Configurable System Variables, p. 96
+ */
+
+#define _SC_AIO_LISTIO_MAX 0
+#define _SC_AIO_MAX 1
+#define _SC_AIO_PRIO_DELTA_MAX 2
+#define _SC_ARG_MAX 3
+#define _SC_CHILD_MAX 4
+#define _SC_CLK_TCK 5
+#define _SC_DELAYTIMER_MAX 6
+#define _SC_MQ_OPEN_MAX 7
+#define _SC_MQ_PRIO_MAX 8
+#define _SC_NGROUPS_MAX 9
+#define _SC_OPEN_MAX 10
+#define _SC_PAGESIZE 11
+#define _SC_RTSIG_MAX 12
+#define _SC_SEM_NSEMS_MAX 13
+#define _SC_SEM_VALUE_MAX 14
+#define _SC_SIGQUEUE_MAX 15
+#define _SC_STREAM_MAX 16
+#define _SC_TIMER_MAX 17
+#define _SC_TZNAME_MAX 18
+
+#define _SC_ASYNCHRONOUS_IO 19
+#define _SC_FSYNC 20
+#define _SC_JOB_CONTROL 21
+#define _SC_MAPPED_FILES 22
+#define _SC_MEMLOCK 23
+#define _SC_MEMLOCK_RANGE 24
+#define _SC_MEMORY_PROTECTION 25
+#define _SC_MESSAGE_PASSING 26
+#define _SC_PRIORITIZED_IO 27
+#define _SC_REALTIME_SIGNALS 28
+#define _SC_SAVED_IDS 29
+#define _SC_SEMAPHORES 30
+#define _SC_SHARED_MEMORY_OBJECTS 31
+#define _SC_SYNCHRONIZED_IO 32
+#define _SC_TIMERS 33
+#define _SC_VERSION 34
+
+/*
+ * P1003.1c/D10, p. 52 adds the following.
+ */
+
+#define _SC_GETGR_R_SIZE_MAX 35
+#define _SC_GETPW_R_SIZE_MAX
+#define _SC_LOGIN_NAME_MAX
+#define _SC_THREAD_DESTRUCTOR_ITERATIONS
+#define _SC_THREAD_KEYS_MAX
+#define _SC_THREAD_STACK_MIN
+#define _SC_THREAD_THREADS_MAX
+#define _SC_TTY_NAME_MAX
+
+#define _SC_THREADS
+#define _SC_THREAD_ATTR_STACKADDR
+#define _SC_THREAD_ATTR_STACKSIZE
+#define _SC_THREAD_PRIORITY_SCHEDULING
+#define _SC_THREAD_PRIO_INHERIT
+#define _SC_THREAD_PRIO_CEILING
+#define _SC_THREAD_PROCESS_SHARED
+#define _SC_THREAD_SAGE_FUNCTIONS
+
+/*
+ * 4.8.1 Get Configurable System Variables, P1003.1b-1993, p. 95
+ */
+
+long sysconf(
+ int name
+);
+
+#endif
+/* end of include */