diff options
author | joeh <joeh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-06-01 20:57:00 +0000 |
---|---|---|
committer | joeh <joeh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-06-01 20:57:00 +0000 |
commit | 1afc4abb0e489acaa6b1e3f335052048ed4be58b (patch) | |
tree | 1ac0ade087820737388e0629693fa043e4259b09 /PACE | |
parent | 565728f2b305cd6d33a6bdd8dbc7614639c8e608 (diff) | |
download | ATCD-1afc4abb0e489acaa6b1e3f335052048ed4be58b.tar.gz |
ChangeLogTag: Fri Jun 1 15:38:45 2001 Joe Hoffert <joeh@cs.wustl.edu>
Diffstat (limited to 'PACE')
91 files changed, 8005 insertions, 30 deletions
diff --git a/PACE/ChangeLog b/PACE/ChangeLog index 1f45cdbd910..76bf69335cd 100644 --- a/PACE/ChangeLog +++ b/PACE/ChangeLog @@ -1,3 +1,93 @@ +Fri Jun 1 15:38:45 2001 Joe Hoffert <joeh@cs.wustl.edu> + + * pace/vxworks/aio.c: + * pace/vxworks/aio.inl: + * pace/vxworks/aio.h: + * pace/vxworks/assert.c: + * pace/vxworks/assert.inl: + * pace/vxworks/assert.h: + * pace/vxworks/ctype.c: + * pace/vxworks/ctype.h: + * pace/vxworks/ctype.inl: + * pace/vxworks/dirent.c: + * pace/vxworks/dirent.h: + * pace/vxworks/dirent.inl: + * pace/vxworks/errno.h: + * pace/vxworks/fcntl.c: + * pace/vxworks/fcntl.h: + * pace/vxworks/fcntl.inl: + * pace/vxworks/grp.c: + * pace/vxworks/grp.h: + * pace/vxworks/grp.inl: + * pace/vxworks/limits.h: + * pace/vxworks/locale.c: + * pace/vxworks/locale.h: + * pace/vxworks/locale.inl: + * pace/vxworks/math.c: + * pace/vxworks/math.h: + * pace/vxworks/math.inl: + * pace/vxworks/mman.c: + * pace/vxworks/mman.h: + * pace/vxworks/mman.inl: + * pace/vxworks/mqueue.c: + * pace/vxworks/mqueue.h: + * pace/vxworks/pthread.c: + * pace/vxworks/pthread.h: + * pace/vxworks/pthread.inl: + * pace/vxworks/pwd.c: + * pace/vxworks/pwd.h: + * pace/vxworks/pwd.inl: + * pace/vxworks/sched.c: + * pace/vxworks/sched.h: + * pace/vxworks/sched.inl: + * pace/vxworks/semaphore.c: + * pace/vxworks/semaphore.h: + * pace/vxworks/semaphore.inl: + * pace/vxworks/setjmp.c: + * pace/vxworks/setjmp.h: + * pace/vxworks/setjmp.inl: + * pace/vxworks/signal.c: + * pace/vxworks/signal.h: + * pace/vxworks/signal.inl: + * pace/vxworks/socket.c: + * pace/vxworks/socket.h: + * pace/vxworks/socket.inl: + * pace/vxworks/stat.c: + * pace/vxworks/stat.h: + * pace/vxworks/stat.inl: + * pace/vxworks/stdio.c: + * pace/vxworks/stdio.h: + * pace/vxworks/stdio.inl: + * pace/vxworks/stdlib.c: + * pace/vxworks/stdlib.h: + * pace/vxworks/stdlib.inl: + * pace/vxworks/string.c: + * pace/vxworks/string.h: + * pace/vxworks/string.inl: + * pace/vxworks/termios.c: + * pace/vxworks/termios.h: + * pace/vxworks/termios.inl: + * pace/vxworks/time.c: + * pace/vxworks/time.h: + * pace/vxworks/time.inl: + * pace/vxworks/times.c: + * pace/vxworks/times.h: + * pace/vxworks/times.inl: + * pace/vxworks/types.h: + * pace/vxworks/unistd.c: + * pace/vxworks/unistd.h: + * pace/vxworks/unistd.inl: + * pace/vxworks/utime.c: + * pace/vxworks/utime.h: + * pace/vxworks/utime.inl: + * pace/vxworks/utsname.c: + * pace/vxworks/utsname.h: + * pace/vxworks/utsname.inl: + * pace/vxworks/wait.c: + * pace/vxworks/wait.h: + * pace/vxworks/wait.inl: + Added these files for the VxWorks port of PACE. + Mon May 14 12:55:33 2001 Joe Hoffert <joeh@cs.wustl.edu> * docs/www/pace-car.html: diff --git a/PACE/pace/config/config.h b/PACE/pace/config/config.h index 13b0e878bab..85f6c9af5d4 100644 --- a/PACE/pace/config/config.h +++ b/PACE/pace/config/config.h @@ -63,6 +63,10 @@ # define PACE_NONCONST_ARG_CAST(TYPE) (TYPE) # define PACE_VOIDSTARTSTAR_ARG_CAST(TYPE) # define PACE_AIO_SUSPEND_LIST_ARG_CAST (const struct aiocb **) +#elif PACE_LACKS_POSIX == PACE_VXWORKS +# define PACE_NONCONST_ARG_CAST(TYPE) (TYPE) +# define PACE_VOIDSTARTSTAR_ARG_CAST(TYPE) +# define PACE_AIO_SUSPEND_LIST_ARG_CAST (const struct aiocb **) #else /* ! PACE_LYNXOS */ # define PACE_NONCONST_ARG_CAST(TYPE) # define PACE_VOIDSTARTSTAR_ARG_CAST(TYPE) diff --git a/PACE/pace/config/platform.h b/PACE/pace/config/platform.h index ec206c25599..81cffd75fce 100644 --- a/PACE/pace/config/platform.h +++ b/PACE/pace/config/platform.h @@ -56,11 +56,21 @@ /* These platforms are NOT POSIX compliant. */ +/* This is really kludgy but not sure what else to do at this point. + It appears that if PACE_HAS_POSIX is not defined (i.e., no #define + at all of any kind) and the same goes for PACE_VXWORKS then in + pace/config/config.h #if PACE_HAS_POSIX == PACE_LYNXOS will evaluate + to true. I am assuming both get default values of 0. + + PACE_WIN32 should be defined as 0 though because pace/config/utility.h + checks it. + */ + #elif defined (PACE_VXWORKS) # define PACE_LACKS_POSIX PACE_VXWORKS -# define PACE_LINUX 0 -# define PACE_LYNXOS 0 -# define PACE_SUNOS 0 +# define PACE_LINUX -1 +# define PACE_LYNXOS -1 +# define PACE_SUNOS -1 # define PACE_WIN32 0 /* Doesn't use the makefile! */ #elif defined (WIN32) @@ -71,6 +81,7 @@ # define PACE_LYNXOS 0 # define PACE_SUNOS 0 # define PACE_VXWORKS 0 +#error "Here in platform.h for Win32" #endif #endif /* PACE_CONFIG_PLATFORM_H */ diff --git a/PACE/pace/vxworks/aio.c b/PACE/pace/vxworks/aio.c new file mode 100644 index 00000000000..f9c32d822b4 --- /dev/null +++ b/PACE/pace/vxworks/aio.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/aio.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/aio.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/aio.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/aio.h b/PACE/pace/vxworks/aio.h new file mode 100644 index 00000000000..fa519c4df73 --- /dev/null +++ b/PACE/pace/vxworks/aio.h @@ -0,0 +1,45 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/aio.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_AIO_H_VXWORKS +#define PACE_AIO_H_VXWORKS + +#include <aio.h> +#include "pace/time.h" +#include "pace/signal.h" + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#define PACE_AIO_ALLDONE AIO_ALLDONE +#define PACE_AIO_CANCELED AIO_CANCELED +#define PACE_AIO_NOCANCELED AIO_NOTCANCELED +#define PACE_LIO_NOP LIO_NOP +#define PACE_LIO_NOWAIT LIO_NOWAIT +#define PACE_LIO_READ LIO_READ +#define PACE_LIO_WAIT LIO_WAIT +#define PACE_LIO_WRITE LIO_WRITE + +#ifndef PACE_AIOCB +#define PACE_AIOCB +typedef struct aiocb pace_aiocb; +#endif /* PACE_AIOCB */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_AIO_H_VXWORKS */ diff --git a/PACE/pace/vxworks/aio.inl b/PACE/pace/vxworks/aio.inl new file mode 100644 index 00000000000..05e62e2b9ae --- /dev/null +++ b/PACE/pace/vxworks/aio.inl @@ -0,0 +1,96 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/aio.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_aio_cancel (PACE_HANDLE fildes, pace_aiocb * aiocbp) +{ + return aio_cancel (fildes, aiocbp); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_aio_error (const pace_aiocb * aiocbp) +{ + return aio_error (PACE_NONCONST_ARG_CAST (struct aiocb *) aiocbp); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_aio_fsync (int op, pace_aiocb * aiocbp) +{ + PACE_UNUSED_ARG (op); + PACE_UNUSED_ARG (aiocbp); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_aio_read (pace_aiocb * aiocbp) +{ + return aio_read (aiocbp); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_aio_return (pace_aiocb * aiocbp) +{ + return aio_return (aiocbp); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_aio_suspend (const pace_aiocb * const list[], + int nent, + const pace_timespec * timeout) +{ + return aio_suspend (PACE_AIO_SUSPEND_LIST_ARG_CAST list, + nent, + PACE_NONCONST_ARG_CAST (struct timespec *) timeout); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_aio_write (pace_aiocb * aiocbp) +{ + return aio_write (aiocbp); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_lio_listio (int mode, + pace_aiocb * const list[], + int nent, + pace_sigevent * sig) +{ + return lio_listio (mode, PACE_NONCONST_ARG_CAST (struct aiocb **) list, + nent, sig); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ diff --git a/PACE/pace/vxworks/assert.c b/PACE/pace/vxworks/assert.c new file mode 100644 index 00000000000..8731f27260d --- /dev/null +++ b/PACE/pace/vxworks/assert.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/assert.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/assert.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/assert.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/assert.h b/PACE/pace/vxworks/assert.h new file mode 100644 index 00000000000..3b2f014109d --- /dev/null +++ b/PACE/pace/vxworks/assert.h @@ -0,0 +1,29 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/assert.h + * + * = AUTHOR + * Joe Hoffert + * + * =========================================================================== */ + +#ifndef PACE_ASSERT_H_VXWORKS +#define PACE_ASSERT_H_VXWORKS + +#include <assert.h> + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +# if defined (PACE_HAS_CPLUSPLUS) +} +# endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_ASSERT_H_VXWORKS */ diff --git a/PACE/pace/vxworks/assert.inl b/PACE/pace/vxworks/assert.inl new file mode 100644 index 00000000000..b3def672d99 --- /dev/null +++ b/PACE/pace/vxworks/assert.inl @@ -0,0 +1,14 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/assert.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ diff --git a/PACE/pace/vxworks/ctype.c b/PACE/pace/vxworks/ctype.c new file mode 100644 index 00000000000..01b1da173ab --- /dev/null +++ b/PACE/pace/vxworks/ctype.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/ctype.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/ctype.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/ctype.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/ctype.h b/PACE/pace/vxworks/ctype.h new file mode 100644 index 00000000000..106684d7371 --- /dev/null +++ b/PACE/pace/vxworks/ctype.h @@ -0,0 +1,27 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/ctype.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_CTYPE_H_VXWORKS +#define PACE_CTYPE_H_VXWORKS + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_CTYPE_H_VXWORKS */ diff --git a/PACE/pace/vxworks/ctype.inl b/PACE/pace/vxworks/ctype.inl new file mode 100644 index 00000000000..21aca11b729 --- /dev/null +++ b/PACE/pace/vxworks/ctype.inl @@ -0,0 +1,133 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/ctype.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include <ctype.h> + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +int +pace_isalnum (int c) +{ + return isalnum (c); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +int +pace_isalpha (int c) +{ + return isalpha (c); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +int +pace_iscntrl (int c) +{ + return iscntrl (c); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +int +pace_isdigit (int c) +{ + return isdigit (c); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +int +pace_isgraph (int c) +{ + return isgraph (c); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +int +pace_islower (int c) +{ + return islower (c); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +int +pace_isprint (int c) +{ + return isprint (c); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +int +pace_ispunct (int c) +{ + return ispunct (c); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +int +pace_isspace (int c) +{ + return isspace (c); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +int +pace_isupper (int c) +{ + return isupper (c); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +int +pace_isxdigit (int c) +{ + return isxdigit (c); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +int +pace_tolower (int c) +{ + return tolower (c); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +int +pace_toupper (int c) +{ + return toupper (c); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ diff --git a/PACE/pace/vxworks/dirent.c b/PACE/pace/vxworks/dirent.c new file mode 100644 index 00000000000..c1a09545067 --- /dev/null +++ b/PACE/pace/vxworks/dirent.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/dirent.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/dirent.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/dirent.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/dirent.h b/PACE/pace/vxworks/dirent.h new file mode 100644 index 00000000000..1b746c6ec4a --- /dev/null +++ b/PACE/pace/vxworks/dirent.h @@ -0,0 +1,40 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/dirent.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_DIRENT_H_VXWORKS +#define PACE_DIRENT_H_VXWORKS + +#include "pace/sys/types.h" +#include <dirent.h> + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#ifndef PACE_DIR_T +#define PACE_DIR_T +typedef DIR PACE_DIR; +#endif /* PACE_DIR_T */ + +#ifndef PACE_DIRENT +#define PACE_DIRENT +typedef struct dirent pace_dirent; +#endif /* PACE_DIRENT */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_DIRENT_H_VXWORKS */ diff --git a/PACE/pace/vxworks/dirent.inl b/PACE/pace/vxworks/dirent.inl new file mode 100644 index 00000000000..5c6c6cd9b14 --- /dev/null +++ b/PACE/pace/vxworks/dirent.inl @@ -0,0 +1,64 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/dirent.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +PACE_DIR * +pace_opendir (const char * dirname) +{ + return opendir (PACE_NONCONST_ARG_CAST(char *) dirname); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +pace_dirent * +pace_readdir (PACE_DIR * dirp) +{ + return readdir (dirp); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_CLSR_UOF) +PACE_INLINE +int +pace_readdir_r (PACE_DIR * dirp, pace_dirent * entry, + pace_dirent ** result) +{ + PACE_UNUSED_ARG (entry); + /* <result> has better not be 0! */ + *result = pace_readdir (dirp); + return 0; +} +#endif /* PACE_HAS_POSIX_CLSR_UOF */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +void +pace_rewinddir (PACE_DIR * dirp) +{ + rewinddir (dirp); + return; +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +int +pace_closedir (PACE_DIR * dirp) +{ + return closedir (dirp); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ diff --git a/PACE/pace/vxworks/errno.h b/PACE/pace/vxworks/errno.h new file mode 100644 index 00000000000..7e64a524658 --- /dev/null +++ b/PACE/pace/vxworks/errno.h @@ -0,0 +1,75 @@ +/* $Id$ + +* ============================================================================ +* +* = LIBRARY +* pace +* +* = FILENAME +* pace/vxworks/errno.h +* +* = AUTHOR +* Joe Hoffert +* +* =========================================================================== */ + +#ifndef PACE_ERRNO_H_VXWORKS +#define PACE_ERRNO_H_VXWORKS + +#include <errno.h> + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#define PACE_E2BIG E2BIG +#define PACE_EACCES EACCES +#define PACE_EAGAIN EAGAIN +#define PACE_EBADF EBADF +#define PACE_EBADMSG +#define PACE_EBUSY EBUSY +#define PACE_ECANCELED ECANCELED +#define PACE_ECHILD ECHILD +#define PACE_EDEADLK EDEADLK +#define PACE_EDOM EDOM +#define PACE_EEXIST EEXIST +#define PACE_EFAULT EFAULT +#define PACE_EFBIG EFBIG +#define PACE_EINPROGRESS EINPROGRESS +#define PACE_EINTR EINTR +#define PACE_EINVAL EINVAL +#define PACE_EIO EIO +#define PACE_EISDIR EISDIR +#define PACE_EMFILE EMFILE +#define PACE_EMLINK EMLINK +#define PACE_EMSGSIZE EMSGSIZE +#define PACE_EENAMETOOLONG ENAMETOOLONG +#define PACE_ENFILE ENFILE +#define PACE_ENODEV ENODEV +#define PACE_ENOENT ENOENT +#define PACE_ENOEXEC ENOEXEC +#define PACE_ENOLCK ENOLCK +#define PACE_ENOMEM ENOMEM +#define PACE_ENOSPC ENOSPC +#define PACE_ENOSYS ENOSYS +#define PACE_ENOTDIR ENOTDIR +#define PACE_ENOTEMPTY ENOTEMPTY +#define PACE_ENOTSUP ENOTSUP +#define PACE_ENOTTY ENOTTY +#define PACE_ENXIO ENXIO +#define PACE_EPERM EPERM +#define PACE_EPIPE EPIPE +#define PACE_ERANGE ERANGE +#define PACE_EROFS EROFS +#define PACE_ESPIPE ESPIPE +#define PACE_ESRCH ESRCH +#define PACE_ETIMEDOUT ETIMEDOUT +#define PACE_EXDEV EXDEV + +#define pace_errno errno + +# if defined (PACE_HAS_CPLUSPLUS) +} +# endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_ERRNO_H_VXWORKS */ diff --git a/PACE/pace/vxworks/fcntl.c b/PACE/pace/vxworks/fcntl.c new file mode 100644 index 00000000000..c0bc9a30a38 --- /dev/null +++ b/PACE/pace/vxworks/fcntl.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/fcntl.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/fcntl.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/fcntl.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/fcntl.h b/PACE/pace/vxworks/fcntl.h new file mode 100644 index 00000000000..534beaca5b2 --- /dev/null +++ b/PACE/pace/vxworks/fcntl.h @@ -0,0 +1,63 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/fnctl.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_FCNTL_H_VXWORKS +#define PACE_FCNTL_H_VXWORKS + +#include "pace/sys/types.h" +#include "pace/unistd.h" +#include "pace/sys/stat.h" +#include <fcntl.h> + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#define PACE_FD_CLOEXEC FD_CLOEXEC +#define PACE_F_DUPFD D_DUPFD +#define PACE_F_GETFD F_GETFD +#define PACE_F_GETFL F_GETFL +#define PACE_F_GETLK F_GETLK +#define PACE_F_RDLCK F_RDLCK +#define PACE_F_SETFD F_SETFD +#define PACE_F_SETFL F_SETFL +#define PACE_F_SETLK F_SETLK +#define PACE_F_SETLKW F_SETLKW +#define PACE_F_UNLCK F_UNLCK +#define PACE_F_WRLCK F_WRLCK +#define PACE_O_ACCMODE O_ACCMODE +#define PACE_O_APPEND O_APPEND +#define PACE_O_CREAT O_CREAT +#define PACE_O_DSYNC O_DSYNC +#define PACE_O_EXCL O_EXCL +#define PACE_O_NOCTTY O_NOCTTY +#define PACE_O_NONBLOCK O_NONBLOCK +#define PACE_O_RDONLY O_RDONLY +#define PACE_O_RDWR O_RDWR +#define PACE_O_RSYNC O_RSYNC +#define PACE_O_SYNC O_SYNC +#define PACE_O_TRUNC O_TRUNC +#define PACE_O_WRONLY O_WRONLY + +#ifndef PACE_FLOCK +#define PACE_FLOCK +typedef struct flock pace_flock; +#endif /* PACE_FLOCK */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_FCNTL_H_VXWORKS */ diff --git a/PACE/pace/vxworks/fcntl.inl b/PACE/pace/vxworks/fcntl.inl new file mode 100644 index 00000000000..f4dc5fd8dfe --- /dev/null +++ b/PACE/pace/vxworks/fcntl.inl @@ -0,0 +1,23 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/fcntl.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +int +pace_creat (const char * path, pace_mode_t mode) +{ + return creat (path, mode); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ diff --git a/PACE/pace/vxworks/grp.c b/PACE/pace/vxworks/grp.c new file mode 100644 index 00000000000..4a12ee0f64c --- /dev/null +++ b/PACE/pace/vxworks/grp.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/grp.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/grp.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/grp.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/grp.h b/PACE/pace/vxworks/grp.h new file mode 100644 index 00000000000..5fcd0fd959d --- /dev/null +++ b/PACE/pace/vxworks/grp.h @@ -0,0 +1,32 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace (posix ace) + * + * = FILENAME + * pace/vxworks/grp.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_GRP_H_VXWORKS +#define PACE_GRP_H_VXWORKS + +# if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +# endif /* PACE_HAS_CPLUSPLUS */ + +#ifndef PACE_GROUP +#define PACE_GROUP +typedef struct group pace_group; +#endif /* PACE_GROUP */ + +# if defined (PACE_HAS_CPLUSPLUS) +} +# endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_GRP_H_VXWORKS */ diff --git a/PACE/pace/vxworks/grp.inl b/PACE/pace/vxworks/grp.inl new file mode 100644 index 00000000000..db0a124ec14 --- /dev/null +++ b/PACE/pace/vxworks/grp.inl @@ -0,0 +1,74 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/grp.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#if (PACE_HAS_POSIX_SD_UOF) +PACE_INLINE +pace_group * +pace_getgrgid (pace_gid_t gid) +{ + /* getgrgid() is not supported: just one user anyways */ + PACE_UNUSED_ARG (gid); + return 0; +} +#endif /* PACE_HAS_POSIX_SD_UOF */ + +#if (PACE_HAS_POSIX_SDR_UOF) +PACE_INLINE +int +pace_getgrgid_r (pace_gid_t gid, + pace_group * grp, + char * buffer, + size_t bufsize, + pace_group ** result) +{ + /* getgrgid_r() is not supported: just one user anyways */ + PACE_UNUSED_ARG (gid); + PACE_UNUSED_ARG (grp); + PACE_UNUSED_ARG (buffer); + PACE_UNUSED_ARG (bufsize); + PACE_UNUSED_ARG (result); + return 0; +} +#endif /* PACE_HAS_POSIX_SDR_UOF */ + +#if (PACE_HAS_POSIX_SD_UOF) +PACE_INLINE +pace_group * +pace_getgrnam (const char * name) +{ + /* getgrnam() is not supported: just one user anyways */ + PACE_UNUSED_ARG (name); + return 0; +} +#endif /* PACE_HAS_POSIX_SD_UOF */ + +#if (PACE_HAS_POSIX_SDR_UOF) +PACE_INLINE +int +pace_getgrnam_r (const char * name, + pace_group * grp, + char * buffer, + size_t bufsize, + pace_group ** result) +{ + /* getgrnam_r() is not supported: just one user anyways */ + PACE_UNUSED_ARG (name); + PACE_UNUSED_ARG (grp); + PACE_UNUSED_ARG (buffer); + PACE_UNUSED_ARG (bufsize); + PACE_UNUSED_ARG (result); + return 0; +} +#endif /* PACE_HAS_POSIX_SDR_UOF */ diff --git a/PACE/pace/vxworks/limits.h b/PACE/pace/vxworks/limits.h new file mode 100644 index 00000000000..e0d70071157 --- /dev/null +++ b/PACE/pace/vxworks/limits.h @@ -0,0 +1,29 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace (posix ace) + * + * = FILENAME + * pace/vxworks/limits.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_LIMITS_H_VXWORKS +#define PACE_LIMITS_H_VXWORKS + +#include <limits.h> + +# if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +# endif /* (PACE_HAS_CPLUSPLUS) */ + +# if defined (PACE_HAS_CPLUSPLUS) +} +# endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_LIMITS_H_VXWORKS */ diff --git a/PACE/pace/vxworks/locale.c b/PACE/pace/vxworks/locale.c new file mode 100644 index 00000000000..530fd21999c --- /dev/null +++ b/PACE/pace/vxworks/locale.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/locale.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/locale.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/locale.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/locale.h b/PACE/pace/vxworks/locale.h new file mode 100644 index 00000000000..4838e912fd3 --- /dev/null +++ b/PACE/pace/vxworks/locale.h @@ -0,0 +1,40 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/locale.h + * + * = AUTHOR + * Joe Hoffert + * + * =========================================================================== */ + +#ifndef PACE_LOCALE_H_VXWORKS +#define PACE_LOCALE_H_VXWORKS + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#define PACE_LC_ALL LC_ALL +#define PACE_LC_COLLATE LC_COLLATE +#define PACE_LC_CTYPE LC_CTYPE +#define PACE_LC_MONETARY LC_MONETARY +#define PACE_LC_NUMERIC LC_NUMERIC +#define PACE_LC_TIME LC_TIME +#define PACE_NULL NULL + +#ifndef PACE_LCONV +#define PACE_LCONV +typedef struct lconv pace_lconv; +#endif /* PACE_LCONV */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_LOCALE_H_VXWORKS */ diff --git a/PACE/pace/vxworks/locale.inl b/PACE/pace/vxworks/locale.inl new file mode 100644 index 00000000000..2ab01a32dce --- /dev/null +++ b/PACE/pace/vxworks/locale.inl @@ -0,0 +1,34 @@ +/* $Id$ -*- C -*- + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/locale.inl + * + * = AUTHOR + * Joe Hoffert + * + * =========================================================================== */ + +#include <locale.h> + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +pace_lconv * +pace_localeconv (void) +{ + return localeconv (); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_MP_UOF) +PACE_INLINE +char * +pace_setlocale (int category, const char * locale) +{ + return setlocale (category, locale); +} +#endif /* PACE_HAS_POSIX_MP_UOF */ diff --git a/PACE/pace/vxworks/math.c b/PACE/pace/vxworks/math.c new file mode 100644 index 00000000000..1d3b87dc973 --- /dev/null +++ b/PACE/pace/vxworks/math.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/math.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/math.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/math.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/math.h b/PACE/pace/vxworks/math.h new file mode 100644 index 00000000000..cda356e550e --- /dev/null +++ b/PACE/pace/vxworks/math.h @@ -0,0 +1,29 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/math.h + * + * = AUTHOR + * Luther Baker + * + * ============================================================================ */ + +#ifndef PACE_MATH_H_VXWORKS +#define PACE_MATH_H_VXWORKS + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#define PACE_HUGE_VAL HUGE_VAL + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_MATH_H_VXWORKS */ diff --git a/PACE/pace/vxworks/math.inl b/PACE/pace/vxworks/math.inl new file mode 100644 index 00000000000..05feb58dbee --- /dev/null +++ b/PACE/pace/vxworks/math.inl @@ -0,0 +1,215 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/math.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +/* FUZZ: disable check_for_math_include */ +#include <math.h> + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_acos (double x) +{ + return acos (x); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_asin (double x) +{ + return asin (x); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_atan (double x) +{ + return atan (x); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_atan2 (double x, double y) +{ + return atan2 (x, y); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_cos (double x) +{ + return cos (x); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_sin (double x) +{ + return sin (x); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_tan (double x) +{ + return tan (x); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_cosh (double x) +{ + return cosh (x); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_sinh (double x) +{ + return sinh (x); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_tanh (double x) +{ + return tanh (x); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_exp (double x) +{ + return exp (x); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_frexp (double x, int * exp) +{ + return frexp (x, exp); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_ldexp (double x, int exp) +{ + return ldexp (x, exp); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_log (double x) +{ + return log (x); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_log10 (double x) +{ + return log10 (x); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_modf (double x, double * iptr) +{ + return modf (x, iptr); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_pow (double x, double y) +{ + return pow (x, y); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_sqrt (double x) +{ + return sqrt (x); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_ceil (double x) +{ + return ceil (x); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_fabs (double x) +{ + return fabs (x); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_floor (double x) +{ + return floor (x); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_fmod (double x, double y) +{ + return fmod (x, y); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ diff --git a/PACE/pace/vxworks/mman.c b/PACE/pace/vxworks/mman.c new file mode 100644 index 00000000000..149f345054e --- /dev/null +++ b/PACE/pace/vxworks/mman.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/mman.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/sys/mman.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/mman.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/mman.h b/PACE/pace/vxworks/mman.h new file mode 100644 index 00000000000..7bddb69ee86 --- /dev/null +++ b/PACE/pace/vxworks/mman.h @@ -0,0 +1,42 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/mman.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_SYS_MMAN_H_VXWORKS +#define PACE_SYS_MMAN_H_VXWORKS + +#include <sys/mman.h> + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#define PACE_MAP_FAILED MAP_FAILED +#define PACE_MAP_FIXED MAP_FIXED +#define PACE_MAP_PRIVATE MAP_PRIVATE +#define PACE_MAP_SHARED MAP_SHARED +#define PACE_MCL_CURRENT MCL_CURRENT +#define PACE_MS_ASYNC MS_ASYNC +#define PACE_MS_INVALIDATE +#define PACE_MS_SYNC MS_SYNC +#define PACE_PROT_EXEC PROT_EXEC +#define PACE_PROT_NONE PROT_NONE +#define PACE_PROT_READ PROT_READ +#define PACE_PROT_WRITE PROT_WRITE + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_SYS_MMAN_H_VXWORKS */ diff --git a/PACE/pace/vxworks/mman.inl b/PACE/pace/vxworks/mman.inl new file mode 100644 index 00000000000..5ec4f55a781 --- /dev/null +++ b/PACE/pace/vxworks/mman.inl @@ -0,0 +1,133 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/mman.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/fcntl.h" + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_mlock (const void * addr, pace_size_t len) +{ + return mlock (((char*)addr), len); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_mlockall (int flags) +{ + return mlockall (flags); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +void * +pace_mmap (void * addr, + pace_size_t len, + int prot, + int flags, + PACE_HANDLE fildes, + pace_off_t off) +{ + PACE_UNUSED_ARG(addr); + PACE_UNUSED_ARG(len); + PACE_UNUSED_ARG(prot); + PACE_UNUSED_ARG(flags); + PACE_UNUSED_ARG(fildes); + PACE_UNUSED_ARG(off); + PACE_ERRNO_NO_SUPPORT_RETURN ((void *) -1); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_munlock (const void * addr, pace_size_t len) +{ + return munlock (((char*)addr), len); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_mprotect (void * addr, + pace_size_t len, + int prot) +{ + PACE_UNUSED_ARG(addr); + PACE_UNUSED_ARG(len); + PACE_UNUSED_ARG(prot); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_msync (void * addr, + pace_size_t len, + int flags) +{ + PACE_UNUSED_ARG(addr); + PACE_UNUSED_ARG(len); + PACE_UNUSED_ARG(flags); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_munlockall () +{ + return munlockall (); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_munmap (void * addr, pace_size_t len) +{ + PACE_UNUSED_ARG(addr); + PACE_UNUSED_ARG(len); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +PACE_HANDLE +pace_shm_open (const char * name, + int oflag, + pace_mode_t mode) +{ + /* Just use open per ACE. */ + return pace_open (name, oflag, mode); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_shm_unlink (const char * name) +{ + /* Just use unlink per ACE. */ + return pace_unlink (name); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ diff --git a/PACE/pace/vxworks/mqueue.c b/PACE/pace/vxworks/mqueue.c new file mode 100644 index 00000000000..b2cbe7f35b9 --- /dev/null +++ b/PACE/pace/vxworks/mqueue.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace (posix ace) + * + * = FILENAME + * pace/vxworks/mqueue.c + * + * = AUTHOR + * Luther Baker + * + * ============================================================================= */ + +#include "pace/mqueue.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/mqueue.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/mqueue.h b/PACE/pace/vxworks/mqueue.h new file mode 100644 index 00000000000..8e3b66e136a --- /dev/null +++ b/PACE/pace/vxworks/mqueue.h @@ -0,0 +1,43 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/mqueue.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_MQUEUE_H_VXWORKS +#define PACE_MQUEUE_H_VXWORKS + +#if PACE_LINUX +# include "pace/emulation/mqueue.h" +#else +# include <mqueue.h> +#endif /* PACE_LINUX */ + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#ifndef PACE_MQD_T +#define PACE_MQD_T + typedef mqd_t pace_mqd_t; +#endif /* PACE_MQD_T */ + +#ifndef PACE_MQ_ATTR +#define PACE_MQ_ATTR + typedef struct mq_attr pace_mq_attr; +#endif /* PACE_MQ_ATTR */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_MQUEUE_H_VXWORKS */ diff --git a/PACE/pace/vxworks/mqueue.inl b/PACE/pace/vxworks/mqueue.inl new file mode 100644 index 00000000000..2459563e9b3 --- /dev/null +++ b/PACE/pace/vxworks/mqueue.inl @@ -0,0 +1,87 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/posix/mqueue.inl + * + * = AUTHOR + * Luther Baker + * + * ============================================================================= */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_mq_close (pace_mqd_t mqdes) +{ + return mq_close (mqdes); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_mq_getattr (pace_mqd_t mqdes, + pace_mq_attr * mqstat) +{ + return mq_getattr (mqdes, mqstat); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_mq_notify (pace_mqd_t mqdes, + const pace_sigevent * notification) +{ + return mq_notify (mqdes, notification); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +ssize_t +pace_mq_receive (pace_mqd_t mqdes, + char * msg_ptr, + size_t msg_len, + unsigned int * msg_prio) +{ + return mq_receive (mqdes, msg_ptr, msg_len, msg_prio); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_mq_send (pace_mqd_t mqdes, + const char * msg_ptr, + size_t msg_len, + unsigned int msg_prio) +{ + return mq_send (mqdes, msg_ptr, msg_len, msg_prio); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_mq_setattr (pace_mqd_t mqdes, + const pace_mq_attr * mqstat, + pace_mq_attr * omqstat) +{ + return mq_setattr (mqdes, mqstat, omqstat); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_mq_unlink (const char * name) +{ + return mq_unlink (name); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ diff --git a/PACE/pace/vxworks/pthread.c b/PACE/pace/vxworks/pthread.c new file mode 100644 index 00000000000..2e4786b391c --- /dev/null +++ b/PACE/pace/vxworks/pthread.c @@ -0,0 +1,21 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/pthread.c + * + * = AUTHOR + * Joe Hoffert. The *VAST* majority of the pthread code for VxWorks + * has been supplied by Hughes Network Systems via Braeton Taylor. + * + * ============================================================================= */ + +#include "pace/pthread.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/pthread.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/pthread.h b/PACE/pace/vxworks/pthread.h new file mode 100644 index 00000000000..c6fcc73cfb0 --- /dev/null +++ b/PACE/pace/vxworks/pthread.h @@ -0,0 +1,97 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/pthread.h + * + * = AUTHOR + * Joe Hoffert. The *VAST* majority of the pthread code for VxWorks + * has been supplied by Hughes Network Systems via Braeton Taylor. + * + * ============================================================================ */ + +#ifndef PACE_PTHREAD_H_VXWORKS +#define PACE_PTHREAD_H_VXWORKS + +#include <taskLib.h> +#include <taskHookLib.h> +#include <intLib.h> +#include <errnoLib.h> +#include "pace/sys/types.h" +#include "pace/signal.h" + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#define PACE_PTHREAD_CANCELED PTHREAD_CANCELED +#define PACE_PTHREAD_CANCEL_AYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS +#define PACE_PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED +#define PACE_PTHREAD_CACEL_DISABLE PTHREAD_CANCEL_DISABLE +#define PACE_PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE +#define PACE_PTHREAD_COND_INITIALIZER PTHREAD_COND_INITIALIZER +#define PACE_PTHREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED +#define PACE_PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE +#define PACE_PTHREAD_EXPLICIT_SCHED PTHREAD_EXPLICIT_SCHED +#define PACE_PTHREAD_INHERIT_SCHED PTHREAD_INHERIT_SCHED +#define PACE_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER +#define PACE_PTHREAD_ONCE_INIT PTHREAD_ONCE_INIT +#define PACE_PTHREAD_PRIO_INHERIT PTHREAD_PRIO_INHERIT +#define PACE_PTHREAD_PRIO_NONE PTHREAD_PRIO_NONE +#define PACE_PTHREAD_PRIO_PROTECT PTHREAD_PRIO_PROTECT +#define PACE_PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE +#define PACE_PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED +#define PACE_PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_PROCESS +#define PACE_PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_SYSTEM + +#ifndef PACE_SCHED_PARAM +#define PACE_SCHED_PARAM + typedef struct sched_param pace_sched_param; +#endif /* PACE_SCHED_PARAM */ + +#if defined (PACE_HAS_CPLUSPLUS) +# ifndef PACE_ATFORK_PF +# define PACE_ATFORK_PF + typedef void (*pace_atfork_pf) (void); +# endif /* PACE_ATFORK_PF */ + +# ifndef PACE_KEYCREATE_PF +# define PACE_KEYCREATE_PF + typedef void (*pace_keycreate_pf) (void*); +# endif /* PACE_KEYCREATE_PF */ + +# ifndef PACE_ONCE_PF +# define PACE_ONCE_PF + typedef void (*pace_once_pf) (void); +# endif /* PACE_ONCE_PF */ + +# ifndef PACE_CREATE_PF +# define PACE_CREATE_PF + typedef void* (*pace_create_pf) (void*); +# endif /* PACE_CREATE_PF */ + +#endif /* PACE_HAS_CPLUPLUS */ + + /* + * VxWorks helper functions + */ +#if (PACE_HAS_POSIX_NONUOF_FUNCS) + PACE_INLINE int pthread_verify(pace_pthread_t pthread); + PACE_INLINE void pthread_run_cleanup (WIND_TCB *pTcb); + PACE_INLINE int pthread_queue_add(pace_pthread_t pthread); + PACE_INLINE int pthread_queue_remove(pace_pthread_t pthread); + PACE_INLINE void pthread_cleanup_popall(pace_pthread_t thread); + PACE_INLINE void pthread_destructor_thread(pace_pthread_t pthread); + PACE_INLINE int pthread_key_validate(pace_pthread_key_t key); + PACE_INLINE void pthread_destructor_key(pace_pthread_key_t key, void * arg); +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_PTHREAD_H_VXWORKS */ diff --git a/PACE/pace/vxworks/pthread.inl b/PACE/pace/vxworks/pthread.inl new file mode 100644 index 00000000000..356c1cfe5ec --- /dev/null +++ b/PACE/pace/vxworks/pthread.inl @@ -0,0 +1,1817 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/pthread.inl + * + * = AUTHOR + * Joe Hoffert. The *VAST* majority of the pthread code for VxWorks + * has been supplied by Hughes Network Systems via Braeton Taylor. + * + * + * ============================================================================= */ + +#include "pace/unistd.h" + +/* pthread queue */ +static pthread_q_entry pthread_queue[PTHEAD_QUEUE_MAX_LEN]; +static pthread_q_entry * first, *current; +static int pthread_count = 0; +static pthread_q_entry * pthread_queue_get_entry(); +static initialized = 0; + +pthread_key_entry keyList[PTHREAD_KEYS_MAX]; + +/* + * The defaut pthread attr structure, if calling task + * does not pass attr, this default will be used + */ +struct _PTHREAD_ATTR _pthread_attr_default_s = +{ + 10000, /* stacksize */ + { '\0' }, /* name */ + {100}, /* priority */ + PTHREAD_SCOPE_SYSTEM, /* scope */ + SCHED_FIFO, /* indirect function */ + PTHREAD_CREATE_DETACHED /* detached */ +}; + +/* global default access */ +pace_pthread_attr_t pthread_attr_default = &_pthread_attr_default_s; + + +/* + * VxWorks Helper Functions + */ + + +/* + * Get a free entry from the pthread queue. + */ +pthread_q_entry * pthread_queue_get_entry() +{ + int i; + for (i = 0; i<PTHEAD_QUEUE_MAX_LEN; i++) + { + if (pthread_queue[i].status == FALSE) + return &pthread_queue[i]; + } + + /* error condition, can alloc more in future */ + return NULL; +} + +/* + * Run the destructor functions for the specific data key + */ +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +void +pthread_destructor_key(pace_pthread_key_t key, void * arg) +{ + if (pthread_key_validate(key)) + { + if (keyList[key].destructor != NULL) + (*(keyList[key].destructor))(arg); + } +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +/* + * Run the destructor functions for the thread + * For each key value, if there is a non-NULL destructor pointer, + * and the thread has a non-NULL value associated with that key, + * the function pointed to is called with the current associated + * value as its sole argument. + * + * return: none. + */ +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +void +pthread_destructor_thread(pace_pthread_t pthread) +{ + int i; + + for (i = 0; i < PTHREAD_KEYS_MAX; i ++) + { + if (pthread->keyvaluelist[i] != NULL) + pthread_destructor_key(i, pthread->keyvaluelist[i]); + } +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +/* + * General exit processing. + */ +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +static void pthread_proc_exit(pace_pthread_t pthread, void *value_ptr) +{ + int key; + int needgive = 0; + + pthread_cleanup_popall(pthread); + + /* thread storage data cleanup is automatically*/ + pthread_destructor_thread(pthread); + + /* joinable or detached */ + if(pthread->detachflag == PTHREAD_CREATE_DETACHED) + { + free(pthread); + } + else + { + key = intLock(); + + /* pass the value */ + pthread->joinvalue = value_ptr; + + switch(pthread->joinstate) + { + case JOIN_PENDING: + pthread->joinstate = JOIN_TERMINATED; + needgive = 1; + break; + case JOIN_NORMAL: + default: + pthread->joinstate = JOIN_TERMINATED; + break; + } + intUnlock(key); + + /* unblock the calling thread */ + if(needgive) + semGive(((pace_pthread_t)(pthread->jointhread))->joinSem); + } +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pthread_verify(pace_pthread_t pthread) +{ + int key; + pthread_q_entry * entry; + + key = intLock(); + + /* if queue is empty */ + if (first == NULL) + { + intUnlock(key); + return ERROR; + } + + entry = first; /* get the first one */ + + while (entry != NULL) + { + if (entry->pthread == pthread) + { + intUnlock(key); + return TRUE; + } + entry = entry->next; + } + + intUnlock(key); + + return FALSE; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +/* + * The cleanup routine that will be called if the task get deleted. + */ +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +void +pthread_run_cleanup (WIND_TCB *pTcb) /* pointer to deleted task's WIND_TCB */ +{ + pace_pthread_t pthread; + + /* free thread tcb only*/ + if (pTcb->_USER_SPARE4 != 0) + { + pthread = (pace_pthread_t) pTcb->_USER_SPARE4; + + pthread_proc_exit(pthread, NULL); + } +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +/* + * Add to the pthread queue. + */ +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pthread_queue_add(pace_pthread_t pthread) +{ + int key; + pthread_q_entry * entry; + + key = intLock(); + + if ((entry = pthread_queue_get_entry()) != NULL) + { + entry->status = TRUE; + entry->pthread = pthread; + + if (first == NULL) + { + first = entry; + current = entry; + } + else + { + current->next = entry; + current = entry; + } + pthread_count ++; + intUnlock(key); + return OK; + } + + intUnlock(key); + return ERROR; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +/* + * Remove an entry to the pthread queue. + */ +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pthread_queue_remove(pace_pthread_t pthread) +{ + int key; + pthread_q_entry * entry1; + pthread_q_entry * entry2; + + key = intLock(); + + if (first == NULL) + { + intUnlock(key); + return ERROR; + } + + /* if it is the first one, simple */ + if (first->pthread == pthread) + { + first->status = FALSE; + first->pthread = NULL; + + entry1 = first->next; + + first->next = NULL; + + /* if it is the only one */ + if (current == first) + current = entry1; + + first = entry1; + + intUnlock(key); + return OK; + } + + /* else */ + + entry1 = first; + entry2 = entry1->next; + + while (entry2 != NULL) + { + if (entry2->pthread == pthread) + { + if (current == entry2) + current = entry1; + + entry1->next = entry2->next; /* remove the node */ + + /* set invalid and put back to the list */ + entry2->status = FALSE; + entry2->pthread = NULL; + entry2->next = NULL; + intUnlock(key); + return OK; + } + entry1 = entry2; + entry2 = entry2->next; + } + + intUnlock(key); + return ERROR; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +/* + * Run the rest of cleanup routines left in the stack. + */ +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +void +pthread_cleanup_popall(pace_pthread_t thread) +{ + int count; + int i; + + count = thread->rtnCount - 1; + for (i = count; i > 0 ; i--) + { + thread->rtnCount --; + (*(thread->cleanupRtn[i].routine))(thread->cleanupRtn[i].args); + } +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +/* + * Validate the key to see if the key is already created (valid) + */ +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pthread_key_validate(pace_pthread_key_t key) +{ + int intkey; + + intkey = intLock(); + + if (keyList[key].valid) + { + intUnlock(intkey); + return TRUE; + } + else + { + intUnlock(intkey); + return FALSE; + } +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + + + +/* + * PACE - POSIX Functions + */ + + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +# if defined (PACE_HAS_CPLUSPLUS) +PACE_INLINE +int +pace_pthread_atfork (pace_atfork_pf prepare, + pace_atfork_pf parent, + pace_atfork_pf child) +{ + /* + * In VxWorks, there is only one process. + */ + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +# else /* ! PACE_HAS_CPLUSPLUS */ +PACE_INLINE +int +pace_pthread_atfork (void (*prepare) (), + void (*parent) (), + void (*child) ()) +{ + /* + * In VxWorks, there is only one process. + */ + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +# endif /* PACE_HAS_CPLUSPLUS */ +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_attr_destroy (pace_pthread_attr_t * attr) +{ + /* + * Free memory allocated to the attributes object. + */ + if ((*attr) == 0) + return ERROR; + + free ((char *) *attr); + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_attr_getdetachstate (const pace_pthread_attr_t * attr, + int * detachstate) +{ + *detachstate = (*attr)->dstate; + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_attr_getinheritsched (const pace_pthread_attr_t * attr, + int * inheritsched) +{ + /* + * Get the priority inheritence of the thread attribute structure. + * Only PTHREAD_EXPLICIT_SCHED is returned. + */ + *inheritsched = PTHREAD_EXPLICIT_SCHED; + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_attr_getschedparam (const pace_pthread_attr_t * attr, + pace_sched_param * param) +{ + param->sched_priority = (*attr)->schedule.sched_priority; + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_attr_getschedpolicy (const pace_pthread_attr_t * attr, + int * policy) +{ + /* + * VxWorks only supports SCHED_FIFO. + */ + + *policy = SCHED_FIFO; + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_attr_getscope (const pace_pthread_attr_t * attr, + int * contentionscope) +{ + /* + * Since all VxWorks tasks are system wide scope, + * no support for the scope except for PTHREAD_SCOPE_SYSTEM + */ + + *contentionscope = PTHREAD_SCOPE_SYSTEM; + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_attr_getstackaddr (const pace_pthread_attr_t * attr, + void ** stackaddr) +{ + /* + * VxWorks has no support for stack address getting + */ + + return ERROR; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_attr_getstacksize (const pace_pthread_attr_t * attr, + size_t * stacksize) +{ + if (*attr == 0) + return ERROR; + + *stacksize = (*attr)->stacksize; + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_attr_init (pace_pthread_attr_t * attr) +{ + /* + * Attempt to allocate memory for the attributes object. + */ + + if ((*attr = (pace_pthread_attr_t) malloc(sizeof(struct _PTHREAD_ATTR))) + == NULL) + { + return ERROR; + } + + /* + * Set the default attributes. + */ + + memcpy ((void *)(*attr), (void *)pthread_attr_default, + sizeof(struct _PTHREAD_ATTR)); + + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_attr_setdetachstate (pace_pthread_attr_t * attr, + int detachstate) +{ + if ((detachstate != PTHREAD_CREATE_DETACHED) || + (detachstate != PTHREAD_CREATE_JOINABLE)) + { + (*attr)->dstate = PTHREAD_CREATE_DETACHED; + return ERROR; + } + + (*attr)->dstate = detachstate; + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_attr_setinheritsched (pace_pthread_attr_t * attr, + int inheritsched) +{ + /* + * For VxWorks, no inheritance of priority between the spawning task + * and the spawned task. Only PTHREAD_EXPLICIT_SCHED is supported. + */ + if (inheritsched == PTHREAD_EXPLICIT_SCHED) + { + return OK; + } + + return ERROR; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_attr_setschedparam (pace_pthread_attr_t * attr, + const pace_sched_param * param) +{ + /* range check */ + if (param->sched_priority > SCHED_RR_HIGH_PRI || + param->sched_priority < SCHED_RR_LOW_PRI ) + { + return ERROR; + } + + (*attr)->schedule.sched_priority = param->sched_priority; + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_attr_setschedpolicy (pace_pthread_attr_t * attr, + int policy) +{ + /* + * In VxWorks, the schedule policy is set in system scope, + * the whole system is running with one single scheduler, and + * is always pre-emptive priority based. The system wide + * scheduler can only be changed by kernelTimeSlice() + * + * To maintain the RTOS characteristics, only SCHED_FIFO is + * supported. + */ + if (policy != SCHED_FIFO) + return ERROR; + else + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_attr_setscope (pace_pthread_attr_t * attr, + int contentionscope) +{ + /* + * Since all VxWorks tasks are system wide scope, + * no support for the scope except for PTHREAD_SCOPE_SYSTEM + */ + if (contentionscope != PTHREAD_SCOPE_SYSTEM) + return ERROR; + else + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_attr_setstackaddr (pace_pthread_attr_t * attr, + void * stackaddr) +{ + /* + * VxWorks does not support stack address setting. + */ + return ERROR; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_attr_setstacksize (pace_pthread_attr_t * attr, + size_t stacksize) +{ + /* + * Default size will be assigned if the stacksize is 0 + */ + if (*attr == 0) return ERROR; + + if (stacksize != 0) + (*attr)->stacksize = stacksize; + else + (*attr)->stacksize = PTHREAD_DEFAULT_STACK_SIZE; + + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_cancel (pace_pthread_t thread) +{ + /* + * In VxWorks, to cancel a thread is to delete a task. + */ + if (!pthread_verify(thread)) + return ESRCH; + + if (taskIdVerify(thread->tid) == ERROR) /* already exit, never happen */ + return ERROR; + + if (thread->stateflag == PTHREAD_CANCEL_DISABLE) + return ERROR; + else + return (taskDelete(thread->tid)); +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_cond_broadcast (pace_pthread_cond_t * cond) +{ + /* + * This call unblocks all the threads that are blocked + * on the specified condition variable cond. + */ + return semFlush(*cond); +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_cond_destroy (pace_pthread_cond_t * cond) +{ + if (*cond != NULL) + return semDelete(*cond); + + return EINVAL; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_cond_init (pace_pthread_cond_t * cond, + const pace_pthread_condattr_t * attr) +{ + *cond = semBCreate(SEM_Q_PRIORITY, SEM_FULL); + if (*cond == NULL) + return ERROR; + + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_cond_signal (pace_pthread_cond_t * cond) +{ + return semGive(*cond); +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_cond_timedwait (pace_pthread_cond_t * cond, + pace_pthread_mutex_t * mutex, + const pace_timespec * abstime) +{ + STATUS status; + int timeval = 0; + int errornumber, returnval = 0; + + if (pace_pthread_mutex_unlock(mutex) != OK) return ERROR; + + /* convert the abstime to timeval */ + status = semTake(*cond, timeval); + + if (status != OK) + { + errornumber = errnoGet(); + if (errornumber == S_objLib_OBJ_ID_ERROR) + returnval = EINVAL; + else if (errornumber == S_objLib_OBJ_TIMEOUT) + returnval = ETIMEDOUT; + else + returnval = ERROR; + } + + pace_pthread_mutex_lock(mutex); + + return returnval; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_cond_wait (pace_pthread_cond_t * cond, + pace_pthread_mutex_t * mutex) +{ + STATUS status; + int errornumber; + int returnval = 0; + + if (pace_pthread_mutex_unlock(mutex) != OK) + return ERROR; + + status = semTake(*cond, WAIT_FOREVER); + + if(status != OK) + { + errornumber = errnoGet(); + if (errornumber == S_objLib_OBJ_ID_ERROR) + returnval = EINVAL; + else + returnval = ERROR; + } + + pace_pthread_mutex_lock(mutex); + + return returnval; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_condattr_destroy (pace_pthread_condattr_t * attr) +{ + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_condattr_getpshared (const pace_pthread_condattr_t * attr, + int * pshared) +{ + /* + * All the resources in present VxWorks are shared system wide. + */ + *pshared = PTHREAD_PROCESS_SHARED; + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_condattr_init (pace_pthread_condattr_t * attr) +{ + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_condattr_setpshared (pace_pthread_condattr_t * attr, + int pshared) +{ + /* + * All the resources in present VxWorks are shared system wide. + */ + if (pshared != PTHREAD_PROCESS_SHARED) + return ERROR; + + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +# if defined (PACE_HAS_CPLUSPLUS) +PACE_INLINE +int +pace_pthread_create (pace_pthread_t * thread, + const pace_pthread_attr_t * attr, + pace_create_pf start_routine, + void * arg) +{ + pthread_attr_t pattr; + char * pname; + int taskid; + pace_pthread_t pthread; + WIND_TCB * pTcb; + + if (attr == 0) + pattr = pthread_attr_default; + else + if (*attr == 0) + pattr = pthread_attr_default; + else + pattr = *attr; + + if (pattr->name[0] != '\0') /* name is provided */ + pname = pattr->name; + else + pname = (char *)0; + + taskid = taskSpawn(pname, + (SCHED_FIFO_HIGH_PRI - pattr->schedule.sched_priority), + VX_FP_TASK, pattr->stacksize, (FUNCPTR)start_routine, + (int)arg, 0,0,0,0,0,0,0,0,0); + if (taskid == ERROR) + return ERROR; + + if ((pTcb = taskTcb(taskid)) == NULL) + { + taskDelete(taskid); + return ERROR; + } + + pthread = (pace_pthread_t )malloc(sizeof(struct _PTHREAD_T)); + + if(pthread == NULL) + { + taskDelete(taskid); + return ERROR; + } + + /* construct pace_pthread_t structure */ + + bzero((char *)pthread, sizeof(struct _PTHREAD_T)); + pthread->tid = taskid; + pthread->stateflag = PTHREAD_CANCEL_ENABLE; + pthread->canceltype = PTHREAD_CANCEL_ASYNCHRONOUS; + pthread->detachflag = pattr->dstate; + + /* initialize the join semaphore also */ + if ((pthread->joinSem = semBCreate(SEM_Q_PRIORITY, SEM_EMPTY)) == NULL) + { + free((void *)pthread); + taskDelete(taskid); + return ERROR; + } + + /* pass it to the caller */ + *thread = pthread; + + /* save to the WIND_TCB for reference afterward */ + pTcb->_USER_SPARE4 = (int) pthread; + + taskDeleteHookAdd((FUNCPTR)pthread_run_cleanup); + + pthread_queue_add(pthread); + + return OK; +} +# else /* ! PACE_HAS_CPLUSPLUS */ +PACE_INLINE +int +pace_pthread_create (pace_pthread_t * thread, + const pace_pthread_attr_t * attr, + void * (*start_routine) (void*), + void * arg) +{ + pace_pthread_attr_t pattr; + char * pname; + int taskid; + pace_pthread_t pthread; + WIND_TCB * pTcb; + + if (attr == 0) + pattr = pthread_attr_default; + else + if (*attr == 0) + pattr = pthread_attr_default; + else + pattr = *attr; + + if (pattr->name[0] != '\0') /* name is provided */ + pname = pattr->name; + else + pname = (char *)0; + + taskid = taskSpawn(pname, + (SCHED_FIFO_HIGH_PRI - pattr->schedule.sched_priority), + VX_FP_TASK, pattr->stacksize, (FUNCPTR)start_routine, + (int)arg, 0,0,0,0,0,0,0,0,0); + if (taskid == ERROR) + return ERROR; + + if ((pTcb = taskTcb(taskid)) == NULL) + { + taskDelete(taskid); + return ERROR; + } + + pthread = (pace_pthread_t )malloc(sizeof(struct _PTHREAD_T)); + + if(pthread == NULL) + { + taskDelete(taskid); + return ERROR; + } + + /* construct pace_pthread_t structure */ + + bzero((char *)pthread, sizeof(struct _PTHREAD_T)); + pthread->tid = taskid; + pthread->stateflag = PTHREAD_CANCEL_ENABLE; + pthread->canceltype = PTHREAD_CANCEL_ASYNCHRONOUS; + pthread->detachflag = pattr->dstate; + + /* initialize the join semaphore also */ + if ((pthread->joinSem = semBCreate(SEM_Q_PRIORITY, SEM_EMPTY)) == NULL) + { + free((void *)pthread); + taskDelete(taskid); + return ERROR; + } + + /* pass it to the caller */ + *thread = pthread; + + /* save to the WIND_TCB for reference afterward */ + pTcb->_USER_SPARE4 = (int) pthread; + + taskDeleteHookAdd((FUNCPTR)pthread_run_cleanup); + + pthread_queue_add(pthread); + + return OK; +} +# endif /*! PACE_HAS_CPLUSPLUS */ +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_detach (pace_pthread_t thread) +{ + int key; + int needfree; + needfree = 0; + + if (!pthread_verify(thread)) + return EINVAL; + + key = intLock(); + + switch (thread->joinstate) + { + /* task is joined, or detached, but still running, do nothing */ + case JOIN_PENDING: + case JOIN_DETATCHED: + intUnlock(key); + return OK; + break; + case JOIN_NORMAL: /* task is running */ + thread->joinstate = JOIN_DETATCHED; + break; + case JOIN_TERMINATED: + needfree = 1; + break; + default: + break; + } + + intUnlock(key); + + if (needfree) + { + pthread_queue_remove(thread); + free(thread); + } + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_equal (pace_pthread_t t1, pace_pthread_t t2) +{ + if (pthread_verify(t1) && pthread_verify(t2)) + { + if (t1->tid != t2->tid) + return 0; + } + + return 1; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +void +pace_pthread_exit (void * value_ptr) +{ + /* + * Normal thread exit. All the cleanup routine will be popped, if any. + * If the thread is detached, free the storage; otherwise wait for join. + */ + pace_pthread_t pthread; + + if ((pthread = pace_pthread_self()) != NULL) + { + pthread_proc_exit(pthread, value_ptr); + + exit(0); + } + exit(-1); +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_getschedparam (pace_pthread_t thread, + int * policy, + pace_sched_param * param) +{ + if (thread == 0) + return ERROR; + + *policy = sched_getscheduler(thread->tid); + + if (sched_getparam(thread->tid, param) == OK) + { + /* convert VxWorks priority to POSIX priority */ + param->sched_priority = SCHED_FIFO_HIGH_PRI - param->sched_priority; + return OK; + } + + return ERROR; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +void * +pace_pthread_getspecific (pace_pthread_key_t key) +{ + pace_pthread_t pthread; + + if (!pthread_key_validate(key)) + return NULL; + + if ((pthread = pace_pthread_self()) != NULL) + { + return pthread->keyvaluelist[key]; + } + + return NULL; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_join (pace_pthread_t thread, void ** value_ptr) +{ + /* + * The pthread_join() function suspends execution of the calling + * thread until the target thread terminates, unless the target + * thread has already terminated. + * The terminating thread can pass value to the caller by + * pthread_exit() and the calling thread gets it from "value_ptr" + * The application must verify the "value_ptr" value before using it. + */ + pace_pthread_t pthread; + int needfree; + int key; + + if (!pthread_verify(thread)) + return ERROR; + + if (thread->detachflag != PTHREAD_CREATE_JOINABLE) + return ERROR; + + if ((pthread = pace_pthread_self()) == NULL) + return ERROR; + + needfree = 0; + + key = intLock(); + switch (thread->joinstate) + { + case JOIN_NORMAL: + thread->jointhread = pthread; + thread->joinstate = JOIN_PENDING; + break; + case JOIN_TERMINATED: + needfree = 1; + break; + case JOIN_PENDING: + default: + intUnlock(key); + return ERROR; + } + intUnlock(key); + + if (needfree) + { + *value_ptr = thread->joinvalue; + pthread_queue_remove(thread); + free(thread); + return OK; + } + + /* if we are here, thread is not terminated yet */ + + semTake(pthread->joinSem, WAIT_FOREVER); + + /* cleanup */ + *value_ptr = thread->joinvalue; + pthread_queue_remove(thread); + free(thread); + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +# if defined (PACE_HAS_CPLUSPLUS) +PACE_INLINE +int +pace_pthread_key_create (pace_pthread_key_t * key, + pace_keycreate_pf destructor) +{ + /* + * Create a thread-specific data key. Also initialize the + * data structure if it is called first time. + */ + int i; + int intkey; + + /* do the initialization if it is the first time */ + if (initialized == 0) + { + initialized = 1; + + /* initialize the data structure */ + for (i = 0; i < PTHREAD_KEYS_MAX; i++) + { + keyList[i].index = i; + keyList[i].valid = FALSE; + keyList[i].destructor = NULL; + } + } + + /* find first available position */ + intkey = intLock(); + for (i = 0; i < PTHREAD_KEYS_MAX; i++) + { + if(keyList[i].valid == FALSE) + { + *key = (pthread_key_t)keyList[i].index; + keyList[i].valid = TRUE; + keyList[i].destructor = destructor; + intUnlock(intkey); + return OK; + } + } + + intUnlock(intkey); + return ERROR; +} +#else /* ! PACE_HAS_CPLUSPLUS */ +PACE_INLINE +int +pace_pthread_key_create (pace_pthread_key_t * key, + void (*destructor)(void*)) +{ + /* + * Create a thread-specific data key. Also initialize the + * data structure if it is called first time. + */ + int i; + int intkey; + + /* do the initialization if it is the first time */ + if (initialized == 0) + { + initialized = 1; + + /* initialize the data structure */ + for (i = 0; i < PTHREAD_KEYS_MAX; i++) + { + keyList[i].index = i; + keyList[i].valid = FALSE; + keyList[i].destructor = NULL; + } + } + + /* find first available position */ + intkey = intLock(); + for (i = 0; i < PTHREAD_KEYS_MAX; i++) + { + if(keyList[i].valid == FALSE) + { + *key = (pace_pthread_key_t)keyList[i].index; + keyList[i].valid = TRUE; + keyList[i].destructor = destructor; + intUnlock(intkey); + return OK; + } + } + + intUnlock(intkey); + return ERROR; +} +# endif /* PACE_HAS_CPLUSPLUS */ +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_key_delete (pace_pthread_key_t key) +{ + int intkey; + + if ((key < 0) || (key >= PTHREAD_KEYS_MAX)) + return ERROR; + + intkey = intLock(); + + keyList[key].valid = FALSE; + keyList[key].destructor = NULL; + + intUnlock(intkey); + + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_kill (pace_pthread_t thread, int sig) +{ + if (pthread_verify(thread)) + return kill(thread->tid, sig); + else + return EINVAL; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_mutex_destroy (pace_pthread_mutex_t * mutex) +{ + if (*mutex != NULL) + return semDelete(*mutex); + + return EINVAL; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_mutex_getprioceiling (pace_pthread_mutex_t * mutex, + int * prioceiling) +{ + /* + * Mutex priority is not supported in VxWorks; + * it depends on the thread using it and has the same priority + * ceiling as this thread (SCHED_RR_HIGH_PRI). + */ + *prioceiling = SCHED_RR_HIGH_PRI; + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_mutex_init (pace_pthread_mutex_t * mutex, + const pace_pthread_mutexattr_t * attr) +{ + /* + * Initialises the mutex referenced by mutex with attributes + * specified by attr. If attr is NULL, the default mutex + * attributes are used. + */ + int options = 0; + + if (attr != NULL) + { + if((*attr)->protocol == PTHREAD_PRIO_INHERIT) + options = SEM_INVERSION_SAFE; + } + + *mutex = semMCreate(options); + if (*mutex == NULL) + return ERROR; + + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_mutex_lock (pace_pthread_mutex_t * mutex) +{ + STATUS status; + int errornumber; + + status = semTake(*mutex, WAIT_FOREVER); + if (status == OK) + return OK; + else + { + errornumber = errnoGet(); + if (errornumber == S_objLib_OBJ_ID_ERROR) + return EINVAL; + + return ERROR; + } +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_mutex_setprioceiling (pace_pthread_mutex_t * mutex, + int prioceiling, + int * old_ceiling) +{ + /* + * Mutex priority is not supported in VxWorks; + * it depends on the thread using it and has the same priority + * ceiling as this thread (SCHED_RR_HIGH_PRI). + */ + *old_ceiling = SCHED_RR_HIGH_PRI; + + if (prioceiling != SCHED_RR_HIGH_PRI) + return ERROR; + + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_mutex_trylock (pace_pthread_mutex_t * mutex) +{ + STATUS status; + int errornumber; + + status = semTake(*mutex, NO_WAIT); + if (status == OK) + return OK; + else + { + errornumber = errnoGet(); + if (errornumber == S_objLib_OBJ_ID_ERROR) + return EINVAL; + if (errornumber == S_objLib_OBJ_UNAVAILABLE) + return EBUSY; + + return ERROR; + } +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_mutex_unlock (pace_pthread_mutex_t * mutex) +{ + STATUS status; + int errornumber; + + status = semGive(*mutex); + if (status == OK) + return OK; + else + { + errornumber = errnoGet(); + if (errornumber == S_semLib_INVALID_OPERATION) + return EPERM; + + return ERROR; + } +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_mutexattr_destroy (pace_pthread_mutexattr_t * attr) +{ + free(*attr); + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_mutexattr_getprioceiling (pace_pthread_mutexattr_t * attr, + int * prioceiling) +{ + /* + * Mutex priority is not supported in VxWorks, + * it depends the thread using it and has the same priority + * ceiling as this thread (SCHED_RR_HIGH_PRI). + */ + *prioceiling = SCHED_RR_HIGH_PRI; + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_mutexattr_getprotocol (const pace_pthread_mutexattr_t * attr, + int * protocol) +{ +/* + * Does not support PTHREAD_PRIO_PROTECT for VxWorks + */ + if (attr == 0) + return EINVAL; + + *protocol = (*attr)->protocol; + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_mutexattr_setprioceiling (pace_pthread_mutexattr_t * attr, + int prioceiling) +{ + /* + * Mutex priority is not supported in VxWorks; + * it depends on the thread using it and has the same priority + * ceiling as this thread (SCHED_RR_HIGH_PRI). + */ + if (prioceiling == SCHED_RR_HIGH_PRI) + return OK; + else + return ERROR; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_mutexattr_setprotocol (pace_pthread_mutexattr_t * attr, + int protocol) +{ +/* + * Does not support PTHREAD_PRIO_PROTECT for VxWorks + */ + if ((protocol == PTHREAD_PRIO_NONE) || + (protocol == PTHREAD_PRIO_INHERIT )) + { + (*attr)->protocol = protocol; + return OK; + } + + return ERROR; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_mutexattr_getpshared (const pace_pthread_mutexattr_t * attr, + int * pshared) +{ + /* + * Only supports PTHREAD_PROCESS_SHARED + */ + *pshared = PTHREAD_PROCESS_SHARED; + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_mutexattr_init (pace_pthread_mutexattr_t * attr) +{ + /* + * Initializes a mutex attributes object attr with the + * default value for all of the attributes + */ + pace_pthread_mutexattr_t pattr; + pattr = (pace_pthread_mutexattr_t) malloc(sizeof(struct _PTHREAD_MUX_ATTR)); + if (pattr == NULL) + return ERROR; + + pattr->protocol = PTHREAD_PRIO_INHERIT; + pattr->shared = PTHREAD_PROCESS_SHARED; + pattr->type = PTHREAD_MUTEX_DEFAULT; + + *attr = pattr; + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_mutexattr_setpshared (pace_pthread_mutexattr_t * attr, + int pshared) +{ + /* + * Only supports PTHREAD_PROCESS_SHARED + */ + if (attr == 0) return EINVAL; + + if (pshared != PTHREAD_PROCESS_SHARED) + return ERROR; + else + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +# if defined (PACE_HAS_CPLUSPLUS) +PACE_INLINE +int +pace_pthread_once (pace_pthread_once_t * once_control, + pace_once_pf void_routine) +{ + /* + * Once function allows the function to be executed exact only once + * Subsequent calls of pthread_once() with the same once_control will + * not call the void_routine(). + */ + int i; + int key; + pace_pthread_t pthread; + + if ((pthread = pace_pthread_self()) == NULL) + return ERROR; + + /* make it atomic */ + key = intLock(); + + for (i = 0; i < pthread->onceCount; i++) + { + if (*once_control == pthread->onceList[i].once_ctl) + { + /* do nothing, already called */ + intUnlock(key); + return OK; + } + } + + /* if we are here, no match is found */ + pthread->onceList[pthread->onceCount].once_ctl = *once_control; + pthread->onceCount++; + intUnlock(key); + + /* run the init routine */ + (*void_routine)(); + return OK; +} +# else /* ! PACE_HAS_CPLUSPLUS */ +PACE_INLINE +int +pace_pthread_once (pace_pthread_once_t * once_control, + void (*void_routine) (void)) +{ + /* + * Once function allows the function to be executed exact only once + * Subsequent calls of pthread_once() with the same once_control will + * not call the void_routine(). + */ + int i; + int key; + pace_pthread_t pthread; + + if ((pthread = pace_pthread_self()) == NULL) + return ERROR; + + /* make it atomic */ + key = intLock(); + + for (i = 0; i < pthread->onceCount; i++) + { + if (*once_control == pthread->onceList[i].once_ctl) + { + /* do nothing, already called */ + intUnlock(key); + return OK; + } + } + + /* if we are here, no match is found */ + pthread->onceList[pthread->onceCount].once_ctl = *once_control; + pthread->onceCount++; + intUnlock(key); + + /* run the init routine */ + (*void_routine)(); + return OK; +} +# endif /* PACE_HAS_CPLUSPLUS */ +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +pace_pthread_t +pace_pthread_self () +{ + WIND_TCB *pTcb; + + if ((pTcb = taskTcb(taskIdSelf())) == NULL) + return (pace_pthread_t)NULL; + + return (pace_pthread_t)(pTcb->_USER_SPARE4); +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_setcancelstate (int state, int * oldstate) +{ + int key; + pace_pthread_t pthread; + + if ((state != PTHREAD_CANCEL_ENABLE) && + (state != PTHREAD_CANCEL_DISABLE)) + { + return ERROR; + } + + if ((pthread = pace_pthread_self()) == NULL) + return ERROR; + + key = intLock(); + *oldstate = pthread->stateflag; + pthread->stateflag = state; + intUnlock(key); + + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_setcanceltype (int type, int * oldtype) +{ + /* + * Only asychronouse type is supported + */ + pace_pthread_t pthread; + + if (type != PTHREAD_CANCEL_ASYNCHRONOUS) + return ERROR; + + if ((pthread = pace_pthread_self()) == NULL) + return ERROR; + + *oldtype = pthread->canceltype; + + return OK; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_setschedparam (pace_pthread_t thread, + int policy, + const pace_sched_param * param) +{ + /* + * Only priority can be changed. + */ + struct sched_param sparam; + + if (thread == 0) + return ERROR; + + if (policy != sched_getscheduler(thread->tid)) + return ERROR; + + /* convert POSIX priority to VxWorks priority */ + sparam.sched_priority = SCHED_FIFO_HIGH_PRI - param->sched_priority; + + return (sched_setparam(thread->tid, &sparam)); +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_setspecific (pace_pthread_key_t key, const void * value) +{ + pace_pthread_t pthread; + + if (!pthread_key_validate(key)) + return ERROR; + + if ((pthread = pace_pthread_self()) != NULL) + { + pthread->keyvaluelist[key] = PACE_NONCONST_ARG_CAST(void *) value; + return OK; + } + + return ERROR; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_pthread_sigmask (int how, const sigset_t * set, + sigset_t * oset) +{ + switch (how) + { + case SIG_BLOCK: + case SIG_UNBLOCK: + { + /* get the old mask */ + *oset = sigsetmask (*set); + /* create a new mask: the following assumes that sigset_t is 4 bytes, + * which it is on VxWorks 5.2, so bit operations are done simply . . . + */ + sigsetmask (how == SIG_BLOCK ? (*oset |= *set) : (*oset &= ~*set)); + break; + } + case SIG_SETMASK: + *oset = sigsetmask (*set); + break; + default: + return -1; + } + + return 0; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +void +pace_pthread_testcancel () +{ + return; +} +#endif /* PACE_HAS_NONUOF_FUNCS */ diff --git a/PACE/pace/vxworks/pwd.c b/PACE/pace/vxworks/pwd.c new file mode 100644 index 00000000000..08f623cb684 --- /dev/null +++ b/PACE/pace/vxworks/pwd.c @@ -0,0 +1,20 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/pwd.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/pwd.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/pwd.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/pwd.h b/PACE/pace/vxworks/pwd.h new file mode 100644 index 00000000000..4a2463658e5 --- /dev/null +++ b/PACE/pace/vxworks/pwd.h @@ -0,0 +1,34 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/pwd.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_PWD_H_VXWORKS +#define PACE_PWD_H_VXWORKS + +#include "pace/sys/types.h" + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#ifndef PACE_PASSWD +#define PACE_PASSWD + typedef struct passwd pace_passwd; +#endif /* PACE_PASSWD */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_PWD_H_VXWORKS */ diff --git a/PACE/pace/vxworks/pwd.inl b/PACE/pace/vxworks/pwd.inl new file mode 100644 index 00000000000..ef3e26e5dbf --- /dev/null +++ b/PACE/pace/vxworks/pwd.inl @@ -0,0 +1,74 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/pwd.inl + * + * = AUTHOR + * Luther Baker + * + * ============================================================================= */ + +#if (PACE_HAS_POSIX_SD_UOF) +PACE_INLINE +pace_passwd * +pace_getpwuid (pace_uid_t uid) +{ + /* getpwuid() is not supported: just one user anyways */ + PACE_UNUSED_ARG (uid); + return 0; +} +#endif /* PACE_HAS_POSIX_SD_UOF */ + +#if (PACE_HAS_POSIX_SDR_UOF) +PACE_INLINE +int +pace_getpwuid_r (pace_uid_t uid, + pace_passwd * pwd, + char * buffer, + pace_size_t bufsize, + pace_passwd ** result) +{ + /* getpwuid_r() is not supported: just one user anyways */ + PACE_UNUSED_ARG (uid); + PACE_UNUSED_ARG (pwd); + PACE_UNUSED_ARG (buffer); + PACE_UNUSED_ARG (bufsize); + PACE_UNUSED_ARG (result); + return 0; +} +#endif /* PACE_HAS_POSIX_SDR_UOF */ + +#if (PACE_HAS_POSIX_SD_UOF) +PACE_INLINE +pace_passwd * +pace_getpwnam (const char * name) +{ + /* getpwuid() is not supported: just one user anyways */ + PACE_UNUSED_ARG (name); + return 0; +} +#endif /* PACE_HAS_POSIX_SD_UOF */ + +#if (PACE_HAS_POSIX_SDR_UOF) +PACE_INLINE +int +pace_getpwnam_r (const char * name, + pace_passwd * pwd, + char * buffer, + pace_size_t bufsize, + pace_passwd ** result) +{ + /* getpwuid_r() is not supported: just one user anyways */ + PACE_UNUSED_ARG (name); + PACE_UNUSED_ARG (pwd); + PACE_UNUSED_ARG (buffer); + PACE_UNUSED_ARG (bufsize); + PACE_UNUSED_ARG (result); + return 0; +} +#endif /* PACE_HAS_POSIX_SDR_UOF */ diff --git a/PACE/pace/vxworks/sched.c b/PACE/pace/vxworks/sched.c new file mode 100644 index 00000000000..14a8857f86e --- /dev/null +++ b/PACE/pace/vxworks/sched.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/sched.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/sched.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/sched.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/sched.h b/PACE/pace/vxworks/sched.h new file mode 100644 index 00000000000..722b5953c95 --- /dev/null +++ b/PACE/pace/vxworks/sched.h @@ -0,0 +1,38 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/sched.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_SCHED_H_VXWORKS +#define PACE_SCHED_H_VXWORKS + +#include <sched.h> +#include "pace/time.h" + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#define PACE_SCHED_FIFO SCHED_FIFO +#define PACE_SCHED_OTHER SCHED_RR + +#ifndef PACE_SCHED_PARAM +#define PACE_SCHED_PARAM + typedef struct sched_param pace_sched_param; +#endif /* PACE_SCHED_PARAM */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_SCHED_H_VXWORKS */ diff --git a/PACE/pace/vxworks/sched.inl b/PACE/pace/vxworks/sched.inl new file mode 100644 index 00000000000..0db7d7620f5 --- /dev/null +++ b/PACE/pace/vxworks/sched.inl @@ -0,0 +1,91 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/sched.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sched_get_priority_max (int policy) +{ + return sched_get_priority_max (policy); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sched_get_priority_min (int policy) +{ + return sched_get_priority_min (policy); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sched_getparam (pace_pid_t pid, + pace_sched_param * param) +{ + return sched_getparam (pid, param); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sched_rr_get_interval (pace_pid_t pid, + pace_timespec * interval) +{ + return sched_rr_get_interval (pid, interval); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sched_setparam (pace_pid_t pid, + const pace_sched_param * param) +{ + return sched_setparam (pid, param); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sched_getscheduler (pace_pid_t pid) +{ + return sched_getscheduler (pid); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sched_setscheduler (pace_pid_t pid, + int policy, + const pace_sched_param * param) +{ + return sched_setscheduler (pid, policy, param); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sched_yield () +{ + return sched_yield (); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ diff --git a/PACE/pace/vxworks/semaphore.c b/PACE/pace/vxworks/semaphore.c new file mode 100644 index 00000000000..f4d56e89543 --- /dev/null +++ b/PACE/pace/vxworks/semaphore.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/semaphore.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/semaphore.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/semaphore.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/semaphore.h b/PACE/pace/vxworks/semaphore.h new file mode 100644 index 00000000000..f5a0a97d05a --- /dev/null +++ b/PACE/pace/vxworks/semaphore.h @@ -0,0 +1,31 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/semaphore.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_SEMAPHORE_H_VXWORKS +#define PACE_SEMAPHORE_H_VXWORKS + +#include <semaphore.h> + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +typedef sem_t pace_sem_t; + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_SEMAPHORE_H_VXWORKS */ diff --git a/PACE/pace/vxworks/semaphore.inl b/PACE/pace/vxworks/semaphore.inl new file mode 100644 index 00000000000..beb5328d1aa --- /dev/null +++ b/PACE/pace/vxworks/semaphore.inl @@ -0,0 +1,86 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/semaphore.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sem_close (pace_sem_t * sem) +{ + return sem_close (sem); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sem_destroy (pace_sem_t * sem) +{ + return sem_destroy (sem); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sem_getvalue (pace_sem_t * sem, int * sval) +{ + return sem_getvalue (sem, sval); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sem_init (pace_sem_t * sem, int pshared, unsigned int value) +{ + return sem_init (sem, pshared, value); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sem_post (pace_sem_t * sem) +{ + return sem_post (sem); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sem_trywait (pace_sem_t * sem) +{ + return sem_trywait (sem); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sem_unlink (const char * name) +{ + return sem_unlink (name); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sem_wait (pace_sem_t * sem) +{ + return sem_wait (sem); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ diff --git a/PACE/pace/vxworks/setjmp.c b/PACE/pace/vxworks/setjmp.c new file mode 100644 index 00000000000..e2248f0389b --- /dev/null +++ b/PACE/pace/vxworks/setjmp.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/setjmp.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/setjmp.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/setjmp.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/setjmp.h b/PACE/pace/vxworks/setjmp.h new file mode 100644 index 00000000000..5c0f8b57751 --- /dev/null +++ b/PACE/pace/vxworks/setjmp.h @@ -0,0 +1,33 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/setjmp.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_SETJMP_H_VXWORKS +#define PACE_SETJMP_H_VXWORKS + +#include <types/vxTypesOld.h> +#include <setjmp.h> + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + + typedef jmp_buf pace_jmp_buf; + typedef sigjmp_buf pace_sigjmp_buf; + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_SETJMP_H_VXWORKS */ diff --git a/PACE/pace/vxworks/setjmp.inl b/PACE/pace/vxworks/setjmp.inl new file mode 100644 index 00000000000..cd86befa688 --- /dev/null +++ b/PACE/pace/vxworks/setjmp.inl @@ -0,0 +1,34 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/setjmp.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +void +pace_longjmp (pace_jmp_buf env, int val) +{ + longjmp (env, val); + return; +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_SIG_UOF) +PACE_INLINE +void +pace_siglongjmp (pace_sigjmp_buf env, int val) +{ + siglongjmp (env, val); + return; +} +#endif /* PACE_HAS_POSIX_SIG_UOF */ diff --git a/PACE/pace/vxworks/signal.c b/PACE/pace/vxworks/signal.c new file mode 100644 index 00000000000..b7b840f3539 --- /dev/null +++ b/PACE/pace/vxworks/signal.c @@ -0,0 +1,28 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/signal.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/signal.h" + +#if (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/signal.inl" +#endif /* ! PACE_HAS_INLINE */ + +#if (PACE_HAS_CPLUSPLUS) +} +#endif diff --git a/PACE/pace/vxworks/signal.h b/PACE/pace/vxworks/signal.h new file mode 100644 index 00000000000..9b4343559a8 --- /dev/null +++ b/PACE/pace/vxworks/signal.h @@ -0,0 +1,71 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/signal.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#ifndef PACE_SIGNAL_H_VXWORKS +#define PACE_SIGNAL_H_VXWORKS + +#include <signal.h> +#include "pace/sys/types.h" +#include "pace/time.h" + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#ifndef PACE_SIG_PF +# define PACE_SIG_PF + typedef void (*pace_sig_pf)(int); +#endif /* PACE_SIG_PF */ + +#ifndef PACE_SIG_ATOMIC_T +#define PACE_SIG_ATOMIC_T + typedef sig_atomic_t pace_sig_atomic_t; +#endif /* PACE_SIG_ATOMIC_T */ + +#ifndef PACE_SIGSET_T +#define PACE_SIGSET_T + typedef sigset_t pace_sigset_t; +#endif /* PACE_SIGSET_T */ + +#ifndef PACE_SIGACTION_S +#define PACE_SIGACTION_S + typedef struct sigaction pace_sigaction_s; +#endif /* PACE_SIGACTION_S */ + +#ifndef PACE_SIGINFO_T +#define PACE_SIGINFO_T + typedef siginfo_t pace_siginfo_t; +#endif /* PACE_SIGINFO_T */ + +#ifndef PACE_SIGEVENT +#define PACE_SIGEVENT + typedef struct sigevent pace_sigevent; +#endif /* PACE_SIGEVENT */ + +#ifndef PACE_SIGVAL +#define PACE_SIGVAL + typedef union sigval pace_sigval; +#endif /* PACE_SIGVAL */ + +#ifndef PACE_TIMESPEC +#define PACE_TIMESPEC + typedef struct timespec pace_timespec; +#endif /* PACE_TIMESPEC */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_SIGNAL_H_VXWORKS */ diff --git a/PACE/pace/vxworks/signal.inl b/PACE/pace/vxworks/signal.inl new file mode 100644 index 00000000000..c78e9ca9620 --- /dev/null +++ b/PACE/pace/vxworks/signal.inl @@ -0,0 +1,163 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/signal.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#if (PACE_HAS_POSIX_SIG_UOF) +PACE_INLINE +int +pace_kill (pace_pid_t pid, int sig) +{ + return kill (pid, sig); +} +#endif /* PACE_HAS_POSIX_SIG_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_raise (int sig) +{ + return raise (sig); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_SIG_UOF) +PACE_INLINE +int +pace_sigaction (int sig, const pace_sigaction_s * act, + pace_sigaction_s * oact) +{ + return sigaction (sig, act, oact); +} +#endif /* PACE_HAS_POSIX_SIG_UOF */ + +#if (PACE_HAS_POSIX_SIG_UOF) +PACE_INLINE +int +pace_sigaddset (pace_sigset_t * set, int signo) +{ + return sigaddset (set, signo); +} +#endif /* PACE_HAS_POSIX_SIG_UOF */ + +#if (PACE_HAS_POSIX_SIG_UOF) +PACE_INLINE +int +pace_sigemptyset (pace_sigset_t * set) +{ + return sigemptyset (set); +} +#endif /* PACE_HAS_POSIX_SIG_UOF */ + +#if (PACE_HAS_POSIX_SIG_UOF) +PACE_INLINE +int +pace_sigdelset (pace_sigset_t * set, int signo) +{ + return sigdelset (set, signo); +} +#endif /* PACE_HAS_POSIX_SIG_UOF */ + +#if (PACE_HAS_POSIX_SIG_UOF) +PACE_INLINE +int +pace_sigfillset (pace_sigset_t * set) +{ + return sigfillset (set); +} +#endif /* PACE_HAS_POSIX_SIG_UOF */ + +#if (PACE_HAS_POSIX_SIG_UOF) +PACE_INLINE +int +pace_sigismember (const pace_sigset_t * set, int signo) +{ + return sigismember (set, signo); +} +#endif /* PACE_HAS_POSIX_SIG_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +pace_sig_pf +pace_signal (int sig, pace_sig_pf func) +{ + return signal (sig, func); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_SIG_UOF) +PACE_INLINE +int +pace_sigpending (pace_sigset_t * set) +{ + return sigpending (set); +} +#endif /* PACE_HAS_POSIX_SIG_UOF */ + +#if (PACE_HAS_POSIX_SIG_UOF) +PACE_INLINE +int +pace_sigprocmask (int how, const pace_sigset_t * set, + pace_sigset_t * oset) +{ + return sigprocmask (how, set, oset); +} +#endif /* PACE_HAS_POSIX_SIG_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sigqueue (pace_pid_t pid, int signo, + const pace_sigval value) +{ + return sigqueue (pid, signo, value); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_SIG_UOF) +PACE_INLINE +int +pace_sigsuspend (const pace_sigset_t * sigmask) +{ + return sigsuspend (sigmask); +} +#endif /* PACE_HAS_POSIX_SIG_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sigtimedwait (const pace_sigset_t * set, pace_siginfo_t * info, + const pace_timespec * timeout) +{ + return sigtimedwait (set, info, timeout); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sigwait (const pace_sigset_t * set, int * sig) +{ + PACE_UNUSED_ARG (sig); + return sigwait (PACE_NONCONST_ARG_CAST (pace_sigset_t *) set); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_sigwaitinfo (const pace_sigset_t *set, pace_siginfo_t *info) +{ + return sigwaitinfo (set, info); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ diff --git a/PACE/pace/vxworks/socket.c b/PACE/pace/vxworks/socket.c new file mode 100644 index 00000000000..84b52baa24c --- /dev/null +++ b/PACE/pace/vxworks/socket.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/socket.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/sys/socket.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/socket.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/socket.h b/PACE/pace/vxworks/socket.h new file mode 100644 index 00000000000..4d23fe807d1 --- /dev/null +++ b/PACE/pace/vxworks/socket.h @@ -0,0 +1,218 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/socket.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_SOCKET_H_VXWORKS +#define PACE_SOCKET_H_VXWORKS + +#include <sys/types.h> +#include <sockLib.h> + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#ifndef PACE_SOMAXCONN +#define PACE_SOMAXCONN SOMAXCONN +#endif /* PACE_SOMAXCONN */ + +#ifndef PACE_SOCKLEN_T +#define PACE_SOCKLEN_T + typedef int pace_socklen_t; +#endif /* PACE_SOCKLEN_T */ + +#ifndef PACE_SA_FAMILY_T +#define PACE_SA_FAMILY_T +#endif /* PACE_SA_FAMILY_T */ + +#ifndef PACE_MSGHDR +#define PACE_MSGHDR + typedef struct msghdr pace_msghdr; +#endif /* PACE_MSGHDR */ + +#ifndef PACE_CMSGRHDR +#define PACE_CMSGRHDR + typedef struct cmsghdr pace_cmsghdr; +#endif /* PACE_CMSGRHDR */ + +#ifndef PACE_LINGER +#define PACE_LINGER + typedef struct linger pace_linger; +#endif /* PACE_LINGER */ + +#ifndef PACE_SOCK_STREAM +#define PACE_SOCK_STREAM SOCK_STREAM +#endif /* PACE_SOCK_STREAM */ + +#ifndef PACE_SOCK_DGRAM +#define PACE_SOCK_DGRAM SOCK_DGRAM +#endif /* PACE_SOCK_DGRAM */ + +#ifndef PACE_SOCK_RAW +#define PACE_SOCK_RAW SOCK_RAW +#endif /* PACE_MSGHDR */ + +#ifndef PACE_SOCK_SEQPACKET +#define PACE_SOCK_SEQPACKET SOCK_SEQPACKET +#endif /* PACE_SOCK_SEQPACKET */ + +#ifndef PACE_PF_UNSPEC +#define PACE_PF_UNSPEC PF_UNSPEC +#endif /* PACE_PF_UNSPEC */ + +#ifndef PACE_PF_LOCAL +#define PACE_PF_LOCAL PF_LOCAL +#endif /* PACE_PF_LOCAL */ + +#ifndef PACE_PF_INET +#define PACE_PF_INET PF_INET +#endif /* PACE_PF_INET */ + +#ifndef PACE_PF_ISO +#define PACE_PF_ISO PF_ISO +#endif /* PACE_PF_ISO */ + +#ifndef PACE_PF_OSI +#define PACE_PF_OSI PF_OSI +#endif /* PACE_PF_OSI */ + +#ifndef PACE_AF_UNSPEC +#define PACE_AF_UNSPEC AF_UNSPEC +#endif /* PACE_AF_UNSPEC */ + +#ifndef PACE_AF_LOCAL +#define PACE_AF_LOCAL AF_LOCAL +#endif /* PACE_AF_LOCAL */ + +#ifndef PACE_AF_INET +#define PACE_AF_INET AF_INET +#endif /* PACE_AF_INET */ + +#ifndef PACE_AF_ISO +#define PACE_AF_ISO AF_ISO +#endif /* PACE_AF_ISO */ + +#ifndef PACE_AF_OSI +#define PACE_AF_OSI AF_OSI +#endif /* PACE_AF_OSI */ + +#ifndef PACE_MSG_OOB +#define PACE_MSG_OOB MSG_OOB +#endif /* PACE_MSG_OOB */ + +#ifndef PACE_MSG_PEEK +#define PACE_MSG_PEEK MSG_PEEK +#endif /* PACE_MSG_PEEK */ + +#ifndef PACE_MSG_DONTROUTE +#define PACE_MSG_DONTROUTE MSG_DONTROUTE +#endif /* PACE_MSG_DONTROUTE */ + +#ifndef PACE_MSG_EOR +#define PACE_MSG_EOR MSG_EOR +#endif /* PACE_MSG_EOR */ + +#ifndef PACE_MSG_TRUNC +#define PACE_MSG_TRUNC MSG_TRUNC +#endif /* PACE_MSG_TRUNC */ + +#ifndef PACE_MSG_CTRUNC +#define PACE_MSG_CTRUNC MSG_CTRUNC +#endif /* PACE_MSG_CTRUNC */ + +#ifndef PACE_MSG_WAITALL +#define PACE_MSG_WAITALL MSG_WAITALL +#endif /* PACE_MSG_WAITALL */ + +#ifndef PACE_SOL_SOCKET +#define PACE_SOL_SOCKET SOL_SOCKET +#endif /* PACE_SOL_SOCKET */ + +#ifndef PACE_SO_BROADCAST +#define PACE_SO_BROADCAST SO_BROADCAST +#endif /* PACE_SO_BROADCAST */ + +#ifndef PACE_SO_DEBUG +#define PACE_SO_DEBUG SO_DEBUG +#endif /* PACE_SO_DEBUG */ + +#ifndef PACE_SO_DONTROUTE +#define PACE_SO_DONTROUTE SO_DONTROUTE +#endif /* PACE_SO_DONTROUTE */ + +#ifndef PACE_SO_ERROR +#define PACE_SO_ERROR SO_ERROR +#endif /* PACE_SO_ERROR */ + +#ifndef PACE_SO_KEEPALIVE +#define PACE_SO_KEEPALIVE SO_KEEPALIVE +#endif /* PACE_SO_KEEPALIVE */ + +#ifndef PACE_SO_LINGER +#define PACE_SO_LINGER SO_LINGER +#endif /* PACE_SO_LINGER */ + +#ifndef PACE_SO_OOBINLINE +#define PACE_SO_OOBINLINE SO_OOBINLINE +#endif /* PACE_SO_OOBINLINE */ + +#ifndef PACE_SO_RCVBUF +#define PACE_SO_RCVBUF SO_RCVBUF +#endif /* PACE_SO_RCVBUF */ + +#ifndef PACE_SO_RCVLOWAT +#define PACE_SO_RCVLOWAT SO_RCVLOWAT +#endif /* PACE_SO_RCVLOWAT */ + +#ifndef PACE_SO_RCVTIMEO +#define PACE_SO_RCVTIMEO SO_RCVTIMEO +#endif /* PACE_SO_RCVTIMEO */ + +#ifndef PACE_SO_REUSEADDR +#define PACE_SO_REUSEADDR SO_REUSEADDR +#endif /* PACE_SO_REUSEADDR */ + +#ifndef PACE_SO_SNDBUF +#define PACE_SO_SNDBUF SO_SNDBUF +#endif /* PACE_SO_SNDBUF */ + +#ifndef PACE_SO_SNDLOWAT +#define PACE_SO_SNDLOWAT SO_SNDLOWAT +#endif /* PACE_SO_SNDLOWAT */ + +#ifndef PACE_SO_SNDTIMEO +#define PACE_SO_SNDTIMEO SO_SNDTIMEO +#endif /* PACE_SO_SNDTIMEO */ + +#ifndef PACE_SO_TYPE +#define PACE_SO_TYPE SO_TYPE +#endif /* PACE_SO_TYPE */ + +#ifndef PACE_CMSG_DATA +#define PACE_CMSG_DATA(cmsg) CMSG_DATA(cmsg) +#endif /* PACE_CMSG_DATA */ + +#ifndef PACE_CMSG_NXTHDR +#define PACE_CMSG_NXTHDR(mhdr, cmsg) CMSG_NXTHDR(mhdr, cmsg) +#endif /* PACE_CMSG_DATA */ + +#ifndef PACE_CMSG_FIRSTHDR +#define PACE_CMSG_NXTHDR(mhdr, cmsg) CMSG_NXTHDR(mhdr, cmsg) +#endif /* PACE_CMSG_DATA */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_SOCKET_H_VXWORKS */ diff --git a/PACE/pace/vxworks/socket.inl b/PACE/pace/vxworks/socket.inl new file mode 100644 index 00000000000..908ba4e62b4 --- /dev/null +++ b/PACE/pace/vxworks/socket.inl @@ -0,0 +1,242 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/socket.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include <unistd.h> +#include <stdarg.h> + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +int +pace_accept (int s, + pace_sockaddr * socketaddress, + pace_socklen_t * addresslen) +{ + accept (s, socketaddress, addresslen); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +int +pace_bind (int s, + const pace_sockaddr * socketaddress, + pace_socklen_t addresslen) +{ + bind (s, socketaddress, addresslen); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +int +pace_connect (int s, + const pace_sockaddr * socketaddress, + pace_socklen_t addresslen) +{ + connect (s, socketaddress, addresslen); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +int +pace_getpeername (int s, + pace_sockaddr * socketaddress, + pace_socklen_t * addresslen) +{ + getpeername (s, socketaddress, addresslen); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +int +pace_getsockname (int s, + pace_sockaddr * socketaddress, + pace_socklen_t * addresslen) +{ + getsockname (s, socketaddress, addresslen); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +int +pace_getsockopt (int s, + int level, + int optname, + void * optval, + pace_socklen_t optlen) +{ + getsockopt (s, level, optname, optval, optlen); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +int +pace_setsockopt (int s, + int level, + int optname, + const * optval) +{ + setsockopt (s, level, optname, optval); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +int +pace_setsockopt (int s, + int level, + int optname, + const * optval) +{ + setsockopt (s, level, optname, optval); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +int +pace_isfdtype (int fildes, int fdtype) +{ + isfdtype (fildes, fdtype); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +int +pace_listen (int s, int backlog) +{ + listen (s, backlog); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +pace_ssize_t +pace_recv (int s, + void * buf, + pace_size_t len, + int flags) +{ + recv (s, buf, len, flags); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +pace_ssize_t +pace_recvfrom (int s, + void * buf, + pace_size_t len, + int flags, + pace_sockaddr * from, + pace_socklen_t * fromlen) +{ + recvfrom (s, buf, len, flags, from, fromlen); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +pace_ssize_t +pace_rcvmsg (int s, + pace_msghdr * msg, + int flags) +{ + rcvmsg (s, msg, flags); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +pace_ssize_t +pace_send (int s, + const void * buf, + pace_size_t len, + int flags) +{ + send (s, buf, len, flags); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +pace_ssize_t +pace_sendto (int s, + const void * buf, + pace_size_t len, + int flags, + const pace_sockaddr * to, + pace_socklen_t * tolen) +{ + sendto (s, buf, len, flags, to, tolen); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +pace_ssize_t +pace_sendmsg (int s, + const pace_msghdr * msg, + int flags) +{ + sendmsg (s, msg, flags); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +int +pace_shutdown (int s, int how) +{ + shutdown (s, how); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +int +pace_socket (int protofamily, int type, int protocol) +{ + socket (protofamily, type, protocol); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + +#if (PACE_HAS_POSIX_SOCK_UOF) +PACE_INLINE +int +pace_socketpair (int protofamily, + int type, + int protocol, + int sv[2]) +{ + socketpair (protofamily, type, protocol, sy); +} +#endif /* PACE_HAS_POSIX_SOCK_UOF */ + + + + + + + + + + + diff --git a/PACE/pace/vxworks/stat.c b/PACE/pace/vxworks/stat.c new file mode 100644 index 00000000000..4a1e3ba06bb --- /dev/null +++ b/PACE/pace/vxworks/stat.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/stat.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/sys/stat.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/stat.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/stat.h b/PACE/pace/vxworks/stat.h new file mode 100644 index 00000000000..ce6669cb971 --- /dev/null +++ b/PACE/pace/vxworks/stat.h @@ -0,0 +1,59 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/stat.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_SYS_STAT_H_VXWORKS +#define PACE_SYS_STAT_H_VXWORKS + +#include <types/vxTypesOld.h> +#include <sys/stat.h> + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#define PACE_S_IRGRP S_IRGRP +#define PACE_S_IROTH S_IROTH +#define PACE_S_IRUSR S_IRUSR +#define PACE_S_IRWXG S_IRWXG +#define PACE_S_IRWXO S_IRWXO +#define PACE_S_IRWXU S_IRWXU +#define PACE_S_ISBLK S_ISBLK +#define PACE_S_ISCHR S_ISCHR +#define PACE_S_ISDIR S_ISDIR +#define PACE_S_ISFIFO S_ISFIFO +#define PACE_S_ISGID S_SIGID +#define PACE_S_ISREG S_ISREG +#define PACE_S_ISUID S_ISUID +#define PACE_S_IWGRP S_IWGRP +#define PACE_S_IWOTH S_IWOTH +#define PACE_S_IWUSR S_IWUSR +#define PACE_S_IXGRP S_IXGRP +#define PACE_S_IXOTH S_IXOTH +#define PACE_S_IXUSR S_IXUSR +#define PACE_S_TYPEISMQ S_TYPEISMQ +#define PACE_S_TYPEISSEM S_TYPEISSEM +#define PACE_S_TYPEISSHM S_TYPEISSHM + +#ifndef PACE_STAT +#define PACE_STAT + /* Kludge since there is a func and a type of the same name */ + typedef struct stat pace_stat_s; +#endif /* PACE_STAT */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_SYS_STAT_H_VXWORKS */ diff --git a/PACE/pace/vxworks/stat.inl b/PACE/pace/vxworks/stat.inl new file mode 100644 index 00000000000..0f12e277d20 --- /dev/null +++ b/PACE/pace/vxworks/stat.inl @@ -0,0 +1,85 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/stat.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#if (PACE_HAS_POSIX_FA_UOF) +PACE_INLINE +int +pace_chmod (const char * path, pace_mode_t mode) +{ + PACE_UNUSED_ARG(path); + PACE_UNUSED_ARG(mode); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_FA_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_fchmod (PACE_HANDLE fildes, pace_mode_t mode) +{ + PACE_UNUSED_ARG(fildes); + PACE_UNUSED_ARG(mode); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +int +pace_fstat (PACE_HANDLE fildes, pace_stat_s * buf) +{ + return fstat (fildes, buf); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +int +pace_mkdir (const char * path, pace_mode_t mode) +{ + PACE_UNUSED_ARG (mode); + return mkdir (PACE_NONCONST_ARG_CAST (char *) path); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_F_UOF) +PACE_INLINE +int +pace_mkfifo (const char * path, pace_mode_t mode) +{ + PACE_UNUSED_ARG(path); + PACE_UNUSED_ARG(mode); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_F_UOF */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +int +pace_stat (const char * path, pace_stat_s * buf) +{ + return stat (PACE_NONCONST_ARG_CAST (char *) path, buf); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_FA_UOF) +PACE_INLINE +pace_mode_t +pace_umask (pace_mode_t cmask) +{ + PACE_UNUSED_ARG(cmask); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_FA_UOF */ diff --git a/PACE/pace/vxworks/stdio.c b/PACE/pace/vxworks/stdio.c new file mode 100644 index 00000000000..ec5b053e2ff --- /dev/null +++ b/PACE/pace/vxworks/stdio.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/stdio.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/stdio.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/stdio.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/stdio.h b/PACE/pace/vxworks/stdio.h new file mode 100644 index 00000000000..2e819b7a431 --- /dev/null +++ b/PACE/pace/vxworks/stdio.h @@ -0,0 +1,58 @@ +/* $Id$ -*- C -*- + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/stdio.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_STDIO_H_VXWORKS +#define PACE_STDIO_H_VXWORKS + +#include <stdarg.h> +#include <stdio.h> + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#define PACE_BUFSIZ BUFSIZ +#define PACE_EOF EOF +#define PACE_FILENAME_MAX FILENAME_MAX +#define PACE_L_ctermid L_ctermid +#define PACE_L_cuserid L_cuserid +#ifndef PACE_NULL +#define PACE_NULL NULL +#endif /* PACE_NULL */ +#define PACE_SEEK_CUR SEEK_CUR +#define PACE_SEEK_END SEEK_END +#define PACE_SEEK_SET SEEK_SET +#define PACE_TMP_MAX TMP_MAX +#define pace_stderr stderr +#define pace_stdout stdout +#define pace_stdin stdin + +#ifndef PACE_FPOS_T +#define PACE_FPOS_T +typedef fpos_t pace_fpos_t; +#endif /* PACE_FPOS_T */ + +#ifndef PACE_SIZE_T +#define PACE_SIZE_T + typedef size_t pace_size_t; +#endif /* PACE_SIZE_T */ + +typedef FILE PACE_FILE; + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_STDIO_H_VXWORKS */ diff --git a/PACE/pace/vxworks/stdio.inl b/PACE/pace/vxworks/stdio.inl new file mode 100644 index 00000000000..6feb0f3372e --- /dev/null +++ b/PACE/pace/vxworks/stdio.inl @@ -0,0 +1,475 @@ +/* $Id$ -*- C -*- + + * =========================================================================== + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/stdio.inl + * + * = AUTHOR + * Joe Hoffert + * + * =========================================================================== */ + +#include <stdarg.h> + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +void +pace_clearerr (FILE * stream) +{ + clearerr (stream); + return; +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_DS_UOF) +PACE_INLINE +char * +pace_ctermid (char * s) +{ + PACE_UNUSED_ARG(s); + PACE_ERRNO_NO_SUPPORT_RETURN ((char *) 0); +} +#endif /* PACE_HAS_POSIX_DS_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +int +pace_fclose (FILE * stream) +{ + return fclose (stream); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +FILE * +pace_fdopen (int fildes, + const char * type) +{ + return fdopen (fildes, + type); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +int +pace_ferror (FILE * stream) +{ + return ferror (stream); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +int +pace_feof (FILE * stream) +{ + return feof (stream); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +int +pace_fflush (FILE * stream) +{ + return fflush (stream); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +int +pace_fileno (FILE * stream) +{ + return fileno (stream); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +int +pace_fgetc (FILE * stream) +{ + return fgetc (stream); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_fgetpos(PACE_FILE * stream, + pace_fpos_t * pos) +{ + return fgetpos (stream, pos); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +char * +pace_fgets (char * s, + int n, + FILE * stream) +{ + return fgets (s, + n, + stream); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_FL_UOF) +PACE_INLINE +void +pace_flockfile (FILE * file) +{ + PACE_UNUSED_ARG (file); + PACE_ERRNO_NO_SUPPORT (); + return; +} +#endif /* PACE_HAS_POSIX_FL_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +FILE * +pace_fopen (const char * filename, + const char * mode) +{ + return fopen (filename, + mode); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +int +pace_fputc (int c, + FILE * stream) +{ + return fputc (c, + stream); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +int +pace_fputs (const char * s, + FILE * stream) +{ + return fputs (s, + stream); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +size_t +pace_fread (void * ptr, + size_t size, + size_t number_of_items, + FILE * stream) +{ + return fread (ptr, + size, + number_of_items, + stream); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +FILE * +pace_freopen (const char * filename, + const char * mode, + FILE * stream) +{ + return freopen (filename, + mode, + stream); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_FM_UOF) +PACE_INLINE +int +pace_fseek (FILE * stream, + long offset, + int whence) +{ + return fseek (stream, + offset, + whence); +} +#endif /* PACE_HAS_POSIX_FM_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_fsetpos(PACE_FILE *stream, const pace_fpos_t *pos) +{ + return fsetpos (stream, pos); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_FM_UOF) +PACE_INLINE +long +pace_ftell (FILE * stream) +{ + return ftell (stream); +} +#endif /* PACE_HAS_POSIX_FM_UOF */ + +#if (PACE_HAS_POSIX_FL_UOF) +PACE_INLINE +int +pace_ftrylockfile (FILE * file) +{ + PACE_UNUSED_ARG(file); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_FL_UOF */ + +#if (PACE_HAS_POSIX_FL_UOF) +PACE_INLINE +void +pace_funlockfile (FILE * file) +{ + PACE_UNUSED_ARG(file); + PACE_ERRNO_NO_SUPPORT (); + return; +} +#endif /* PACE_HAS_POSIX_FL_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +pace_size_t +pace_fwrite(const void * ptr, + pace_size_t size, pace_size_t nmemb, + PACE_FILE * stream) +{ + return fwrite (ptr, size, nmemb, stream); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +int +pace_getc (FILE * stream) +{ + return getc (stream); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_FL_UOF) +PACE_INLINE +int +pace_getc_unlocked (FILE * stream) +{ + PACE_UNUSED_ARG(stream); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_FL_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +int +pace_getchar () +{ + return getchar (); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_FL_UOF) +PACE_INLINE +int +pace_getchar_unlocked () +{ + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_FL_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +char * +pace_gets (char * s) +{ + return gets (s); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +void +pace_perror (const char * s) +{ + perror (s); + return; +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +int +pace_putc (int c, + FILE * stream) +{ + return putc (c, stream); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_FL_UOF) +PACE_INLINE +int +pace_putc_unlocked (int c, + FILE * stream) +{ + PACE_UNUSED_ARG(c); + PACE_UNUSED_ARG(stream); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_FL_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +int +pace_putchar (int c) +{ + return putchar (c); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_FL_UOF) +PACE_INLINE +int +pace_putchar_unlocked (int c) +{ + PACE_UNUSED_ARG(c); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_FL_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +int +pace_puts (const char * s) +{ + return puts (s); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +int +pace_remove (const char * path) +{ + return remove (path); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +int +pace_rename (const char * old_name, + const char * new_name) +{ + return rename (old_name, + new_name); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_FM_UOF) +PACE_INLINE +void +pace_rewind (FILE * stream) +{ + rewind (stream); + return; +} +#endif /* PACE_HAS_POSIX_FM_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +void +pace_setbuf (FILE * stream, char * buf) +{ + setbuf (stream, buf); + return; +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_setvbuf(PACE_FILE * stream, + char * buf, + int mode, pace_size_t size) +{ + return setvbuf (stream, buf, mode, size); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +FILE * +pace_tmpfile () +{ + return tmpfile (); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +char * +pace_tmpnam (char * s) +{ + return tmpnam (s); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +int +pace_ungetc (int c, FILE * stream) +{ + return ungetc (c, stream); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_vfprintf (PACE_FILE * stream, + const char * format, + va_list arg) +{ + return vfprintf (stream, format, arg); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_vprintf (const char * format, + va_list arg) +{ + return vprintf (format, arg); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_vsprintf (char * s, + const char * format, + va_list arg) +{ + return vsprintf (s, format, arg); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ diff --git a/PACE/pace/vxworks/stdlib.c b/PACE/pace/vxworks/stdlib.c new file mode 100644 index 00000000000..bea76354026 --- /dev/null +++ b/PACE/pace/vxworks/stdlib.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/stdlib.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/stdlib.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/stdlib.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/stdlib.h b/PACE/pace/vxworks/stdlib.h new file mode 100644 index 00000000000..75a5196af60 --- /dev/null +++ b/PACE/pace/vxworks/stdlib.h @@ -0,0 +1,64 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/stdlib.h + * + * = AUTHOR + * Luther Baker + * + * ============================================================================ */ + +#ifndef PACE_STDLIB_H_VXWORKS +#define PACE_STDLIB_H_VXWORKS + +#include <stdlib.h> + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#define PACE_EXIT_FAILURE EXIT_FAILURE +#define PACE_EXIT_SUCCESS EXIT_SUCCESS +#define PACE_MB_CUR_MAX MB_CUR_MAX +#ifndef PACE_NULL +# define PACE_NULL NULL +#endif /* PACE_NULL */ +#define PACE_RAND_MAX RAND_MAX + +#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 + typedef size_t pace_size_t; +#endif /* PACE_SIZE_T */ + +#ifndef PACE_WCHAR_T +#define PACE_WCHAR_T + typedef wchar_t pace_wchar_t; +#endif /* PACE_WCHAR_T */ + +#if defined (PACE_HAS_CPLUSPLUS) +# ifndef PACE_BSEARCH_PF +# define PACE_BSEARCH_PF + typedef int (*pace_bsearch_pf) (const void*, const void*); +# endif /* PACE_BSEARCH_PF */ +#endif /* PACE_HAS_CPLUSPLUS */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_STDLIB_H_VXWORKS */ diff --git a/PACE/pace/vxworks/stdlib.inl b/PACE/pace/vxworks/stdlib.inl new file mode 100644 index 00000000000..080fa46434b --- /dev/null +++ b/PACE/pace/vxworks/stdlib.inl @@ -0,0 +1,319 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/stdlib.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include <stdlib.h> + +#if (PACE_HAS_POSIX_SIG_UOF) +PACE_INLINE +void +pace_abort (void) +{ + abort (); +} +#endif /* PACE_HAS_POSIX_SIG_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +int +pace_abs (int val) +{ + return abs (val); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_atexit (void (*func)(void)) +{ + return atexit (func); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +double +pace_atof (const char * str) +{ + return atof (str); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +int +pace_atoi (const char * str) +{ + return atoi (str); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +long +pace_atol (const char * str) +{ + return atol (str); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +# if defined (PACE_HAS_CPLUSPLUS) +PACE_INLINE +void * +pace_bsearch (const void *key, const void *base, + size_t nel, size_t size, + pace_bsearch_pf compar) +{ + return bsearch (key, base, nel, size, compar); +} +# else /* ! PACE_HAS_CPLUSPLUS */ +PACE_INLINE +void * +pace_bsearch (const void *key, const void *base, + size_t nel, size_t size, + int (*compar)(const void *,const void *)) +{ + return bsearch (key, base, nel, size, compar); +} +# endif /* PACE_HAS_CPLUSPLUS */ +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +pace_div_t +pace_div (int numer, int denom) +{ + return div (numer, denom); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_MP_UOF) +PACE_INLINE +void +pace_exit (int status) +{ + exit (status); + return; +} +#endif /* PACE_HAS_POSIX_MP_UOF */ + +#if (PACE_HAS_POSIX_MP_UOF) +PACE_INLINE +char * +pace_getenv (const char * name) +{ + return getenv (name); +} +#endif /* PACE_HAS_POSIX_MP_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +long int +pace_labs (long int j) +{ + return labs (j); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +pace_ldiv_t +pace_ldiv (long int numer, long int denom) +{ + return ldiv (numer, denom); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_mblen (const char* s, pace_size_t n) +{ + return mblen (s, n); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +pace_size_t +pace_mbstowcs (pace_wchar_t* pwcs, + const char* s, + pace_size_t n) +{ + return mbstowcs (pwcs, s, n); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_mbtowc (pace_wchar_t* pwc, + const char* s, + pace_size_t n) +{ + return mbtowc (pwc, s, n); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_CLS_UOF) +# if (PACE_HAS_CPLUSPLUS) +PACE_INLINE +void +pace_qsort (void * base, size_t nel, size_t width, + pace_bsearch_pf compar) +{ + qsort (base, nel, width, compar); +} +# else /* ! PACE_HAS_CPLUSPLUS */ +PACE_INLINE +void +pace_qsort (void * base, size_t nel, size_t width, + int (*compar)(const void *,const void *)) +{ + qsort (base, nel, width, compar); +} +# endif /* PACE_HAS_CPLUSPLUS */ +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +int +pace_rand () +{ + return rand (); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +void +pace_srand (unsigned int seed) +{ + srand (seed); + return; +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLSR_UOF) +PACE_INLINE +int +pace_rand_r (unsigned int *seed) +{ + PACE_UNUSED_ARG (seed); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_CLSR_UOF */ + + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +double +pace_strtod (const char* nptr, + char** endptr) +{ + return strtod (nptr, endptr); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_strtol (const char* nptr, + char** endptr, + int base) +{ + return strtol (nptr, endptr, base); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +unsigned long int +pace_strtoul (const char* nptr, + char** endptr, + int base) +{ + return strtoul (nptr, endptr, base); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_system (const char* string) +{ + return system (string); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +pace_size_t +pace_wcstombs (char* s, + const pace_wchar_t* pwcs, + pace_size_t n) +{ + return wcstombs (s, pwcs, n); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_wctomb (char* s, pace_wchar_t wchar) +{ + return wctomb (s, wchar); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +/* Memory Management. */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +void * +pace_malloc (size_t size) +{ + return malloc (size); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +void * +pace_calloc (size_t nelem, size_t elsize) +{ + return calloc (nelem, elsize); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +void +pace_free (void * ptr) +{ + free (ptr); + return; +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +void * +pace_realloc (void * ptr, size_t size) +{ + return realloc (ptr, size); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ diff --git a/PACE/pace/vxworks/string.c b/PACE/pace/vxworks/string.c new file mode 100644 index 00000000000..a6404ccfd0b --- /dev/null +++ b/PACE/pace/vxworks/string.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/string.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/string.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/string.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/string.h b/PACE/pace/vxworks/string.h new file mode 100644 index 00000000000..f2fcee61fe5 --- /dev/null +++ b/PACE/pace/vxworks/string.h @@ -0,0 +1,36 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/string.h + * + * = AUTHOR + * Luther Baker + * + * ============================================================================ */ + +#ifndef PACE_STRING_H_VXWORKS +#define PACE_STRING_H_VXWORKS + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#if !defined (PACE_NULL) +# define PACE_NULL NULL +#endif /* NULL */ + +#ifndef PACE_SIZE_T +#define PACE_SIZE_T + typedef size_t pace_size_t; +#endif /* PACE_SIZE_T */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_STRING_H_VXWORKS */ diff --git a/PACE/pace/vxworks/string.inl b/PACE/pace/vxworks/string.inl new file mode 100644 index 00000000000..de0a0bbc1fa --- /dev/null +++ b/PACE/pace/vxworks/string.inl @@ -0,0 +1,198 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/string.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include <string.h> +#include "pace/string.h" + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +void * +pace_memchr (const void *s, int c, pace_size_t n) +{ + return (void*) memchr (s, c, n); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_memcmp (const void *s1, const void *s2, pace_size_t n) +{ + return memcmp (s1, s2, n); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +void * +pace_memcpy (void * s1, const void * s2, pace_size_t n) +{ + return memcpy (s1, s2, n); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +void * +pace_memmove (void *s1, const void *s2, pace_size_t n) +{ + return memmove (s1, s2, n); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_BROKEN_INLINE +void * +pace_memset (void *s, int c, pace_size_t n) +{ + return memset (s, c, n); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +char * +pace_strcat (char * s1, const char * s2) +{ + return strcat (s1, s2); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +char * +pace_strncat (char * s1, const char * s2, size_t n) +{ + return strncat (s1, s2, n); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +char * +pace_strchr (const char * s, int c) +{ + return (char*) strchr (s, c); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +char * +pace_strrchr (const char * s, int c) +{ + return (char*) strrchr (s, c); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_BROKEN_INLINE +int +pace_strcmp (const char * s1, const char * s2) +{ + return strcmp (s1, s2); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_BROKEN_INLINE +int +pace_strncmp (const char * s1, const char * s2, size_t n) +{ + return strncmp (s1, s2, n); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_BROKEN_INLINE +char * +pace_strcpy (char * s1, const char * s2) +{ + return strcpy (s1, s2); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +char * +pace_strncpy (char * s1, const char * s2, size_t n) +{ + return strncpy (s1, s2, n); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_BROKEN_INLINE +size_t +pace_strcspn (const char * s1, const char * s2) +{ + return strcspn (s1, s2); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +size_t +pace_strspn (const char * s1, const char * s2) +{ + return strspn (s1, s2); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +size_t +pace_strlen (const char * s) +{ + return strlen (s); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_BROKEN_INLINE +char * +pace_strpbrk (const char * s1, const char * s2) +{ + return (char*) strpbrk (s1, s2); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +char * +pace_strstr (const char * s1, const char * s2) +{ + return (char*) strstr (s1, s2); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +char * +pace_strtok (char * s1, const char * s2) +{ + return strtok (s1, s2); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLSR_UOF) +PACE_INLINE +char * +pace_strtok_r (char * s, const char * sep, char ** lasts) +{ + return strtok_r (s, sep, lasts); +} +#endif /* PACE_HAS_POSIX_CLSR_UOF */ diff --git a/PACE/pace/vxworks/termios.c b/PACE/pace/vxworks/termios.c new file mode 100644 index 00000000000..4cc7e1d7388 --- /dev/null +++ b/PACE/pace/vxworks/termios.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/termios.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/termios.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/termios.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/termios.h b/PACE/pace/vxworks/termios.h new file mode 100644 index 00000000000..a21eef15fb6 --- /dev/null +++ b/PACE/pace/vxworks/termios.h @@ -0,0 +1,49 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/termios.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_SYS_TERMIOS_H_VXWORKS +#define PACE_SYS_TERMIOS_H_VXWORKS + +#include "pace/sys/types.h" + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS) */ + +#ifndef PACE_CC_T +#define PACE_CC_T +typedef int pace_cc_t; +#endif /* PACE_CC_T */ + +#ifndef PACE_SPEED_T +#define PACE_SPEED_T +typedef int pace_speed_t; +#endif /* PACE_SPEED_T */ + +#ifndef PACE_TCFLAG_T +#define PACE_TCFLAG_T +typedef int pace_tcflag_t; +#endif /* PACE_TCFLAG_T */ + +#ifndef PACE_TERMIOS +#define PACE_TERMIOS +typedef int pace_termios; +#endif /* PACE_TERMIOS */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_SYS_TERMIOS_H_VXWORKS */ diff --git a/PACE/pace/vxworks/termios.inl b/PACE/pace/vxworks/termios.inl new file mode 100644 index 00000000000..06c344a7d5c --- /dev/null +++ b/PACE/pace/vxworks/termios.inl @@ -0,0 +1,125 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/termios.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + + +#if (PACE_HAS_POSIX_DS_UOF) +PACE_INLINE +pace_speed_t +pace_cfgetospeed (const pace_termios *termiosp) +{ + PACE_UNUSED_ARG(termiosp); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_DS_UOF */ + +#if (PACE_HAS_POSIX_DS_UOF) +PACE_INLINE +int +pace_cfsetospeed (pace_termios *termios_p, pace_speed_t speed) +{ + PACE_UNUSED_ARG(termios_p); + PACE_UNUSED_ARG(speed); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_DS_UOF */ + +#if (PACE_HAS_POSIX_DS_UOF) +PACE_INLINE +pace_speed_t +pace_cfgetispeed (const pace_termios *termios_p) +{ + PACE_UNUSED_ARG(termios_p); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_DS_UOF */ + +#if (PACE_HAS_POSIX_DS_UOF) +PACE_INLINE +int +pace_cfsetispeed (pace_termios *termios_p, pace_speed_t speed) +{ + PACE_UNUSED_ARG(termios_p); + PACE_UNUSED_ARG(speed); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_DS_UOF */ + +#if (PACE_HAS_POSIX_DS_UOF) +PACE_INLINE +int +pace_tcdrain (PACE_HANDLE fildes) +{ + PACE_UNUSED_ARG(fildes); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_DS_UOF */ + +#if (PACE_HAS_POSIX_DS_UOF) +PACE_INLINE +int +pace_tcgetattr (PACE_HANDLE fildes, pace_termios *termios_p) +{ + PACE_UNUSED_ARG(fildes); + PACE_UNUSED_ARG(termios_p); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_DS_UOF */ + +#if (PACE_HAS_POSIX_DS_UOF) +PACE_INLINE +int +pace_tcflow (PACE_HANDLE fildes, int action) +{ + PACE_UNUSED_ARG(fildes); + PACE_UNUSED_ARG(action); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_DS_UOF */ + +#if (PACE_HAS_POSIX_DS_UOF) +PACE_INLINE +int +pace_tcflush (PACE_HANDLE fildes, int queue_selector) +{ + PACE_UNUSED_ARG(fildes); + PACE_UNUSED_ARG(queue_selector); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_DS_UOF */ + +#if (PACE_HAS_POSIX_DS_UOF) +PACE_INLINE +int +pace_tcsendbreak (PACE_HANDLE fildes, int duration) +{ + PACE_UNUSED_ARG(fildes); + PACE_UNUSED_ARG(duration); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_DS_UOF */ + +#if (PACE_HAS_POSIX_DS_UOF) +PACE_INLINE +int +pace_tcsetattr (PACE_HANDLE fildes, + int optional_actions, + const pace_termios *termios_p) +{ + PACE_UNUSED_ARG(fildes); + PACE_UNUSED_ARG(optional_actions); + PACE_UNUSED_ARG(termios_p); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_DS_UOF */ diff --git a/PACE/pace/vxworks/time.c b/PACE/pace/vxworks/time.c new file mode 100644 index 00000000000..2074220b3ab --- /dev/null +++ b/PACE/pace/vxworks/time.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/time.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/time.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/time.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/time.h b/PACE/pace/vxworks/time.h new file mode 100644 index 00000000000..d5f51c59d38 --- /dev/null +++ b/PACE/pace/vxworks/time.h @@ -0,0 +1,87 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/time.h + * + * = AUTHOR + * Luther Baker + * + * ============================================================================ */ + +#ifndef PACE_TIME_H_VXWORKS +#define PACE_TIME_H_VXWORKS + +#include <time.h> +#include "pace/signal.h" + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#define PACE_CLK_TCK CLK_TCK +#define PACE_CLOCKS_PER_SEC CLOCKS_PER_SEC +#define PACE_CLOCK_REALTIME CLOCK_REALTIME +#ifndef PACE_NULL +#define PACE_NULL NULL +#endif /* PACE_NULL */ +#define PACE_TIMER_ABSTIME TIMER_ABSTIME + +#ifndef PACE_CLOCKID_T +#define PACE_CLOCKID_T +# if defined PACE_EMU_CLOCKID_T + 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 +#define PACE_CLOCK_T + typedef clock_t pace_clock_t; +#endif /* PACE_CLOCK_T */ + +#ifndef PACE_SIZE_T +#define PACE_SIZE_T + typedef size_t pace_size_t; +#endif /* PACE_SIZE_T */ + +#ifndef PACE_TIMER_T +#define PACE_TIMER_T + typedef timer_t pace_timer_t; +#endif /* PACE_TIMER_T */ + +#ifndef PACE_TIME_T +#define PACE_TIME_T + typedef time_t pace_time_t; +#endif /* PACE_TIME_T */ + +#ifndef PACE_TM +#define PACE_TM + typedef struct tm pace_tm; +#endif /* PACE_TM */ + +#ifndef PACE_TIMESPEC +#define PACE_TIMESPEC + typedef struct timespec pace_timespec; +#endif /* PACE_TIMESPEC */ + +#ifndef PACE_ITIMERSPEC +#define PACE_ITIMERSPEC + typedef struct itimerspec pace_itimerspec; +#endif /* PACE_ITIMERSPEC */ + +#ifndef PACE_SIGEVENT +#define PACE_SIGEVENT + typedef struct sigevent pace_sigevent; +#endif /* PACE_SIGEVENT */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_TIME_H_VXWORKS */ diff --git a/PACE/pace/vxworks/time.inl b/PACE/pace/vxworks/time.inl new file mode 100644 index 00000000000..04a3d06b576 --- /dev/null +++ b/PACE/pace/vxworks/time.inl @@ -0,0 +1,249 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/time.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/errno.h" +#include "pace/signal.h" +extern int errno; + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +char * +pace_asctime (const pace_tm * time) +{ + return asctime (time); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLSR_UOF) +PACE_INLINE +char * +pace_asctime_r (const pace_tm * time, char * buf) +{ + /*VxWorks 5.3 seems to have POSIX.4 Draft 9 versions of this as well */ + size_t buflen = 26; + if (asctime_r (time, buf, & buflen) != 0) + return (char*) 0; + return buf; +} +#endif /* PACE_HAS_POSIX_CLSR_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +pace_clock_t +pace_clock (void) +{ + return clock (); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +double +pace_difftime (pace_time_t time1, pace_time_t time2) +{ + return difftime (time1, time2); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_clock_getres (pace_clockid_t clock_id, + pace_timespec * res) +{ + return clock_getres (clock_id, res); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_clock_gettime (pace_clockid_t clock_id, + pace_timespec * tp) +{ + return clock_gettime (clock_id, tp); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_clock_settime (pace_clockid_t clock_id, + const pace_timespec * tp) +{ + return clock_settime (clock_id, PACE_NONCONST_ARG_CAST (struct timespec *) tp); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +char * +pace_ctime (const pace_time_t * clock) +{ + return ctime (clock); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLSR_UOF) +PACE_INLINE +char * +pace_ctime_r (const pace_time_t * clock, char * buf) +{ + size_t buflen = 26; + return ctime_r (clock, buf, & buflen); +} +#endif /* PACE_HAS_POSIX_CLSR_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +pace_tm * +pace_gmtime (const pace_time_t * clock) +{ + return gmtime (clock); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLSR_UOF) +PACE_INLINE +pace_tm * +pace_gmtime_r (const pace_time_t * clock, pace_tm * result) +{ + /* VxWorks 5.3 apparently has POSIX.4 Draft 9 versions of these */ + if (gmtime_r (clock, result) != 0) + return (pace_tm*)0; + return result; +} +#endif /* PACE_HAS_POSIX_CLSR_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +pace_tm * +pace_localtime (const pace_time_t * clock) +{ + return localtime (clock); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLSR_UOF) +PACE_INLINE +pace_tm * +pace_localtime_r (const pace_time_t * clock, pace_tm * result) +{ + /* VxWorks 5.3 apparently has POSIX.4 Draft 9 versions of these */ + if (localtime_r (clock, result) != 0) + return (pace_tm*)0; + return result; +} +#endif /* PACE_HAS_POSIX_CLSR_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +time_t +pace_mktime (pace_tm * timeptr) +{ + return mktime (timeptr); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_nanosleep (const pace_timespec * rqtp, + pace_timespec * rmtp) +{ + return nanosleep (PACE_NONCONST_ARG_CAST (struct timespec *) rqtp, rmtp); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +size_t +pace_strftime (char *s, pace_size_t maxsize, + const char *format, + const pace_tm *timeptr) +{ + return strftime (s, maxsize, format, timeptr); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +time_t +pace_time (pace_time_t * tloc) +{ + return time (tloc); +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_timer_create (pace_clockid_t clock_id, + pace_sigevent * evp, + pace_timer_t *timerid) +{ + return timer_create (clock_id, evp, timerid); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_timer_delete (pace_timer_t timerid) +{ + return timer_delete (timerid); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_timer_getoverrun (pace_timer_t timerid) +{ + return timer_getoverrun (timerid); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_timer_gettime (pace_timer_t timerid, + pace_itimerspec * value) +{ + return timer_gettime (timerid, value); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +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); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_CLS_UOF) +PACE_INLINE +void +pace_tzset () +{ + PACE_ERRNO_NO_SUPPORT (); + return; +} +#endif /* PACE_HAS_POSIX_CLS_UOF */ diff --git a/PACE/pace/vxworks/times.c b/PACE/pace/vxworks/times.c new file mode 100644 index 00000000000..51b4dc90dc7 --- /dev/null +++ b/PACE/pace/vxworks/times.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/times.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/sys/times.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/times.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/times.h b/PACE/pace/vxworks/times.h new file mode 100644 index 00000000000..d2ae481355e --- /dev/null +++ b/PACE/pace/vxworks/times.h @@ -0,0 +1,39 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/times.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_SYS_TIMES_H_VXWORKS +#define PACE_SYS_TIMES_H_VXWORKS + +#include <sys/times.h> + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#ifndef PACE_CLOCK_T +#define PACE_CLOCK_T +typedef int pace_clock_t; +#endif /* PACE_CLOCK_T */ + +#ifndef PACE_TMS +#define PACE_TMS +typedef struct tms pace_tms; +#endif /* PACE_TMS */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_SYS_TIMES_H_VXWORKS */ diff --git a/PACE/pace/vxworks/times.inl b/PACE/pace/vxworks/times.inl new file mode 100644 index 00000000000..26fd11605e9 --- /dev/null +++ b/PACE/pace/vxworks/times.inl @@ -0,0 +1,24 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/times.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#if (PACE_HAS_POSIX_MP_UOF) +PACE_INLINE +pace_clock_t +pace_times (pace_tms * buffer) +{ + PACE_UNUSED_ARG(buffer); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_MP_UOF */ diff --git a/PACE/pace/vxworks/types.h b/PACE/pace/vxworks/types.h new file mode 100644 index 00000000000..12f1bf1b81d --- /dev/null +++ b/PACE/pace/vxworks/types.h @@ -0,0 +1,263 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/types.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#include <sys/types.h> +#include <sched.h> +#include <semLib.h> + +#ifndef PACE_SYS_TYPES_H_VXWORKS +#define PACE_SYS_TYPES_H_VXWORKS + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#define PTHREAD_MAX_PRIORITY 255 +#define PTHREAD_MIN_PRIORITY 0 + +#define MAX_CLEAN_RTN 20 +#define MAX_ONCE_ENTRY 100 + +#define JOIN_NORMAL 0 +#define JOIN_PENDING 1 +#define JOIN_TERMINATED 2 +#define JOIN_DETATCHED 3 + +#define PTHREAD_DEFAULT_STACK_SIZE 10000 + +/* detach */ +#define PTHREAD_CREATE_DETACHED 0x40 /* = THR_DETACHED */ +#define PTHREAD_CREATE_JOINABLE 0 +/* scope */ +#define PTHREAD_SCOPE_SYSTEM 0x01 /* = THR_BOUND */ +#define PTHREAD_SCOPE_PROCESS 0 + +/* inherit */ +#define PTHREAD_INHERIT_SCHED 1 +#define PTHREAD_EXPLICIT_SCHED 0 + +/* + * Value of process-shared attribute + */ +#define PTHREAD_PROCESS_SHARED 1 /* = USYNC_PROCESS */ +#define PTHREAD_PROCESS_PRIVATE 0 /* = USYNC_THREAD */ +#define DEFAULT_TYPE PTHREAD_PROCESS_PRIVATE + +#define PTHREAD_MUTEX_DEFAULT 0x1 +#define PTHREAD_MUTEX_ERRORCHECK 0x2 +#define PTHREAD_MUTEX_NORMAL 0x3 +#define PTHREAD_MUTEX_RECURSIVE 0x4 + +#define PTHREAD_PRIO_INHERIT 0x10 +#define PTHREAD_PRIO_NONE 0x20 +#define PTHREAD_PRIO_PROTECT 0x30 + +/* + * macros - default initializers defined as in synch.h + * Any change here should be reflected in synch.h. + */ + + +/* cancellation type and state */ +#define PTHREAD_CANCEL_ENABLE 0x00 +#define PTHREAD_CANCEL_DISABLE 0x01 +#define PTHREAD_CANCEL_DEFERRED 0x00 +#define PTHREAD_CANCEL_ASYNCHRONOUS 0x02 +#define PTHREAD_CANCELED -19 + +#define PTHREAD_MAXNAME 100 + + + /* For future upgradeability to wchar */ +#ifndef PACE_TCHAR +#define PACE_TCHAR + typedef char pace_tchar; +#endif /* PACE_TCHAR */ + +#ifndef PACE_HANDLE + typedef int PACE_HANDLE; +#endif /* PACE_HANDLE */ + +#ifndef PACE_INVALID_HANDLE +#define PACE_INVALID_HANDLE -1 +#endif /* PACE_INVALID_HANDLE */ + +#ifndef PACE_DEV_T +#define PACE_DEV_T + typedef dev_t pace_dev_t; +#endif /* PACE_DEV_T */ + +#ifndef PACE_GID_T +#define PACE_GID_T + typedef gid_t pace_gid_t; +#endif /* PACE_GID_T */ + +#ifndef PACE_INO_T +#define PACE_INO_T + typedef ino_t pace_ino_t; +#endif /* PACE_INO_T */ + +#ifndef PACE_MODE_T +#define PACE_MODE_T + typedef mode_t pace_mode_t; +#endif /* PACE_MODE_T */ + +#ifndef PACE_NLINK_T +#define PACE_NLINK_T + typedef nlink_t pace_nlink_t; +#endif /* PACE_NLINK_T */ + +#ifndef PACE_OFF_T +#define PACE_OFF_T + typedef off_t pace_off_t; +#endif /* PACE_OFF_T */ + +#ifndef PACE_PID_T +#define PACE_PID_T + typedef pid_t pace_pid_t; +#endif /* PACE_PID_T */ + +#ifndef PACE_PTHREAD_ATTR_T +#define PACE_PTHREAD_ATTR_T + + typedef struct _PTHREAD_ATTR + { + int stacksize; + char name[PTHREAD_MAXNAME]; /*the name */ + struct sched_param schedule; /* priority */ + int scope; /* options */ + int policy; /* schedule policy */ + int dstate; /* detached state */ + } * pace_pthread_attr_t; +#endif /* PACE_PTHREAD_ATTR_T */ + +#ifndef PACE_PTHREAD_CONDATTR_T +#define PACE_PTHREAD_CONDATTR_T + typedef int pace_pthread_condattr_t; +#endif /* PACE_PTHREAD_CONDATTR_T */ + +#ifndef PACE_PTHREAD_COND_T +#define PACE_PTHREAD_COND_T + typedef SEM_ID pace_pthread_cond_t; +#endif /* PACE_PTHREAD_COND_T */ + +#ifndef PACE_PTHREAD_KEY_T +#define PACE_PTHREAD_KEY_T + typedef int pace_pthread_key_t; +#endif /* PACE_PTHREAD_KEY_T */ + +#ifndef PACE_PTHREAD_MUTEXATTR_T +#define PACE_PTHREAD_MUTEXATTR_T + + typedef struct _PTHREAD_MUX_ATTR + { + int protocol; /* priority inheritance */ + int shared; /* system or process */ + int type; /* mutex type */ + } * pace_pthread_mutexattr_t; +#endif /* PACE_PTHREAD_MUTEXATTR_T */ + +#ifndef PACE_PTHREAD_MUTEX_T +#define PACE_PTHREAD_MUTEX_T + typedef SEM_ID pace_pthread_mutex_t; +#endif /* PACE_PTHREAD_MUTEX_T */ + +#ifndef PACE_PTHREAD_ONCE_T +#define PACE_PTHREAD_ONCE_T + typedef int pace_pthread_once_t; +# define PTHREAD_ONCE_INIT 0 +#endif /* PACE_PTHREAD_ONCE_T */ + +#ifndef PACE_PTHREAD_T +#define PACE_PTHREAD_T +# define PTHREAD_KEYS_MAX 100 +# define _USER_SPARE4 spare4 + typedef struct _FUNC_HANDLE + { + void (*routine)(void *); + void * args; + } funcHandle; + + typedef struct _ONCE_FUNC + { + int once_ctl; + void (*init_routine)(void); + } pthread_once_e; + + typedef struct _PTHREAD_T + { + unsigned int tid; + funcHandle cleanupRtn[MAX_CLEAN_RTN]; + int rtnCount; + pthread_once_e onceList[MAX_ONCE_ENTRY]; + int onceCount; /* once variable count */ + int stateflag; /* cancel state */ + int canceltype; /* cancel type */ + int detachflag; /* detached state */ + int joinstate; /* join state */ + SEM_ID joinSem; /* join semaphore */ + void * joinvalue; /* pass value */ + struct _PTHREAD_T * jointhread; /* the calling thread */ + void * keyvaluelist[PTHREAD_KEYS_MAX]; + } * pace_pthread_t; +#endif /* PACE_PTHREAD_T */ + +#ifndef PACE_SIZE_T +#define PACE_SIZE_T + typedef size_t pace_size_t; +#endif /* PACE_SIZE_T */ + +#ifndef PACE_SSIZE_T +#define PACE_SSIZE_T + typedef ssize_t pace_ssize_t; +#endif /* PACE_SSIZE_T */ + +#ifndef PACE_UID_T +#define PACE_UID_T + typedef uid_t pace_uid_t; +#endif /* PACE_UID_T */ + + + + +#ifndef PACE_PTHREAD_QUEUE_T +#define PACE_PTHREAD_QUEUE_T + struct _PTHREAD_QUEUE_ENTRY + { + int status; + pace_pthread_t pthread; + struct _PTHREAD_QUEUE_ENTRY * next; + }; + + typedef struct _PTHREAD_QUEUE_ENTRY pthread_q_entry; + +# define PTHEAD_QUEUE_MAX_LEN 100 + + struct _PTHREAD_KEY_ENTRY + { + int index; + int valid; + void (*destructor)(void*); + }; + + typedef struct _PTHREAD_KEY_ENTRY pthread_key_entry; +#endif /* PACE_PTHREAD_QUEUE_T */ + + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_SYS_TYPES_H_VXWORKS */ diff --git a/PACE/pace/vxworks/unistd.c b/PACE/pace/vxworks/unistd.c new file mode 100644 index 00000000000..16234ef66fb --- /dev/null +++ b/PACE/pace/vxworks/unistd.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/unistd.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/unistd.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/unistd.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/unistd.h b/PACE/pace/vxworks/unistd.h new file mode 100644 index 00000000000..19ca710618f --- /dev/null +++ b/PACE/pace/vxworks/unistd.h @@ -0,0 +1,56 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/unistd.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_UNISTD_H_VXWORKS +#define PACE_UNISTD_H_VXWORKS + +#include "pace/sys/types.h" +#include <unistd.h> + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#define PACE_F_OK F_OK +#ifndef PACE_NULL +# define PACE_NULL NULL +#endif /* PACE_NULL */ +#define PACE_R_OK R_OK +#define PACE_SEEK_CUR SEEK_CUR +#define PACE_SEEK_END SEEK_END +#define PACE_SEEK_SET SEEK_SET +#define PACE_STDERR_FILENO STDERR_FILENO +#define PACE_STDIN_FILENO STDIN_FILENO +#define PACE_STDOUT_FILENO STDOUT_FILENO +#define PACE_W_OK W_OK +#define PACE_X_OK X_OK + +/* _POSIX _PC _SC Macros need to go here */ + +#ifndef PACE_SIZE_T +#define PACE_SIZE_T +typedef size_t pace_size_t; +#endif /* PACE_SIZE_T */ + +#ifndef PACE_SSIZE_T +#define PACE_SSIZE_T +typedef ssize_t pace_ssize_t; +#endif /* PACE_SSIZE_T */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_UNISTD_H_VXWORKS */ diff --git a/PACE/pace/vxworks/unistd.inl b/PACE/pace/vxworks/unistd.inl new file mode 100644 index 00000000000..c2446346b86 --- /dev/null +++ b/PACE/pace/vxworks/unistd.inl @@ -0,0 +1,506 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/unistd.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include <unistd.h> +#include <stdarg.h> +#include <string.h> +#include <stdlib.h> +#include <time.h> + +#if (PACE_HAS_POSIX_MP_UOF) +PACE_INLINE +void +pace__exit (int status) +{ + exit (status); + return; +} +#endif /* PACE_HAS_POSIX_MP_UOF */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +int +pace_access (const char * path, int amode) +{ + PACE_UNUSED_ARG(path); + PACE_UNUSED_ARG(amode); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_SIG_UOF) +PACE_INLINE +unsigned int +pace_alarm (unsigned int seconds) +{ + PACE_UNUSED_ARG(seconds); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_SIG_UOF */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +int +pace_chdir (const char * path) +{ + return chdir (PACE_NONCONST_ARG_CAST (char *) path); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_FA_UOF) +PACE_INLINE +int +pace_chown (const char * path, uid_t owner, pace_gid_t group) +{ + PACE_UNUSED_ARG(path); + PACE_UNUSED_ARG(owner); + PACE_UNUSED_ARG(group); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_FA_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +int +pace_close (PACE_HANDLE fildes) +{ + return close (fildes); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_FM_UOF) +PACE_INLINE +PACE_HANDLE +pace_dup (PACE_HANDLE fildes) +{ + PACE_UNUSED_ARG(fildes); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_FM_UOF */ + +#if (PACE_HAS_POSIX_FM_UOF) +PACE_INLINE +PACE_HANDLE +pace_dup2 (PACE_HANDLE fildes, PACE_HANDLE fildes2) +{ + PACE_UNUSED_ARG(fildes); + PACE_UNUSED_ARG(fildes2); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_FM_UOF */ + +#if (PACE_HAS_POSIX_MP_UOF) +PACE_INLINE +int +pace_execv (const char * path, + char * const argv[]) +{ + PACE_UNUSED_ARG(path); + PACE_UNUSED_ARG(argv); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); + /* if successful, this operation does NOT return */ +} +#endif /* PACE_HAS_POSIX_MP_UOF */ + +#if (PACE_HAS_POSIX_MP_UOF) +PACE_INLINE +int +pace_execve (const char * path, + char * const argv[], + char * const envp[]) +{ + PACE_UNUSED_ARG(path); + PACE_UNUSED_ARG(argv); + PACE_UNUSED_ARG(envp); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); + /* if successful, this operation does NOT return */ +} +#endif /* PACE_HAS_POSIX_MP_UOF */ + +#if (PACE_HAS_POSIX_MP_UOF) +PACE_INLINE +int +pace_execvp (const char * file, + char * const argv[]) +{ + PACE_UNUSED_ARG(file); + PACE_UNUSED_ARG(argv); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); + /* if successful, this operation does NOT return */ +} +#endif /* PACE_HAS_POSIX_MP_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_fdatasync (PACE_HANDLE fildes) +{ + PACE_UNUSED_ARG(fildes); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_MP_UOF) +PACE_INLINE +pid_t +pace_fork () +{ + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_MP_UOF */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +long +pace_fpathconf (PACE_HANDLE fildes, int name) +{ + PACE_UNUSED_ARG(fildes); + PACE_UNUSED_ARG(name); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_fsync (PACE_HANDLE fildes) +{ + PACE_UNUSED_ARG(fildes); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_ftruncate (PACE_HANDLE fildes, pace_off_t length) +{ + return ftruncate (fildes, length); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +char * +pace_getcwd (char * buf, size_t size) +{ + return getcwd (buf, size); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_UG_UOF) +PACE_INLINE +uid_t +pace_getegid () +{ + /* getegid() is not supported: just one user anyway */ + return 0; +} +#endif /* PACE_HAS_POSIX_UGR_UOF */ + +#if (PACE_HAS_POSIX_UG_UOF) +PACE_INLINE +uid_t +pace_geteuid () +{ + /* geteuid() is not supported: just one user anyway */ + return 0; +} +#endif /* PACE_HAS_POSIX_UGR_UOF */ + +#if (PACE_HAS_POSIX_UG_UOF) +PACE_INLINE +int +pace_getgroups (int gidsetsize, pace_gid_t grouplist[]) +{ + /* getgroups() is not supported: just one user anyway */ + PACE_UNUSED_ARG(gidsetsize); + PACE_UNUSED_ARG(grouplist); + return 0; +} +#endif /* PACE_HAS_POSIX_UG_UOF */ + +#if (PACE_HAS_POSIX_UG_UOF) +PACE_INLINE +uid_t +pace_getgid () +{ + /* getgid() is not supported: just one user anyway */ + return 0; +} +#endif /* PACE_HAS_POSIX_UGR_UOF */ + +#if (PACE_HAS_POSIX_UG_UOF) +PACE_INLINE +char* +pace_getlogin () +{ + PACE_ERRNO_NO_SUPPORT_RETURN ((char *) 0); +} +#endif /* PACE_HAS_POSIX_UGR_UOF */ + +#if (PACE_HAS_POSIX_UGR_UOF) +PACE_INLINE +int +pace_getlogin_r (char * name, size_t namesize) +{ + PACE_UNUSED_ARG(name); + PACE_UNUSED_ARG(namesize); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_UGR_UOF */ + +#if (PACE_HAS_POSIX_UG_UOF) +PACE_INLINE +pid_t +pace_getpgrp () +{ + /* getpgrp() is not supported: just one user anyway */ + return 0; +} +#endif /* PACE_HAS_POSIX_UG_UOF */ + +#if (PACE_HAS_POSIX_MP_UOF) +PACE_INLINE +pid_t +pace_getpid () +{ + /* getpid() is not supported: just one user anyway */ + return 0; +} +#endif /* PACE_HAS_POSIX_MP_UOF */ + +#if (PACE_HAS_POSIX_MP_UOF) +PACE_INLINE +pid_t +pace_getppid () +{ + /* getppid() is not supported: just one user anyway */ + return 0; +} +#endif /* PACE_HAS_POSIX_MP_UOF */ + +#if (PACE_HAS_POSIX_UG_UOF) +PACE_INLINE +uid_t +pace_getuid () +{ + /* getuid() is not supported: just one user anyways */ + return 0; +} +#endif /* PACE_HAS_POSIX_UG_UOF */ + +#if (PACE_HAS_POSIX_DS_UOF) +PACE_INLINE +int +pace_isatty (int fildes) +{ + return isatty (fildes); +} +#endif /* PACE_HAS_POSIX_DS_UOF */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +int +pace_link (const char * existing, const char * new_link) +{ + PACE_UNUSED_ARG(existing); + PACE_UNUSED_ARG(new_link); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_FM_UOF) +PACE_INLINE +pace_off_t +pace_lseek (PACE_HANDLE fildes, pace_off_t offset, int whence) +{ + return lseek (fildes, offset, whence); +} +#endif /* PACE_HAS_POSIX_FM_UOF */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +long +pace_pathconf (const char * path, int name) +{ + PACE_UNUSED_ARG(path); + PACE_UNUSED_ARG(name); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_SIG_UOF) +PACE_INLINE +int +pace_pause () +{ + return pause (); +} +#endif /* PACE_HAS_POSIX_SIG_UOF */ + +#if (PACE_HAS_POSIX_P_UOF) +PACE_INLINE +int +pace_pipe (PACE_HANDLE fildes[2]) +{ + PACE_UNUSED_ARG(fildes); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_P_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +ssize_t +pace_read (PACE_HANDLE fildes, void * buf, size_t nbyte) +{ + return read (fildes, buf, nbyte); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +int +pace_rmdir (const char * path) +{ + return rmdir (PACE_NONCONST_ARG_CAST (char *) path); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_UG_UOF) +PACE_INLINE +int +pace_setgid (pace_gid_t gid) +{ + /* setuid() is not supported: just one user anyways */ + return 0; +} +#endif /* PACE_HAS_POSIX_UG_UOF */ + +#if (PACE_HAS_POSIX_JC_UOF) +PACE_INLINE +int +pace_setpgid (pid_t pid, pid_t pgid) +{ + /* setpgid() is not supported: just one user anyways */ + return 0; +} +#endif /* PACE_HAS_POSIX_JC_UOF */ + +#if (PACE_HAS_POSIX_UG_UOF) +PACE_INLINE +pid_t +pace_setsid () +{ + /* setsid() is not supported: just one user anyways */ + return 0; +} +#endif /* PACE_HAS_POSIX_UG_UOF */ + +#if (PACE_HAS_POSIX_UG_UOF) +PACE_INLINE +int +pace_setuid (uid_t uid) +{ + /* setuid() is not supported: just one user anyways */ + return 0; +} +#endif /* PACE_HAS_POSIX_UG_UOF */ + +#if (PACE_HAS_POSIX_MP_UOF) +PACE_INLINE +unsigned int +pace_sleep (unsigned int seconds) +{ + struct timespec rqtp; + /* Initializer doesn't work with Green Hills 1.8.7 */ + rqtp.tv_sec = seconds; + rqtp.tv_nsec = 0L; + return nanosleep (&rqtp, 0); +} +#endif /* PACE_HAS_POSIX_MP_UOF */ + +#if (PACE_HAS_POSIX_SP_UOF) +PACE_INLINE +long +pace_sysconf (int name) +{ + PACE_UNUSED_ARG(name); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_SP_UOF */ + +#if (PACE_HAS_POSIX_JC_UOF) +PACE_INLINE +pid_t +pace_tcgetpgrp (PACE_HANDLE fildes) +{ + PACE_UNUSED_ARG(fildes); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_JC_UOF */ + +#if (PACE_HAS_POSIX_JC_UOF) +PACE_INLINE +int +pace_tcsetpgrp (PACE_HANDLE fildes, pid_t pgrp_id) +{ + PACE_UNUSED_ARG(fildes); + PACE_UNUSED_ARG(pgrp_id); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_JC_UOF */ + +#if (PACE_HAS_POSIX_DS_UOF) +PACE_INLINE +char * +pace_ttyname (PACE_HANDLE fildes) +{ + PACE_UNUSED_ARG(fildes); + PACE_ERRNO_NO_SUPPORT_RETURN ((char *) 0); +} +#endif /* PACE_HAS_POSIX_DS_UOF */ + +#if (PACE_HAS_POSIX_NONUOF_FUNCS) +PACE_INLINE +int +pace_ttyname_r (PACE_HANDLE fildes, + char * name, + size_t namesize) +{ + PACE_UNUSED_ARG(fildes); + PACE_UNUSED_ARG(name); + PACE_UNUSED_ARG(namesize); + PACE_ERRNO_NO_SUPPORT_RETURN (-1); +} +#endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +int +pace_unlink (const char * path) +{ + return unlink (PACE_NONCONST_ARG_CAST (char *) path); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ + +#if (PACE_HAS_POSIX_DI_UOF) +PACE_INLINE +ssize_t +pace_write (PACE_HANDLE fildes, const void * buf, size_t nbyte) +{ + return write (fildes, PACE_NONCONST_ARG_CAST (void *) buf, nbyte); +} +#endif /* PACE_HAS_POSIX_DI_UOF */ diff --git a/PACE/pace/vxworks/utime.c b/PACE/pace/vxworks/utime.c new file mode 100644 index 00000000000..fc770964337 --- /dev/null +++ b/PACE/pace/vxworks/utime.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/utime.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/utime.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/utime.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/utime.h b/PACE/pace/vxworks/utime.h new file mode 100644 index 00000000000..144ca29d567 --- /dev/null +++ b/PACE/pace/vxworks/utime.h @@ -0,0 +1,35 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/utime.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_UTIME_H_VXWORKS +#define PACE_UTIME_H_VXWORKS + +#include "pace/sys/types.h" +#include <utime.h> + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#ifndef PACE_UTIMBUF +#define PACE_UTIMBUF +typedef struct utimbuf pace_utimbuf; +#endif /* PACE_UTIMBUF */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_UTIME_H_VXWORKS */ diff --git a/PACE/pace/vxworks/utime.inl b/PACE/pace/vxworks/utime.inl new file mode 100644 index 00000000000..8a9be4793f8 --- /dev/null +++ b/PACE/pace/vxworks/utime.inl @@ -0,0 +1,25 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/utime.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#if (PACE_HAS_POSIX_FS_UOF) +PACE_INLINE +int +pace_utime (const char * path, + const pace_utimbuf * times) +{ + return utime (PACE_NONCONST_ARG_CAST (char *) path, + PACE_NONCONST_ARG_CAST (pace_utimbuf *) times); +} +#endif /* PACE_HAS_POSIX_FS_UOF */ diff --git a/PACE/pace/vxworks/utsname.c b/PACE/pace/vxworks/utsname.c new file mode 100644 index 00000000000..be5b4a33584 --- /dev/null +++ b/PACE/pace/vxworks/utsname.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/utsname.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/sys/utsname.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/utsname.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/utsname.h b/PACE/pace/vxworks/utsname.h new file mode 100644 index 00000000000..95eeab7d968 --- /dev/null +++ b/PACE/pace/vxworks/utsname.h @@ -0,0 +1,48 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/utsname.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_SYS_UTSNAME_H_VXWORKS +#define PACE_SYS_UTSNAME_H_VXWORKS + +#include <sys/utsname.h> +#include "pace/stddef.h" + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#ifndef PACE_UTSNAME +#define PACE_UTSNAME +# if !defined (SYS_NMLN) +# define SYS_NMLN 257 +# endif /* SYS_NMLN */ +# if !defined (_SYS_NMLN) +# define _SYS_NMLN SYS_NMLN +# endif /* _SYS_NMLN */ +typedef struct +{ + pace_tchar sysname[_SYS_NMLN]; + pace_tchar nodename[_SYS_NMLN]; + pace_tchar release[_SYS_NMLN]; + pace_tchar version[_SYS_NMLN]; + pace_tchar machine[_SYS_NMLN]; +} pace_utsname; +#endif /* PACE_UTSNAME */ + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_SYS_UTSNAME_H_VXWORKS */ diff --git a/PACE/pace/vxworks/utsname.inl b/PACE/pace/vxworks/utsname.inl new file mode 100644 index 00000000000..fb0052108d2 --- /dev/null +++ b/PACE/pace/vxworks/utsname.inl @@ -0,0 +1,33 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/utsname.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/string.h" +#include <hostLib.h> +#include <sysLib.h> + +#if (PACE_HAS_POSIX_SP_UOF) +PACE_INLINE +int +pace_uname (pace_utsname * name) +{ + size_t maxnamelen = sizeof name->nodename; + pace_strcpy (name->sysname, "VxWorks"); + pace_strcpy (name->release, "???"); + pace_strcpy (name->version, sysBspRev ()); + pace_strcpy (name->machine, sysModel ()); + + return gethostname (name->nodename, maxnamelen); +} +#endif /* PACE_HAS_POSIX_SP_UOF */ diff --git a/PACE/pace/vxworks/wait.c b/PACE/pace/vxworks/wait.c new file mode 100644 index 00000000000..2be98112c5f --- /dev/null +++ b/PACE/pace/vxworks/wait.c @@ -0,0 +1,20 @@ +/* $Id$ + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/wait.c + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include "pace/sys/wait.h" + +#if !defined (PACE_HAS_INLINE) +# include "pace/vxworks/wait.inl" +#endif /* ! PACE_HAS_INLINE */ diff --git a/PACE/pace/vxworks/wait.h b/PACE/pace/vxworks/wait.h new file mode 100644 index 00000000000..1e588452e1f --- /dev/null +++ b/PACE/pace/vxworks/wait.h @@ -0,0 +1,38 @@ +/* $Id$ + + * ============================================================================ + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/wait.h + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================ */ + +#ifndef PACE_WAIT_H_VXWORKS +#define PACE_WAIT_H_VXWORKS + +#include "pace/sys/types.h" + +#if defined (PACE_HAS_CPLUSPLUS) +extern "C" { +#endif /* PACE_HAS_CPLUSPLUS */ + +#define PACE_WEXITSTATUS WEXITSTATUS +#define PACE_WIFEXITED WIFEXITED +#define PACE_WIFSIGNALED WISIGNALED +#define PACE_WIFSTOPPED WIFSTOPPED +#define PACE_WNOHANG WNOHANG +#define PACE_WSTOPSIG WSTOPSIG +#define PACE_WTERMSIG WTERMSIG +#define PACE_WUNTRACED WUNTRACED + +#if defined (PACE_HAS_CPLUSPLUS) +} +#endif /* PACE_HAS_CPLUSPLUS */ + +#endif /* PACE_WAIT_H_VXWORKS */ diff --git a/PACE/pace/vxworks/wait.inl b/PACE/pace/vxworks/wait.inl new file mode 100644 index 00000000000..33e8c2bee4f --- /dev/null +++ b/PACE/pace/vxworks/wait.inl @@ -0,0 +1,38 @@ +/* $Id$ -*- C -*- + + * ============================================================================= + * + * = LIBRARY + * pace + * + * = FILENAME + * pace/vxworks/wait.inl + * + * = AUTHOR + * Joe Hoffert + * + * ============================================================================= */ + +#include <sys/wait.h> + +#if (PACE_HAS_POSIX_MP_UOF) +PACE_INLINE +pid_t +pace_wait (int * statloc) +{ + PACE_UNUSED_ARG (statloc); + PACE_ERRNO_NO_SUPPORT_RETURN (0); +} +#endif /* PACE_HAS_POSIX_MP_UOF */ + +#if (PACE_HAS_POSIX_MP_UOF) +PACE_INLINE +pid_t +pace_waitpid (pid_t pid, int * statloc, int options) +{ + PACE_UNUSED_ARG (pid); + PACE_UNUSED_ARG (statloc); + PACE_UNUSED_ARG (options); + PACE_ERRNO_NO_SUPPORT_RETURN (0); +} +#endif /* PACE_HAS_POSIX_MP_UOF */ diff --git a/PACE/pace/win32/mman.c b/PACE/pace/win32/mman.c index 2e2f0b32ad2..7c08f8f6e0f 100644 --- a/PACE/pace/win32/mman.c +++ b/PACE/pace/win32/mman.c @@ -27,19 +27,9 @@ void * mmap (void * addr, size_t len, int prot, int flags, PACE_HANDLE fildes, pace_off_t off) { - void * addr_mapping = (void*)0; + void *addr_mapping = 0; int nt_flags = 0; - PACE_HANDLE local_handle = PACE_INVALID_HANDLE; - PACE_HANDLE * file_mapping = CreateFileMapping (fildes, - 0, - prot, - 0, - 0, - 0); - if (*file_mapping == 0) - { - PACE_FAIL_RETURN (MAP_FAILED); - } + PACE_HANDLE file_mapping = PACE_INVALID_HANDLE; if (PACE_BIT_ENABLED (flags, MAP_PRIVATE)) { @@ -54,33 +44,41 @@ mmap (void * addr, size_t len, int prot, int flags, nt_flags = FILE_MAP_WRITE; } + file_mapping = CreateFileMapping (fildes, + 0, + prot, + 0, + 0, + 0); + if (file_mapping == 0) + PACE_FAIL_RETURN (MAP_FAILED); + +# if defined (PACE_OS_EXTRA_MMAP_FLAGS) + nt_flags |= PACE_OS_EXTRA_MMAP_FLAGS; +# endif /* PACE_OS_EXTRA_MMAP_FLAGS */ + # if !defined (PACE_HAS_WINCE) - addr_mapping = MapViewOfFileEx (*file_mapping, + addr_mapping = MapViewOfFileEx (file_mapping, nt_flags, 0, off, len, addr); # else - /* WinCE doesn't allow specifying <addr>. */ - PACE_UNUSED_ARG (addr); - addr_mapping = MapViewOfFile (*file_mapping, + ACE_UNUSED_ARG (addr); /* WinCE does not allow specifying <addr>.*/ + addr_mapping = MapViewOfFile (file_mapping, nt_flags, 0, off, len); -# endif /* ! ACE_HAS_WINCE */ +# endif /* ! PACE_HAS_WINCE */ /* Only close this down if we used the temporary. */ - if (file_mapping == &local_handle) - { - CloseHandle (*file_mapping); - } + if (file_mapping == PACE_INVALID_HANDLE) + CloseHandle (file_mapping); if (addr_mapping == 0) - { - PACE_FAIL_RETURN (MAP_FAILED); - } + PACE_FAIL_RETURN (MAP_FAILED); else if (PACE_BIT_ENABLED (flags, MAP_FIXED) && addr_mapping != addr) @@ -89,9 +87,7 @@ mmap (void * addr, size_t len, int prot, int flags, return MAP_FAILED; } else - { - return addr_mapping; - } + return addr_mapping; } #endif /* PACE_HAS_POSIX_NONUOF_FUNCS */ |