NAME

ACE_OS - This class defines an operating system independent programming API that shields developers from non-portable aspects of writing efficient system programs on Win32, POSIX, and other versions of UNIX. If you are porting ACE to a new platform, this is the place to focus your attention. Please see the README file in this directory for complete information on the meaning of the various macros.

SYNOPSIS

#include <ace/OS.h>

class ACE_OS { public: enum ACE_HRTimer_Op{ #if defined ( CHORUS) ACE_HRTIMER_START = K_BSTART, ACE_HRTIMER_INCR = K_BPOINT, ACE_HRTIMER_STOP = K_BSTOP, ACE_HRTIMER_GETTIME = 0xFFFF #else ACE_HRTIMER_START = 0x0, ACE_HRTIMER_INCR = 0x1, ACE_HRTIMER_STOP = 0x2, ACE_HRTIMER_GETTIME = 0xFFFF #endif };

class ace_flock_t { public: void dump (void) const; ACE_OVERLAPPED overlapped_; LPCTSTR lockname_; ACE_HANDLE handle_; };

static int atoi (const char *s); static char *getenv (const char *symbol); static int putenv (const char *string); 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 = ACE_DEFAULT_SYNCH_TYPE, 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 LPTSTR cuserid (LPTSTR 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 (ACE_SHLIB_HANDLE handle); static char *dlerror (void); static ACE_SHLIB_HANDLE dlopen ( ACE_DL_TYPE filename, int mode = ACE_DEFAULT_SHLIB_MODE ); static void *dlsym (ACE_SHLIB_HANDLE 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 *fopen (const char *filename, const char *mode); static FILE *fdopen (ACE_HANDLE handle, const char *mode); static char *fgets (char *buf, int size, FILE *fp); static int stat (const char *file, struct stat *); static int fprintf (FILE *fp, const char *format, ...); static int sprintf (char *buf, const char *format, ...); static int vsprintf ( char *buffer, const char *format, va_list argptr ); static void perror (const char *s); static int printf (const char *format, ...); static char *gets (char *str); static int puts (const char *s); static int fflush (FILE *fp); 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 void rewind (FILE *fp); static int flock_init ( ACE_OS::ace_flock_t *lock, int flags = 0, LPCTSTR name = 0, mode_t perms = 0 ); static int flock_destroy (ACE_OS::ace_flock_t *lock); static int flock_rdlock ( ACE_OS::ace_flock_t *lock, short whence = 0, off_t start = 0, off_t len = 0 ); static int flock_tryrdlock ( ACE_OS::ace_flock_t *lock, short whence = 0, off_t start = 0, off_t len = 0 ); static int flock_trywrlock ( ACE_OS::ace_flock_t *lock, short whence = 0, off_t start = 0, off_t len = 0 ); static int flock_unlock ( ACE_OS::ace_flock_t *lock, short whence = 0, off_t start = 0, off_t len = 0 ); static int flock_wrlock ( ACE_OS::ace_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 = 0); static void exit (int status = 0); static pid_t fork (void); static pid_t fork (const char *program_name); static pid_t fork_exec (ASYS_TCHAR *argv[]); static int getpagesize (void); static gid_t getgid (void); static pid_t getpid (void); static pid_t getpgid (pid_t pid); 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 secs); static u_int ualarm (u_int usecs, u_int interval = 0); static u_int ualarm ( const ACE_Time_Value &tv, const ACE_Time_Value &tv_interval = ACE_Time_Value::zero ); static ACE_hrtime_t gethrtime ( const ACE_HRTimer_Op = ACE_HRTIMER_GETTIME ); static void readPPCTimeBase (u_long &most, u_long &least); static int clock_gettime (clockid_t, struct timespec *); 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 int nanosleep ( const struct timespec *requested, struct timespec *remaining = 0 ); static time_t mktime (struct tm *timeptr); static double difftime (time_t t1, time_t t0); static time_t time (time_t *tloc = 0); static struct tm *localtime (const time_t *clock); static struct tm *localtime_r ( const time_t *clock, struct tm *res ); static struct tm *gmtime (const time_t *clock); static struct tm *gmtime_r (const time_t *clock, struct tm *res); static char *asctime (const struct tm *tm); static char *asctime_r ( const struct tm *tm, char *buf, int buflen ); static char *ctime (const time_t *t); static char *ctime_r (const time_t *clock, char *buf, int buflen); static wchar_t *ctime (const time_t *t); static wchar_t *ctime_r ( const time_t *clock, wchar_t *buf, int buflen ); static size_t strftime ( char *s, size_t maxsize, const char *format, const struct tm *timeptr ); static void *sbrk (int brk); static void *calloc (size_t elements, size_t sizeof_elements); static void *malloc (size_t); static void *realloc (void *, size_t); static void free (void *); static int memcmp (const void *t, const void *s, size_t len); static void *memcpy (void *t, const void *s, size_t len); static void *memmove (void *t, const void *s, size_t len); static void *memset (void *s, int c, size_t len); static int msgctl (int msqid, int cmd, struct 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, LPSECURITY_ATTRIBUTES sa = 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 = ACE_DEFAULT_SYNCH_TYPE, LPCTSTR name = 0, void *arg = 0, LPSECURITY_ATTRIBUTES sa = 0 ); static int mutex_destroy (ACE_mutex_t *m); static int mutex_lock (ACE_mutex_t *m); static int mutex_lock (ACE_mutex_t *m, int &abandoned); static int mutex_trylock (ACE_mutex_t *m); static int mutex_trylock (ACE_mutex_t *m, int &abandoned); static int mutex_unlock (ACE_mutex_t *m); static int thread_mutex_init ( ACE_thread_mutex_t *m, int type = ACE_DEFAULT_SYNCH_TYPE, 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 int 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 ( const char *filename, int mode, int perms = 0, LPSECURITY_ATTRIBUTES sa = 0 ); static int putmsg ( ACE_HANDLE handle, const struct strbuf *ctl, const struct strbuf *data, int flags ); static int 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 pread ( ACE_HANDLE handle, void *buf, size_t nbyte, off_t offset ); 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, const struct msghdr *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 ssize_t pwrite ( ACE_HANDLE handle, const void *buf, size_t nbyte, off_t offset ); static int writev ( ACE_HANDLE handle, const struct iovec *iov, int iovcnt ); static int select ( int width, fd_set *rfds, fd_set *wfds, fd_set *efds, const ACE_Time_Value *tv = 0 ); static int select ( int width, fd_set *rfds, fd_set *wfds, fd_set *efds, const 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 ACE_HANDLE shm_open ( const char *filename, int mode, int perms = 0, LPSECURITY_ATTRIBUTES sa = 0 ); static int shm_unlink (const char *path); static mode_t umask (mode_t cmask); static int chdir (const char *path); static int mkdir ( const char *path, mode_t mode = ACE_DEFAULT_DIR_PERMS ); static int mkfifo ( const char *file, mode_t mode = ACE_DEFAULT_FILE_PERMS ); static char *mktemp (char *t); static char *getcwd (char *, size_t); static int rename (const char *old_name, const char *new_name); static int unlink (const char *path); static char *tempnam (const char *dir, const char *pfx); 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 = ACE_DEFAULT_SYNCH_TYPE, 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_wrlock (ACE_rwlock_t *rw); static int rw_tryrdlock (ACE_rwlock_t *rw); static int rw_trywrlock (ACE_rwlock_t *rw); static int rw_trywrlock_upgrade (ACE_rwlock_t *rw); static int rw_unlock (ACE_rwlock_t *rw); static int event_init ( ACE_event_t *event, int manual_reset = 0, int initial_state = 0, int type = ACE_DEFAULT_SYNCH_TYPE, LPCTSTR name = 0, void *arg = 0, LPSECURITY_ATTRIBUTES sa = 0 ); static int event_destroy (ACE_event_t *event); static int event_wait (ACE_event_t *event); static int event_timedwait ( ACE_event_t *event, ACE_Time_Value *timeout ); static int event_signal (ACE_event_t *event); static int event_pulse (ACE_event_t *event); static int event_reset (ACE_event_t *event); static int sema_destroy (ACE_sema_t *s); static int sema_init ( ACE_sema_t *s, u_int count, int type = ACE_DEFAULT_SYNCH_TYPE, LPCTSTR name = 0, void *arg = 0, int max = 0x7fffffff, LPSECURITY_ATTRIBUTES sa = 0 ); static int sema_post (ACE_sema_t *s); static int sema_post (ACE_sema_t *s, size_t release_count); static int sema_trywait (ACE_sema_t *s); static int sema_wait (ACE_sema_t *s); static int sema_wait (ACE_sema_t *s, ACE_Time_Value &tv); 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 int sched_params ( const ACE_Sched_Params &, ACE_id_t id = ACE_SELF ); 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 how, 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 passwd *getpwnam (const char *user); static struct passwd *getpwnam_r ( const char *name, struct passwd *pwent, char *buffer, int buflen ); 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 inet_aton (const char *strptr, 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 int socket_init ( int version_high = 1, int version_low = 1 ); static int socket_fini (void); static char *compile ( const char *instring, char *expbuf, char *endbuf ); static int step (const char *str, char *expbuf); static int to_lower (int c); static int strcasecmp (const char *s, const char *t); static int strncasecmp (const char *s, const char *t, size_t len); static char *strcat (char *s, const char *t); static char *strchr (char *s, int c); static char *strrchr (char *s, int c); static const char *strchr (const char *s, int c); static const char *strrchr (const char *s, int c); static int strcmp (const char *s, const char *t); static int strncmp (const char *s, const char *t, size_t len); static char *strcpy (char *s, const char *t); static char *strpbrk (char *s1, const char *s2); static const char *strpbrk (const char *s1, const char *s2); static size_t strspn(const char *s1, const char *s2); static char *strstr (char *s, const char *t); static const char *strstr (const char *s, const char *t); static char *strdup (const char *s); static size_t strlen (const char *s); static char *strncpy (char *s, const char *t, size_t len); static char *strncat (char *s, const char *t, size_t len); static char *strtok (char *s, const char *tokens); static char *strtok_r (char *s, const char *tokens, char **lasts); static long strtol (const char *s, char **ptr, int base); static u_long strtoul (const char *s, char **ptr, int base); static double strtod (const char *s, char **endptr); static int ace_isspace (const char s); static size_t strlen (const wchar_t *s); static wchar_t *strcpy (wchar_t *s, const wchar_t *t); typedef ACE_UINT32 WChar; static u_int wslen (const WChar *); static WChar *wscpy (WChar *, const WChar *); static int atoi (const wchar_t *s); static wint_t to_lower (wint_t c); static wchar_t *strcat (wchar_t *s, const wchar_t *t); static wchar_t *strchr (const wchar_t *s, wint_t c); static wchar_t *strrchr (const wchar_t *s, wint_t c); static int strcmp (const wchar_t *s, const wchar_t *t); static int strncmp ( const wchar_t *s, const wchar_t *t, size_t len ); static int strcasecmp (const wchar_t *s, const wchar_t *t); static int strncasecmp ( const wchar_t *s, const wchar_t *t, size_t len ); static wchar_t *strpbrk (const wchar_t *s1, const wchar_t *s2); static wchar_t *strncpy ( wchar_t *s, const wchar_t *t, size_t len ); static wchar_t *strncat ( 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 ace_isspace (wchar_t c); static wchar_t *strstr (const wchar_t *s, const wchar_t *t); static wchar_t *strdup (const wchar_t *s); static int sprintf (wchar_t *buf, const wchar_t *format, ...); static int sprintf (wchar_t *buf, const char *format, ...); static int fprintf (FILE *fp, const wchar_t *format, ...); static void perror (const wchar_t *s); static int vsprintf ( wchar_t *buffer, const wchar_t *format, va_list argptr ); static int access (const wchar_t *path, int amode); static FILE *fopen (const wchar_t *filename, const wchar_t *mode); static FILE *fdopen (ACE_HANDLE handle, const wchar_t *mode); static int stat (const wchar_t *file, struct stat *); static wchar_t *getenv (const wchar_t *symbol); static int system (const wchar_t *s); static int hostname (wchar_t *name, size_t maxnamelen); static ACE_HANDLE open ( const wchar_t *filename, int mode, int perms = 0, LPSECURITY_ATTRIBUTES sa = 0 ); static int rename ( const wchar_t *oldname, const wchar_t *newname ); static int unlink (const wchar_t *path); static wchar_t *dlerror (void); static ACE_SHLIB_HANDLE dlopen ( ACE_WIDE_DL_TYPE filename, int mode = ACE_DEFAULT_SHLIB_MODE ); static void *dlsym ( ACE_SHLIB_HANDLE handle, ACE_WIDE_DL_TYPE symbol ); static wchar_t *mktemp (wchar_t *t); static int mkdir ( const wchar_t *path, mode_t mode = ACE_DEFAULT_DIR_PERMS ); static int chdir (const wchar_t *path); static wchar_t *getcwd (wchar_t *, size_t); 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, u_int 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, u_int 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 (const ACE_Thread_ID &thread); static int thr_create ( ACE_THR_FUNC, void *args, long flags, ACE_Thread_ID *, long priority = ACE_DEFAULT_THREAD_PRIORITY, void *stack = 0, size_t stacksize = 0 ); static int thr_getprio ( ACE_Thread_ID thr_id, int &prio, int *policy = 0 ); static int thr_join (ACE_Thread_ID waiter_id, void **status); static int thr_kill (ACE_Thread_ID thr_id, int signum); static ACE_Thread_ID thr_self (void); static int thr_setprio (ACE_Thread_ID thr_id, int prio); static int thr_setprio (const ACE_Sched_Priority prio); static int thr_suspend (ACE_Thread_ID target_thread); static int thr_cancel (ACE_Thread_ID t_id); static int thr_continue (ACE_hthread_t target_thread); static int thr_create ( ACE_THR_FUNC func, void *args, long flags, ACE_thread_t *thr_id, ACE_hthread_t *t_handle = 0, long priority = ACE_DEFAULT_THREAD_PRIORITY, void *stack = 0, size_t stacksize = 0, ACE_Thread_Adapter *thread_adapter = 0 ); static int thr_getprio (ACE_hthread_t thr_id, int &prio); 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_kill (ACE_thread_t thr_id, int signum); static ACE_thread_t thr_self (void); static void thr_self (ACE_hthread_t &); static int thr_setprio (ACE_hthread_t thr_id, int prio); static int thr_setprio (const ACE_Sched_Priority prio); static int thr_suspend (ACE_hthread_t target_thread); static int thr_cancel (ACE_thread_t t_id); 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 lwp_getparams (ACE_Sched_Params &); static int thr_getspecific (ACE_thread_key_t key, void **data); 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, ACE_THR_C_DEST, void *inst = 0 ); static int thr_keycreate ( ACE_thread_key_t *key, ACE_THR_DEST, void *inst = 0 ); static int thr_key_used (ACE_thread_key_t key); static size_t thr_min_stack (void); static int thr_setconcurrency (int hint); static int lwp_setparams (const ACE_Sched_Params &); static int thr_setspecific (ACE_thread_key_t key, void *data); static int thr_sigsetmask ( int how, const sigset_t *nsm, sigset_t *osm ); static int thr_setcancelstate (int new_state, int *old_state); static int thr_setcanceltype (int new_type, int *old_type); 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; static ACE_hthread_t NULL_hthread; static ACE_thread_key_t NULL_key; static int socket_initialized_; static void mutex_lock_cleanup (void *mutex); static void cleanup_tss (const u_int main_thread); static int netdb_acquire (void); static int netdb_release (void); static int scheduling_class (const char *class_name, ACE_id_t &); static int set_scheduling_params ( const ACE_Sched_Params &, ACE_id_t id = ACE_SELF ); static int priority_control (ACE_idtype_t, ACE_id_t, int, void *); private: ACE_CLASS_IS_NAMESPACE (ACE_OS); static const wchar_t *day_of_week_name[7]; static const wchar_t *month_name[12]; };

DESCRIPTION

This class encapsulates all the differences between various versions of UNIX and WIN32! The other components in ACE are programmed to use only the methods in this class, which makes it *much* easier to move ACE to a new platform. The methods in this class also automatically restart when interrupts occur during system calls (assuming that the ACE_Log_Msg::restart flag is enabled).

A set of wrappers for miscellaneous operations.

static int atoi (const char *s);

static char *getenv (const char *symbol);

static int putenv (const char *string);

static int getopt (
    int argc,
    char *const *argv,
    const char *optstring
    );

static long sysconf (int);

A set of wrappers for condition variables.

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 = ACE_DEFAULT_SYNCH_TYPE,
    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);

A set of wrappers for determining config info.

static LPTSTR cuserid (LPTSTR 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);

A set of wrappers for explicit dynamic linking.

static int dlclose (ACE_SHLIB_HANDLE handle);

static char *dlerror (void);

static ACE_SHLIB_HANDLE dlopen (
    ACE_DL_TYPE filename,
    int mode = ACE_DEFAULT_SHLIB_MODE
    );

static void *dlsym (ACE_SHLIB_HANDLE handle, ACE_DL_TYPE symbol);

A set of wrappers for stdio file operations.

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);

CE doesn't support these char version functions. However, we should provide UNICODE version of them.

static FILE *fopen (const char *filename, const char *mode);

static FILE *fdopen (ACE_HANDLE handle, const char *mode);

static char *fgets (char *buf, int size, FILE *fp);

static int stat (const char *file, struct stat *);

static int fprintf (FILE *fp, const char *format, ...);

static int sprintf (char *buf, const char *format, ...);

static int vsprintf (
    char *buffer,
    const char *format,
    va_list argptr
    );

static void perror (const char *s);

CE doesn't support these function at all. (And it doesn't mean anything to provide these interfaces at all.)

static int printf (const char *format, ...);

static char *gets (char *str);

static int puts (const char *s);

static int fflush (FILE *fp);

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 void rewind (FILE *fp);

A set of wrappers for file locks.

static int flock_init (
    ACE_OS::ace_flock_t *lock,
    int flags = 0,
    LPCTSTR name = 0,
    mode_t perms = 0
    );

static int flock_destroy (ACE_OS::ace_flock_t *lock);

static int flock_rdlock (
    ACE_OS::ace_flock_t *lock,
    short whence = 0,
    off_t start = 0,
    off_t len = 0
    );

static int flock_tryrdlock (
    ACE_OS::ace_flock_t *lock,
    short whence = 0,
    off_t start = 0,
    off_t len = 0
    );

static int flock_trywrlock (
    ACE_OS::ace_flock_t *lock,
    short whence = 0,
    off_t start = 0,
    off_t len = 0
    );

static int flock_unlock (
    ACE_OS::ace_flock_t *lock,
    short whence = 0,
    off_t start = 0,
    off_t len = 0
    );

static int flock_wrlock (
    ACE_OS::ace_flock_t *lock,
    short whence = 0,
    off_t start = 0,
    off_t len = 0
    );

A set of wrappers for low-level process operations.

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 = 0);

static void exit (int status = 0);

static pid_t fork (void);

static pid_t fork (const char *program_name);

static pid_t fork_exec (ASYS_TCHAR *argv[]);

static int getpagesize (void);

static gid_t getgid (void);

static pid_t getpid (void);

static pid_t getpgid (pid_t pid);

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);

A set of wrappers for timers and resource stats.

static u_int alarm (u_int secs);

static u_int ualarm (u_int usecs, u_int interval = 0);

static u_int ualarm (
    const ACE_Time_Value &tv,
    const ACE_Time_Value &tv_interval = ACE_Time_Value::zero
    );

static ACE_hrtime_t gethrtime (
    const ACE_HRTimer_Op = ACE_HRTIMER_GETTIME
    );

static void readPPCTimeBase (u_long &most, u_long &least);

static int clock_gettime (clockid_t, struct timespec *);

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 int nanosleep (
    const struct timespec *requested,
    struct timespec *remaining = 0
    );

A set of wrappers for operations on time.

static time_t mktime (struct tm *timeptr);

static double difftime (time_t t1, time_t t0);

static time_t time (time_t *tloc = 0);

static struct tm *localtime (const time_t *clock);

static struct tm *localtime_r (const time_t *clock, struct tm *res);

static struct tm *gmtime (const time_t *clock);

static struct tm *gmtime_r (const time_t *clock, struct tm *res);

static char *asctime (const struct tm *tm);

static char *asctime_r (const struct tm *tm, char *buf, int buflen);

static char *ctime (const time_t *t);

static char *ctime_r (const time_t *clock, char *buf, int buflen);

static wchar_t *ctime (const time_t *t);

static wchar_t *ctime_r (
    const time_t *clock,
    wchar_t *buf,
    int buflen
    );

static size_t strftime (
    char *s,
    size_t maxsize,
    const char *format,
    const struct tm *timeptr
    );

A set of wrappers for memory managment.

static void *sbrk (int brk);

static void *calloc (size_t elements, size_t sizeof_elements);

static void *malloc (size_t);

static void *realloc (void *, size_t);

static void free (void *);

A set of wrappers for memory copying operations.

static int memcmp (const void *t, const void *s, size_t len);

static void *memcpy (void *t, const void *s, size_t len);

static void *memmove (void *t, const void *s, size_t len);

static void *memset (void *s, int c, size_t len);

A set of wrappers for System V message queues.

static int msgctl (int msqid, int cmd, struct 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
    );

A set of wrappers for memory mapped files.

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,
    LPSECURITY_ATTRIBUTES sa = 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);

A set of wrappers for mutex locks.

static int mutex_init (
    ACE_mutex_t *m,
    int type = ACE_DEFAULT_SYNCH_TYPE,
    LPCTSTR name = 0,
    void *arg = 0,
    LPSECURITY_ATTRIBUTES sa = 0
    );

static int mutex_destroy (ACE_mutex_t *m);

static int mutex_lock (ACE_mutex_t *m);

static int mutex_lock (ACE_mutex_t *m, int &abandoned);

static int mutex_trylock (ACE_mutex_t *m);

static int mutex_trylock (ACE_mutex_t *m, int &abandoned);

static int mutex_unlock (ACE_mutex_t *m);

A set of wrappers for mutex locks that only work within a

single process.
static int thread_mutex_init (
    ACE_thread_mutex_t *m,
    int type = ACE_DEFAULT_SYNCH_TYPE,
    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);

A set of wrappers for low-level file operations.

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 int 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 (
    const char *filename,
    int mode,
    int perms = 0,
    LPSECURITY_ATTRIBUTES sa = 0
    );

static int putmsg (
    ACE_HANDLE handle,
    const struct strbuf *ctl,
    const struct strbuf *data,
    int flags
    );

static int 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 pread (
    ACE_HANDLE handle,
    void *buf,
    size_t nbyte,
    off_t offset
    );

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,
    const struct msghdr *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 ssize_t pwrite (
    ACE_HANDLE handle,
    const void *buf,
    size_t nbyte,
    off_t offset
    );

static int writev (
    ACE_HANDLE handle,
    const struct iovec *iov,
    int iovcnt
    );

A set of wrappers for event demultiplexing and IPC.

static int select (
    int width,
    fd_set *rfds,
    fd_set *wfds,
    fd_set *efds,
    const ACE_Time_Value *tv = 0
    );

static int select (
    int width,
    fd_set *rfds,
    fd_set *wfds,
    fd_set *efds,
    const 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 ACE_HANDLE shm_open (
    const char *filename,
    int mode,
    int perms = 0,
    LPSECURITY_ATTRIBUTES sa = 0
    );

static int shm_unlink (const char *path);

A set of wrappers for directory operations.

static mode_t umask (mode_t cmask);

static int chdir (const char *path);

static int mkdir (
    const char *path,
    mode_t mode = ACE_DEFAULT_DIR_PERMS
    );

static int mkfifo (
    const char *file,
    mode_t mode = ACE_DEFAULT_FILE_PERMS
    );

static char *mktemp (char *t);

static char *getcwd (char *, size_t);

static int rename (const char *old_name, const char *new_name);

static int unlink (const char *path);

static char *tempnam (const char *dir, const char *pfx);

A set of wrappers for random number operations.

static int rand (void);

static int rand_r (ACE_RANDR_TYPE seed);

static void srand (u_int seed);

A set of wrappers for readers/writer locks.

static int rwlock_init (
    ACE_rwlock_t *rw,
    int type = ACE_DEFAULT_SYNCH_TYPE,
    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_wrlock (ACE_rwlock_t *rw);

static int rw_tryrdlock (ACE_rwlock_t *rw);

static int rw_trywrlock (ACE_rwlock_t *rw);

static int rw_trywrlock_upgrade (ACE_rwlock_t *rw);

static int rw_unlock (ACE_rwlock_t *rw);

A set of wrappers for auto-reset and manuaevents.

static int event_init (
    ACE_event_t *event,
    int manual_reset = 0,
    int initial_state = 0,
    int type = ACE_DEFAULT_SYNCH_TYPE,
    LPCTSTR name = 0,
    void *arg = 0,
    LPSECURITY_ATTRIBUTES sa = 0
    );

static int event_destroy (ACE_event_t *event);

static int event_wait (ACE_event_t *event);

static int event_timedwait (
    ACE_event_t *event,
    ACE_Time_Value *timeout
    );

static int event_signal (ACE_event_t *event);

static int event_pulse (ACE_event_t *event);

static int event_reset (ACE_event_t *event);

A set of wrappers for semaphores.

static int sema_destroy (ACE_sema_t *s);

static int sema_init (
    ACE_sema_t *s,
    u_int count,
    int type = ACE_DEFAULT_SYNCH_TYPE,
    LPCTSTR name = 0,
    void *arg = 0,
    int max = 0x7fffffff,
    LPSECURITY_ATTRIBUTES sa = 0
    );

static int sema_post (ACE_sema_t *s);

static int sema_post (ACE_sema_t *s, size_t release_count);

static int sema_trywait (ACE_sema_t *s);

static int sema_wait (ACE_sema_t *s);

static int sema_wait (ACE_sema_t *s, ACE_Time_Value &tv);

A set of wrappers for System V semaphores.

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);

Thread scheduler interface.

static int sched_params (
    const ACE_Sched_Params &,
    ACE_id_t id = ACE_SELF
    );

A set of wrappers for System V shared memory.

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);

A set of wrappers for Signals.

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 how, const sigset_t *nsp, sigset_t *osp);

A set of wrappers for sockets.

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 passwd *getpwnam (const char *user);

static struct passwd *getpwnam_r (
    const char *name,
    struct passwd *pwent,
    char *buffer,
    int buflen
    );

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 inet_aton (const char *strptr, 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 int socket_init (int version_high = 1, int version_low = 1);

static int socket_fini (void);

A set of wrappers for regular expressions.

static char *compile (
    const char *instring,
    char *expbuf,
    char *endbuf
    );

static int step (const char *str, char *expbuf);

A set of wrappers for non-UNICODE string operations.

static int to_lower (int c);

static int strcasecmp (const char *s, const char *t);

static int strncasecmp (const char *s, const char *t, size_t len);

static char *strcat (char *s, const char *t);

static char *strchr (char *s, int c);

static char *strrchr (char *s, int c);

static const char *strchr (const char *s, int c);

static const char *strrchr (const char *s, int c);

static int strcmp (const char *s, const char *t);

static int strncmp (const char *s, const char *t, size_t len);

static char *strcpy (char *s, const char *t);

static char *strpbrk (char *s1, const char *s2);

static const char *strpbrk (const char *s1, const char *s2);

static size_t strspn(const char *s1, const char *s2);

static char *strstr (char *s, const char *t);

static const char *strstr (const char *s, const char *t);

static char *strdup (const char *s);

static size_t strlen (const char *s);

static char *strncpy (char *s, const char *t, size_t len);

static char *strncat (char *s, const char *t, size_t len);

static char *strtok (char *s, const char *tokens);

static char *strtok_r (char *s, const char *tokens, char **lasts);

static long strtol (const char *s, char **ptr, int base);

static u_long strtoul (const char *s, char **ptr, int base);

static double strtod (const char *s, char **endptr);

static int ace_isspace (const char s);

static size_t strlen (const wchar_t *s);

static wchar_t *strcpy (wchar_t *s, const wchar_t *t);

The following WChar typedef and functions are used by TAO. TAO does not use wchar_t because the size of wchar_t is platform-dependent.

typedef ACE_UINT32 WChar;

static u_int wslen (const WChar *);

static WChar *wscpy (WChar *, const WChar *);

A set of wrappers for UNICODE string operations.

static int atoi (const wchar_t *s);

static wint_t to_lower (wint_t c);

static wchar_t *strcat (wchar_t *s, const wchar_t *t);

static wchar_t *strchr (const wchar_t *s, wint_t c);

static wchar_t *strrchr (const wchar_t *s, wint_t c);

static int strcmp (const wchar_t *s, const wchar_t *t);

static int strncmp (const wchar_t *s, const wchar_t *t, size_t len);

static int strcasecmp (const wchar_t *s, const wchar_t *t);

static int strncasecmp (
    const wchar_t *s,
    const wchar_t *t,
    size_t len
    );

static wchar_t *strpbrk (const wchar_t *s1, const wchar_t *s2);

static wchar_t *strncpy (wchar_t *s, const wchar_t *t, size_t len);

static wchar_t *strncat (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 ace_isspace (wchar_t c);

static wchar_t *strstr (const wchar_t *s, const wchar_t *t);

static wchar_t *strdup (const wchar_t *s);

static int sprintf (wchar_t *buf, const wchar_t *format, ...);

static int sprintf (wchar_t *buf, const char *format, ...);

the following three are newly added for CE. but they can also be use on Win32. static char *fgets (wchar_t *buf, int size, FILE *fp);

static int fprintf (FILE *fp, const wchar_t *format, ...);

static void perror (const wchar_t *s);

static int vsprintf (
    wchar_t *buffer,
    const wchar_t *format,
    va_list argptr
    );

static int access (const wchar_t *path, int amode);

static FILE *fopen (const wchar_t *filename, const wchar_t *mode);

static FILE *fdopen (ACE_HANDLE handle, const wchar_t *mode);

static int stat (const wchar_t *file, struct stat *);

static wchar_t *getenv (const wchar_t *symbol);

static int system (const wchar_t *s);

static int hostname (wchar_t *name, size_t maxnamelen);

static ACE_HANDLE open (
    const wchar_t *filename,
    int mode,
    int perms = 0,
    LPSECURITY_ATTRIBUTES sa = 0
    );

static int rename (const wchar_t *oldname, const wchar_t *newname);

static int unlink (const wchar_t *path);

static wchar_t *dlerror (void);

static ACE_SHLIB_HANDLE dlopen (
    ACE_WIDE_DL_TYPE filename,
    int mode = ACE_DEFAULT_SHLIB_MODE
    );

static void *dlsym (ACE_SHLIB_HANDLE handle, ACE_WIDE_DL_TYPE symbol);

static wchar_t *mktemp (wchar_t *t);

static int mkdir (
    const wchar_t *path,
    mode_t mode = ACE_DEFAULT_DIR_PERMS
    );

static int chdir (const wchar_t *path);

static wchar_t *getcwd (wchar_t *, size_t);

A set of wrappers for TLI.

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,
    u_int 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,
    u_int 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);

A set of wrappers for threads (these are portable since they use the ACE_Thread_ID).

static int thr_continue (const ACE_Thread_ID &thread);

static int thr_create (
    ACE_THR_FUNC,
    void *args,
    long flags,
    ACE_Thread_ID *,
    long priority = ACE_DEFAULT_THREAD_PRIORITY,
    void *stack = 0,
    size_t stacksize = 0
    );

static int thr_getprio (
    ACE_Thread_ID thr_id,
    int &prio,
    int *policy = 0
    );

static int thr_join (ACE_Thread_ID waiter_id, void **status);

static int thr_kill (ACE_Thread_ID thr_id, int signum);

static ACE_Thread_ID thr_self (void);

static int thr_setprio (ACE_Thread_ID thr_id, int prio);

static int thr_setprio (const ACE_Sched_Priority prio);

static int thr_suspend (ACE_Thread_ID target_thread);

static int thr_cancel (ACE_Thread_ID t_id);

A set of wrappers for threads

These are non-portable since they use ACE_thread_t and ACE_hthread_t and will go away in a future release.
static int thr_continue (ACE_hthread_t target_thread);

static int thr_create (
    ACE_THR_FUNC func,
    void *args,
    long flags,
    ACE_thread_t *thr_id,
    ACE_hthread_t *t_handle = 0,
    long priority = ACE_DEFAULT_THREAD_PRIORITY,
    void *stack = 0,
    size_t stacksize = 0,
    ACE_Thread_Adapter *thread_adapter = 0
    );

static int thr_getprio (ACE_hthread_t thr_id, int &prio);

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_kill (ACE_thread_t thr_id, int signum);

static ACE_thread_t thr_self (void);

static void thr_self (ACE_hthread_t &);

static int thr_setprio (ACE_hthread_t thr_id, int prio);

static int thr_setprio (const ACE_Sched_Priority prio);

static int thr_suspend (ACE_hthread_t target_thread);

static int thr_cancel (ACE_thread_t t_id);

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 lwp_getparams (ACE_Sched_Params &);

static int thr_getspecific (ACE_thread_key_t key, void **data);

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,
    ACE_THR_C_DEST,
    void *inst = 0
    );

static int thr_keycreate (
    ACE_thread_key_t *key,
    ACE_THR_DEST,
    void *inst = 0
    );

static int thr_key_used (ACE_thread_key_t key);

static size_t thr_min_stack (void);

static int thr_setconcurrency (int hint);

static int lwp_setparams (const ACE_Sched_Params &);

static int thr_setspecific (ACE_thread_key_t key, void *data);

static int thr_sigsetmask (
    int how,
    const sigset_t *nsm,
    sigset_t *osm
    );

static int thr_setcancelstate (int new_state, int *old_state);

static int thr_setcanceltype (int new_type, int *old_type);

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;

static ACE_hthread_t NULL_hthread;

static ACE_thread_key_t NULL_key;

static int socket_initialized_;

static void mutex_lock_cleanup (void *mutex);

static void cleanup_tss (const u_int main_thread);

static int netdb_acquire (void);

static int netdb_release (void);

static int scheduling_class (const char *class_name, ACE_id_t &);

static int set_scheduling_params (
    const ACE_Sched_Params &,
    ACE_id_t id = ACE_SELF
    );

Can't call the following priocntl, because that's a macro on Solaris.

static int priority_control (ACE_idtype_t, ACE_id_t, int, void *);

AUTHOR

Doug Schmidt schmidt@cs.wustl.edu, Jesper S. M|ller stophph@diku.dk, and a cast of thousands...

The ACE_Sched_Priority type should be used for platform-

independent thread and process priorities, by convention. int should be used for OS-specific priorities.

LIBRARY

ace