#include <ace/OS.h>
class ACE_QoS : public QOS {
public:
ACE_Flow_Spec sending_flowspec (void) const;
void sending_flowspec (const ACE_Flow_Spec &fs);
ACE_Flow_Spec receiving_flowspec (void) const;
void receiving_flowspec (const ACE_Flow_Spec &fs);
iovec provider_specific (void) const;
void provider_specific (const iovec &ps);
ACE_OS_Object_Manager (void);
~ACE_OS_Object_Manager (void);
private:
ACE_Flow_Spec sending_flowspec_;
ACE_Flow_Spec receiving_flowspec_;
class ACE_QoS_Params {
public:
ACE_QoS_Params ( iovec *caller_data = 0, iovec *callee_data = 0, ACE_QoS *socket_qos = 0, ACE_QoS *group_socket_qos = 0, u_long flags = 0 );
iovec *caller_data (void) const;
void caller_data (iovec *);
iovec *callee_data (void) const;
void callee_data (iovec *);
ACE_QoS *socket_qos (void) const;
void socket_qos (ACE_QoS *);
ACE_QoS *group_socket_qos (void) const;
void group_socket_qos (ACE_QoS *);
u_long flags (void) const;
void flags (u_long);
private:
iovec *caller_data_;
iovec *callee_data_;
ACE_QoS *socket_qos_;
ACE_QoS *group_socket_qos_;
u_long flags_;
};
class ACE_Accept_QoS_Params
{
public:
ACE_Accept_QoS_Params (
ACE_QOS_CONDITION_FUNC qos_condition_callback = 0,
u_long callback_data = 0
);
ACE_QOS_CONDITION_FUNC qos_condition_callback (void) const;
void qos_condition_callback (ACE_QOS_CONDITION_FUNC qcc);
u_long callback_data (void) const;
void callback_data (u_long cd);
private:
ACE_QOS_CONDITION_FUNC qos_condition_callback_;
u_long callback_data_;
};
class ACE_OS
{
public:
enum ACE_HRTimer_Op{ ACE_HRTIMER_START = K_BSTART,
ACE_HRTIMER_INCR = K_BPOINT,
ACE_HRTIMER_STOP = K_BSTOP,
ACE_HRTIMER_GETTIME = 0xFFFF };
enum ACE_HRTimer_Op{ ACE_HRTIMER_START = 0x0,
ACE_HRTIMER_INCR = 0x1,
ACE_HRTIMER_STOP = 0x2,
ACE_HRTIMER_GETTIME = 0xFFFF };
class ace_flock_t
{
public:
void dump (void) const;
ACE_OVERLAPPED overlapped_;
LPCTSTR lockname_;
ACE_HANDLE handle_;
ACE_mutex_t *process_lock_;
};
static LPSECURITY_ATTRIBUTES default_win32_security_attributes (
LPSECURITY_ATTRIBUTES
);
static const OSVERSIONINFO &get_win32_versioninfo (void);
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 int argv_to_string (
ASYS_TCHAR **argv,
ASYS_TCHAR *&buf,
int substitute_env_args = 1
);
static int string_to_argv (
ASYS_TCHAR *buf,
size_t &argc,
ASYS_TCHAR **&argv,
int substitute_env_args = 1
);
static long sysconf (int);
static int condattr_init (
ACE_condattr_t &attributes,
int type = ACE_DEFAULT_SYNCH_TYPE
);
static int condattr_destroy (ACE_condattr_t &attributes);
static int cond_broadcast (ACE_cond_t *cv);
static int cond_destroy (ACE_cond_t *cv);
static int cond_init (
ACE_cond_t *cv,
short type = ACE_DEFAULT_SYNCH_TYPE,
LPCTSTR name = 0,
void *arg = 0
);
static int cond_init (
ACE_cond_t *cv,
ACE_condattr_t &attributes,
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 ASYS_TCHAR *dlerror (void);
static ACE_SHLIB_HANDLE dlopen (
const ASYS_TCHAR *filename,
int mode = ACE_DEFAULT_SHLIB_MODE
);
static void *dlsym (
ACE_SHLIB_HANDLE handle,
const char *symbol
);
static DIR *opendir (const char *filename);
static void closedir (DIR *);
static struct dirent *readdir (DIR *);
static int readdir_r (
DIR *dirp,
struct dirent *entry,
struct dirent **result
);
static long telldir (DIR *);
static void seekdir (DIR *, long loc);
static void rewinddir (DIR *);
static int last_error (void);
static void last_error (int);
static int set_errno_to_last_error (void);
static int set_errno_to_wsa_last_error (void);
static int fclose (FILE *fp);
static int fcntl (ACE_HANDLE handle, int cmd, long arg = 0);
static int fdetach (const char *file);
static int fsync(ACE_HANDLE handle);
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 truncate (const char *filename, off_t length);
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, int n = 0);
static int puts (const char *s);
static int fputs (const char *s, FILE *stream);
static int fflush (FILE *fp);
static size_t fread (
void *ptr,
size_t size,
size_t nelems,
FILE *fp
);
static int fseek (FILE *fp, long offset, int ptrname);
static int fstat (ACE_HANDLE, struct stat *);
static int lstat (const char *, 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 void *bsearch (
const void *key,
const void *base,
size_t nel,
size_t size,
ACE_COMPARE_FUNC
);
static void qsort (
void *base,
size_t nel,
size_t width,
ACE_COMPARE_FUNC
);
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,
int unlink_file = 1
);
static void adjust_flock_params (
ACE_OS::ace_flock_t *lock,
short whence,
off_t &start,
off_t &len
);
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 atexit (ACE_EXIT_HOOK func);
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 void abort (void);
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 int allocation_granularity (void);
static gid_t getgid (void);
static int setgid (gid_t);
static pid_t getpid (void);
static pid_t getpgid (pid_t pid);
static pid_t getppid (void);
static uid_t getuid (void);
static int setuid (uid_t);
static pid_t setsid (void);
static int setpgid (pid_t pid, pid_t pgid);
static int setreuid (uid_t ruid, uid_t euid);
static int setregid (gid_t rgid, gid_t egid);
static int system (const char *s);
static pid_t waitpid (
pid_t pid,
ACE_exitcode *status = 0,
int wait_options = 0,
ACE_HANDLE handle = 0
);
static pid_t wait (
pid_t pid,
ACE_exitcode *status,
int wait_options = 0,
ACE_HANDLE handle = 0
);
static pid_t wait (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 void tzset (void);
static long timezone (void);
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 ASYS_TCHAR *ctime (const time_t *t);
static char *ctime_r (
const time_t *clock,
char *buf,
int buflen
);
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 const void *memchr (const void *s, int c, 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 recursive_mutex_init (
ACE_recursive_thread_mutex_t *m,
LPCTSTR name = 0,
void *arg = 0,
LPSECURITY_ATTRIBUTES sa = 0
);
static int recursive_mutex_destroy (
ACE_recursive_thread_mutex_t *m
);
static int recursive_mutex_lock (
ACE_recursive_thread_mutex_t *m
);
static int recursive_mutex_trylock (
ACE_recursive_thread_mutex_t *m
);
static int recursive_mutex_unlock (
ACE_recursive_thread_mutex_t *m
);
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 long filesize (LPCTSTR 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 ioctl (
ACE_HANDLE socket,
u_long io_control_code,
void *in_buffer_p,
u_long in_buffer,
void *out_buffer_p,
u_long out_buffer,
u_long *bytes_returned,
ACE_OVERLAPPED *overlapped,
ACE_OVERLAPPED_COMPLETION_FUNC func
);
static int ioctl (
ACE_HANDLE socket,
u_long io_control_code,
ACE_QoS &ace_qos,
u_long *bytes_returned,
void *buffer_p = 0,
u_long buffer = 0,
ACE_OVERLAPPED *overlapped = 0,
ACE_OVERLAPPED_COMPLETION_FUNC func = 0
);
static int isastream (ACE_HANDLE handle);
static int isatty (int handle);
static int isatty (ACE_HANDLE handle);
static off_t lseek (
ACE_HANDLE handle,
off_t offset,
int whence
);
ACE_LOFF_T llseek (
ACE_HANDLE handle,
ACE_LOFF_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 read_n (
ACE_HANDLE handle,
void *buf,
size_t len
);
static int readlink (
const char *path,
char *buf,
size_t bufsiz
);
static ssize_t pread (
ACE_HANDLE handle,
void *buf,
size_t nbyte,
off_t offset
);
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 write_n (
ACE_HANDLE handle,
const void *buf,
size_t len
);
static ssize_t pwrite (
ACE_HANDLE handle,
const void *buf,
size_t nbyte,
off_t offset
);
static ssize_t readv (
ACE_HANDLE handle,
iovec *iov,
int iovlen
);
static ssize_t writev (
ACE_HANDLE handle,
const iovec *iov,
int iovcnt
);
static ssize_t recvv (
ACE_HANDLE handle,
iovec *iov,
int iovlen
);
static ssize_t sendv (
ACE_HANDLE handle,
const 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 = 0,
const char *pfx = 0
);
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 sigsuspend (const sigset_t *set);
static int sigprocmask (
int how,
const sigset_t *nsp,
sigset_t *osp
);
static int pthread_sigmask (
int how,
const sigset_t *nsp,
sigset_t *osp
);
static ACE_HANDLE accept (
ACE_HANDLE handle,
struct sockaddr *addr,
int *addrlen
);
static ACE_HANDLE accept (
ACE_HANDLE handle,
struct sockaddr *addr,
int *addrlen,
const ACE_Accept_QoS_Params &qos_params
);
static int bind (
ACE_HANDLE s,
struct sockaddr *name,
int namelen
);
static int connect (
ACE_HANDLE handle,
struct sockaddr *addr,
int addrlen
);
static int connect (
ACE_HANDLE handle,
const sockaddr *addr,
int addrlen,
const ACE_QoS_Params &qos_params
);
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 *gethostbyname2 (
const char *name,
int type
);
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 const char *inet_ntop (
int family,
const void *addrptr,
char *strptr,
size_t len
);
static int inet_pton (
int family,
const char *strptr,
void *addrptr
);
static int enum_protocols (
int *protocols,
ACE_Protocol_Info *protocol_buffer,
u_long *buffer_length
);
static ACE_HANDLE join_leaf (
ACE_HANDLE socket,
const sockaddr *name,
int namelen,
const ACE_QoS_Params &qos_params
);
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 recvfrom (
ACE_HANDLE handle,
iovec *buffers,
int buffer_count,
size_t &number_of_bytes_recvd,
int &flags,
struct sockaddr *addr,
int *addrlen,
ACE_OVERLAPPED *overlapped,
ACE_OVERLAPPED_COMPLETION_FUNC func
);
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 sendto (
ACE_HANDLE handle,
const iovec *buffers,
int buffer_count,
size_t &number_of_bytes_sent,
int flags,
const struct sockaddr *addr,
int addrlen,
ACE_OVERLAPPED *overlapped,
ACE_OVERLAPPED_COMPLETION_FUNC func
);
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 protocol_family,
int type,
int proto
);
static ACE_HANDLE socket (
int protocol_family,
int type,
int proto,
ACE_Protocol_Info *protocolinfo,
ACE_SOCK_GROUP g,
u_long flags
);
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 void setpwent (void);
static void endpwent (void);
static struct passwd *getpwent (void);
static struct passwd *getpwnam (const char *user);
static struct passwd *getpwnam_r (
const char *name,
struct passwd *pwent,
char *buffer,
int buflen
);
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 const char *strchr (const char *s, int c);
static char *strrchr (char *s, int c);
static const char *strrchr (const char *s, int c);
static char *strnchr (char *s, int c, size_t len);
static const char *strnchr (const char *s, int c, size_t len);
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 *strecpy (char *des, const char *src);
static char *strpbrk (char *s1, const char *s2);
static const char *strpbrk (const char *s1, const char *s2);
static size_t strcspn (const char *s, const char *reject);
static size_t strspn(const char *s1, const char *s2);
static char *strptime (
char *buf,
const char *format,
struct tm *tm
);
static char *strstr (char *s, const char *t);
static const char *strstr (const char *s, const char *t);
static char *strnstr (char *s, const char *t, size_t len);
static const char *strnstr (
const char *s,
const char *t,
size_t len
);
static char *strdup (const char *s);
static char *strenvdup (const char *str);
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);
static int strcmp (const wchar_t *s, const wchar_t *t);
static size_t strspn (
const wchar_t *string,
const wchar_t *charset
);
static wchar_t *strenvdup (const wchar_t *str);
static size_t strlen (const ACE_UINT16 *s);
static ACE_UINT16 *strcpy (
ACE_UINT16 *s,
const ACE_UINT16 *t
);
static int strcmp (
const ACE_USHORT16 *s,
const ACE_USHORT16 *t
);
typedef ACE_UINT16 WChar;
static u_int wslen (const WChar *);
static WChar *wscpy (WChar *, const WChar *);
static int wscmp (const WChar *, const WChar *);
static int wsncmp (const WChar *, const WChar *, size_t len);
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 (wchar_t *s, wint_t c);
static const wchar_t *strchr (const wchar_t *s, wint_t c);
static wchar_t *strecpy (wchar_t *s, const wchar_t *t);
static wchar_t *strrchr (wchar_t *s, wint_t c);
static const wchar_t *strrchr (const wchar_t *s, wint_t c);
static wchar_t *strnchr (wchar_t *s, wint_t c, size_t len);
static const wchar_t *strnchr (
const wchar_t *s,
wint_t c,
size_t len
);
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 (wchar_t *s1, const wchar_t *s2);
static const 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 u_long strtoul (
const wchar_t *s,
wchar_t **ptr,
int base
);
static double strtod (const wchar_t *s, wchar_t **endptr);
static int ace_isspace (wchar_t c);
static wchar_t *strstr (wchar_t *s, const wchar_t *t);
static const wchar_t *strstr (
const wchar_t *s,
const wchar_t *t
);
static wchar_t *strnstr (
wchar_t *s,
const wchar_t *t,
size_t len
);
static const wchar_t *strnstr (
const wchar_t *s,
const wchar_t *t,
size_t len
);
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 wchar_t *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 int truncate (const wchar_t *filename, off_t length);
static int putenv (const wchar_t *str);
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 *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 mkfifo (
const wchar_t *file,
mode_t mode = ACE_DEFAULT_FILE_PERMS
);
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 (const 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_OS_thread_key_t key,
void **data
);
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_OS_thread_key_t *key,
ACE_THR_C_DEST,
void *inst = 0
);
static int thr_keycreate (
ACE_thread_key_t *key,
ACE_THR_C_DEST,
void *inst = 0
);
static int thr_keycreate (
ACE_OS_thread_key_t *key,
ACE_THR_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_OS_thread_key_t key,
void *data
);
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 int sigtimedwait (
const sigset_t *set,
siginfo_t *info,
const ACE_Time_Value *timeout
);
static void thr_testcancel (void);
static void thr_yield (void);
static void unique_name (
const void *object,
LPTSTR name,
size_t length
);
static ACE_thread_t NULL_thread;
static ACE_hthread_t NULL_hthread;
static ACE_thread_key_t NULL_key;
static KnCap actorcaps_[ACE_CHORUS_MAX_ACTORS];
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 ACE_EXIT_HOOK exit_hook_;
static ACE_EXIT_HOOK set_exit_hook (ACE_EXIT_HOOK hook);
friend class ACE_OS_Object_Manager;
static int strptime_getnum (
char *buf,
int *num,
int *bi,
int *fi,
int min,
int max
);
static const wchar_t *day_of_week_name[7];
static const wchar_t *month_name[12];
static void fopen_mode_to_open_mode_converter (
char x,
int &hmode
);
static OSVERSIONINFO win32_versioninfo_;
};
class ACE_Object_Manager_Base
{
public:
virtual int init (void) = 0;
virtual int fini (void) = 0;
enum Object_Manager_State{ OBJ_MAN_UNINITIALIZED = 0,
OBJ_MAN_INITIALIZING,
OBJ_MAN_INITIALIZED,
OBJ_MAN_SHUTTING_DOWN,
OBJ_MAN_SHUT_DOWN };
protected:
ACE_Object_Manager_Base (void);
virtual ~ACE_Object_Manager_Base (void);
int starting_up_i (void);
int shutting_down_i (void);
Object_Manager_State object_manager_state_;
u_int dynamically_allocated_;
ACE_Object_Manager_Base *next_;
private:
inline (defined (__DECCXX_VER) && __DECCXX_VER < 60000000);
ACE_Object_Manager_Base (const ACE_Object_Manager_Base &);
ACE_Object_Manager_Base &operator= (
const ACE_Object_Manager_Base &
);
};
static sigset_t *default_mask (void);
static ACE_Thread_Hook *thread_hook (void);
static ACE_Thread_Hook *thread_hook (
ACE_Thread_Hook *new_thread_hook
);
static ACE_OS_Object_Manager *instance (void);
static ACE_OS_Object_Manager *instance_;
static void *preallocated_object[ACE_OS_PREALLOCATED_OBJECTS];
sigset_t *default_mask_;
ACE_Thread_Hook *thread_hook_;
ACE_OS_Exit_Info exit_info_;
int at_exit (ACE_EXIT_HOOK func);
static void print_error_message (
u_int line_number,
LPCTSTR message
);
friend class ACE_OS;
friend class ACE_Object_Manager;
friend class ACE_OS_Object_Manager_Manager;
friend class ACE_TSS_Cleanup;
friend class ACE_TSS_Emulation;
friend class ACE_Log_Msg;
friend void ACE_OS_Object_Manager_Internal_Exit_Hook ();
};
ACE_Flow_Spec sending_flowspec (void) const;
void sending_flowspec (const ACE_Flow_Spec &fs);
ACE_Flow_Spec receiving_flowspec (void) const;
void receiving_flowspec (const ACE_Flow_Spec &fs);
iovec provider_specific (void) const;
void provider_specific (const iovec &ps);
ACE_Object_Manager
can be
constructed/destructed in main
with
ACE_HAS_NONSTATIC_OBJECT_MANAGER
.
ACE_OS_Object_Manager (void);
~ACE_OS_Object_Manager (void);
schmidt@cs.wustl.edu
, Jesper S. M|ller
stophph@diku.dk
, and a cast of thousands...