#include <ace/OS.h> class ACE_OS {
public:
static int atoi (const char *s);
static char *getenv (const char *symbol);
static int getopt ( int argc, char *const *argv, const char *optstring );
static long sysconf (int);
static int cond_broadcast (ACE_cond_t *cv);
static int cond_destroy (ACE_cond_t *cv);
static int cond_init ( ACE_cond_t *cv, int type = USYNC_THREAD, LPCTSTR name = 0, void *arg = 0 );
static int cond_signal (ACE_cond_t *cv);
static int cond_timedwait ( ACE_cond_t *cv, ACE_mutex_t *m, ACE_Time_Value * );
static int cond_wait (ACE_cond_t *cv, ACE_mutex_t *m);
static int cond_timedwait ( ACE_cond_t *cv, ACE_thread_mutex_t *m, ACE_Time_Value * );
static int cond_wait (ACE_cond_t *cv, ACE_thread_mutex_t *m);
static char *cuserid (char *user, size_t maxlen = 32);
static int uname (struct utsname *name);
static long sysinfo (int cmd, char *buf, long count);
static int hostname (char *name, size_t maxnamelen);
static int dlclose (void *handle);
static char *dlerror (void);
static void *dlopen (ACE_DL_TYPE filename, int mode);
static void *dlsym (void *handle, ACE_DL_TYPE symbol);
static int last_error (void);
static void last_error (int);
static int fclose (FILE *fp);
static int fcntl (ACE_HANDLE handle, int cmd, int val = 0);
static int fdetach (const char *file);
static FILE *fdopen (ACE_HANDLE handle, const char *mode);
static char *fgets (char *buf, int size, FILE *fp);
static int fflush (FILE *fp);
static FILE *fopen (const char *filename, const char *mode);
static int fprintf (FILE *fp, const char *format, ...);
static size_t fread ( void *ptr, size_t size, size_t nelems, FILE *fp );
static int fstat (ACE_HANDLE, struct stat *);
static int ftruncate (ACE_HANDLE, off_t);
static size_t fwrite ( const void *ptr, size_t size, size_t nitems, FILE *fp );
static char *gets (char *str);
static void perror (const char *s);
static int printf (const char *format, ...);
static int puts (const char *s);
static void rewind (FILE *fp);
static int sprintf (char *buf, const char *format, ...);
static int flock_init ( ACE_OS::flock_t *lock, int flags = 0, LPCTSTR name = 0, mode_t perms = 0 );
static int flock_destroy (ACE_OS::flock_t *lock);
static int flock_rdlock ( ACE_OS::flock_t *lock, short whence = 0, off_t start = 0, off_t len = 0 );
static int flock_tryrdlock ( ACE_OS::flock_t *lock, short whence = 0, off_t start = 0, off_t len = 0 );
static int flock_trywrlock ( ACE_OS::flock_t *lock, short whence = 0, off_t start = 0, off_t len = 0 );
static int flock_unlock ( ACE_OS::flock_t *lock, short whence = 0, off_t start = 0, off_t len = 0 );
static int flock_wrlock ( ACE_OS::flock_t *lock, short whence = 0, off_t start = 0, off_t len = 0 );
static int execl (const char *path, const char *arg0, ...);
static int execle (const char *path, const char *arg0, ...);
static int execlp (const char *file, const char *arg0, ...);
static int execv (const char *path, char *const argv[]);
static int execvp (const char *file, char *const argv[]);
static int execve ( const char *path, char *const argv[], char *const envp[] );
static void _exit (int status);
static void exit (int status);
static pid_t fork (void);
static pid_t fork_exec (char *argv[]);
static uid_t getgid (void);
static pid_t getpid (void);
static uid_t getuid (void);
static pid_t setsid (void);
static int system (const char *s);
static pid_t wait (int * = 0);
static pid_t waitpid (pid_t, int * = 0, int = 0);
static u_int alarm (u_int delay);
static hrtime_t gethrtime (void);
static ACE_Time_Value gettimeofday (void);
static int getrusage (int who, struct rusage *rusage);
static int getrlimit (int resource, struct rlimit *rl);
static int setrlimit (int resource, ACE_SETRLIMIT_TYPE *rl);
static int sleep (u_int seconds);
static int sleep (const ACE_Time_Value &tv);
static time_t time (time_t *tloc);
static struct tm *localtime (const time_t *clock);
static struct tm *localtime_r ( const time_t *clock, struct tm *res );
static char *asctime (const struct tm *tm);
static char *ctime (const time_t *t);
static char *ctime_r (const time_t *clock, char *buf, int buflen);
static char *asctime_r ( const struct tm *tm, char *buf, int buflen );
static void *sbrk (int brk);
static void *malloc (size_t);
static void *realloc (void *, size_t);
static void free (void *);
static int memcmp (const void *s, const void *t, size_t len);
static void *memcpy (void *s, const void *t, size_t len);
static void *memset (void *s, int c, size_t len);
static int msgctl (int msqid, int cmd, msqid_ds *);
static int msgget (key_t key, int msgflg);
static int msgrcv ( int int_id, void *buf, size_t len, long type, int flags );
static int msgsnd ( int int_id, const void *buf, size_t len, int flags );
static int madvise (caddr_t addr, size_t len, int advice);
static void *mmap ( void *addr, size_t len, int prot, int flags, ACE_HANDLE handle, off_t off = 0, ACE_HANDLE *file_mapping = 0 );
static int mprotect (void *addr, size_t len, int prot);
static int msync (void *addr, size_t len, int sync);
static int munmap (void *addr, size_t len);
static int mutex_init ( ACE_mutex_t *m, int type = USYNC_THREAD, LPCTSTR name = 0, void *arg = 0 );
static int mutex_destroy (ACE_mutex_t *m);
static int mutex_lock (ACE_mutex_t *m);
static int mutex_trylock (ACE_mutex_t *m);
static int mutex_unlock (ACE_mutex_t *m);
static int thread_mutex_init ( ACE_thread_mutex_t *m, int type = USYNC_THREAD, LPCTSTR name = 0, void *arg = 0 );
static int thread_mutex_destroy (ACE_thread_mutex_t *m);
static int thread_mutex_lock (ACE_thread_mutex_t *m);
static int thread_mutex_trylock (ACE_thread_mutex_t *m);
static int thread_mutex_unlock (ACE_thread_mutex_t *m);
static int access (const char *path, int amode);
static int close (ACE_HANDLE handle);
static ACE_HANDLE creat (LPCTSTR filename, mode_t mode);
static ACE_HANDLE dup (ACE_HANDLE handle);
static int dup2 (ACE_HANDLE oldfd, ACE_HANDLE newfd);
static int fattach (int handle, const char *path);
static long filesize (ACE_HANDLE handle);
static int getmsg ( ACE_HANDLE handle, struct strbuf *ctl, struct strbuf *data, int *flags );
static getpmsg ( ACE_HANDLE handle, struct strbuf *ctl, struct strbuf *data, int *band, int *flags );
static int ioctl (ACE_HANDLE handle, int cmd, void * = 0);
static int isastream (ACE_HANDLE handle);
static int isatty (ACE_HANDLE handle);
static off_t lseek (ACE_HANDLE handle, off_t offset, int whence);
static ACE_HANDLE open ( LPCTSTR filename, int mode, int perms = 0 );
static int putmsg ( ACE_HANDLE handle, const struct strbuf *ctl, const struct strbuf *data, int flags );
static putpmsg ( ACE_HANDLE handle, const struct strbuf *ctl, const struct strbuf *data, int band, int flags );
static ssize_t read (ACE_HANDLE handle, void *buf, size_t len);
static ssize_t read ( ACE_HANDLE handle, void *buf, size_t len, ACE_OVERLAPPED * );
static ssize_t readv ( ACE_HANDLE handle, struct iovec *iov, int iovlen );
static int recvmsg ( ACE_HANDLE handle, struct msghdr *msg, int flags );
static int sendmsg ( ACE_HANDLE handle, ACE_SENDMSG_TYPE *msg, int flags );
static ssize_t write ( ACE_HANDLE handle, const void *buf, size_t nbyte );
static ssize_t write ( ACE_HANDLE handle, const void *buf, size_t nbyte, ACE_OVERLAPPED * );
static int writev ( ACE_HANDLE handle, ACE_WRITEV_TYPE *iov, int iovcnt );
static int select ( int width, fd_set *rfds, fd_set *wfds, fd_set *efds, ACE_Time_Value *tv );
static int poll ( struct pollfd *pollfds, u_long len, ACE_Time_Value *tv = 0 );
static int poll ( struct pollfd *pollfds, u_long len, const ACE_Time_Value &tv );
static int pipe (ACE_HANDLE handles[]);
static int chdir (const char *path);
static int mkfifo (const char *file, mode_t mode);
static char *mktemp (char *t);
static char *getcwd (char *, size_t);
static mode_t umask (mode_t cmask);
static int unlink (const char *path);
static int rand (void);
static int rand_r (ACE_RANDR_TYPE seed);
static void srand (u_int seed);
static int rwlock_init ( ACE_rwlock_t *rw, int type = USYNC_THREAD, LPCTSTR name = 0, void *arg = 0 );
static int rwlock_destroy (ACE_rwlock_t *rw);
static int rw_rdlock (ACE_rwlock_t *rw);
static int rw_tryrdlock (ACE_rwlock_t *rw);
static int rw_trywrlock (ACE_rwlock_t *rw);
static int rw_unlock (ACE_rwlock_t *rw);
static int rw_wrlock (ACE_rwlock_t *rw);
static int sema_destroy (ACE_sema_t *s);
static int sema_init ( ACE_sema_t *s, u_int count, int type = USYNC_THREAD, LPCTSTR name = 0, void *arg = 0, int max = 0x7fffffff );
static int sema_post (ACE_sema_t *s);
static int sema_trywait (ACE_sema_t *s);
static int sema_wait (ACE_sema_t *s);
static int semctl (int int_id, int semnum, int cmd, semun);
static int semget (key_t key, int nsems, int flags);
static int semop (int int_id, struct sembuf *sops, size_t nsops);
static void *shmat (int int_id, void *shmaddr, int shmflg);
static int shmctl (int int_id, int cmd, struct shmid_ds *buf);
static int shmdt (void *shmaddr);
static int shmget (key_t key, int size, int flags);
static int kill (pid_t pid, int signum);
static int sigaction ( int signum, const struct sigaction *nsa, struct sigaction *osa );
static int sigaddset (sigset_t *s, int signum);
static int sigdelset (sigset_t *s, int signum);
static int sigemptyset (sigset_t *s);
static int sigfillset (sigset_t *s);
static int sigismember (sigset_t *s, int signum);
static ACE_SignalHandler signal (int signum, ACE_SignalHandler);
static int sigprocmask ( int signum, const sigset_t *nsp, sigset_t *osp );
static ACE_HANDLE accept ( ACE_HANDLE handle, struct sockaddr *addr, int *addrlen );
static int bind ( ACE_HANDLE s, struct sockaddr *name, int namelen );
static int connect ( ACE_HANDLE handle, struct sockaddr *addr, int addrlen );
static int closesocket (ACE_HANDLE s);
static struct hostent *gethostbyaddr ( const char *addr, int length, int type );
static struct hostent *gethostbyname (const char *name);
static struct hostent *gethostbyaddr_r ( const char *addr, int length, int type, struct hostent *result, ACE_HOSTENT_DATA buffer, int *h_errnop );
static struct hostent *gethostbyname_r ( const char *name, struct hostent *result, ACE_HOSTENT_DATA buffer, int *h_errnop );
static int getpeername ( ACE_HANDLE handle, struct sockaddr *addr, int *addrlen );
static struct protoent *getprotobyname (const char *name);
static struct protoent *getprotobyname_r ( const char *name, struct protoent *result, ACE_PROTOENT_DATA buffer );
static struct protoent *getprotobynumber (int proto);
static struct protoent *getprotobynumber_r ( int proto, struct protoent *result, ACE_PROTOENT_DATA buffer );
static struct servent *getservbyname ( const char *svc, const char *proto );
static struct servent *getservbyname_r ( const char *svc, const char *proto, struct servent *result, ACE_SERVENT_DATA buf );
static int getsockname ( ACE_HANDLE handle, struct sockaddr *addr, int *addrlen );
static int getsockopt ( ACE_HANDLE handle, int level, int optname, char *optval, int *optlen );
static long inet_addr (const char *name);
static char *inet_ntoa (const struct in_addr addr);
static int listen (ACE_HANDLE handle, int backlog);
static int recv ( ACE_HANDLE handle, char *buf, int len, int flags = 0 );
static int recvfrom ( ACE_HANDLE handle, char *buf, int len, int flags, struct sockaddr *addr, int *addrlen );
static int send ( ACE_HANDLE handle, const char *buf, int len, int flags = 0 );
static int sendto ( ACE_HANDLE handle, const char *buf, int len, int flags, const struct sockaddr *addr, int addrlen );
static int setsockopt ( ACE_HANDLE handle, int level, int optname, const char *optval, int optlen );
static int shutdown (ACE_HANDLE handle, int how);
static ACE_HANDLE socket (int domain, int type, int proto);
static int socketpair ( int domain, int type, int protocol, ACE_HANDLE sv[2] );
static char *compile ( const char *instring, char *expbuf, char *endbuf );
static int step (const char *str, char *expbuf);
static int strcasecmp (const char *s, const char *t);
static char *strcat (char *s, const char *t);
static char *strchr (const char *s, int c);
static char *strrchr (const char *s, int c);
static int strcmp (const char *s, const char *t);
static char *strcpy (char *s, const char *t);
static char *strstr (const char *s, const char *t);
static char *strdup (const char *s);
static size_t strlen (const char *s);
static int strncmp (const char *s, const char *t, size_t len);
static char *strncpy (char *s, const char *t, size_t len);
static char *strtok (char *s, const char *tokens);
static long strtol (const char *s, char **ptr, int base);
static wchar_t *strcat (wchar_t *s, const wchar_t *t);
static wchar_t *strchr (const wchar_t *s, int c);
static wchar_t *strrchr (const wchar_t *s, int c);
static int strcmp (const wchar_t *s, const wchar_t *t);
static wchar_t *strcpy (wchar_t *s, const wchar_t *t);
static size_t strlen (const wchar_t *s);
static int strncmp ( const wchar_t *s, const wchar_t *t, size_t len );
static wchar_t *strncpy ( wchar_t *s, const wchar_t *t, size_t len );
static wchar_t *strtok (wchar_t *s, const wchar_t *tokens);
static long strtol (const wchar_t *s, wchar_t **ptr, int base);
static int t_accept ( ACE_HANDLE fildes, int resfd, struct t_call *call );
static char *t_alloc ( ACE_HANDLE fildes, int struct_type, int fields );
static int t_bind ( ACE_HANDLE fildes, struct t_bind *req, struct t_bind *ret );
static int t_close (ACE_HANDLE fildes);
static int t_connect( int fildes, struct t_call *sndcall, struct t_call *rcvcall );
static void t_error (char *errmsg);
static int t_free (char *ptr, int struct_type);
static int t_getinfo (ACE_HANDLE fildes, struct t_info *info);
static int t_getname ( ACE_HANDLE fildes, struct netbuf *namep, int type );
static int t_getstate (ACE_HANDLE fildes);
static int t_listen (ACE_HANDLE fildes, struct t_call *call);
static int t_look (ACE_HANDLE fildes);
static int t_open (char *path, int oflag, struct t_info *info);
static int t_optmgmt ( ACE_HANDLE fildes, struct t_optmgmt *req, struct t_optmgmt *ret );
static int t_rcv ( ACE_HANDLE fildes, char *buf, unsigned nbytes, int *flags );
static int t_rcvdis (ACE_HANDLE fildes, struct t_discon *discon);
static int t_rcvrel (ACE_HANDLE fildes);
static int t_rcvudata ( ACE_HANDLE fildes, struct t_unitdata *unitdata, int *flags );
static int t_rcvuderr (ACE_HANDLE fildes, struct t_uderr *uderr);
static int t_snd ( ACE_HANDLE fildes, char *buf, unsigned nbytes, int flags );
static int t_snddis (ACE_HANDLE fildes, struct t_call *call);
static int t_sndrel (ACE_HANDLE fildes);
static int t_sync (ACE_HANDLE fildes);
static int t_unbind (ACE_HANDLE fildes);
static int thr_continue (ACE_hthread_t target_thread);
static int thr_create ( ACE_THR_FUNC, void *args, long flags, ACE_thread_t *thr_id, ACE_hthread_t *t_handle = 0, u_int priority = 0, void *stack = 0, size_t stacksize = 0 );
static int thr_cmp (ACE_hthread_t t1, ACE_hthread_t t2);
static int thr_equal (ACE_thread_t t1, ACE_thread_t t2);
static void thr_exit (void *status = 0);
static int thr_getconcurrency (void);
static int thr_getprio (ACE_hthread_t thr_id, int *prio);
static int thr_getspecific (ACE_thread_key_t key, void **data);
static int thr_join (ACE_hthread_t waiter_id, void **status);
static int thr_join ( ACE_thread_t waiter_id, ACE_thread_t *thr_id, void **status );
static int thr_keyfree (ACE_thread_key_t key);
static int thr_key_detach (void *inst);
static int thr_keycreate (ACE_thread_key_t *key, void (*dest)( void *), void *inst = 0 );
static int thr_key_used (ACE_thread_key_t key);
static int thr_kill (ACE_thread_t thr_id, int signum);
static size_t thr_min_stack (void);
static ACE_thread_t thr_self (void);
static void thr_self (ACE_hthread_t &);
static int thr_setconcurrency (int hint);
static int thr_setprio (ACE_hthread_t thr_id, int prio);
static int thr_setspecific (ACE_thread_key_t key, void *data);
static int thr_sigsetmask ( int signum, const sigset_t *nsm, sigset_t *osm );
static int thr_suspend (ACE_hthread_t target_thread);
static int thr_setcancelstate (int new_state, int *old_state);
static int thr_setcanceltype (int new_type, int *old_type);
static int thr_cancel (ACE_thread_t t_id);
static int sigwait (sigset_t *set, int *sig = 0);
static void thr_testcancel (void);
static void thr_yield (void);
static ACE_thread_t NULL_thread;
private:
ACE_OS (void);
static void mutex_lock_cleanup (void *lock);
};
static int atoi (const char *s);
static char *getenv (const char *symbol);
static int getopt (
int argc,
char *const *argv,
const char *optstring
);
static long sysconf (int);
static int cond_broadcast (ACE_cond_t *cv);
static int cond_destroy (ACE_cond_t *cv);
static int cond_init (
ACE_cond_t *cv,
int type = USYNC_THREAD,
LPCTSTR name = 0,
void *arg = 0
);
static int cond_signal (ACE_cond_t *cv);
static int cond_timedwait (
ACE_cond_t *cv,
ACE_mutex_t *m,
ACE_Time_Value *
);
static int cond_wait (ACE_cond_t *cv, ACE_mutex_t *m);
static int cond_timedwait (
ACE_cond_t *cv,
ACE_thread_mutex_t *m,
ACE_Time_Value *
);
static int cond_wait (ACE_cond_t *cv, ACE_thread_mutex_t *m);
static char *cuserid (char *user, size_t maxlen = 32);
static int uname (struct utsname *name);
static long sysinfo (int cmd, char *buf, long count);
static int hostname (char *name, size_t maxnamelen);
static int dlclose (void *handle);
static char *dlerror (void);
static void *dlopen (ACE_DL_TYPE filename, int mode);
static void *dlsym (void *handle, ACE_DL_TYPE symbol);
static int last_error (void);
static void last_error (int);
static int fclose (FILE *fp);
static int fcntl (ACE_HANDLE handle, int cmd, int val = 0);
static int fdetach (const char *file);
static FILE *fdopen (ACE_HANDLE handle, const char *mode);
static char *fgets (char *buf, int size, FILE *fp);
static int fflush (FILE *fp);
static FILE *fopen (const char *filename, const char *mode);
static int fprintf (FILE *fp, const char *format, ...);
static size_t fread (void *ptr, size_t size, size_t nelems, FILE *fp);
static int fstat (ACE_HANDLE, struct stat *);
static int ftruncate (ACE_HANDLE, off_t);
static size_t fwrite (
const void *ptr,
size_t size,
size_t nitems,
FILE *fp
);
static char *gets (char *str);
static void perror (const char *s);
static int printf (const char *format, ...);
static int puts (const char *s);
static void rewind (FILE *fp);
static int sprintf (char *buf, const char *format, ...);
static int flock_init (
ACE_OS::flock_t *lock,
int flags = 0,
LPCTSTR name = 0,
mode_t perms = 0
);
static int flock_destroy (ACE_OS::flock_t *lock);
static int flock_rdlock (
ACE_OS::flock_t *lock,
short whence = 0,
off_t start = 0,
off_t len = 0
);
static int flock_tryrdlock (
ACE_OS::flock_t *lock,
short whence = 0,
off_t start = 0,
off_t len = 0
);
static int flock_trywrlock (
ACE_OS::flock_t *lock,
short whence = 0,
off_t start = 0,
off_t len = 0
);
static int flock_unlock (
ACE_OS::flock_t *lock,
short whence = 0,
off_t start = 0,
off_t len = 0
);
static int flock_wrlock (
ACE_OS::flock_t *lock,
short whence = 0,
off_t start = 0,
off_t len = 0
);
static int execl (const char *path, const char *arg0, ...);
static int execle (const char *path, const char *arg0, ...);
static int execlp (const char *file, const char *arg0, ...);
static int execv (const char *path, char *const argv[]);
static int execvp (const char *file, char *const argv[]);
static int execve (
const char *path,
char *const argv[],
char *const envp[]
);
static void _exit (int status);
static void exit (int status);
static pid_t fork (void);
static pid_t fork_exec (char *argv[]);
static uid_t getgid (void);
static pid_t getpid (void);
static uid_t getuid (void);
static pid_t setsid (void);
static int system (const char *s);
static pid_t wait (int * = 0);
static pid_t waitpid (pid_t, int * = 0, int = 0);
static u_int alarm (u_int delay);
static hrtime_t gethrtime (void);
static ACE_Time_Value gettimeofday (void);
static int getrusage (int who, struct rusage *rusage);
static int getrlimit (int resource, struct rlimit *rl);
static int setrlimit (int resource, ACE_SETRLIMIT_TYPE *rl);
static int sleep (u_int seconds);
static int sleep (const ACE_Time_Value &tv);
static time_t time (time_t *tloc);
static struct tm *localtime (const time_t *clock);
static struct tm *localtime_r (const time_t *clock, struct tm *res);
static char *asctime (const struct tm *tm);
static char *ctime (const time_t *t);
static char *ctime_r (const time_t *clock, char *buf, int buflen);
static char *asctime_r (const struct tm *tm, char *buf, int buflen);
static void *sbrk (int brk);
static void *malloc (size_t);
static void *realloc (void *, size_t);
static void free (void *);
static int memcmp (const void *s, const void *t, size_t len);
static void *memcpy (void *s, const void *t, size_t len);
static void *memset (void *s, int c, size_t len);
static int msgctl (int msqid, int cmd, msqid_ds *);
static int msgget (key_t key, int msgflg);
static int msgrcv (
int int_id,
void *buf,
size_t len,
long type,
int flags
);
static int msgsnd (
int int_id,
const void *buf,
size_t len,
int flags
);
static int madvise (caddr_t addr, size_t len, int advice);
static void *mmap (
void *addr,
size_t len,
int prot,
int flags,
ACE_HANDLE handle,
off_t off = 0,
ACE_HANDLE *file_mapping = 0
);
static int mprotect (void *addr, size_t len, int prot);
static int msync (void *addr, size_t len, int sync);
static int munmap (void *addr, size_t len);
static int mutex_init (
ACE_mutex_t *m,
int type = USYNC_THREAD,
LPCTSTR name = 0,
void *arg = 0
);
static int mutex_destroy (ACE_mutex_t *m);
static int mutex_lock (ACE_mutex_t *m);
static int mutex_trylock (ACE_mutex_t *m);
static int mutex_unlock (ACE_mutex_t *m);
static int thread_mutex_init (
ACE_thread_mutex_t *m,
int type = USYNC_THREAD,
LPCTSTR name = 0,
void *arg = 0
);
static int thread_mutex_destroy (ACE_thread_mutex_t *m);
static int thread_mutex_lock (ACE_thread_mutex_t *m);
static int thread_mutex_trylock (ACE_thread_mutex_t *m);
static int thread_mutex_unlock (ACE_thread_mutex_t *m);
static int access (const char *path, int amode);
static int close (ACE_HANDLE handle);
static ACE_HANDLE creat (LPCTSTR filename, mode_t mode);
static ACE_HANDLE dup (ACE_HANDLE handle);
static int dup2 (ACE_HANDLE oldfd, ACE_HANDLE newfd);
static int fattach (int handle, const char *path);
static long filesize (ACE_HANDLE handle);
static int getmsg (
ACE_HANDLE handle,
struct strbuf *ctl,
struct strbuf *data,
int *flags
);
static getpmsg (
ACE_HANDLE handle,
struct strbuf *ctl,
struct strbuf *data,
int *band,
int *flags
);
static int ioctl (ACE_HANDLE handle, int cmd, void * = 0);
static int isastream (ACE_HANDLE handle);
static int isatty (ACE_HANDLE handle);
static off_t lseek (ACE_HANDLE handle, off_t offset, int whence);
static ACE_HANDLE open (LPCTSTR filename, int mode, int perms = 0);
static int putmsg (
ACE_HANDLE handle,
const struct strbuf *ctl,
const struct strbuf *data,
int flags
);
static putpmsg (
ACE_HANDLE handle,
const struct strbuf *ctl,
const struct strbuf *data,
int band,
int flags
);
static ssize_t read (ACE_HANDLE handle, void *buf, size_t len);
static ssize_t read (
ACE_HANDLE handle,
void *buf,
size_t len,
ACE_OVERLAPPED *
);
static ssize_t readv (
ACE_HANDLE handle,
struct iovec *iov,
int iovlen
);
static int recvmsg (ACE_HANDLE handle, struct msghdr *msg, int flags);
static int sendmsg (
ACE_HANDLE handle,
ACE_SENDMSG_TYPE *msg,
int flags
);
static ssize_t write (
ACE_HANDLE handle,
const void *buf,
size_t nbyte
);
static ssize_t write (
ACE_HANDLE handle,
const void *buf,
size_t nbyte,
ACE_OVERLAPPED *
);
static int writev (
ACE_HANDLE handle,
ACE_WRITEV_TYPE *iov,
int iovcnt
);
static int select (
int width,
fd_set *rfds,
fd_set *wfds,
fd_set *efds,
ACE_Time_Value *tv
);
static int poll (
struct pollfd *pollfds,
u_long len,
ACE_Time_Value *tv = 0
);
static int poll (
struct pollfd *pollfds,
u_long len,
const ACE_Time_Value &tv
);
static int pipe (ACE_HANDLE handles[]);
static int chdir (const char *path);
static int mkfifo (const char *file, mode_t mode);
static char *mktemp (char *t);
static char *getcwd (char *, size_t);
static mode_t umask (mode_t cmask);
static int unlink (const char *path);
static int rand (void);
static int rand_r (ACE_RANDR_TYPE seed);
static void srand (u_int seed);
static int rwlock_init (
ACE_rwlock_t *rw,
int type = USYNC_THREAD,
LPCTSTR name = 0,
void *arg = 0
);
static int rwlock_destroy (ACE_rwlock_t *rw);
static int rw_rdlock (ACE_rwlock_t *rw);
static int rw_tryrdlock (ACE_rwlock_t *rw);
static int rw_trywrlock (ACE_rwlock_t *rw);
static int rw_unlock (ACE_rwlock_t *rw);
static int rw_wrlock (ACE_rwlock_t *rw);
static int sema_destroy (ACE_sema_t *s);
static int sema_init (
ACE_sema_t *s,
u_int count,
int type = USYNC_THREAD,
LPCTSTR name = 0,
void *arg = 0,
int max = 0x7fffffff
);
static int sema_post (ACE_sema_t *s);
static int sema_trywait (ACE_sema_t *s);
static int sema_wait (ACE_sema_t *s);
static int semctl (int int_id, int semnum, int cmd, semun);
static int semget (key_t key, int nsems, int flags);
static int semop (int int_id, struct sembuf *sops, size_t nsops);
static void *shmat (int int_id, void *shmaddr, int shmflg);
static int shmctl (int int_id, int cmd, struct shmid_ds *buf);
static int shmdt (void *shmaddr);
static int shmget (key_t key, int size, int flags);
static int kill (pid_t pid, int signum);
static int sigaction (
int signum,
const struct sigaction *nsa,
struct sigaction *osa
);
static int sigaddset (sigset_t *s, int signum);
static int sigdelset (sigset_t *s, int signum);
static int sigemptyset (sigset_t *s);
static int sigfillset (sigset_t *s);
static int sigismember (sigset_t *s, int signum);
static ACE_SignalHandler signal (int signum, ACE_SignalHandler);
static int sigprocmask (
int signum,
const sigset_t *nsp,
sigset_t *osp
);
static ACE_HANDLE accept (
ACE_HANDLE handle,
struct sockaddr *addr,
int *addrlen
);
static int bind (ACE_HANDLE s, struct sockaddr *name, int namelen);
static int connect (
ACE_HANDLE handle,
struct sockaddr *addr,
int addrlen
);
static int closesocket (ACE_HANDLE s);
static struct hostent *gethostbyaddr (
const char *addr,
int length,
int type
);
static struct hostent *gethostbyname (const char *name);
static struct hostent *gethostbyaddr_r (
const char *addr,
int length,
int type,
struct hostent *result,
ACE_HOSTENT_DATA buffer,
int *h_errnop
);
static struct hostent *gethostbyname_r (
const char *name,
struct hostent *result,
ACE_HOSTENT_DATA buffer,
int *h_errnop
);
static int getpeername (
ACE_HANDLE handle,
struct sockaddr *addr,
int *addrlen
);
static struct protoent *getprotobyname (const char *name);
static struct protoent *getprotobyname_r (
const char *name,
struct protoent *result,
ACE_PROTOENT_DATA buffer
);
static struct protoent *getprotobynumber (int proto);
static struct protoent *getprotobynumber_r (
int proto,
struct protoent *result,
ACE_PROTOENT_DATA buffer
);
static struct servent *getservbyname (
const char *svc,
const char *proto
);
static struct servent *getservbyname_r (
const char *svc,
const char *proto,
struct servent *result,
ACE_SERVENT_DATA buf
);
static int getsockname (
ACE_HANDLE handle,
struct sockaddr *addr,
int *addrlen
);
static int getsockopt (
ACE_HANDLE handle,
int level,
int optname,
char *optval,
int *optlen
);
static long inet_addr (const char *name);
static char *inet_ntoa (const struct in_addr addr);
static int listen (ACE_HANDLE handle, int backlog);
static int recv (
ACE_HANDLE handle,
char *buf,
int len,
int flags = 0
);
static int recvfrom (
ACE_HANDLE handle,
char *buf,
int len,
int flags,
struct sockaddr *addr,
int *addrlen
);
static int send (
ACE_HANDLE handle,
const char *buf,
int len,
int flags = 0
);
static int sendto (
ACE_HANDLE handle,
const char *buf,
int len,
int flags,
const struct sockaddr *addr,
int addrlen
);
static int setsockopt (
ACE_HANDLE handle,
int level,
int optname,
const char *optval,
int optlen
);
static int shutdown (ACE_HANDLE handle, int how);
static ACE_HANDLE socket (int domain, int type, int proto);
static int socketpair (
int domain,
int type,
int protocol,
ACE_HANDLE sv[2]
);
static char *compile (
const char *instring,
char *expbuf,
char *endbuf
);
static int step (const char *str, char *expbuf);
static int strcasecmp (const char *s, const char *t);
static char *strcat (char *s, const char *t);
static char *strchr (const char *s, int c);
static char *strrchr (const char *s, int c);
static int strcmp (const char *s, const char *t);
static char *strcpy (char *s, const char *t);
static char *strstr (const char *s, const char *t);
static char *strdup (const char *s);
static size_t strlen (const char *s);
static int strncmp (const char *s, const char *t, size_t len);
static char *strncpy (char *s, const char *t, size_t len);
static char *strtok (char *s, const char *tokens);
static long strtol (const char *s, char **ptr, int base);
static int t_accept (
ACE_HANDLE fildes,
int resfd,
struct t_call *call
);
static char *t_alloc (ACE_HANDLE fildes, int struct_type, int fields);
static int t_bind (
ACE_HANDLE fildes,
struct t_bind *req,
struct t_bind *ret
);
static int t_close (ACE_HANDLE fildes);
static int t_connect(
int fildes,
struct t_call *sndcall,
struct t_call *rcvcall
);
static void t_error (char *errmsg);
static int t_free (char *ptr, int struct_type);
static int t_getinfo (ACE_HANDLE fildes, struct t_info *info);
static int t_getname (
ACE_HANDLE fildes,
struct netbuf *namep,
int type
);
static int t_getstate (ACE_HANDLE fildes);
static int t_listen (ACE_HANDLE fildes, struct t_call *call);
static int t_look (ACE_HANDLE fildes);
static int t_open (char *path, int oflag, struct t_info *info);
static int t_optmgmt (
ACE_HANDLE fildes,
struct t_optmgmt *req,
struct t_optmgmt *ret
);
static int t_rcv (
ACE_HANDLE fildes,
char *buf,
unsigned nbytes,
int *flags
);
static int t_rcvdis (ACE_HANDLE fildes, struct t_discon *discon);
static int t_rcvrel (ACE_HANDLE fildes);
static int t_rcvudata (
ACE_HANDLE fildes,
struct t_unitdata *unitdata,
int *flags
);
static int t_rcvuderr (ACE_HANDLE fildes, struct t_uderr *uderr);
static int t_snd (
ACE_HANDLE fildes,
char *buf,
unsigned nbytes,
int flags
);
static int t_snddis (ACE_HANDLE fildes, struct t_call *call);
static int t_sndrel (ACE_HANDLE fildes);
static int t_sync (ACE_HANDLE fildes);
static int t_unbind (ACE_HANDLE fildes);
static int thr_continue (ACE_hthread_t target_thread);
static int thr_create (
ACE_THR_FUNC,
void *args,
long flags,
ACE_thread_t *thr_id,
ACE_hthread_t *t_handle = 0,
u_int priority = 0,
void *stack = 0,
size_t stacksize = 0
);
static int thr_cmp (ACE_hthread_t t1, ACE_hthread_t t2);
static int thr_equal (ACE_thread_t t1, ACE_thread_t t2);
static void thr_exit (void *status = 0);
static int thr_getconcurrency (void);
static int thr_getprio (ACE_hthread_t thr_id, int *prio);
static int thr_getspecific (ACE_thread_key_t key, void **data);
static int thr_join (ACE_hthread_t waiter_id, void **status);
static int thr_join (
ACE_thread_t waiter_id,
ACE_thread_t *thr_id,
void **status
);
static int thr_keyfree (ACE_thread_key_t key);
static int thr_key_detach (void *inst);
static int thr_keycreate (ACE_thread_key_t *key, void (*dest)(
void *),
void *inst = 0
);
static int thr_key_used (ACE_thread_key_t key);
static int thr_kill (ACE_thread_t thr_id, int signum);
static size_t thr_min_stack (void);
static ACE_thread_t thr_self (void);
static void thr_self (ACE_hthread_t &);
static int thr_setconcurrency (int hint);
static int thr_setprio (ACE_hthread_t thr_id, int prio);
static int thr_setspecific (ACE_thread_key_t key, void *data);
static int thr_sigsetmask (
int signum,
const sigset_t *nsm,
sigset_t *osm
);
static int thr_suspend (ACE_hthread_t target_thread);
static int thr_setcancelstate (int new_state, int *old_state);
static int thr_setcanceltype (int new_type, int *old_type);
static int thr_cancel (ACE_thread_t t_id);
static int sigwait (sigset_t *set, int *sig = 0);
static void thr_testcancel (void);
static void thr_yield (void);
static ACE_thread_t NULL_thread;
schmidt@cs.wustl.edu
, Jesper S. M|ller
stophph@diku.dk
, and a cast of thousands...