summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwh1 <jwh1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-07-10 18:58:05 +0000
committerjwh1 <jwh1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-07-10 18:58:05 +0000
commit2e53fa8ec5e5af890f6982b0910bd1397762e59c (patch)
treebeee8abc96cb01476a0c5a71d303d4e6c6bb6881
parent2bf2f9afec91a8139c0cc82509a2287eb1fdc07c (diff)
downloadATCD-2e53fa8ec5e5af890f6982b0910bd1397762e59c.tar.gz
Mon Jul 10 13:47:25 2000 John Heitmann <jwh1@cs.wustl.edu>
-rw-r--r--PACE/pace/emulation/mqueue.c452
-rw-r--r--PACE/pace/emulation/mqueue.h48
-rw-r--r--PACE/pace/emulation/time.c57
-rw-r--r--PACE/pace/emulation/time.h33
-rw-r--r--PACE/pace/mqueue.h4
-rw-r--r--PACE/pace/posix/mqueue.h19
-rw-r--r--PACE/pace/posix/pthread.inl84
-rw-r--r--PACE/pace/posix/stdio.h387
-rw-r--r--PACE/pace/posix/stdio.inl7
-rw-r--r--PACE/pace/posix/stdlib.h138
-rw-r--r--PACE/pace/posix/string.h121
-rw-r--r--PACE/pace/posix/string.inl37
-rw-r--r--PACE/pace/posix/time.h11
-rw-r--r--PACE/pace/posix/time.inl86
-rw-r--r--PACE/pace/posix/unistd.inl7
-rw-r--r--PACE/pace/stddef.h2
-rw-r--r--PACE/pace/stdio.h411
-rw-r--r--PACE/pace/stdlib.h147
-rw-r--r--PACE/pace/string.h165
-rw-r--r--PACE/pace/unistd.h80
20 files changed, 1564 insertions, 732 deletions
diff --git a/PACE/pace/emulation/mqueue.c b/PACE/pace/emulation/mqueue.c
new file mode 100644
index 00000000000..c1c7440a5fc
--- /dev/null
+++ b/PACE/pace/emulation/mqueue.c
@@ -0,0 +1,452 @@
+/* $Id$ */
+#include "pace/sys/mman.h"
+#include "pace/stdio.h"
+#include "pace/fcntl.h"
+#include "pace/string.h"
+#include "pace/stdlib.h"
+#include "pace/sys/types.h"
+#include "pace/pthread.h"
+#include "pace/emulation/mqueue.h"
+
+typedef struct mqd* pace_mqd_t;
+
+typedef struct
+{
+ pace_mq_attr attr;
+ pace_size_t num_open;
+ pace_pthread_mutex_t mutex;
+ pace_size_t head;
+ pace_size_t freelist;
+} mqfile;
+
+typedef struct
+{
+ pace_size_t next; /* Index of next element */
+ unsigned int priority;
+ pace_size_t length;
+} message_header;
+
+struct mq_attr attrdefault = { 0, 32, 256, 0 };
+
+pace_mqd_t mq_open (const char* name, int oflag, pace_mode_t mode, pace_mq_attr* attr)
+{
+ int m_padding = sizeof (message_header); /* How much extra space per message do we need */
+ int f_padding = sizeof (mqfile); /* How much fixed padding is needed */
+ int mflags, mprot;
+ int fd;
+ pace_size_t i;
+ pace_size_t mapsize;
+ char* mmaploc;
+ int create_mmap = 0; /* 1 if the file has never be inited */
+ pace_pthread_mutexattr_t mattr;
+ message_header* temp = 0; /*Used in initializaiton of mqueue*/
+ long index; /* index into the file */
+ pace_mqd_t result = pace_malloc (sizeof (struct mqd));
+
+ if (attr == 0)
+ {
+ attr = &attrdefault;
+ }
+
+ /* Fix alignment */
+ if (attr->mq_msgsize % sizeof (long) != 0)
+ {
+ attr->mq_msgsize += 8 - (attr->mq_msgsize % sizeof (long));
+ }
+ if (oflag & PACE_O_CREAT)
+ {
+ /* We need to protect access without the help of O_RDONLY in the fs */
+ fd = pace_open ((name, PACE_O_RDWR | PACE_O_CREAT | PACE_O_EXCL, mode));
+
+ if (fd == -1 && errno != EEXIST)
+ {
+ /* An error other than EEXIST has occurred. */
+ return (pace_mqd_t)-1;
+ }
+ else if (fd != -1)
+ {
+ /* If a new file was created successfully */
+ create_mmap = 1;
+ }
+ else if (oflag & PACE_O_EXCL)
+ {
+ /* If the file exists and we don't want it */
+ errno = EEXIST;
+ return (pace_mqd_t)-1;
+ }
+ else
+ {
+ /* We want the existing file */
+ fd = pace_open ((name, PACE_O_RDWR));
+ }
+ }
+ else
+ {
+ fd = pace_open ((name, PACE_O_RDWR));
+ if (fd == -1)
+ {
+ errno = ENOENT;
+ return (pace_mqd_t)-1;
+ }
+ }
+
+ mapsize = f_padding + (attr->mq_msgsize + m_padding) * (attr->mq_maxmsg);
+ mprot = PACE_PROT_READ | PACE_PROT_WRITE;
+ mflags = PACE_MAP_SHARED;
+
+ if (create_mmap)
+ {
+ /* Create and 0 out the file */
+ if (pace_lseek (fd, mapsize, PACE_SEEK_SET) == -1)
+ {
+ return (pace_mqd_t)-1;
+ }
+ if (pace_write (fd, "", 1) != 1)
+ {
+ return (pace_mqd_t)-1;
+ }
+
+ mmaploc = mmap (0, mapsize, mprot, mflags, fd, 0);
+ if ((int)mmaploc == -1)
+ {
+ return (pace_mqd_t)-1;
+ }
+ pace_memset (mmaploc, 0, mapsize);
+
+ if (pace_pthread_mutexattr_init (&mattr) == -1)
+ {
+ return (pace_mqd_t)-1;
+ }
+ if (pace_pthread_mutex_init (&(((mqfile*)mmaploc)->mutex), &mattr) == -1)
+ {
+ return (pace_mqd_t)-1;
+ }
+ if (pace_pthread_mutex_lock (&(((mqfile*)mmaploc)->mutex)) == -1)
+ {
+ return (pace_mqd_t)-1;
+ }
+
+ index = sizeof (mqfile);
+ ((mqfile*)mmaploc)->freelist = index;
+ ((mqfile*)mmaploc)->head = 0;
+
+ for (i = 0; i < attr->mq_maxmsg; ++i)
+ {
+ temp = (message_header *) &mmaploc[index];
+ index += sizeof (message_header) + attr->mq_msgsize;
+ temp->next = index;
+ }
+ temp->next = 0;
+ attr->mq_curmsgs = 0;
+ ((mqfile*)mmaploc)->attr = *attr;
+ }
+ else
+ {
+ /* Just open the existing map */
+ mmaploc = mmap (0, mapsize, mprot, mflags, fd, 0);
+ if ((int)mmaploc == -1)
+ {
+ return (pace_mqd_t)-1;
+ }
+
+ /* ???? Test here for race */
+
+ if (pace_pthread_mutex_lock (&(((mqfile*)mmaploc)->mutex)) == -1)
+ {
+ return (pace_mqd_t)-1;
+ }
+ ((mqfile*)mmaploc)->attr.mq_flags = attr->mq_flags;
+ }
+
+ ((mqfile*)mmaploc)->num_open++;
+
+
+ if (pace_pthread_mutex_unlock (&(((mqfile*)mmaploc)->mutex)) == -1)
+ {
+ return (pace_mqd_t)-1;
+ }
+
+ result->fd = fd;
+ result->mptr = mmaploc;
+ result->length = mapsize;
+ result->oflag = oflag;
+
+ return result;
+}
+
+int mq_close (pace_mqd_t mqdes)
+{
+ if (pace_pthread_mutex_lock (&( ((mqfile*)mqdes->mptr)->mutex)) == -1)
+ {
+ errno = EBADF;
+ return -1;
+ }
+ ((mqfile*)mqdes->mptr)->num_open--;
+ if (pace_pthread_mutex_unlock (&(((mqfile*)mqdes->mptr)->mutex)) == -1)
+ {
+ errno = EBADF;
+ return -1;
+ }
+ if (munmap (mqdes->mptr, mqdes->length) == -1)
+ {
+ return -1;
+ }
+ free (mqdes);
+ return 0;
+}
+
+int mq_unlink (const char* name)
+{
+ return pace_unlink (name);
+}
+
+int mq_send (pace_mqd_t mqdes, const char* ptr, pace_size_t length, unsigned int priority)
+{
+ mqfile* queue = ((mqfile*)mqdes->mptr);
+ long index, old_index;
+ if (mqdes->oflag & O_RDONLY)
+ {
+ /* Incorrect access priviledges */
+ errno = EBADF;
+ return -1;
+ }
+ if (queue->attr.mq_msgsize < length)
+ {
+ /* Message too long */
+ errno = EMSGSIZE;
+ return -1;
+ }
+
+ /* If the queue is full... */
+ if (queue->attr.mq_curmsgs >= queue->attr.mq_maxmsg)
+ {
+ if (queue->attr.mq_flags & O_NONBLOCK)
+ {
+ errno = EAGAIN;
+ return -1;
+ }
+ else
+ {
+ /* ???? */
+ }
+ }
+ else
+ {
+ if (pace_pthread_mutex_lock (&queue->mutex) == -1)
+ {
+ return -1;
+ }
+
+ queue->attr.mq_curmsgs++;
+ /* Fill in the fields of the header */
+ ((message_header*)(&mqdes->mptr[queue->freelist]))->priority = priority;
+ ((message_header*)(&mqdes->mptr[queue->freelist]))->length = length;
+ pace_memcpy (((void*)(&mqdes->mptr[queue->freelist + sizeof (message_header)])),
+ ptr, length);
+
+ /* Update the linked list */
+ old_index = 0;
+ index = queue->head;
+ while (index != 0 && ((message_header*)(&mqdes->mptr[index]))->priority >= priority)
+ {
+ old_index = index;
+ index = ((message_header*)(&mqdes->mptr[index]))->next;
+ }
+
+ /* If the msg goes at the head */
+ if (old_index == 0)
+ {
+ queue->head = queue->freelist;
+ queue->freelist = ((message_header*)(&mqdes->mptr[queue->freelist]))->next;
+ ((message_header*)(&mqdes->mptr[queue->head]))->next = index;
+ }
+ else
+ {
+ ((message_header*)(&mqdes->mptr[old_index]))->next = queue->freelist;
+ old_index = queue->freelist;
+ queue->freelist = ((message_header*)(&mqdes->mptr[queue->freelist]))->next;
+ ((message_header*)(&mqdes->mptr[old_index]))->next = index;
+ }
+ if (pace_pthread_mutex_unlock (&queue->mutex) == -1)
+ {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+pace_ssize_t mq_receive (pace_mqd_t mqdes,
+ char * msg_ptr,
+ pace_size_t msg_len,
+ unsigned int * nmsg_prio)
+{
+ mqfile* queue = ((mqfile*)mqdes->mptr);
+ pace_size_t temp;
+
+ if (queue->attr.mq_msgsize > msg_len)
+ {
+ errno = EMSGSIZE;
+ return -1;
+ }
+ if (queue->attr.mq_curmsgs == 0)
+ {
+ if (queue->attr.mq_flags & O_NONBLOCK)
+ {
+ errno = EAGAIN;
+ return -1;
+ }
+ else
+ {
+ errno = ENOTSUP;
+ return -1;
+ /*???? wait on cond var */
+ }
+ }
+
+ if (pace_pthread_mutex_lock (&queue->mutex) == -1)
+ {
+ errno = EBADMSG;
+ return -1;
+ }
+
+ queue->attr.mq_curmsgs--;
+ if (nmsg_prio != 0)
+ {
+ *nmsg_prio = ((message_header*)(&mqdes->mptr[queue->head]))->priority;
+ }
+
+ pace_memcpy (msg_ptr, ((void*)(&mqdes->mptr[queue->head + sizeof (message_header)])),
+ ((message_header*)(&mqdes->mptr[queue->head]))->length);
+ temp = queue->head;
+ queue->head = ((message_header*)(&mqdes->mptr[queue->head]))->next;
+ ((message_header*)(&mqdes->mptr[temp]))->next = queue->freelist;
+ queue->freelist = temp;
+
+ if (pace_pthread_mutex_unlock (&queue->mutex) == -1)
+ {
+ errno = EBADMSG;
+ return -1;
+ }
+ return ((message_header*)(&mqdes->mptr[queue->head]))->length;
+}
+
+int mq_getattr (pace_mqd_t mqdes, pace_mq_attr * mqstat)
+{
+ *mqstat = ((mqfile*)mqdes->mptr)->attr;
+ return 0;
+}
+
+int mq_setattr(pace_mqd_t mqdes, const pace_mq_attr * mqstat, pace_mq_attr * omqstat)
+{
+ if (omqstat != 0)
+ {
+ *omqstat = ((mqfile*)mqdes->mptr)->attr;
+ }
+ if (mqstat == 0 || mqdes == 0)
+ {
+ /* You eediot*/
+ errno = EFAULT;
+ return -1;
+ }
+
+ ((mqfile*)mqdes->mptr)->attr.mq_flags = mqstat->mq_flags;
+
+ return 0;
+}
+
+int mq_notify (pace_mqd_t mqd, const pace_sigevent* notification)
+{
+ errno = ENOSYS;
+ PACE_UNUSED_ARG (mqd);
+ PACE_UNUSED_ARG (notification);
+ return -1;
+}
+
+void print_queue (pace_mqd_t mqd)
+{
+
+ mqfile* queue = ((mqfile*)(mqd->mptr));
+ pace_size_t i, index;
+ i=0;
+ index = queue->freelist;
+ while (index != 0)
+ {
+ i++;
+ index = ((message_header*)(&mqd->mptr[index]))->next;
+ }
+ printf ("There are %i total blacks of size %i.\n", queue->attr.mq_maxmsg, queue->attr.mq_msgsize);
+ printf ("There are %i free blocks left.\n", i);
+ printf ("There are %i messages on the queue.\n", queue->attr.mq_curmsgs);
+
+ i=0;
+ index = queue->head;
+ while (index != 0)
+ {
+ i++;
+ printf ("Message %i has a prio of %i and len of %i.\n", i,
+ ((message_header*)(&mqd->mptr[index]))->priority,
+ ((message_header*)(&mqd->mptr[index]))->length);
+ index = ((message_header*)(&mqd->mptr[index]))->next;
+ }
+ printf ("\n");
+}
+
+int main (int argc, char** argv)
+{
+ int flags;
+ pace_mqd_t mqd;
+ pace_mq_attr attr;
+ char* string;
+ char* s2;
+ flags = O_RDWR | O_CREAT | O_NONBLOCK;
+ attr.mq_flags |= O_NONBLOCK;
+ attr.mq_msgsize = 51;
+ attr.mq_maxmsg = 50;
+
+ mqd = mq_open ("hello", flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, &attr);
+
+ PACE_UNUSED_ARG (argc);
+ PACE_UNUSED_ARG (argv);
+
+ string = "Message\n";
+ s2 = malloc (1600);
+
+ print_queue (mqd);
+
+ printf ("Sending message 1\n");
+ if (mq_send (mqd, string, 9, 11) == -1)
+ {
+ perror ("send");
+ return -1;
+ }
+ print_queue (mqd);
+
+ printf ("Sending message 2\n");
+ string = "Message2\n";
+ if (mq_send (mqd, string, 10, 10) == -1)
+ {
+ perror ("send");
+ return -1;
+ }
+print_queue (mqd);
+
+ printf ("Getting message one\n");
+ flags = mq_receive (mqd, s2, 1600, 0);
+ if (flags == -1)
+ {
+ perror ("receiev:");
+ exit (0);
+ }
+print_queue (mqd);
+ printf (s2);
+ flags = mq_receive (mqd, s2, 1600, 0);
+ if (flags == -1)
+ {
+ perror ("receiev:");
+ exit (0);
+ }
+print_queue (mqd);
+ printf (s2);
+
+ return mq_close (mqd);
+}
diff --git a/PACE/pace/emulation/mqueue.h b/PACE/pace/emulation/mqueue.h
new file mode 100644
index 00000000000..2c865b2b179
--- /dev/null
+++ b/PACE/pace/emulation/mqueue.h
@@ -0,0 +1,48 @@
+/* $Id$ */
+#ifndef PACE_EMU_MQUEUE_H
+#define PACE_EMU_MQUEUE_H
+
+#include "pace/signal.h"
+
+#define PACE_MQ_ATTR
+typedef struct mq_attr
+{
+ long mq_flags;
+ pace_size_t mq_maxmsg;
+ pace_size_t mq_msgsize;
+ pace_size_t mq_curmsgs;
+} pace_mq_attr;
+
+struct mqd
+{
+ int fd;
+ long length;
+ int oflag;
+ char* mptr;
+};
+
+#define PACE_MQD_T
+typedef struct mqd* pace_mqd_t;
+
+pace_mqd_t mq_open (const char* name,
+ int oflag,
+ pace_mode_t mode,
+ pace_mq_attr* attr);
+
+int mq_close (pace_mqd_t mqdes);
+int mq_unlink (const char* name);
+int mq_send (pace_mqd_t mqdes,
+ const char* ptr,
+ pace_size_t length,
+ unsigned int priority);
+pace_ssize_t mq_receive (pace_mqd_t mqdes,
+ char * msg_ptr,
+ pace_size_t msg_len,
+ unsigned int * nmsg_prio);
+int mq_getattr (pace_mqd_t mqdes, pace_mq_attr * mqstat);
+int mq_setattr (pace_mqd_t mqdes,
+ const pace_mq_attr * mqstat,
+ pace_mq_attr * omqstat);
+int mq_notify (pace_mqd_t mqd, const pace_sigevent* notification);
+
+#endif /* PACE_EMU_MQUEUE_H */
diff --git a/PACE/pace/emulation/time.c b/PACE/pace/emulation/time.c
new file mode 100644
index 00000000000..e7f2c053c0e
--- /dev/null
+++ b/PACE/pace/emulation/time.c
@@ -0,0 +1,57 @@
+/* $Id$ */
+
+#include "pace/emulation/time.h"
+
+int pace_emu_clock_settime (pace_emu_clockid_t clock_id, const pace_timespec* tp)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
+int pace_emu_clock_gettime (pace_emu_clockid_t clock_id, pace_timespec* tp)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
+int pace_emu_clock_getres (pace_emu_clockid_t clock_id, pace_timespec* res)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
+int pace_emu_timer_create (pace_emu_clockid_t clock_id,
+ pace_sigevent* evp,
+ pace_emu_timer_t* timerid)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
+int pace_emu_timer_delete (pace_emu_timer_t timerid)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
+int pace_emu_timer_settime (pace_emu_timer_t timerid,
+ int flags,
+ const pace_itimerspec* value,
+ pace_itimerspec* ovalue)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
+int pace_emu_timer_gettime (pace_emu_timer_t timerid,
+ const pace_itimerspec* value)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
+int pace_emu_timer_getoverrun (pace_emu_timer_t timerid)
+{
+ errno = ENOSYS;
+ return -1;
+}
diff --git a/PACE/pace/emulation/time.h b/PACE/pace/emulation/time.h
new file mode 100644
index 00000000000..6c08dc826f7
--- /dev/null
+++ b/PACE/pace/emulation/time.h
@@ -0,0 +1,33 @@
+/* $Id$ */
+
+#ifndef PACE_EMU_TIME_H
+#define PACE_EMU_TIME_H
+
+#include "pace/signal.h"
+
+typedef int pace_emu_clockid_t;
+typedef int pace_emu_timer_t;
+typedef struct emu_itimerspec {} pace_emu_itimerspec;
+typedef struct emu_timespec {} pace_emu_timespec;
+
+#ifndef PACE_SIGEVENT
+#define PACE_SIGEVENT
+ typedef struct sigevent pace_sigevent;
+#endif /* PACE_SIGEVENT */
+int pace_emu_clock_settime (pace_emu_clockid_t clock_id, const pace_emu_timespec* tp);
+int pace_emu_clock_gettime (pace_emu_clockid_t clock_id, pace_emu_timespec* tp);
+int pace_emu_clock_getres (pace_emu_clockid_t clock_id, pace_emu_timespec* res);
+
+int pace_emu_timer_create (pace_emu_clockid_t clock_id,
+ pace_sigevent* evp,
+ pace_emu_timer_t* timerid);
+int pace_emu_timer_delete (pace_emu_timer_t timerid);
+int pace_emu_timer_settime (pace_emu_timer_t timerid,
+ int flags,
+ const pace_emu_itimerspec* value,
+ pace_emu_itimerspec* ovalue);
+int pace_emu_timer_gettime (pace_emu_timer_t timerid,
+ const pace_emu_itimerspec* value);
+int pace_emu_timer_getoverrun (pace_emu_timer_t timerid);
+
+#endif /* PACE_EMU_TIME_H */
diff --git a/PACE/pace/mqueue.h b/PACE/pace/mqueue.h
index 06a8430c7f0..5f205c31ade 100644
--- a/PACE/pace/mqueue.h
+++ b/PACE/pace/mqueue.h
@@ -73,7 +73,7 @@ extern "C" {
*/
PACE_INLINE ssize_t pace_mq_receive (pace_mqd_t mqdes,
char * msg_ptr,
- size_t msg_len,
+ pace_size_t msg_len,
unsigned int * nmsg_prio);
/**
@@ -83,7 +83,7 @@ extern "C" {
*/
PACE_INLINE int pace_mq_send (pace_mqd_t mqdes,
const char * mst_ptr,
- size_t msg_len,
+ pace_size_t msg_len,
unsigned int psg_prio);
/**
diff --git a/PACE/pace/posix/mqueue.h b/PACE/pace/posix/mqueue.h
index ec3299faf8c..c85500b4d01 100644
--- a/PACE/pace/posix/mqueue.h
+++ b/PACE/pace/posix/mqueue.h
@@ -16,7 +16,12 @@
#ifndef PACE_MQUEUE_H_POSIX
#define PACE_MQUEUE_H_POSIX
-#include <mqueue.h>
+#if PACE_LINUX
+# include "pace/emulation/mqueue.h"
+#else
+# include <mqueue.h>
+#endif /* PACE_LINUX */
+
#include "pace/signal.h"
#if defined (PACE_HAS_CPLUSPLUS)
@@ -25,12 +30,20 @@ extern "C" {
#ifndef PACE_MQD_T
#define PACE_MQD_T
-typedef mqd_t pace_mqd_t;
+# if PACE_LINUX
+ typedef pace_emu_mqd_t pace_mqd_t;
+# else
+ typedef mqd_t pace_mqd_t;
+# endif /* PACE_LINUX */
#endif /* PACE_MQD_T */
#ifndef PACE_MQ_ATTR
#define PACE_MQ_ATTR
-typedef struct mq_attr pace_mq_attr;
+# if PACE_LINUX
+ typedef struct pace_emu_mq_attr pace_mq_attr;
+# else
+ typedef struct mq_attr pace_mq_attr;
+# endif /* PACE_LINUX */
#endif /* PACE_MQ_ATTR */
#if defined (PACE_HAS_CPLUSPLUS)
diff --git a/PACE/pace/posix/pthread.inl b/PACE/pace/posix/pthread.inl
index 5d1e50bb5c2..29a1ad0e379 100644
--- a/PACE/pace/posix/pthread.inl
+++ b/PACE/pace/posix/pthread.inl
@@ -217,8 +217,14 @@ int
pace_pthread_condattr_getpshared (const pace_pthread_condattr_t * attr,
int * pshared)
{
- return pthread_condattr_getpshared (PACE_NONCONST_ARG_CAST (pace_pthread_condattr_t *) attr,
- pshared);
+#if PACE_LINUX
+ errno = ENOSYS;
+ PACE_UNUSED_ARG (attr);
+ PACE_UNUSED_ARG (pshared);
+ return -1;
+#else
+ return pthread_condattr_getpshared (PACE_NONCONST_ARG_CAST (pace_pthread_condattr_t *) attr, pshared);
+#endif /* PACE_LINUX */
}
PACE_INLINE
@@ -233,7 +239,14 @@ int
pace_pthread_condattr_setpshared (pace_pthread_condattr_t * attr,
int pshared)
{
+#if PACE_LINUX
+ errno = ENOSYS;
+ PACE_UNUSED_ARG (attr);
+ PACE_UNUSED_ARG (pshared);
+ return -1;
+#else
return pthread_condattr_setpshared (attr, pshared);
+#endif /* PACE_LINUX */
}
PACE_INLINE
@@ -325,11 +338,16 @@ int
pace_pthread_mutex_getprioceiling (pace_pthread_mutex_t * mutex,
int * prioceiling)
{
-#if PACE_HAS_POSIX == PACE_LYNXOS
+#if PACE_LINUX
+ errno = ENOSYS;
+ PACE_UNUSED_ARG (mutex);
+ PACE_UNUSED_ARG (prioceiling);
+ return -1;
+#elif PACE_LYNXOS
PACE_ERRNO_NO_SUPPORT_RETURN (-1);
#else /* ! PACE_LYNXOS */
return pthread_mutex_getprioceiling (mutex, prioceiling);
-#endif /* ! PACE_LYNXOS */
+#endif /* PACE_LINUX */
}
PACE_INLINE
@@ -353,11 +371,17 @@ pace_pthread_mutex_setprioceiling (pace_pthread_mutex_t * mutex,
int prioceiling,
int * old_ceiling)
{
-#if PACE_HAS_POSIX == PACE_LYNXOS
+#if PACE_LINUX
+ errno = ENOSYS;
+ PACE_UNUSED_ARG (mutex);
+ PACE_UNUSED_ARG (prioceiling);
+ PACE_UNUSED_ARG (old_ceiling);
+ return -1;
+#elif PACE_LYNXOS
PACE_ERRNO_NO_SUPPORT_RETURN (-1);
#else /* ! PACE_LYNXOS */
return pthread_mutex_setprioceiling (mutex, prioceiling, old_ceiling);
-#endif /* ! PACE_LYNXOS */
+#endif /* PACE_LINUX */
}
PACE_INLINE
@@ -386,7 +410,14 @@ int
pace_pthread_mutexattr_getprioceiling (pace_pthread_mutexattr_t * attr,
int * prioceiling)
{
+#if PACE_LINUX
+ errno = ENOSYS;
+ PACE_UNUSED_ARG (attr);
+ PACE_UNUSED_ARG (prioceiling);
+ return -1;
+#else
return pthread_mutexattr_getprioceiling (attr, prioceiling);
+#endif /* PACE_LINUX */
}
PACE_INLINE
@@ -394,8 +425,14 @@ int
pace_pthread_mutexattr_getprotocol (const pace_pthread_mutexattr_t * attr,
int * protocol)
{
- return pthread_mutexattr_getprotocol (PACE_NONCONST_ARG_CAST (pace_pthread_mutexattr_t *) attr,
- protocol);
+#if PACE_LINUX
+ errno = ENOSYS;
+ PACE_UNUSED_ARG (attr);
+ PACE_UNUSED_ARG (protocol);
+ return -1;
+#else
+ return pthread_mutexattr_getprotocol (PACE_NONCONST_ARG_CAST (pace_pthread_mutexattr_t *) attr, protocol);
+#endif /* PACE_LINUX */
}
PACE_INLINE
@@ -403,7 +440,14 @@ int
pace_pthread_mutexattr_setprioceiling (pace_pthread_mutexattr_t * attr,
int prioceiling)
{
+#if PACE_LINUX
+ errno = ENOSYS;
+ PACE_UNUSED_ARG (attr);
+ PACE_UNUSED_ARG (prioceiling);
+ return -1;
+#else
return pthread_mutexattr_setprioceiling (attr, prioceiling);
+#endif /* PACE_LINUX */
}
PACE_INLINE
@@ -411,7 +455,14 @@ int
pace_pthread_mutexattr_setprotocol (pace_pthread_mutexattr_t * attr,
int protocol)
{
+#if PACE_LINUX
+ errno = ENOSYS;
+ PACE_UNUSED_ARG (attr);
+ PACE_UNUSED_ARG (protocol);
+ return -1;
+#else
return pthread_mutexattr_setprotocol (attr, protocol);
+#endif /* PACE_LINUX */
}
PACE_INLINE
@@ -419,8 +470,14 @@ int
pace_pthread_mutexattr_getpshared (const pace_pthread_mutexattr_t * attr,
int * pshared)
{
- return pthread_mutexattr_getpshared (PACE_NONCONST_ARG_CAST (pace_pthread_mutexattr_t *) attr,
- pshared);
+#if PACE_LINUX
+ errno = ENOSYS;
+ PACE_UNUSED_ARG (attr);
+ PACE_UNUSED_ARG (pshared);
+ return -1;
+#else
+ return pthread_mutexattr_getpshared (PACE_NONCONST_ARG_CAST (pace_pthread_mutexattr_t *) attr, pshared);
+#endif /* PACE_LINUX */
}
PACE_INLINE
@@ -435,7 +492,14 @@ int
pace_pthread_mutexattr_setpshared (pace_pthread_mutexattr_t * attr,
int pshared)
{
+#if PACE_LINUX
+ errno = ENOSYS;
+ PACE_UNUSED_ARG (attr);
+ PACE_UNUSED_ARG (pshared);
+ return -1;
+#else
return pthread_mutexattr_setpshared (attr, pshared);
+#endif /* PACE_LINUX */
}
PACE_INLINE
diff --git a/PACE/pace/posix/stdio.h b/PACE/pace/posix/stdio.h
index 6d64e987f4c..d34ac976834 100644
--- a/PACE/pace/posix/stdio.h
+++ b/PACE/pace/posix/stdio.h
@@ -13,8 +13,8 @@
*
* ============================================================================ */
-#ifndef PACE_STDIO_H
-#define PACE_STDIO_H
+#ifndef PACE_STDIO_H_POSIX
+#define PACE_STDIO_H_POSIX
#include <stdio.h>
#include <stdarg.h>
@@ -46,389 +46,8 @@ typedef fpos_t pace_fpos_t;
typedef FILE PACE_FILE;
- /**
- PACE's implementation of the POSIX function clearerr.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE void pace_clearerr (PACE_FILE * stream);
-
- /**
- PACE's implementation of the POSIX function fclose.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_fclose (PACE_FILE * stream);
-
- /**
- PACE's implementation of the POSIX function fdopen.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.2.2.
- */
- PACE_INLINE PACE_FILE * pace_fdopen (int fildes, const char * type);
-
- /**
- PACE's implementation of the POSIX function ferror.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_ferror (PACE_FILE * stream);
-
- /**
- PACE's implementation of the POSIX function feof.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_feof (PACE_FILE * stream);
-
- /**
- PACE's implementation of the POSIX function fflush.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_fflush (PACE_FILE * stream);
-
- /**
- PACE's implementation of the POSIX function fileno.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.2.1.
- */
- PACE_INLINE int pace_fileno (PACE_FILE * stream);
-
- /**
- PACE's implementation of the POSIX function fgetc.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_fgetc (PACE_FILE * stream);
-
- /**
- C std 7.19.9.1
- */
- PACE_INLINE int pace_fgetpos(PACE_FILE * stream,
- pace_fpos_t * pos);
-
- /**
- PACE's implementation of the POSIX function fgets.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE char * pace_fgets (char * s, int n, PACE_FILE * stream);
-
- /**
- PACE's implementation of the POSIX function flockfile.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.2.6.
- */
- PACE_INLINE void pace_flockfile (PACE_FILE * file);
- /* Requires PACE_HAS_REENTRANT. */
-
- /**
- PACE's implementation of the POSIX function fopen.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE PACE_FILE * pace_fopen (const char * filename, const char * mode);
-
- /**
- PACE's implementation of the POSIX function fprintf.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- int pace_fprintf (PACE_FILE *stream, const char *format, ...);
-
- /**
- PACE's implementation of the POSIX function fputc.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_fputc (int c, PACE_FILE * stream);
-
- /**
- PACE's implementation of the POSIX function fputs.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_fputs (const char * s, PACE_FILE * stream);
-
- /**
- PACE's implementation of the POSIX function fread.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE pace_size_t pace_fread (void * ptr,
- pace_size_t size,
- pace_size_t number_of_items,
- PACE_FILE * stream);
-
- /**
- PACE's implementation of the POSIX function freopen.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE FILE * pace_freopen (const char * filename,
- const char * mode,
- PACE_FILE * stream);
-
- /**
- PACE's implementation of the POSIX function fscanf.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- #define pace_fscanf (X) fscanf X
- /* int pace_scanf (const char *format, ... );
- *
- * PLEASE PAY SPECIAL ATTENTION HERE!
- * This is a macro and requires an additional set of parenthesis
- * surrounding the arguments.
- */
-
- /**
- PACE's implementation of the POSIX function fseek.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_fseek (PACE_FILE * stream, long offset, int whence);
-
- /**
- C std 7.19.9.3
- */
- PACE_INLINE int pace_fsetpos(PACE_FILE *stream, const pace_fpos_t *pos);
-
- /**
- PACE's implementation of the POSIX function ftell.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE long pace_ftell (PACE_FILE * stream);
-
- /**
- PACE's implementation of the POSIX function ftrylockfile.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.2.6.
- */
- PACE_INLINE int pace_ftrylockfile (PACE_FILE * file);
- /* Requires PACE_HAS_REENTRANT. */
-
- /**
- PACE's implementation of the POSIX function funlockfile.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.2.6.
- */
- PACE_INLINE void pace_funlockfile (PACE_FILE * file);
- /* Requires PACE_HAS_REENTRANT. */
-
- /**
- C std 7.19.8.2
- */
- PACE_INLINE pace_size_t pace_fwrite(const void * ptr,
- pace_size_t size, pace_size_t nmemb,
- PACE_FILE * stream);
-
- /**
- PACE's implementation of the POSIX function getc.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_getc (PACE_FILE * stream);
-
- /**
- PACE's implementation of the POSIX function getc_unlocked.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.2.7.
- */
- PACE_INLINE int pace_getc_unlocked (PACE_FILE * stream);
- /* Requires PACE_HAS_REENTRANT. */
-
- /**
- PACE's implementation of the POSIX function getchar.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_getchar ();
-
- /**
- PACE's implementation of the POSIX function getchar_unlocked.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.2.7.
- */
- PACE_INLINE int pace_getchar_unlocked ();
- /* Requires PACE_HAS_REENTRANT. */
-
- /**
- PACE's implementation of the POSIX function gets.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE char *pace_gets (char * s);
-
- /**
- PACE's implementation of the POSIX function perror.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE void pace_perror (const char * s);
-
- /**
- PACE's implementation of the POSIX function printf.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- int pace_printf (const char* format, ...);
-
- /**
- PACE's implementation of the POSIX function putc.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_putc (int c, PACE_FILE * stream);
-
- /**
- PACE's implementation of the POSIX function putc_unlocked.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.2.7.
- */
- PACE_INLINE int pace_putc_unlocked (int c, PACE_FILE * stream);
- /* Requires PACE_HAS_REENTRANT. */
-
- /**
- PACE's implementation of the POSIX function putchar.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_putchar (int c);
-
- /**
- PACE's implementation of the POSIX function putchar_unlocked.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.2.7.
- */
- PACE_INLINE int pace_putchar_unlocked (int c);
- /* Requires PACE_HAS_REENTRANT. */
-
- /**
- PACE's implementation of the POSIX function puts.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_puts (const char * s);
-
- /**
- PACE's implementation of the POSIX function remove.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_remove (const char * path);
-
- /**
- PACE's implementation of the POSIX function rename.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 5.5.3.
- */
- PACE_INLINE int pace_rename (const char * old_name,
- const char * new_name);
-
- /**
- PACE's implementation of the POSIX function rewind.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE void pace_rewind (PACE_FILE * stream);
-
- /**
- PACE's implementation of the POSIX function sprintf.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- int pace_sprintf (char* s, const char* format, ...);
-
- /**
- PACE's implementation of the POSIX function scanf.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- #define pace_scanf (X) scanf X
- /* int pace_scanf (const char *format, ... );
- *
- * PLEASE PAY SPECIAL ATTENTION HERE!
- * This is a macro and requires an additional set of parenthesis
- * surrounding the arguments.
- */
-
- /**
- PACE's implementation of the POSIX function setbuf.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE void pace_setbuf (PACE_FILE * stream, char * buf);
-
-
- /**
- C std 7.19.5.6
- */
- PACE_INLINE int pace_setvbuf(PACE_FILE * stream,
- char * buf,
- int mode, pace_size_t size);
- /**
- PACE's implementation of the POSIX function sscanf.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- #define pace_sscanf (X) sscanf X
- /* int pace_sscanf (const char *s, const char *format, ... );
- *
- * PLEASE PAY SPECIAL ATTENTION HERE!
- * This is a macro and requires an additional set of parenthesis
- * surrounding the arguments.
- */
-
- /**
- PACE's implementation of the POSIX function sscanf.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE FILE * pace_tmpfile ();
-
- /**
- PACE's implementation of the POSIX function tmpnam.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE char * pace_tmpnam (char * s);
-
- /**
- PACE's implementation of the POSIX function ungetc.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_ungetc (int c, FILE * stream);
-
- /**
- C std 7.19.6.8
- */
- PACE_INLINE int pace_vfprintf (PACE_FILE * stream,
- const char * format,
- va_list arg);
-
- /**
- C std 7.19.6.10
- */
- PACE_INLINE int pace_vprintf (const char * format,
- va_list arg);
-
- /**
- C std 7.19.6.13
- */
- PACE_INLINE int pace_vsprintf (char * s,
- const char * format,
- va_list arg);
-
#if defined (PACE_HAS_CPLUSPLUS)
}
#endif /* PACE_HAS_CPLUSPLUS */
-#if defined (PACE_HAS_INLINE)
-# include "pace/posix/stdio.inl"
-#endif /* PACE_HAS_INLINE */
-
-#endif /* PACE_STDIO_H */
+#endif /* PACE_STDIO_H_POSIX */
diff --git a/PACE/pace/posix/stdio.inl b/PACE/pace/posix/stdio.inl
index 3a226416962..9f4bc03a340 100644
--- a/PACE/pace/posix/stdio.inl
+++ b/PACE/pace/posix/stdio.inl
@@ -24,6 +24,13 @@ pace_clearerr (FILE * stream)
}
PACE_INLINE
+char *
+pace_ctermid (char * s)
+{
+ return ctermid (s);
+}
+
+PACE_INLINE
int
pace_fclose (FILE * stream)
{
diff --git a/PACE/pace/posix/stdlib.h b/PACE/pace/posix/stdlib.h
index 59a0b0fc28c..3c4326a161c 100644
--- a/PACE/pace/posix/stdlib.h
+++ b/PACE/pace/posix/stdlib.h
@@ -13,11 +13,10 @@
*
* ============================================================================ */
-#ifndef PACE_STDLIB_H
-#define PACE_STDLIB_H
+#ifndef PACE_STDLIB_H_POSIX
+#define PACE_STDLIB_H_POSIX
#include <stdlib.h>
-#include "pace/unistd.h"
#if defined (PACE_HAS_CPLUSPLUS)
extern "C" {
@@ -29,8 +28,15 @@ extern "C" {
#define PACE_NULL NULL
#define PACE_RAND_MAX RAND_MAX
-typedef div_t pace_div_t;
-typedef ldiv_t pace_ldiv_t;
+#ifndef PACE_DIV_T
+#define PACE_DIV_T
+ typedef div_t pace_div_t;
+#endif /* PACE_DIV_T */
+
+#ifndef PACE_LDIV_T
+#define PACE_LDIV_T
+ typedef ldiv_t pace_ldiv_t;
+#endif /* PACE_LDIV_T */
#ifndef PACE_SIZE_T
#define PACE_SIZE_T
@@ -42,128 +48,8 @@ typedef ldiv_t pace_ldiv_t;
typedef wchar_t pace_wchar_t;
#endif /* PACE_WCHAR_T */
- /**
- C std 7.20.4.1
- */
- PACE_INLINE void pace_abort (void);
-
- /**
- PACE's implementation of the POSIX function abs.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_abs (int val);
-
- /**
- PACE's implementation of the POSIX function atof.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE double pace_atof (const char * str);
-
- /**
- PACE's implementation of the POSIX function atoi.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_atoi (const char * str);
-
- /**
- PACE's implementation of the POSIX function atol.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE long pace_atol (const char * str);
-
- /**
- PACE's implementation of the POSIX function bsearch.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE void * pace_bsearch (const void *key, const void *base,
- size_t nel, size_t size,
- int (*compar)(const void *,const void *));
-
- /**
- PACE's implementation of the POSIX function exit.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE void pace_exit (int status);
-
- /**
- PACE's implementation of the POSIX function getenv.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 4.6.1.
- */
- PACE_INLINE char * pace_getenv (const char * name);
-
- /**
- PACE's implementation of the POSIX function qsort.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE void pace_qsort (void * base, size_t nel, size_t width,
- int (*compar)(const void *, const void *));
-
- /**
- PACE's implementation of the POSIX function rand.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_rand ();
-
- /**
- PACE's implementation of the POSIX function srand.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE void pace_srand (unsigned int seed);
-
- /**
- PACE's implementation of the POSIX function rand_r.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.3.8.
- */
- PACE_INLINE int pace_rand_r (unsigned int * seed);
- /* Requires PACE_HAS_REENTRANT. */
-
- /* Memory Management */
-
- /**
- PACE's implementation of the POSIX function malloc.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE void * pace_malloc (size_t size);
-
- /**
- PACE's implementation of the POSIX function calloc.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE void * pace_calloc (size_t nelem, size_t elsize);
-
- /**
- PACE's implementation of the POSIX function free.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE void pace_free (void * ptr);
-
- /**
- PACE's implementation of the POSIX function realloc.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE void * pace_realloc (void * ptr, size_t size);
-
#if defined (PACE_HAS_CPLUSPLUS)
}
#endif /* PACE_HAS_CPLUSPLUS */
-#if defined (PACE_HAS_INLINE)
-# include "pace/posix/stdlib.inl"
-#endif /* PACE_HAS_INLINE */
-
-#endif /* PACE_STDLIB_H */
+#endif /* PACE_STDLIB_H_POSIX */
diff --git a/PACE/pace/posix/string.h b/PACE/pace/posix/string.h
index 0d21ae14185..f25fd8b077e 100644
--- a/PACE/pace/posix/string.h
+++ b/PACE/pace/posix/string.h
@@ -13,10 +13,8 @@
*
* ============================================================================ */
-#ifndef PACE_STRING_H
-#define PACE_STRING_H
-
-#include "pace/unistd.h"
+#ifndef PACE_STRING_H_POSIX
+#define PACE_STRING_H_POSIX
#if defined (PACE_HAS_CPLUSPLUS)
extern "C" {
@@ -31,121 +29,8 @@ extern "C" {
typedef size_t pace_size_t;
#endif /* PACE_SIZE_T */
- /**
- PACE's implementation of the POSIX function strcat.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE char * pace_strcat (char * s1, const char * s2);
-
- /**
- PACE's implementation of the POSIX function strncat.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE char * pace_strncat (char * s1, const char * s2, size_t n);
-
- /**
- PACE's implementation of the POSIX function strchr.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE const char * pace_strchr (const char * s, int c);
-
- /**
- PACE's implementation of the POSIX function strrchr.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE const char * pace_strrchr (const char * s, int c);
-
- /**
- PACE's implementation of the POSIX function strcmp.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_strcmp (const char * s1, const char * s2);
-
- /**
- PACE's implementation of the POSIX function strncmp.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE int pace_strncmp (const char * s1, const char * s2, size_t n);
-
- /**
- PACE's implementation of the POSIX function strcpy.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE char * pace_strcpy (char * s1, const char * s2);
-
- /**
- PACE's implementation of the POSIX function strncpy.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE char * pace_strncpy (char * s1, const char * s2, size_t n);
-
- /**
- PACE's implementation of the POSIX function strcspn.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE size_t pace_strcspn (const char * s1, const char * s2);
-
- /**
- PACE's implementation of the POSIX function strspn.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE size_t pace_strspn (const char * s1, const char * s2);
-
- /**
- PACE's implementation of the POSIX function strlen.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE size_t pace_strlen (const char * s);
-
- /**
- PACE's implementation of the POSIX function strpbrk.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE const char * pace_strpbrk (const char * s1, const char * s2);
-
- /**
- PACE's implementation of the POSIX function strstr.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE const char * pace_strstr (const char * s1, const char * s2);
-
- /**
- PACE's implementation of the POSIX function strtok.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.1.
- */
- PACE_INLINE char * pace_strtok (char * s1, const char * s2);
-
- /**
- PACE's implementation of the POSIX function strtok_r.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 8.3.3.
- */
- PACE_INLINE char * pace_strtok_r (char * s,
- const char * sep,
- char ** lasts);
- /* Requires PACE_HAS_REENTRANT. */
-
-
#if defined (PACE_HAS_CPLUSPLUS)
}
#endif /* PACE_HAS_CPLUSPLUS */
-#if defined (PACE_HAS_INLINE)
-# include "pace/posix/string.inl"
-#endif /* PACE_HAS_INLINE */
-
-#endif /* PACE_STRING_H */
+#endif /* PACE_STRING_H_POSIX */
diff --git a/PACE/pace/posix/string.inl b/PACE/pace/posix/string.inl
index 5a01ccfa202..8380b13ab85 100644
--- a/PACE/pace/posix/string.inl
+++ b/PACE/pace/posix/string.inl
@@ -14,6 +14,43 @@
* ============================================================================= */
#include <string.h>
+#include "pace/string.h"
+
+PACE_INLINE
+void *
+pace_memchr (const void *s, int c, pace_size_t n)
+{
+ return memchr (s, c, n);
+}
+
+PACE_INLINE
+int
+pace_memcmp (const void *s1, const void *s2, pace_size_t n)
+{
+ return memcmp (s1, s2, n);
+}
+
+PACE_INLINE
+void *
+pace_memcpy (void * s1, const void * s2, pace_size_t n)
+{
+ return memcpy (s1, s2, n);
+}
+
+PACE_INLINE
+void *
+pace_memmove (void *s1, const void *s2, pace_size_t n)
+{
+ return memmove (s1, s2, n);
+}
+
+PACE_INLINE
+void *
+pace_memset (void *s, int c, pace_size_t n)
+{
+ return memset (s, c, n);
+}
+
PACE_INLINE
char *
diff --git a/PACE/pace/posix/time.h b/PACE/pace/posix/time.h
index eab38fdad55..835c7917c15 100644
--- a/PACE/pace/posix/time.h
+++ b/PACE/pace/posix/time.h
@@ -18,6 +18,9 @@
#include <time.h>
#include "pace/signal.h"
+#if PACE_LINUX
+# include "pace/emulation/time.h"
+#endif /* PACE_LINUX */
#if defined (PACE_HAS_CPLUSPLUS)
extern "C" {
@@ -31,7 +34,11 @@ extern "C" {
#ifndef PACE_CLOCKID_T
#define PACE_CLOCKID_T
+# if PACE_LINUX
+ typedef pace_emu_clockid_t pace_clockid_t;
+# else
typedef clockid_t pace_clockid_t;
+# endif /* PACE_LINUX */
#endif /* PACE_CLOCKID_T */
#ifndef PACE_CLOCK_T
@@ -46,7 +53,11 @@ extern "C" {
#ifndef PACE_TIMER_T
#define PACE_TIMER_T
+# if PACE_LINUX
+ typedef pace_emu_timer_t pace_timer_t;
+# else
typedef timer_t pace_timer_t;
+# endif /* PACE_LINUX */
#endif /* PACE_TIMER_T */
#ifndef PACE_TIME_T
diff --git a/PACE/pace/posix/time.inl b/PACE/pace/posix/time.inl
index 1ab0547cc7c..70daf78062d 100644
--- a/PACE/pace/posix/time.inl
+++ b/PACE/pace/posix/time.inl
@@ -54,38 +54,59 @@ pace_difftime (pace_time_t time1, pace_time_t time2)
PACE_INLINE
int
-pace_clock_getres (clockid_t clock_id,
+pace_clock_getres (pace_clockid_t clock_id,
pace_timespec * res)
{
+#if PACE_LINUX
+ errno = ENOSYS;
+ PACE_UNUSED_ARG (clock_id);
+ PACE_UNUSED_ARG (res);
+ return -1;
+#else
return clock_getres (clock_id, res);
+#endif /* PACE_LINUX */
}
PACE_INLINE
int
-pace_clock_gettime (clockid_t clock_id,
+pace_clock_gettime (pace_clockid_t clock_id,
pace_timespec * tp)
{
+#if PACE_LINUX
+ errno = ENOSYS;
+ PACE_UNUSED_ARG (clock_id);
+ PACE_UNUSED_ARG (tp);
+ return -1;
+#else
return clock_gettime (clock_id, tp);
+#endif /* PACE_LINUX */
}
PACE_INLINE
int
-pace_clock_settime (clockid_t clock_id,
+pace_clock_settime (pace_clockid_t clock_id,
const pace_timespec * tp)
{
+#if PACE_LINUX
+ errno = ENOSYS;
+ PACE_UNUSED_ARG (clock_id);
+ PACE_UNUSED_ARG (tp);
+ return -1;
+#else
return clock_settime (clock_id, PACE_NONCONST_ARG_CAST (struct timespec *) tp);
+#endif /* PACE_LINUX */
}
PACE_INLINE
char *
-pace_ctime (const time_t * clock)
+pace_ctime (const pace_time_t * clock)
{
return ctime (clock);
}
PACE_INLINE
char *
-pace_ctime_r (const time_t * clock, char * buf)
+pace_ctime_r (const pace_time_t * clock, char * buf)
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
return ctime_r (clock, buf);
@@ -99,14 +120,14 @@ pace_ctime_r (const time_t * clock, char * buf)
PACE_INLINE
pace_tm *
-pace_gmtime (const time_t * clock)
+pace_gmtime (const pace_time_t * clock)
{
return gmtime (clock);
}
PACE_INLINE
pace_tm *
-pace_gmtime_r (const time_t * clock, pace_tm * result)
+pace_gmtime_r (const pace_time_t * clock, pace_tm * result)
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
return gmtime_r (clock, result);
@@ -120,14 +141,14 @@ pace_gmtime_r (const time_t * clock, pace_tm * result)
PACE_INLINE
pace_tm *
-pace_localtime (const time_t * clock)
+pace_localtime (const pace_time_t * clock)
{
return localtime (clock);
}
PACE_INLINE
pace_tm *
-pace_localtime_r (const time_t * clock, pace_tm * result)
+pace_localtime_r (const pace_time_t * clock, pace_tm * result)
{
# if defined (PACE_HAS_POSIX_PTHREAD_SEMANTICS)
return localtime_r (clock, result);
@@ -156,7 +177,7 @@ pace_nanosleep (const pace_timespec * rqtp,
PACE_INLINE
size_t
-pace_strftime (char *s, size_t maxsize,
+pace_strftime (char *s, pace_size_t maxsize,
const char *format,
const pace_tm *timeptr)
{
@@ -165,51 +186,78 @@ pace_strftime (char *s, size_t maxsize,
PACE_INLINE
time_t
-pace_time (time_t * tloc)
+pace_time (pace_time_t * tloc)
{
return time (tloc);
}
PACE_INLINE
int
-pace_timer_create (clockid_t clock_id,
+pace_timer_create (pace_clockid_t clock_id,
pace_sigevent * evp,
- timer_t *timerid)
+ pace_timer_t *timerid)
{
+#if PACE_LINUX
+ return pace_emu_timer_create (clock_id, evp, timerid);
+#else
return timer_create (clock_id, evp, timerid);
+#endif /* PACE_LINUX */
}
PACE_INLINE
int
-pace_timer_delete (timer_t timerid)
+pace_timer_delete (pace_timer_t timerid)
{
+#if PACE_LINUX
+ return pace_emu_timer_delete (timerid);
+#else
return timer_delete (timerid);
+#endif /* PACE_LINUX */
}
PACE_INLINE
int
-pace_timer_getoverrun (timer_t timerid)
+pace_timer_getoverrun (pace_timer_t timerid)
{
+#if PACE_LINUX
+ return pace_emu_timer_getoverrun (timerid);
+#else
return timer_getoverrun (timerid);
+#endif /* PACE_LINUX */
}
PACE_INLINE
int
-pace_timer_gettime (timer_t timerid,
+pace_timer_gettime (pace_timer_t timerid,
pace_itimerspec * value)
{
+#if PACE_LINUX
+ errno = ENOSYS;
+ PACE_UNUSED_ARG (timerid);
+ PACE_UNUSED_ARG (value);
+ return -1;
+#else
return timer_gettime (timerid, value);
+#endif /* PACE_LINUX */
}
PACE_INLINE
int
-pace_timer_settime (timer_t timerid,
+pace_timer_settime (pace_timer_t timerid,
int flags,
const pace_itimerspec * value,
pace_itimerspec * ovalue)
{
- return timer_settime (timerid, flags, PACE_NONCONST_ARG_CAST (struct itimerspec *) value,
- ovalue);
+#if PACE_LINUX
+ errno = ENOSYS;
+ PACE_UNUSED_ARG (timerid);
+ PACE_UNUSED_ARG (flags);
+ PACE_UNUSED_ARG (value);
+ PACE_UNUSED_ARG (ovalue);
+ return -1;
+#else
+ return timer_settime (timerid, flags, PACE_NONCONST_ARG_CAST (struct itimerspec *) value, ovalue);
+#endif /* PACE_LINUX */
}
PACE_INLINE
diff --git a/PACE/pace/posix/unistd.inl b/PACE/pace/posix/unistd.inl
index d7538d91396..055a94c8069 100644
--- a/PACE/pace/posix/unistd.inl
+++ b/PACE/pace/posix/unistd.inl
@@ -60,13 +60,6 @@ pace_close (int fildes)
}
PACE_INLINE
-char *
-pace_ctermid (char * s)
-{
- return ctermid (s);
-}
-
-PACE_INLINE
int
pace_dup (int fildes)
{
diff --git a/PACE/pace/stddef.h b/PACE/pace/stddef.h
index 959c90a52d4..712b388ec18 100644
--- a/PACE/pace/stddef.h
+++ b/PACE/pace/stddef.h
@@ -6,7 +6,7 @@
* pace
*
* = FILENAME
-* pace/posix/errno.h
+* pace/stddef.h
*
* = AUTHOR
* John Heitmann
diff --git a/PACE/pace/stdio.h b/PACE/pace/stdio.h
index a501a4f8ade..f3b91b5ab8a 100644
--- a/PACE/pace/stdio.h
+++ b/PACE/pace/stdio.h
@@ -13,19 +13,418 @@
*
* ============================================================================ */
-#ifndef PACE_STDIO_H_INDIRECT
-#define PACE_STDIO_H_INDIRECT
+#ifndef PACE_STDIO_H
+#define PACE_STDIO_H
#include "pace/config/defines.h"
-#if defined (PACE_HAS_POSIX)
+#if (PACE_HAS_POSIX)
# include "pace/posix/stdio.h"
-#elif defined (PACE_VXWORKS)
+#elif (PACE_VXWORKS)
# include "pace/vxworks/stdio.h"
-#elif defined (PACE_WIN32)
+#elif (PACE_WIN32)
# include "pace/win32/stdio.h"
#endif
-#endif /* PACE_STDIO_H_INDIRECT */
+#if defined (PACE_HAS_CPLUSPLUS)
+extern "C" {
+#endif /* PACE_HAS_CPLUSPLUS */
+ /**
+ PACE's implementation of the POSIX function clearerr.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE void pace_clearerr (PACE_FILE * stream);
+ /**
+ PACE's implementation of the POSIX function fclose.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_fclose (PACE_FILE * stream);
+
+ /**
+ PACE's implementation of the POSIX function ctermid.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 4.7.1.
+ */
+ PACE_INLINE char * pace_ctermid (char * s);
+
+ /**
+ PACE's implementation of the POSIX function fdopen.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.2.2.
+ */
+ PACE_INLINE PACE_FILE * pace_fdopen (int fildes, const char * type);
+
+ /**
+ PACE's implementation of the POSIX function ferror.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_ferror (PACE_FILE * stream);
+
+ /**
+ PACE's implementation of the POSIX function feof.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_feof (PACE_FILE * stream);
+
+ /**
+ PACE's implementation of the POSIX function fflush.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_fflush (PACE_FILE * stream);
+
+ /**
+ PACE's implementation of the POSIX function fileno.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.2.1.
+ */
+ PACE_INLINE int pace_fileno (PACE_FILE * stream);
+
+ /**
+ PACE's implementation of the POSIX function fgetc.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_fgetc (PACE_FILE * stream);
+
+ /**
+ C std 7.19.9.1
+ */
+ PACE_INLINE int pace_fgetpos(PACE_FILE * stream,
+ pace_fpos_t * pos);
+
+ /**
+ PACE's implementation of the POSIX function fgets.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE char * pace_fgets (char * s, int n, PACE_FILE * stream);
+
+ /**
+ PACE's implementation of the POSIX function flockfile.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.2.6.
+ */
+ PACE_INLINE void pace_flockfile (PACE_FILE * file);
+ /* Requires PACE_HAS_REENTRANT. */
+
+ /**
+ PACE's implementation of the POSIX function fopen.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE PACE_FILE * pace_fopen (const char * filename, const char * mode);
+
+ /**
+ PACE's implementation of the POSIX function fprintf.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ int pace_fprintf (PACE_FILE *stream, const char *format, ...);
+
+ /**
+ PACE's implementation of the POSIX function fputc.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_fputc (int c, PACE_FILE * stream);
+
+ /**
+ PACE's implementation of the POSIX function fputs.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_fputs (const char * s, PACE_FILE * stream);
+
+ /**
+ PACE's implementation of the POSIX function fread.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE pace_size_t pace_fread (void * ptr,
+ pace_size_t size,
+ pace_size_t number_of_items,
+ PACE_FILE * stream);
+
+ /**
+ PACE's implementation of the POSIX function freopen.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE FILE * pace_freopen (const char * filename,
+ const char * mode,
+ PACE_FILE * stream);
+
+ /**
+ PACE's implementation of the POSIX function fscanf.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ #define pace_fscanf (X) fscanf X
+ /* int pace_scanf (const char *format, ... );
+ *
+ * PLEASE PAY SPECIAL ATTENTION HERE!
+ * This is a macro and requires an additional set of parenthesis
+ * surrounding the arguments.
+ */
+
+ /**
+ PACE's implementation of the POSIX function fseek.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_fseek (PACE_FILE * stream, long offset, int whence);
+
+ /**
+ C std 7.19.9.3
+ */
+ PACE_INLINE int pace_fsetpos(PACE_FILE *stream, const pace_fpos_t *pos);
+
+ /**
+ PACE's implementation of the POSIX function ftell.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE long pace_ftell (PACE_FILE * stream);
+
+ /**
+ PACE's implementation of the POSIX function ftrylockfile.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.2.6.
+ */
+ PACE_INLINE int pace_ftrylockfile (PACE_FILE * file);
+ /* Requires PACE_HAS_REENTRANT. */
+
+ /**
+ PACE's implementation of the POSIX function funlockfile.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.2.6.
+ */
+ PACE_INLINE void pace_funlockfile (PACE_FILE * file);
+ /* Requires PACE_HAS_REENTRANT. */
+
+ /**
+ C std 7.19.8.2
+ */
+ PACE_INLINE pace_size_t pace_fwrite(const void * ptr,
+ pace_size_t size, pace_size_t nmemb,
+ PACE_FILE * stream);
+
+ /**
+ PACE's implementation of the POSIX function getc.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_getc (PACE_FILE * stream);
+
+ /**
+ PACE's implementation of the POSIX function getc_unlocked.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.2.7.
+ */
+ PACE_INLINE int pace_getc_unlocked (PACE_FILE * stream);
+ /* Requires PACE_HAS_REENTRANT. */
+
+ /**
+ PACE's implementation of the POSIX function getchar.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_getchar ();
+
+ /**
+ PACE's implementation of the POSIX function getchar_unlocked.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.2.7.
+ */
+ PACE_INLINE int pace_getchar_unlocked ();
+ /* Requires PACE_HAS_REENTRANT. */
+
+ /**
+ PACE's implementation of the POSIX function gets.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE char *pace_gets (char * s);
+
+ /**
+ PACE's implementation of the POSIX function perror.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE void pace_perror (const char * s);
+
+ /**
+ PACE's implementation of the POSIX function printf.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ int pace_printf (const char* format, ...);
+
+ /**
+ PACE's implementation of the POSIX function putc.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_putc (int c, PACE_FILE * stream);
+
+ /**
+ PACE's implementation of the POSIX function putc_unlocked.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.2.7.
+ */
+ PACE_INLINE int pace_putc_unlocked (int c, PACE_FILE * stream);
+ /* Requires PACE_HAS_REENTRANT. */
+
+ /**
+ PACE's implementation of the POSIX function putchar.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_putchar (int c);
+
+ /**
+ PACE's implementation of the POSIX function putchar_unlocked.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.2.7.
+ */
+ PACE_INLINE int pace_putchar_unlocked (int c);
+ /* Requires PACE_HAS_REENTRANT. */
+
+ /**
+ PACE's implementation of the POSIX function puts.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_puts (const char * s);
+
+ /**
+ PACE's implementation of the POSIX function remove.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_remove (const char * path);
+
+ /**
+ PACE's implementation of the POSIX function rename.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 5.5.3.
+ */
+ PACE_INLINE int pace_rename (const char * old_name,
+ const char * new_name);
+
+ /**
+ PACE's implementation of the POSIX function rewind.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE void pace_rewind (PACE_FILE * stream);
+
+ /**
+ PACE's implementation of the POSIX function sprintf.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ int pace_sprintf (char* s, const char* format, ...);
+
+ /**
+ PACE's implementation of the POSIX function scanf.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ #define pace_scanf (X) scanf X
+ /* int pace_scanf (const char *format, ... );
+ *
+ * PLEASE PAY SPECIAL ATTENTION HERE!
+ * This is a macro and requires an additional set of parenthesis
+ * surrounding the arguments.
+ */
+
+ /**
+ PACE's implementation of the POSIX function setbuf.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE void pace_setbuf (PACE_FILE * stream, char * buf);
+
+
+ /**
+ C std 7.19.5.6
+ */
+ PACE_INLINE int pace_setvbuf(PACE_FILE * stream,
+ char * buf,
+ int mode, pace_size_t size);
+ /**
+ PACE's implementation of the POSIX function sscanf.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ #define pace_sscanf (X) sscanf X
+ /* int pace_sscanf (const char *s, const char *format, ... );
+ *
+ * PLEASE PAY SPECIAL ATTENTION HERE!
+ * This is a macro and requires an additional set of parenthesis
+ * surrounding the arguments.
+ */
+
+ /**
+ PACE's implementation of the POSIX function sscanf.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE FILE * pace_tmpfile ();
+
+ /**
+ PACE's implementation of the POSIX function tmpnam.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE char * pace_tmpnam (char * s);
+
+ /**
+ PACE's implementation of the POSIX function ungetc.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_ungetc (int c, FILE * stream);
+
+ /**
+ C std 7.19.6.8
+ */
+ PACE_INLINE int pace_vfprintf (PACE_FILE * stream,
+ const char * format,
+ va_list arg);
+
+ /**
+ C std 7.19.6.10
+ */
+ PACE_INLINE int pace_vprintf (const char * format,
+ va_list arg);
+
+ /**
+ C std 7.19.6.13
+ */
+ PACE_INLINE int pace_vsprintf (char * s,
+ const char * format,
+ va_list arg);
+#if defined (PACE_HAS_CPLUSPLUS)
+}
+#endif /* PACE_HAS_CPLUSPLUS */
+
+#if defined (PACE_HAS_INLINE)
+# if (PACE_HAS_POSIX)
+# include "pace/posix/stdio.inl"
+# elif (PACE_VXWORKS)
+# include "pace/vxworks/stdio.inl"
+# elif (PACE_WIN32)
+# include "pace/win32/stdio.inl"
+# endif
+#endif /* PACE_HAS_INLINE */
+
+#endif /* PACE_STDIO_H */
diff --git a/PACE/pace/stdlib.h b/PACE/pace/stdlib.h
index da9311f033f..1edf3021ba7 100644
--- a/PACE/pace/stdlib.h
+++ b/PACE/pace/stdlib.h
@@ -13,17 +13,152 @@
*
* ============================================================================ */
-#ifndef PACE_STDLIB_H_INDIRECT
-#define PACE_STDLIB_H_INDIRECT
+#ifndef PACE_STDLIB_H
+#define PACE_STDLIB_H
#include "pace/config/defines.h"
+#include "pace/unistd.h"
-#if defined (PACE_HAS_POSIX)
+#if (PACE_HAS_POSIX)
# include "pace/posix/stdlib.h"
-#elif defined (PACE_VXWORKS)
+#elif (PACE_VXWORKS)
# include "pace/vxworks/stdlib.h"
-#elif defined (PACE_WIN32)
+#elif (PACE_WIN32)
# include "pace/win32/stdlib.h"
#endif
-#endif /* PACE_STDLIB_H_INDIRECT */
+#if defined (PACE_HAS_CPLUSPLUS)
+extern "C" {
+#endif /* PACE_HAS_CPLUSPLUS */
+
+ /**
+ C std 7.20.4.1
+ */
+ PACE_INLINE void pace_abort (void);
+
+ /**
+ PACE's implementation of the POSIX function abs.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_abs (int val);
+
+ /**
+ PACE's implementation of the POSIX function atof.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE double pace_atof (const char * str);
+
+ /**
+ PACE's implementation of the POSIX function atoi.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_atoi (const char * str);
+
+ /**
+ PACE's implementation of the POSIX function atol.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE long pace_atol (const char * str);
+
+ /**
+ PACE's implementation of the POSIX function bsearch.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE void * pace_bsearch (const void *key, const void *base,
+ size_t nel, size_t size,
+ int (*compar)(const void *,const void *));
+
+ /**
+ PACE's implementation of the POSIX function exit.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE void pace_exit (int status);
+
+ /**
+ PACE's implementation of the POSIX function getenv.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 4.6.1.
+ */
+ PACE_INLINE char * pace_getenv (const char * name);
+
+ /**
+ PACE's implementation of the POSIX function qsort.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE void pace_qsort (void * base, size_t nel, size_t width,
+ int (*compar)(const void *, const void *));
+
+ /**
+ PACE's implementation of the POSIX function rand.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_rand ();
+
+ /**
+ PACE's implementation of the POSIX function srand.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE void pace_srand (unsigned int seed);
+
+ /**
+ PACE's implementation of the POSIX function rand_r.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.3.8.
+ */
+ PACE_INLINE int pace_rand_r (unsigned int * seed);
+ /* Requires PACE_HAS_REENTRANT. */
+
+ /* Memory Management */
+
+ /**
+ PACE's implementation of the POSIX function malloc.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE void * pace_malloc (size_t size);
+
+ /**
+ PACE's implementation of the POSIX function calloc.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE void * pace_calloc (size_t nelem, size_t elsize);
+
+ /**
+ PACE's implementation of the POSIX function free.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE void pace_free (void * ptr);
+
+ /**
+ PACE's implementation of the POSIX function realloc.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE void * pace_realloc (void * ptr, size_t size);
+
+#if defined (PACE_HAS_CPLUSPLUS)
+}
+#endif /* PACE_HAS_CPLUSPLUS */
+
+#if defined (PACE_HAS_INLINE)
+# if (PACE_HAS_POSIX)
+# include "pace/posix/stdlib.inl"
+# elif (PACE_VXWORKS)
+# include "pace/vxworks/stdlib.inl"
+# elif (PACE_WIN32)
+# include "pace/win32/stdlib.inl"
+# endif
+#endif /* PACE_HAS_INLINE */
+
+#endif /* PACE_STDLIB_H */
diff --git a/PACE/pace/string.h b/PACE/pace/string.h
index 63a2287a8dd..00dd030e17b 100644
--- a/PACE/pace/string.h
+++ b/PACE/pace/string.h
@@ -13,17 +13,170 @@
*
* ============================================================================ */
-#ifndef PACE_STRING_H_INDIRECT
-#define PACE_STRING_H_INDIRECT
+#ifndef PACE_STRING_H
+#define PACE_STRING_H
#include "pace/config/defines.h"
+#include "pace/unistd.h"
-#if defined (PACE_HAS_POSIX)
+#if (PACE_HAS_POSIX)
# include "pace/posix/string.h"
-#elif defined (PACE_VXWORKS)
+#elif (PACE_VXWORKS)
# include "pace/vxworks/string.h"
-#elif defined (PACE_WIN32)
+#elif (PACE_WIN32)
# include "pace/win32/string.h"
#endif
-#endif /* PACE_STRING_H_INDIRECT */
+#if defined (PACE_HAS_CPLUSPLUS)
+extern "C" {
+#endif /* PACE_HAS_CPLUSPLUS */
+
+ /**
+ pace_memchr function, C std ref. 7.21.5.1
+ */
+ PACE_INLINE void * pace_memchr(const void *s, int c, pace_size_t n);
+
+ /**
+ pace_memcmp function, C std ref. 7.21.4.1
+ */
+ PACE_INLINE int pace_memcmp(const void *s1, const void *s2, pace_size_t n);
+
+ /**
+ pace_memcpy function, C std ref. 7.21.2.1
+ */
+ PACE_INLINE void *pace_memcpy(void * s1, const void * s2, pace_size_t n);
+
+ /**
+ pace_memmove function, C std ref.7.21.2.2
+ */
+ PACE_INLINE void *pace_memmove(void *s1, const void *s2, pace_size_t n);
+
+ /**
+ pace_memset function, C std ref. 7.21.6.1
+ */
+ PACE_INLINE void *pace_memset(void *s, int c, pace_size_t n);
+
+ /**
+ PACE's implementation of the POSIX function strcat.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE char * pace_strcat (char * s1, const char * s2);
+
+ /**
+ PACE's implementation of the POSIX function strncat.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE char * pace_strncat (char * s1, const char * s2, size_t n);
+
+ /**
+ PACE's implementation of the POSIX function strchr.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE const char * pace_strchr (const char * s, int c);
+
+ /**
+ PACE's implementation of the POSIX function strrchr.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE const char * pace_strrchr (const char * s, int c);
+
+ /**
+ PACE's implementation of the POSIX function strcmp.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_strcmp (const char * s1, const char * s2);
+
+ /**
+ PACE's implementation of the POSIX function strncmp.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE int pace_strncmp (const char * s1, const char * s2, size_t n);
+
+ /**
+ PACE's implementation of the POSIX function strcpy.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE char * pace_strcpy (char * s1, const char * s2);
+
+ /**
+ PACE's implementation of the POSIX function strncpy.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE char * pace_strncpy (char * s1, const char * s2, size_t n);
+
+ /**
+ PACE's implementation of the POSIX function strcspn.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE size_t pace_strcspn (const char * s1, const char * s2);
+
+ /**
+ PACE's implementation of the POSIX function strspn.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE size_t pace_strspn (const char * s1, const char * s2);
+
+ /**
+ PACE's implementation of the POSIX function strlen.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE size_t pace_strlen (const char * s);
+
+ /**
+ PACE's implementation of the POSIX function strpbrk.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE const char * pace_strpbrk (const char * s1, const char * s2);
+
+ /**
+ PACE's implementation of the POSIX function strstr.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE const char * pace_strstr (const char * s1, const char * s2);
+
+ /**
+ PACE's implementation of the POSIX function strtok.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.1.
+ */
+ PACE_INLINE char * pace_strtok (char * s1, const char * s2);
+
+ /**
+ PACE's implementation of the POSIX function strtok_r.
+ See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
+ IEEE Std 1003.1, 1996 Edition), Section 8.3.3.
+ */
+ PACE_INLINE char * pace_strtok_r (char * s,
+ const char * sep,
+ char ** lasts);
+ /* Requires PACE_HAS_REENTRANT. */
+
+
+#if defined (PACE_HAS_CPLUSPLUS)
+}
+#endif /* PACE_HAS_CPLUSPLUS */
+
+#if defined (PACE_HAS_INLINE)
+# if (PACE_HAS_POSIX)
+# include "pace/posix/string.inl"
+# elif (PACE_VXWORKS)
+# include "pace/vxworks/string.inl"
+# elif (PACE_WIN32)
+# include "pace/win32/string.inl"
+# endif
+#endif /* PACE_HAS_INLINE */
+
+#endif /* PACE_STRING_H */
diff --git a/PACE/pace/unistd.h b/PACE/pace/unistd.h
index cecf32c59c4..49e6da63589 100644
--- a/PACE/pace/unistd.h
+++ b/PACE/pace/unistd.h
@@ -13,8 +13,8 @@
*
* ============================================================================ */
-#ifndef PACE_UNISTD_H_INDIRECT
-#define PACE_UNISTD_H_INDIRECT
+#ifndef PACE_UNISTD_H
+#define PACE_UNISTD_H
#include "pace/config/defines.h"
@@ -74,14 +74,6 @@ extern "C" {
PACE_INLINE int pace_close (int fildes);
/**
- PACE's implementation of the POSIX function ctermid.
- See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
- IEEE Std 1003.1, 1996 Edition), Section 4.7.1.
- */
- PACE_INLINE char * pace_ctermid (char * s);
-
-
- /**
PACE's implementation of the POSIX function dup.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 6.2.1.
@@ -173,219 +165,219 @@ extern "C" {
*/
PACE_INLINE int pace_ftruncate (int fildes, pace_off_t length);
-/**
+ /**
PACE's implementation of the POSIX function getcwd.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 5.2.2.
*/
PACE_INLINE char * pace_getcwd (char * buf, size_t size);
-/**
+ /**
PACE's implementation of the POSIX function getegid.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.2.1.
*/
PACE_INLINE uid_t pace_getegid ();
-/**
+ /**
PACE's implementation of the POSIX function geteuid.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.2.1.
*/
PACE_INLINE uid_t pace_geteuid ();
-/**
+ /**
PACE's implementation of the POSIX function getgid.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.2.1.
*/
PACE_INLINE uid_t pace_getgid ();
-/**
+ /**
PACE's implementation of the POSIX function getgroups.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.2.3.
*/
PACE_INLINE int pace_getgroups (int gidsetsize, pace_gid_t grouplist[]);
-/**
+ /**
PACE's implementation of the POSIX function getlogin.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.2.4.
*/
PACE_INLINE char * pace_getlogin ();
-/**
+ /**
PACE's implementation of the POSIX function getlogin_r.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.2.4.
*/
PACE_INLINE int pace_getlogin_r (char * name, size_t namesize);
-/* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */
+ /* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */
-/**
+ /**
PACE's implementation of the POSIX function getpgrp.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.3.1.
*/
PACE_INLINE pace_pid_t pace_getpgrp ();
-/**
+ /**
PACE's implementation of the POSIX function getpid.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.1.1.
*/
PACE_INLINE pace_pid_t pace_getpid ();
-/**
+ /**
PACE's implementation of the POSIX function getppid.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.1.1.
*/
PACE_INLINE pace_pid_t pace_getppid ();
-/**
+ /**
PACE's implementation of the POSIX function getuid.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.2.1.
*/
PACE_INLINE uid_t pace_getuid ();
-/**
+ /**
PACE's implementation of the POSIX function isatty.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.7.2.
*/
PACE_INLINE int pace_isatty (int fildes);
-/**
+ /**
PACE's implementation of the POSIX function link.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 5.3.4.
*/
PACE_INLINE int pace_link (const char * existing, const char * new_link);
-/**
+ /**
PACE's implementation of the POSIX function lseek.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 6.5.3.
*/
PACE_INLINE pace_off_t pace_lseek (int fildes, off_t offset, int whence);
-/**
+ /**
PACE's implementation of the POSIX function pathconf.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 5.7.1.
*/
PACE_INLINE long pace_pathconf (const char * path, int name);
-/**
+ /**
PACE's implementation of the POSIX function pause.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 3.4.2.
*/
PACE_INLINE int pace_pause ();
-/**
+ /**
PACE's implementation of the POSIX function pipe.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 6.1.1.
*/
PACE_INLINE int pace_pipe (int fildes[2]);
-/**
+ /**
PACE's implementation of the POSIX function read.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 6.4.1.
*/
PACE_INLINE ssize_t pace_read (int fildes, void * buf, size_t nbyte);
-/**
+ /**
PACE's implementation of the POSIX function rmdir.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 5.5.2.
*/
PACE_INLINE int pace_rmdir (const char * path);
-/**
+ /**
PACE's implementation of the POSIX function setgid.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.2.2.
*/
PACE_INLINE int pace_setgid (pace_gid_t gid);
-/**
+ /**
PACE's implementation of the POSIX function setpgid.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.3.3.
*/
PACE_INLINE int pace_setpgid (pace_pid_t pid, pid_t pgid);
-/**
+ /**
PACE's implementation of the POSIX function setsid.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.3.2.
*/
PACE_INLINE pace_pid_t pace_setsid ();
-/**
+ /**
PACE's implementation of the POSIX function setuid.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.2.2.
*/
PACE_INLINE int pace_setuid (uid_t uid);
-/**
+ /**
PACE's implementation of the POSIX function sleep.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 3.4.3.
*/
PACE_INLINE unsigned pace_sleep (unsigned int seconds);
-/**
- PACE's implementation of the POSIX function sysconf.
+ /**
+ PACE's implementation of the POSIX function sysconf.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.8.1.
*/
PACE_INLINE long pace_sysconf (int name);
-/**
+ /**
PACE's implementation of the POSIX function ttyname.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 7.2.3.1.
*/
PACE_INLINE pid_t pace_tcgetpgrp (int fildes);
-/**
+ /**
PACE's implementation of the POSIX function ttyname.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 7.2.3.1.
*/
PACE_INLINE int pace_tcsetpgrp (int fildes, pid_t pgrp_id);
-/**
+ /**
PACE's implementation of the POSIX function ttyname.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.7.2.
*/
PACE_INLINE char * pace_ttyname (int fildes);
-/**
+ /**
PACE's implementation of the POSIX function ttyname_r.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 4.7.2.
*/
PACE_INLINE int pace_ttyname_r (int fildes, char * name, size_t namesize);
-/* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */
+ /* Requires PACE_HAS_POSIX_PTHREAD_SEMANTICS. */
-/**
+ /**
PACE's implementation of the POSIX function unlink.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 5.5.1.
*/
PACE_INLINE int pace_unlink (const char * path);
-/**
+ /**
PACE's implementation of the POSIX function write.
See POSIX standard (Internation Standard ISO/IEC 9945-1:1996;
IEEE Std 1003.1, 1996 Edition), Section 6.4.2.