ACE_OS Namespace Reference

This namespace defines an OS independent programming API that shields developers from nonportable aspects of writing efficient system programs on Win32, POSIX and other versions of UNIX, and various real-time operating systems. More...


Classes

struct  macaddr_node_t
class  ace_flock_t
 OS file locking structure. More...


Functions from <cctype>

Included are the functions defined in and their equivalents.

Since they are often implemented as macros, we don't use the same name here. Instead, we change by prepending "ace_".

ACE_NAMESPACE_INLINE_FUNCTION
int 
ace_isalnum (ACE_TCHAR c)
 Returns true if the character is an alphanumeric character.

ACE_NAMESPACE_INLINE_FUNCTION
int 
ace_isalpha (ACE_TCHAR c)
 Returns true if the character is an alphabetic character.

ACE_NAMESPACE_INLINE_FUNCTION
int 
ace_iscntrl (ACE_TCHAR c)
 Returns true if the character is a control character.

ACE_NAMESPACE_INLINE_FUNCTION
int 
ace_isdigit (ACE_TCHAR c)
 Returns true if the character is a decimal-digit character.

ACE_NAMESPACE_INLINE_FUNCTION
int 
ace_isgraph (ACE_TCHAR c)
 Returns true if the character is a printable character other than a space.

ACE_NAMESPACE_INLINE_FUNCTION
int 
ace_islower (ACE_TCHAR c)
 Returns true if the character is a lowercase character.

ACE_NAMESPACE_INLINE_FUNCTION
int 
ace_isprint (ACE_TCHAR c)
 Returns true if the character is a printable character.

ACE_NAMESPACE_INLINE_FUNCTION
int 
ace_ispunct (ACE_TCHAR c)
 Returns true if the character is a punctuation character.

ACE_NAMESPACE_INLINE_FUNCTION
int 
ace_isspace (ACE_TCHAR c)
 Returns true if the character is a space character.

ACE_NAMESPACE_INLINE_FUNCTION
int 
ace_isupper (ACE_TCHAR c)
 Returns true if the character is an uppercase character.

ACE_NAMESPACE_INLINE_FUNCTION
int 
ace_isxdigit (ACE_TCHAR c)
 Returns true if the character is a hexadecimal-digit character.

ACE_NAMESPACE_INLINE_FUNCTION
int 
ace_tolower (int c)
 Converts a character to lower case (char version).

ACE_NAMESPACE_INLINE_FUNCTION
wint_t 
ace_towlower (wint_t c)
 Converts a character to lower case (wchar_t version).

ACE_NAMESPACE_INLINE_FUNCTION
int 
ace_toupper (int c)
 Converts a character to upper case (char version).

ACE_NAMESPACE_INLINE_FUNCTION
wint_t 
ace_towupper (wint_t c)
 Converts a character to upper case (wchar_t version).


A set of wrappers for explicit dynamic linking.

ACE_NAMESPACE_INLINE_FUNCTION
int 
dlclose (ACE_SHLIB_HANDLE handle)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_TCHAR
dlerror (void)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_SHLIB_HANDLE 
dlopen (const ACE_TCHAR *filename, int mode=ACE_DEFAULT_SHLIB_MODE)
ACE_NAMESPACE_INLINE_FUNCTION
void * 
dlsym (ACE_SHLIB_HANDLE handle, const ACE_TCHAR *symbol)

A set of wrappers for password routines.

ACE_NAMESPACE_INLINE_FUNCTION
void 
endpwent (void)
ACE_NAMESPACE_INLINE_FUNCTION
struct passwd * 
getpwent (void)
ACE_NAMESPACE_INLINE_FUNCTION
struct passwd * 
getpwnam (const char *user)
ACE_NAMESPACE_INLINE_FUNCTION
struct passwd * 
getpwnam_r (const char *name, struct passwd *pwent, char *buffer, int buflen)
ACE_NAMESPACE_INLINE_FUNCTION
void 
setpwent (void)

A set of wrappers for regular expressions.

ACE_NAMESPACE_INLINE_FUNCTION
char * 
compile (const char *instring, char *expbuf, char *endbuf)
ACE_NAMESPACE_INLINE_FUNCTION
int 
step (const char *str, char *expbuf)

A set of wrappers for Signals.

ACE_NAMESPACE_INLINE_FUNCTION
int 
kill (pid_t pid, int signum)
ACE_NAMESPACE_INLINE_FUNCTION
int 
pthread_sigmask (int how, const sigset_t *nsp, sigset_t *osp)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sigaction (int signum, const ACE_SIGACTION *nsa, ACE_SIGACTION *osa)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sigaddset (sigset_t *s, int signum)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sigdelset (sigset_t *s, int signum)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sigemptyset (sigset_t *s)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sigfillset (sigset_t *s)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sigismember (sigset_t *s, int signum)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_SignalHandler 
signal (int signum, ACE_SignalHandler)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sigprocmask (int how, const sigset_t *nsp, sigset_t *osp)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sigsuspend (const sigset_t *set)

Wrappers to obtain the current user id

ACE_NAMESPACE_INLINE_FUNCTION
char * 
cuserid (char *user, size_t maxlen=ACE_MAX_USERID)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t * 
cuserid (wchar_t *user, size_t maxlen=ACE_MAX_USERID)

A set of wrappers for file locks.

ACE_NAMESPACE_INLINE_FUNCTION
void 
flock_adjust_params (ace_flock_t *lock, short whence, off_t &start, off_t &len)
ACE_NAMESPACE_INLINE_FUNCTION
int 
flock_init (ace_flock_t *lock, int flags=0, const ACE_TCHAR *name=0, mode_t perms=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
flock_destroy (ace_flock_t *lock, int unlink_file=1)
ACE_NAMESPACE_INLINE_FUNCTION
int 
flock_rdlock (ace_flock_t *lock, short whence=0, off_t start=0, off_t len=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
flock_tryrdlock (ace_flock_t *lock, short whence=0, off_t start=0, off_t len=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
flock_trywrlock (ace_flock_t *lock, short whence=0, off_t start=0, off_t len=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
flock_unlock (ace_flock_t *lock, short whence=0, off_t start=0, off_t len=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
flock_wrlock (ace_flock_t *lock, short whence=0, off_t start=0, off_t len=0)

Non-standard functions

These functions aren't in the standard.

ACE_NAMESPACE_INLINE_FUNCTION
void 
_exit (int status=0)
ACE_NAMESPACE_INLINE_FUNCTION
void 
abort (void)
ACE_NAMESPACE_INLINE_FUNCTION
int 
atexit (ACE_EXIT_HOOK func)
ACE_NAMESPACE_INLINE_FUNCTION
int 
atoi (const char *s)
ACE_NAMESPACE_INLINE_FUNCTION
int 
atoi (const wchar_t *s)
ACE_NAMESPACE_INLINE_FUNCTION
void * 
atop (const char *s)
ACE_NAMESPACE_INLINE_FUNCTION
void * 
atop (const wchar_t *s)
ACE_NAMESPACE_INLINE_FUNCTION
void * 
bsearch (const void *key, const void *base, size_t nel, size_t size, ACE_COMPARE_FUNC)
ACE_Export void * calloc (size_t elements, size_t sizeof_elements)
ACE_Export void exit (int status=0)
ACE_Export void free (void *)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
getenv (const char *symbol)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t * 
getenv (const wchar_t *symbol)
ACE_Export ACE_TCHARgetenvstrings (void)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
itoa (int value, char *string, int radix)
 Converts an integer to a string.

ACE_NAMESPACE_INLINE_FUNCTION
wchar_t * 
itoa (int value, wchar_t *string, int radix)
 Converts an integer to a string.

ACE_Export char * itoa_emulation (int value, char *string, int radix)
 Emulated itoa - Converts an integer to a string.

ACE_Export wchar_t * itow_emulation (int value, wchar_t *string, int radix)
 Emulated itow - Converts an integer to a string.

ACE_Export void * malloc (size_t)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE 
mkstemp (char *s)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE 
mkstemp (wchar_t *s)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
mktemp (char *s)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t * 
mktemp (wchar_t *s)
ACE_NAMESPACE_INLINE_FUNCTION
int 
putenv (const char *string)
ACE_NAMESPACE_INLINE_FUNCTION
int 
putenv (const wchar_t *string)
ACE_NAMESPACE_INLINE_FUNCTION
void 
qsort (void *base, size_t nel, size_t width, ACE_COMPARE_FUNC)
ACE_NAMESPACE_INLINE_FUNCTION
int 
rand (void)
ACE_NAMESPACE_INLINE_FUNCTION
int 
rand_r (ACE_RANDR_TYPE &seed)
ACE_Export void * realloc (void *, size_t)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
realpath (const char *file_name, char *resolved_name)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t * 
realpath (const wchar_t *file_name, wchar_t *resolved_name)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_EXIT_HOOK 
set_exit_hook (ACE_EXIT_HOOK hook)
 For use by ACE_Object_Manager only, to register its exit hook..

ACE_NAMESPACE_INLINE_FUNCTION
void 
srand (u_int seed)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_TCHAR
strenvdup (const ACE_TCHAR *str)
ACE_NAMESPACE_INLINE_FUNCTION
double 
strtod (const char *s, char **endptr)
 Converts a string to a double value (char version).

ACE_NAMESPACE_INLINE_FUNCTION
double 
strtod (const wchar_t *s, wchar_t **endptr)
 Converts a string to a double value (wchar_t version).

ACE_NAMESPACE_INLINE_FUNCTION
long 
strtol (const char *s, char **ptr, int base)
 Converts a string to a long value (char version).

ACE_NAMESPACE_INLINE_FUNCTION
long 
strtol (const wchar_t *s, wchar_t **ptr, int base)
 Converts a string to a long value (wchar_t version).

ACE_NAMESPACE_INLINE_FUNCTION
unsigned long 
strtoul (const char *s, char **ptr, int base)
 Converts a string to an unsigned long value (char version).

ACE_NAMESPACE_INLINE_FUNCTION
unsigned long 
strtoul (const wchar_t *s, wchar_t **ptr, int base)
 Converts a string to an unsigned long value (wchar_t version).

ACE_NAMESPACE_INLINE_FUNCTION
int 
system (const ACE_TCHAR *s)
ACE_Export ACE_EXIT_HOOK exit_hook_ = 0
 Function that is called by <ACE_OS::exit>, if non-null.


Functions from <cstring>

Included are the functions defined in and their equivalents.

Todo:
To be complete, we should add strcoll, and strxfrm.


ACE_NAMESPACE_INLINE_FUNCTION
const void * 
memchr (const void *s, int c, size_t len)
 Finds characters in a buffer (const void version).

ACE_NAMESPACE_INLINE_FUNCTION
void * 
memchr (void *s, int c, size_t len)
 Finds characters in a buffer (void version).

ACE_Export const void * memchr_emulation (const void *s, int c, size_t len)
 Emulated memchr - Finds a character in a buffer.

ACE_NAMESPACE_INLINE_FUNCTION
int 
memcmp (const void *t, const void *s, size_t len)
 Compares two buffers.

ACE_NAMESPACE_INLINE_FUNCTION
void * 
memcpy (void *t, const void *s, size_t len)
 Copies one buffer to another.

ACE_NAMESPACE_INLINE_FUNCTION
void * 
memmove (void *t, const void *s, size_t len)
 Moves one buffer to another.

ACE_NAMESPACE_INLINE_FUNCTION
void * 
memset (void *s, int c, size_t len)
 Fills a buffer with a character value.

ACE_NAMESPACE_INLINE_FUNCTION
char * 
strcat (char *s, const char *t)
 Appends a string to another string (char version).

ACE_NAMESPACE_INLINE_FUNCTION
wchar_t * 
strcat (wchar_t *s, const wchar_t *t)
 Appends a string to another string (wchar_t version).

ACE_NAMESPACE_INLINE_FUNCTION
const char * 
strchr (const char *s, int c)
ACE_NAMESPACE_INLINE_FUNCTION
const wchar_t * 
strchr (const wchar_t *s, wchar_t c)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
strchr (char *s, int c)
 Finds the first occurance of a character in a string (char version).

ACE_NAMESPACE_INLINE_FUNCTION
wchar_t * 
strchr (wchar_t *s, wchar_t c)
 Finds the first occurance of a character in a string (wchar_t version).

ACE_NAMESPACE_INLINE_FUNCTION
int 
strcmp (const char *s, const char *t)
 Compares two strings (char version).

ACE_NAMESPACE_INLINE_FUNCTION
int 
strcmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t)
 Compares two strings (wchar_t version).

ACE_NAMESPACE_INLINE_FUNCTION
char * 
strcpy (char *s, const char *t)
 Copies a string (char version).

ACE_NAMESPACE_INLINE_FUNCTION
wchar_t * 
strcpy (wchar_t *s, const wchar_t *t)
 Copies a string (wchar_t version).

ACE_NAMESPACE_INLINE_FUNCTION
size_t 
strcspn (const char *s, const char *reject)
ACE_NAMESPACE_INLINE_FUNCTION
size_t 
strcspn (const wchar_t *s, const wchar_t *reject)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
strdup (const char *s)
 Returns a malloced duplicated string (char version).

ACE_NAMESPACE_INLINE_FUNCTION
wchar_t * 
strdup (const wchar_t *s)
 Returns a malloced duplicated string (wchar_t version).

ACE_Export char * strecpy (char *des, const char *src)
ACE_Export wchar_t * strecpy (wchar_t *s, const wchar_t *t)
ACE_Export char * strerror (int errnum)
 Finds characters in a buffer (const void version).

ACE_NAMESPACE_INLINE_FUNCTION
size_t 
strlen (const char *s)
 Finds the length of a string (char version).

ACE_NAMESPACE_INLINE_FUNCTION
size_t 
strlen (const ACE_WCHAR_T *s)
 Finds the length of a string (ACE_WCHAR_T version).

ACE_NAMESPACE_INLINE_FUNCTION
char * 
strncat (char *s, const char *t, size_t len)
 Appends part of a string to another string (char version).

ACE_NAMESPACE_INLINE_FUNCTION
ACE_WCHAR_T * 
strncat (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
 Appends part of a string to another string (wchar_t version).

ACE_Export const char * strnchr (const char *s, int c, size_t len)
ACE_Export const ACE_WCHAR_T * strnchr (const ACE_WCHAR_T *s, ACE_WCHAR_T c, size_t len)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
strnchr (char *s, int c, size_t len)
 Finds the first occurance of a character in an array (char version).

ACE_NAMESPACE_INLINE_FUNCTION
ACE_WCHAR_T * 
strnchr (ACE_WCHAR_T *s, ACE_WCHAR_T c, size_t len)
 Finds the first occurance of a character in an array (ACE_WCHAR_T version).

ACE_NAMESPACE_INLINE_FUNCTION
int 
strncmp (const char *s, const char *t, size_t len)
 Compares two arrays (char version).

ACE_NAMESPACE_INLINE_FUNCTION
int 
strncmp (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
 Compares two arrays (wchar_t version).

ACE_NAMESPACE_INLINE_FUNCTION
char * 
strncpy (char *s, const char *t, size_t len)
 Copies an array (char version).

ACE_NAMESPACE_INLINE_FUNCTION
ACE_WCHAR_T * 
strncpy (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
 Copies an array (ACE_WCHAR_T version).

ACE_NAMESPACE_INLINE_FUNCTION
size_t 
strnlen (const char *s, size_t maxlen)
 Finds the length of a limited-length string (char version).

ACE_NAMESPACE_INLINE_FUNCTION
size_t 
strnlen (const ACE_WCHAR_T *s, size_t maxlen)
 Finds the length of a limited-length string (ACE_WCHAR_T version).

ACE_Export const char * strnstr (const char *s, const char *t, size_t len)
ACE_Export const ACE_WCHAR_T * strnstr (const ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
strnstr (char *s, const char *t, size_t len)
 Finds the first occurance of a substring in an array (char version).

ACE_NAMESPACE_INLINE_FUNCTION
ACE_WCHAR_T * 
strnstr (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len)
 Finds the first occurance of a substring in an array (wchar_t version).

ACE_NAMESPACE_INLINE_FUNCTION
const char * 
strpbrk (const char *s1, const char *s2)
 Searches for characters in a string (const char version).

ACE_NAMESPACE_INLINE_FUNCTION
const wchar_t * 
strpbrk (const wchar_t *s1, const wchar_t *s2)
 Searches for characters in a string (const wchar_t version).

ACE_NAMESPACE_INLINE_FUNCTION
char * 
strpbrk (char *s1, const char *s2)
 Searches for characters in a string (char version).

ACE_NAMESPACE_INLINE_FUNCTION
wchar_t * 
strpbrk (wchar_t *s1, const wchar_t *s2)
 Searches for characters in a string (wchar_t version).

ACE_NAMESPACE_INLINE_FUNCTION
const char * 
strrchr (const char *s, int c)
ACE_NAMESPACE_INLINE_FUNCTION
const wchar_t * 
strrchr (const wchar_t *s, wchar_t c)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
strrchr (char *s, int c)
 Finds the last occurance of a character in a string (char version).

ACE_NAMESPACE_INLINE_FUNCTION
wchar_t * 
strrchr (wchar_t *s, wchar_t c)
 Finds the last occurance of a character in a string (wchar_t version).

ACE_Export char * strrchr_emulation (char *s, int c)
ACE_Export const char * strrchr_emulation (const char *s, int c)
ACE_Export char * strsncpy (char *dst, const char *src, size_t maxlen)
 This is a "safe" c string copy function (char version).

ACE_Export ACE_WCHAR_T * strsncpy (ACE_WCHAR_T *dst, const ACE_WCHAR_T *src, size_t maxlen)
 This is a "safe" c string copy function (wchar_t version).

ACE_NAMESPACE_INLINE_FUNCTION
size_t 
strspn (const char *s1, const char *s2)
ACE_NAMESPACE_INLINE_FUNCTION
size_t 
strspn (const wchar_t *s1, const wchar_t *s2)
ACE_NAMESPACE_INLINE_FUNCTION
const char * 
strstr (const char *s, const char *t)
ACE_NAMESPACE_INLINE_FUNCTION
const wchar_t * 
strstr (const wchar_t *s, const wchar_t *t)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
strstr (char *s, const char *t)
 Finds the first occurance of a substring in a string (char version).

ACE_NAMESPACE_INLINE_FUNCTION
wchar_t * 
strstr (wchar_t *s, const wchar_t *t)
 Finds the first occurance of a substring in a string (wchar_t version).

ACE_NAMESPACE_INLINE_FUNCTION
char * 
strtok (char *s, const char *tokens)
 Finds the next token in a string (char version).

ACE_NAMESPACE_INLINE_FUNCTION
wchar_t * 
strtok (wchar_t *s, const wchar_t *tokens)
 Finds the next token in a string (wchar_t version).


A set of wrappers for memory mapped files.

ACE_NAMESPACE_INLINE_FUNCTION
int 
madvise (caddr_t addr, size_t len, int map_advice)
ACE_NAMESPACE_INLINE_FUNCTION
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, const ACE_TCHAR *file_mapping_name=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
mprotect (void *addr, size_t len, int prot)
ACE_NAMESPACE_INLINE_FUNCTION
int 
msync (void *addr, size_t len, int sync)
ACE_NAMESPACE_INLINE_FUNCTION
int 
munmap (void *addr, size_t len)

A set of wrappers for System V message queues.

ACE_NAMESPACE_INLINE_FUNCTION
int 
msgctl (int msqid, int cmd, struct msqid_ds *)
ACE_NAMESPACE_INLINE_FUNCTION
int 
msgget (key_t key, int msgflg)
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
msgrcv (int int_id, void *buf, size_t len, long type, int flags)
ACE_NAMESPACE_INLINE_FUNCTION
int 
msgsnd (int int_id, const void *buf, size_t len, int flags)

A set of wrappers for System V shared memory.

ACE_NAMESPACE_INLINE_FUNCTION
void * 
shmat (int int_id, const void *shmaddr, int shmflg)
ACE_NAMESPACE_INLINE_FUNCTION
int 
shmctl (int int_id, int cmd, struct shmid_ds *buf)
ACE_NAMESPACE_INLINE_FUNCTION
int 
shmdt (const void *shmaddr)
ACE_NAMESPACE_INLINE_FUNCTION
int 
shmget (key_t key, size_t size, int flags)

A set of wrappers for sockets.

ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE 
accept (ACE_HANDLE handle, struct sockaddr *addr, int *addrlen)
 BSD-style (no QoS).

ACE_Export ACE_HANDLE accept (ACE_HANDLE handle, struct sockaddr *addr, int *addrlen, const ACE_Accept_QoS_Params &qos_params)
ACE_NAMESPACE_INLINE_FUNCTION
int 
bind (ACE_HANDLE s, struct sockaddr *name, int namelen)
 BSD-style (no QoS).

ACE_NAMESPACE_INLINE_FUNCTION
int 
closesocket (ACE_HANDLE s)
 BSD-style (no QoS).

ACE_NAMESPACE_INLINE_FUNCTION
int 
connect (ACE_HANDLE handle, struct sockaddr *addr, int addrlen)
 BSD-style (no QoS).

ACE_Export int connect (ACE_HANDLE handle, const sockaddr *addr, int addrlen, const ACE_QoS_Params &qos_params)
ACE_NAMESPACE_INLINE_FUNCTION
int 
enum_protocols (int *protocols, ACE_Protocol_Info *protocol_buffer, u_long *buffer_length)
ACE_NAMESPACE_INLINE_FUNCTION
int 
getpeername (ACE_HANDLE handle, struct sockaddr *addr, int *addrlen)
 BSD-style (no QoS).

ACE_NAMESPACE_INLINE_FUNCTION
int 
getsockname (ACE_HANDLE handle, struct sockaddr *addr, int *addrlen)
 BSD-style (no QoS).

ACE_NAMESPACE_INLINE_FUNCTION
int 
getsockopt (ACE_HANDLE handle, int level, int optname, char *optval, int *optlen)
 BSD-style (no QoS).

ACE_Export ACE_HANDLE join_leaf (ACE_HANDLE socket, const sockaddr *name, int namelen, const ACE_QoS_Params &qos_params)
 Joins a leaf node into a QoS-enabled multi-point session.

ACE_NAMESPACE_INLINE_FUNCTION
int 
listen (ACE_HANDLE handle, int backlog)
 BSD-style (no QoS).

ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
recv (ACE_HANDLE handle, char *buf, size_t len, int flags=0)
 BSD-style (no QoS).

ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
recvfrom (ACE_HANDLE handle, char *buf, size_t len, int flags, struct sockaddr *addr, int *addrlen)
 BSD-style (no QoS).

ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
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)
 BSD-style (no QoS).

ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
recvmsg (ACE_HANDLE handle, struct msghdr *msg, int flags)
 BSD-style (no QoS).

ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
recvv (ACE_HANDLE handle, iovec *iov, int iovlen)
 BSD-style (no QoS).

ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
send (ACE_HANDLE handle, const char *buf, size_t len, int flags=0)
 BSD-style (no QoS).

ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
sendmsg (ACE_HANDLE handle, const struct msghdr *msg, int flags)
 BSD-style (no QoS).

ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
sendto (ACE_HANDLE handle, const char *buf, size_t len, int flags, const struct sockaddr *addr, int addrlen)
 BSD-style (no QoS).

ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
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)
 BSD-style (no QoS).

ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
sendv (ACE_HANDLE handle, const iovec *iov, int iovcnt)
 BSD-style (no QoS).

ACE_NAMESPACE_INLINE_FUNCTION
int 
setsockopt (ACE_HANDLE handle, int level, int optname, const char *optval, int optlen)
 Manipulate the options associated with a socket.

ACE_NAMESPACE_INLINE_FUNCTION
int 
shutdown (ACE_HANDLE handle, int how)
 BSD-style (no QoS).

ACE_Export int socket_init (int version_high=1, int version_low=1)
ACE_Export int socket_fini (void)
 Finalize WinSock after last use (e.g., when a DLL is unloaded).

ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE 
socket (int protocol_family, int type, int proto)
 Create a BSD-style socket (no QoS).

ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE 
socket (int protocol_family, int type, int proto, ACE_Protocol_Info *protocolinfo, ACE_SOCK_GROUP g, u_long flags)
ACE_NAMESPACE_INLINE_FUNCTION
int 
socketpair (int domain, int type, int protocol, ACE_HANDLE sv[2])
 BSD-style (no QoS).


A set of wrappers for low-level file operations.

ACE_NAMESPACE_INLINE_FUNCTION
ACE_LOFF_T 
filesize (ACE_HANDLE handle)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_LOFF_T 
filesize (const ACE_TCHAR *handle)

A set of wrappers for condition variables.

ACE_NAMESPACE_INLINE_FUNCTION
int 
condattr_init (ACE_condattr_t &attributes, int type=ACE_DEFAULT_SYNCH_TYPE)
ACE_NAMESPACE_INLINE_FUNCTION
int 
condattr_destroy (ACE_condattr_t &attributes)
ACE_NAMESPACE_INLINE_FUNCTION
int 
cond_broadcast (ACE_cond_t *cv)
ACE_NAMESPACE_INLINE_FUNCTION
int 
cond_destroy (ACE_cond_t *cv)
ACE_Export int cond_init (ACE_cond_t *cv, short type=ACE_DEFAULT_SYNCH_TYPE, const char *name=0, void *arg=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
cond_init (ACE_cond_t *cv, ACE_condattr_t &attributes, const char *name=0, void *arg=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
cond_init (ACE_cond_t *cv, short type, const wchar_t *name, void *arg=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
cond_init (ACE_cond_t *cv, ACE_condattr_t &attributes, const wchar_t *name, void *arg=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
cond_signal (ACE_cond_t *cv)
ACE_NAMESPACE_INLINE_FUNCTION
int 
cond_timedwait (ACE_cond_t *cv, ACE_mutex_t *m, ACE_Time_Value *)
ACE_NAMESPACE_INLINE_FUNCTION
int 
cond_wait (ACE_cond_t *cv, ACE_mutex_t *m)

A set of wrappers for auto-reset and manual events.

ACE_Export int event_destroy (ACE_event_t *event)
ACE_Export int event_init (ACE_event_t *event, int manual_reset=0, int initial_state=0, int type=ACE_DEFAULT_SYNCH_TYPE, const char *name=0, void *arg=0, LPSECURITY_ATTRIBUTES sa=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
event_init (ACE_event_t *event, int manual_reset, int initial_state, int type, const wchar_t *name, void *arg=0, LPSECURITY_ATTRIBUTES sa=0)
ACE_Export int event_pulse (ACE_event_t *event)
ACE_Export int event_reset (ACE_event_t *event)
ACE_Export int event_signal (ACE_event_t *event)
ACE_Export int event_timedwait (ACE_event_t *event, ACE_Time_Value *timeout, int use_absolute_time=1)
ACE_Export int event_wait (ACE_event_t *event)

A set of wrappers for mutex locks.

ACE_Export int mutex_destroy (ACE_mutex_t *m)
ACE_Export int mutex_init (ACE_mutex_t *m, int lock_scope=ACE_DEFAULT_SYNCH_TYPE, const char *name=0, ACE_mutexattr_t *arg=0, LPSECURITY_ATTRIBUTES sa=0, int lock_type=0)
ACE_Export int mutex_init (ACE_mutex_t *m, int lock_scope, const wchar_t *name, ACE_mutexattr_t *arg=0, LPSECURITY_ATTRIBUTES sa=0, int lock_type=0)
ACE_Export int mutex_lock (ACE_mutex_t *m)
ACE_Export int mutex_lock (ACE_mutex_t *m, int &abandoned)
ACE_Export int mutex_lock (ACE_mutex_t *m, const ACE_Time_Value &timeout)
ACE_NAMESPACE_INLINE_FUNCTION
int 
mutex_lock (ACE_mutex_t *m, const ACE_Time_Value *timeout)
ACE_Export void mutex_lock_cleanup (void *mutex)
 Handle asynchronous thread cancellation cleanup.

ACE_Export int mutex_trylock (ACE_mutex_t *m)
ACE_Export int mutex_trylock (ACE_mutex_t *m, int &abandoned)
ACE_Export int mutex_unlock (ACE_mutex_t *m)

A set of wrappers for recursive mutex locks.

ACE_NAMESPACE_INLINE_FUNCTION
int 
recursive_mutex_cond_unlock (ACE_recursive_thread_mutex_t *m, ACE_recursive_mutex_state &state)
ACE_NAMESPACE_INLINE_FUNCTION
void 
recursive_mutex_cond_relock (ACE_recursive_thread_mutex_t *m, ACE_recursive_mutex_state &state)
ACE_NAMESPACE_INLINE_FUNCTION
int 
recursive_mutex_destroy (ACE_recursive_thread_mutex_t *m)
ACE_NAMESPACE_INLINE_FUNCTION
int 
recursive_mutex_init (ACE_recursive_thread_mutex_t *m, const ACE_TCHAR *name=0, ACE_mutexattr_t *arg=0, LPSECURITY_ATTRIBUTES sa=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
recursive_mutex_lock (ACE_recursive_thread_mutex_t *m)
ACE_NAMESPACE_INLINE_FUNCTION
int 
recursive_mutex_lock (ACE_recursive_thread_mutex_t *m, const ACE_Time_Value &timeout)
ACE_NAMESPACE_INLINE_FUNCTION
int 
recursive_mutex_lock (ACE_recursive_thread_mutex_t *m, const ACE_Time_Value *timeout)
ACE_NAMESPACE_INLINE_FUNCTION
int 
recursive_mutex_trylock (ACE_recursive_thread_mutex_t *m)
ACE_NAMESPACE_INLINE_FUNCTION
int 
recursive_mutex_unlock (ACE_recursive_thread_mutex_t *m)

A set of wrappers for readers/writer locks.

ACE_NAMESPACE_INLINE_FUNCTION
int 
rw_rdlock (ACE_rwlock_t *rw)
ACE_NAMESPACE_INLINE_FUNCTION
int 
rw_tryrdlock (ACE_rwlock_t *rw)
ACE_NAMESPACE_INLINE_FUNCTION
int 
rw_trywrlock (ACE_rwlock_t *rw)
ACE_NAMESPACE_INLINE_FUNCTION
int 
rw_trywrlock_upgrade (ACE_rwlock_t *rw)
ACE_NAMESPACE_INLINE_FUNCTION
int 
rw_unlock (ACE_rwlock_t *rw)
ACE_NAMESPACE_INLINE_FUNCTION
int 
rw_wrlock (ACE_rwlock_t *rw)
ACE_NAMESPACE_INLINE_FUNCTION
int 
rwlock_destroy (ACE_rwlock_t *rw)
ACE_Export int rwlock_init (ACE_rwlock_t *rw, int type=ACE_DEFAULT_SYNCH_TYPE, const ACE_TCHAR *name=0, void *arg=0)

Thread scheduler interface.

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

A set of wrappers for semaphores.

ACE_NAMESPACE_INLINE_FUNCTION
int 
sema_destroy (ACE_sema_t *s)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sema_init (ACE_sema_t *s, u_int count, int type=ACE_DEFAULT_SYNCH_TYPE, const char *name=0, void *arg=0, int max=0x7fffffff, LPSECURITY_ATTRIBUTES sa=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sema_init (ACE_sema_t *s, u_int count, int type, const wchar_t *name, void *arg=0, int max=0x7fffffff, LPSECURITY_ATTRIBUTES sa=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sema_post (ACE_sema_t *s)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sema_post (ACE_sema_t *s, u_int release_count)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sema_trywait (ACE_sema_t *s)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sema_wait (ACE_sema_t *s)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sema_wait (ACE_sema_t *s, ACE_Time_Value &tv)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sema_wait (ACE_sema_t *s, ACE_Time_Value *tv)

A set of wrappers for System V semaphores.

ACE_NAMESPACE_INLINE_FUNCTION
int 
semctl (int int_id, int semnum, int cmd, semun)
ACE_NAMESPACE_INLINE_FUNCTION
int 
semget (key_t key, int nsems, int flags)
ACE_NAMESPACE_INLINE_FUNCTION
int 
semop (int int_id, struct sembuf *sops, size_t nsops)

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

ACE_NAMESPACE_INLINE_FUNCTION
int 
thread_mutex_destroy (ACE_thread_mutex_t *m)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thread_mutex_init (ACE_thread_mutex_t *m, int lock_type=0, const char *name=0, ACE_mutexattr_t *arg=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thread_mutex_init (ACE_thread_mutex_t *m, int lock_type, const wchar_t *name, ACE_mutexattr_t *arg=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thread_mutex_lock (ACE_thread_mutex_t *m)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thread_mutex_lock (ACE_thread_mutex_t *m, const ACE_Time_Value &timeout)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thread_mutex_lock (ACE_thread_mutex_t *m, const ACE_Time_Value *timeout)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thread_mutex_trylock (ACE_thread_mutex_t *m)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thread_mutex_unlock (ACE_thread_mutex_t *m)

A set of wrappers for operations on time.

ACE_NAMESPACE_INLINE_FUNCTION
char * 
asctime (const struct tm *tm)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
asctime_r (const struct tm *tm, char *buf, int buflen)
ACE_NAMESPACE_INLINE_FUNCTION
int 
clock_gettime (clockid_t, struct timespec *)
ACE_NAMESPACE_INLINE_FUNCTION
int 
clock_settime (clockid_t, const struct timespec *)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_TCHAR
ctime (const time_t *t)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_TCHAR
ctime_r (const time_t *clock, ACE_TCHAR *buf, int buflen)
ACE_NAMESPACE_INLINE_FUNCTION
double 
difftime (time_t t1, time_t t0)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_hrtime_t 
gethrtime (const ACE_HRTimer_Op=ACE_HRTIMER_GETTIME)
ACE_NAMESPACE_INLINE_FUNCTION
struct tm * 
gmtime (const time_t *clock)
ACE_NAMESPACE_INLINE_FUNCTION
struct tm * 
gmtime_r (const time_t *clock, struct tm *res)
ACE_NAMESPACE_INLINE_FUNCTION
struct tm * 
localtime (const time_t *clock)
ACE_Export struct tm * localtime_r (const time_t *clock, struct tm *res)
ACE_Export time_t mktime (struct tm *timeptr)
ACE_NAMESPACE_INLINE_FUNCTION
int 
nanosleep (const struct timespec *requested, struct timespec *remaining=0)
ACE_NAMESPACE_INLINE_FUNCTION
size_t 
strftime (char *s, size_t maxsize, const char *format, const struct tm *timeptr)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
strptime (const char *buf, const char *format, struct tm *tm)
ACE_NAMESPACE_INLINE_FUNCTION
time_t 
time (time_t *tloc=0)
ACE_NAMESPACE_INLINE_FUNCTION
long 
timezone (void)
ACE_NAMESPACE_INLINE_FUNCTION
void 
tzset (void)

[NOHEADER]

ACE_NAMESPACE_INLINE_FUNCTION
pid_t 
fork (void)
ACE_Export pid_t fork (const ACE_TCHAR *program_name)
ACE_Export pid_t fork_exec (ACE_TCHAR *argv[])

A set of wrappers for threads

ACE_Export ACE_thread_t NULL_thread
ACE_Export ACE_hthread_t NULL_hthread
ACE_Export ACE_thread_key_t NULL_key

Typedefs

typedef ACE_WCHAR_T WChar

Enumerations

enum  ACE_HRTimer_Op { ACE_HRTIMER_START = 0x0, ACE_HRTIMER_INCR = 0x1, ACE_HRTIMER_STOP = 0x2, ACE_HRTIMER_GETTIME = 0xFFFF }

Functions

ACE_NAMESPACE_INLINE_FUNCTION
unsigned long 
inet_addr (const char *name)
ACE_Export int inet_aton (const char *strptr, struct in_addr *addr)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
inet_ntoa (const struct in_addr addr)
ACE_NAMESPACE_INLINE_FUNCTION
const char * 
inet_ntop (int family, const void *addrptr, char *strptr, size_t len)
ACE_NAMESPACE_INLINE_FUNCTION
int 
inet_pton (int family, const char *strptr, void *addrptr)
ACE_NAMESPACE_INLINE_FUNCTION
void 
closedir (ACE_DIR *)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_DIR
opendir (const ACE_TCHAR *filename)
ACE_NAMESPACE_INLINE_FUNCTION
struct ACE_DIRENT * 
readdir (ACE_DIR *)
ACE_NAMESPACE_INLINE_FUNCTION
int 
readdir_r (ACE_DIR *dirp, struct ACE_DIRENT *entry, struct ACE_DIRENT **result)
ACE_NAMESPACE_INLINE_FUNCTION
void 
rewinddir (ACE_DIR *)
ACE_NAMESPACE_INLINE_FUNCTION
int 
scandir (const ACE_TCHAR *dirname, struct ACE_DIRENT **namelist[], int(*selector)(const struct ACE_DIRENT *filename), int(*comparator)(const struct ACE_DIRENT **f1, const struct ACE_DIRENT **f2))
ACE_NAMESPACE_INLINE_FUNCTION
void 
seekdir (ACE_DIR *, long loc)
ACE_NAMESPACE_INLINE_FUNCTION
long 
telldir (ACE_DIR *)
ACE_Export int scandir_emulation (const ACE_TCHAR *dirname, ACE_DIRENT **namelist[], int(*selector)(const ACE_DIRENT *entry), int(*comparator)(const ACE_DIRENT **f1, const ACE_DIRENT **f2))
ACE_INLINE int scandir (const ACE_TCHAR *dirname, struct ACE_DIRENT **namelist[], int(*selector)(const struct ACE_DIRENT *), int(*comparator)(const struct ACE_DIRENT **f1, const struct ACE_DIRENT **f2))
ACE_NAMESPACE_INLINE_FUNCTION
int 
last_error (void)
ACE_NAMESPACE_INLINE_FUNCTION
void 
last_error (int)
ACE_NAMESPACE_INLINE_FUNCTION
int 
set_errno_to_last_error (void)
ACE_NAMESPACE_INLINE_FUNCTION
int 
set_errno_to_wsa_last_error (void)
ACE_NAMESPACE_INLINE_FUNCTION
int 
fcntl (ACE_HANDLE handle, int cmd, long arg=0)
ACE_Export ACE_HANDLE open (const char *filename, int mode, int perms=ACE_DEFAULT_OPEN_PERMS, LPSECURITY_ATTRIBUTES sa=0)
ACE_Export ACE_HANDLE open (const wchar_t *filename, int mode, int perms=ACE_DEFAULT_OPEN_PERMS, LPSECURITY_ATTRIBUTES sa=0)
ACE_NAMESPACE_INLINE_FUNCTION
double 
floor (double x)
 This method computes the largest integral value not greater than x.

ACE_NAMESPACE_INLINE_FUNCTION
double 
ceil (double x)
 This method computes the smallest integral value not less than x.

ACE_NAMESPACE_INLINE_FUNCTION
struct hostent * 
gethostbyaddr (const char *addr, int length, int type)
ACE_NAMESPACE_INLINE_FUNCTION
struct hostent * 
gethostbyaddr_r (const char *addr, int length, int type, struct hostent *result, ACE_HOSTENT_DATA buffer, int *h_errnop)
ACE_NAMESPACE_INLINE_FUNCTION
struct hostent * 
gethostbyname (const char *name)
ACE_NAMESPACE_INLINE_FUNCTION
struct hostent * 
gethostbyname_r (const char *name, struct hostent *result, ACE_HOSTENT_DATA buffer, int *h_errnop)
ACE_NAMESPACE_INLINE_FUNCTION
struct hostent * 
getipnodebyaddr (const void *src, size_t len, int family)
ACE_NAMESPACE_INLINE_FUNCTION
struct hostent * 
getipnodebyname (const char *name, int family, int flags=0)
ACE_Export int getmacaddress (struct macaddr_node_t *node)
ACE_NAMESPACE_INLINE_FUNCTION
struct protoent * 
getprotobyname (const char *name)
ACE_NAMESPACE_INLINE_FUNCTION
struct protoent * 
getprotobyname_r (const char *name, struct protoent *result, ACE_PROTOENT_DATA buffer)
ACE_NAMESPACE_INLINE_FUNCTION
struct protoent * 
getprotobynumber (int proto)
ACE_NAMESPACE_INLINE_FUNCTION
struct protoent * 
getprotobynumber_r (int proto, struct protoent *result, ACE_PROTOENT_DATA buffer)
ACE_NAMESPACE_INLINE_FUNCTION
struct servent * 
getservbyname (const char *svc, const char *proto)
ACE_NAMESPACE_INLINE_FUNCTION
struct servent * 
getservbyname_r (const char *svc, const char *proto, struct servent *result, ACE_SERVENT_DATA buf)
ACE_NAMESPACE_INLINE_FUNCTION
int 
poll (struct pollfd *pollfds, unsigned long len, const ACE_Time_Value *tv=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
poll (struct pollfd *pollfds, unsigned long len, const ACE_Time_Value &tv)
ACE_NAMESPACE_INLINE_FUNCTION
void 
clearerr (FILE *fp)
ACE_NAMESPACE_INLINE_FUNCTION
int 
fclose (FILE *fp)
ACE_NAMESPACE_INLINE_FUNCTION
FILE * 
fdopen (ACE_HANDLE handle, const ACE_TCHAR *mode)
ACE_NAMESPACE_INLINE_FUNCTION
int 
fflush (FILE *fp)
ACE_NAMESPACE_INLINE_FUNCTION
int 
fgetc (FILE *fp)
ACE_NAMESPACE_INLINE_FUNCTION
int 
fgetpos (FILE *fp, fpos_t *pos)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
fgets (char *buf, int size, FILE *fp)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t * 
fgets (wchar_t *buf, int size, FILE *fp)
ACE_Export FILE * fopen (const char *filename, const ACE_TCHAR *mode)
ACE_Export FILE * fopen (const wchar_t *filename, const ACE_TCHAR *mode)
ACE_NAMESPACE_INLINE_FUNCTION
LPSECURITY_ATTRIBUTES 
default_win32_security_attributes (LPSECURITY_ATTRIBUTES)
 Default Win32 Security Attributes definition.

ACE_NAMESPACE_INLINE_FUNCTION
LPSECURITY_ATTRIBUTES 
default_win32_security_attributes_r (LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, SECURITY_DESCRIPTOR *)
ACE_NAMESPACE_INLINE_FUNCTION
const OSVERSIONINFO & 
get_win32_versioninfo (void)
 Return the win32 OSVERSIONINFO structure.

ACE_NAMESPACE_INLINE_FUNCTION
HINSTANCE 
get_win32_resource_module (void)
ACE_NAMESPACE_INLINE_FUNCTION
void 
set_win32_resource_module (HINSTANCE)
ACE_NAMESPACE_INLINE_FUNCTION
void 
fopen_mode_to_open_mode_converter (ACE_TCHAR x, int &hmode)
ACE_Export int fprintf (FILE *fp, const char *format,...)
ACE_Export int fprintf (FILE *fp, const wchar_t *format,...)
ACE_NAMESPACE_INLINE_FUNCTION
int 
fputs (const char *s, FILE *stream)
ACE_NAMESPACE_INLINE_FUNCTION
int 
fputs (const wchar_t *s, FILE *stream)
ACE_NAMESPACE_INLINE_FUNCTION
size_t 
fread (void *ptr, size_t size, size_t nelems, FILE *fp)
ACE_NAMESPACE_INLINE_FUNCTION
FILE * 
freopen (const ACE_TCHAR *filename, const ACE_TCHAR *mode, FILE *stream)
ACE_NAMESPACE_INLINE_FUNCTION
int 
fseek (FILE *fp, long offset, int ptrname)
ACE_NAMESPACE_INLINE_FUNCTION
int 
fsetpos (FILE *fp, fpos_t *pos)
ACE_NAMESPACE_INLINE_FUNCTION
long 
ftell (FILE *fp)
ACE_NAMESPACE_INLINE_FUNCTION
size_t 
fwrite (const void *ptr, size_t size, size_t nitems, FILE *fp)
ACE_NAMESPACE_INLINE_FUNCTION
void 
perror (const char *s)
ACE_NAMESPACE_INLINE_FUNCTION
void 
perror (const wchar_t *s)
ACE_Export int printf (const char *format,...)
ACE_NAMESPACE_INLINE_FUNCTION
int 
puts (const char *s)
ACE_NAMESPACE_INLINE_FUNCTION
int 
puts (const wchar_t *s)
ACE_NAMESPACE_INLINE_FUNCTION
int 
rename (const char *old_name, const char *new_name, int flags=-1)
ACE_NAMESPACE_INLINE_FUNCTION
int 
rename (const wchar_t *old_name, const wchar_t *new_name, int flags=-1)
ACE_NAMESPACE_INLINE_FUNCTION
void 
rewind (FILE *fp)
ACE_Export int snprintf (char *buf, size_t maxlen, const char *format,...)
ACE_Export int snprintf (wchar_t *buf, size_t maxlen, const wchar_t *format,...)
ACE_Export int sprintf (char *buf, const char *format,...)
ACE_Export int sprintf (wchar_t *buf, const wchar_t *format,...)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
tempnam (const char *dir=0, const char *pfx=0)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t * 
tempnam (const wchar_t *dir, const wchar_t *pfx=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
vsprintf (char *buffer, const char *format, va_list argptr)
ACE_NAMESPACE_INLINE_FUNCTION
int 
vsnprintf (char *buffer, size_t maxlen, const char *format, va_list argptr)
ACE_NAMESPACE_INLINE_FUNCTION
int 
vsprintf (wchar_t *buffer, const wchar_t *format, va_list argptr)
ACE_NAMESPACE_INLINE_FUNCTION
int 
vsnprintf (wchar_t *buffer, size_t maxlen, const wchar_t *format, va_list argptr)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
strtok_r (char *s, const char *tokens, char **lasts)
 Finds the next token in a string (safe char version).

ACE_NAMESPACE_INLINE_FUNCTION
wchar_t * 
strtok_r (ACE_WCHAR_T *s, const ACE_WCHAR_T *tokens, ACE_WCHAR_T **lasts)
 Finds the next token in a string (wchar_t version).

ACE_Export char * strtok_r_emulation (char *s, const char *tokens, char **lasts)
 Emulated strtok_r.

ACE_NAMESPACE_INLINE_FUNCTION
int 
strcasecmp (const char *s, const char *t)
 Compares two strings (case insensitive const char version).

ACE_NAMESPACE_INLINE_FUNCTION
int 
strcasecmp (const wchar_t *s, const wchar_t *t)
 Compares two strings (case insensitive const wchar_t version).

ACE_NAMESPACE_INLINE_FUNCTION
int 
strncasecmp (const char *s, const char *t, size_t len)
 Compares two arrays (case insensitive const char version).

ACE_NAMESPACE_INLINE_FUNCTION
int 
strncasecmp (const wchar_t *s, const wchar_t *t, size_t len)
 Compares two arrays (case insensitive const wchar_t version).

ACE_Export int strcasecmp_emulation (const char *s, const char *t)
 Emulated strcasecmp - Performs a case insensitive comparison of strings.

ACE_Export int strncasecmp_emulation (const char *s, const char *t, size_t len)
 Emulated strncasecmp - Performs a case insensitvie comparison of arrays.

ACE_NAMESPACE_INLINE_FUNCTION
int 
getmsg (ACE_HANDLE handle, struct strbuf *ctl, struct strbuf *data, int *flags)
ACE_NAMESPACE_INLINE_FUNCTION
int 
getpmsg (ACE_HANDLE handle, struct strbuf *ctl, struct strbuf *data, int *band, int *flags)
ACE_NAMESPACE_INLINE_FUNCTION
int 
fattach (int handle, const char *path)
ACE_NAMESPACE_INLINE_FUNCTION
int 
fdetach (const char *file)
ACE_NAMESPACE_INLINE_FUNCTION
int 
ioctl (ACE_HANDLE handle, ACE_IOCTL_TYPE_ARG2 cmd, void *=0)
 UNIX-style .

ACE_Export int ioctl (ACE_HANDLE socket, unsigned long io_control_code, void *in_buffer_p, unsigned long in_buffer, void *out_buffer_p, unsigned long out_buffer, unsigned long *bytes_returned, ACE_OVERLAPPED *overlapped, ACE_OVERLAPPED_COMPLETION_FUNC func)
 QoS-enabled .

ACE_Export int ioctl (ACE_HANDLE socket, unsigned long io_control_code, ACE_QoS &ace_qos, unsigned long *bytes_returned, void *buffer_p=0, unsigned long buffer=0, ACE_OVERLAPPED *overlapped=0, ACE_OVERLAPPED_COMPLETION_FUNC func=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
isastream (ACE_HANDLE handle)
ACE_NAMESPACE_INLINE_FUNCTION
int 
putmsg (ACE_HANDLE handle, const struct strbuf *ctl, const struct strbuf *data, int flags)
ACE_NAMESPACE_INLINE_FUNCTION
int 
putpmsg (ACE_HANDLE handle, const struct strbuf *ctl, const struct strbuf *data, int band, int flags)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE 
shm_open (const ACE_TCHAR *filename, int mode, int perms=0, LPSECURITY_ATTRIBUTES sa=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
shm_unlink (const ACE_TCHAR *path)
ACE_NAMESPACE_INLINE_FUNCTION
int 
getrlimit (int resource, struct rlimit *rl)
ACE_NAMESPACE_INLINE_FUNCTION
int 
getrusage (int who, struct rusage *rusage)
ACE_NAMESPACE_INLINE_FUNCTION
int 
setrlimit (int resource, const struct rlimit *rl)
ACE_NAMESPACE_INLINE_FUNCTION
int 
select (int width, fd_set *rfds, fd_set *wfds=0, fd_set *efds=0, const ACE_Time_Value *tv=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
select (int width, fd_set *rfds, fd_set *wfds, fd_set *efds, const ACE_Time_Value &tv)
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
sendfile (ACE_HANDLE out_fd, ACE_HANDLE in_fd, off_t *offset, size_t count)
 Finds the length of a string (char version).

ACE_Export ssize_t sendfile_emulation (ACE_HANDLE out_fd, ACE_HANDLE in_fd, off_t *offset, size_t count)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE 
creat (const ACE_TCHAR *filename, mode_t mode)
ACE_NAMESPACE_INLINE_FUNCTION
int 
fstat (ACE_HANDLE, ACE_stat *)
ACE_NAMESPACE_INLINE_FUNCTION
int 
lstat (const char *, ACE_stat *)
ACE_NAMESPACE_INLINE_FUNCTION
int 
lstat (const wchar_t *, ACE_stat *)
ACE_NAMESPACE_INLINE_FUNCTION
int 
mkdir (const char *path, mode_t mode=ACE_DEFAULT_DIR_PERMS)
ACE_NAMESPACE_INLINE_FUNCTION
int 
mkdir (const wchar_t *path, mode_t mode=ACE_DEFAULT_DIR_PERMS)
ACE_NAMESPACE_INLINE_FUNCTION
int 
mkfifo (const ACE_TCHAR *file, mode_t mode=ACE_DEFAULT_FILE_PERMS)
ACE_NAMESPACE_INLINE_FUNCTION
int 
stat (const char *file, ACE_stat *)
ACE_NAMESPACE_INLINE_FUNCTION
int 
stat (const wchar_t *file, ACE_stat *)
ACE_NAMESPACE_INLINE_FUNCTION
mode_t 
umask (mode_t cmask)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_Time_Value 
gettimeofday (void)
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
readv (ACE_HANDLE handle, const iovec *iov, int iovlen)
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
writev (ACE_HANDLE handle, const iovec *iov, int iovcnt)
ACE_Export int uname (ACE_utsname *name)
ACE_NAMESPACE_INLINE_FUNCTION
pid_t 
wait (int *=0)
ACE_NAMESPACE_INLINE_FUNCTION
pid_t 
wait (pid_t pid, ACE_exitcode *status, int wait_options=0, ACE_HANDLE handle=0)
ACE_NAMESPACE_INLINE_FUNCTION
pid_t 
waitpid (pid_t pid, ACE_exitcode *status=0, int wait_options=0, ACE_HANDLE handle=0)
ACE_Export void cleanup_tss (const u_int main_thread)
ACE_Export int lwp_getparams (ACE_Sched_Params &)
ACE_Export int lwp_setparams (const ACE_Sched_Params &)
ACE_NAMESPACE_INLINE_FUNCTION
long 
priority_control (ACE_idtype_t, ACE_id_t, int, void *)
 Low-level interface to (2).

ACE_Export int scheduling_class (const char *class_name, ACE_id_t &)
 Find the schedling class ID that corresponds to the class name.

ACE_Export int set_scheduling_params (const ACE_Sched_Params &, ACE_id_t id=ACE_SELF)
 Friendly interface to (2).

ACE_NAMESPACE_INLINE_FUNCTION
int 
sigtimedwait (const sigset_t *set, siginfo_t *info, const ACE_Time_Value *timeout)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sigwait (sigset_t *set, int *sig=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sigwaitinfo (const sigset_t *set, siginfo_t *info)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thr_cancel (ACE_thread_t t_id)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thr_cmp (ACE_hthread_t t1, ACE_hthread_t t2)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thr_continue (ACE_hthread_t target_thread)
ACE_Export 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_Base_Thread_Adapter *thread_adapter=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thr_equal (ACE_thread_t t1, ACE_thread_t t2)
ACE_Export void thr_exit (ACE_THR_FUNC_RETURN status=0)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thr_getconcurrency (void)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thr_getprio (ACE_hthread_t id, int &priority)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thr_getprio (ACE_hthread_t id, int &priority, int &policy)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thr_getspecific (ACE_thread_key_t key, void **data)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thr_join (ACE_hthread_t waiter_id, ACE_THR_FUNC_RETURN *status)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thr_join (ACE_thread_t waiter_id, ACE_thread_t *thr_id, ACE_THR_FUNC_RETURN *status)
ACE_Export int thr_get_affinity (ACE_hthread_t id, size_t cpu_set_size, cpu_set_t *cpu_mask)
ACE_Export int thr_set_affinity (ACE_hthread_t thr_id, size_t cpu_set_size, const cpu_set_t *cpu_mask)
ACE_Export int thr_key_detach (ACE_thread_key_t key, void *inst)
ACE_Export int thr_key_used (ACE_thread_key_t key)
ACE_Export int thr_keycreate (ACE_thread_key_t *key, ACE_THR_DEST, void *inst=0)
ACE_Export int thr_keyfree (ACE_thread_key_t key)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thr_kill (ACE_thread_t thr_id, int signum)
ACE_NAMESPACE_INLINE_FUNCTION
size_t 
thr_min_stack (void)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_thread_t 
thr_self (void)
ACE_NAMESPACE_INLINE_FUNCTION
void 
thr_self (ACE_hthread_t &)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thr_setcancelstate (int new_state, int *old_state)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thr_setcanceltype (int new_type, int *old_type)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thr_setconcurrency (int hint)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thr_setprio (ACE_hthread_t ht_id, int priority, int policy=-1)
ACE_Export int thr_setprio (const ACE_Sched_Priority prio)
ACE_Export int thr_setspecific (ACE_thread_key_t key, void *data)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thr_sigsetmask (int how, const sigset_t *nsm, sigset_t *osm)
ACE_NAMESPACE_INLINE_FUNCTION
int 
thr_suspend (ACE_hthread_t target_thread)
ACE_NAMESPACE_INLINE_FUNCTION
void 
thr_testcancel (void)
ACE_NAMESPACE_INLINE_FUNCTION
void 
thr_yield (void)
ACE_Export void unique_name (const void *object, char *name, size_t length)
ACE_NAMESPACE_INLINE_FUNCTION
int 
access (const char *path, int amode)
ACE_NAMESPACE_INLINE_FUNCTION
int 
access (const wchar_t *path, int amode)
ACE_NAMESPACE_INLINE_FUNCTION
unsigned int 
alarm (u_int secs)
ACE_NAMESPACE_INLINE_FUNCTION
long 
allocation_granularity (void)
ACE_Export int argv_to_string (ACE_TCHAR **argv, ACE_TCHAR *&buf, bool substitute_env_args=true)
ACE_NAMESPACE_INLINE_FUNCTION
int 
chdir (const char *path)
ACE_NAMESPACE_INLINE_FUNCTION
int 
chdir (const wchar_t *path)
ACE_NAMESPACE_INLINE_FUNCTION
int 
rmdir (const char *path)
ACE_NAMESPACE_INLINE_FUNCTION
int 
rmdir (const wchar_t *path)
ACE_NAMESPACE_INLINE_FUNCTION
int 
close (ACE_HANDLE handle)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE 
dup (ACE_HANDLE handle)
ACE_NAMESPACE_INLINE_FUNCTION
int 
dup2 (ACE_HANDLE oldfd, ACE_HANDLE newfd)
ACE_Export int execl (const char *path, const char *arg0,...)
ACE_Export int execle (const char *path, const char *arg0,...)
ACE_Export int execlp (const char *file, const char *arg0,...)
ACE_NAMESPACE_INLINE_FUNCTION
int 
execv (const char *path, char *const argv[])
ACE_NAMESPACE_INLINE_FUNCTION
int 
execve (const char *path, char *const argv[], char *const envp[])
ACE_NAMESPACE_INLINE_FUNCTION
int 
execvp (const char *file, char *const argv[])
ACE_NAMESPACE_INLINE_FUNCTION
int 
fsync (ACE_HANDLE handle)
ACE_NAMESPACE_INLINE_FUNCTION
int 
ftruncate (ACE_HANDLE, ACE_LOFF_T)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
getcwd (char *, size_t)
ACE_NAMESPACE_INLINE_FUNCTION
wchar_t * 
getcwd (wchar_t *, size_t)
ACE_NAMESPACE_INLINE_FUNCTION
gid_t 
getgid (void)
ACE_NAMESPACE_INLINE_FUNCTION
gid_t 
getegid (void)
ACE_NAMESPACE_INLINE_FUNCTION
int 
getopt (int argc, char *const *argv, const char *optstring)
ACE_NAMESPACE_INLINE_FUNCTION
long 
getpagesize (void)
ACE_NAMESPACE_INLINE_FUNCTION
pid_t 
getpgid (pid_t pid)
ACE_NAMESPACE_INLINE_FUNCTION
pid_t 
getpid (void)
ACE_NAMESPACE_INLINE_FUNCTION
pid_t 
getppid (void)
ACE_NAMESPACE_INLINE_FUNCTION
uid_t 
getuid (void)
ACE_NAMESPACE_INLINE_FUNCTION
uid_t 
geteuid (void)
ACE_NAMESPACE_INLINE_FUNCTION
int 
hostname (char *name, size_t maxnamelen)
ACE_NAMESPACE_INLINE_FUNCTION
int 
hostname (wchar_t *name, size_t maxnamelen)
ACE_NAMESPACE_INLINE_FUNCTION
int 
isatty (int handle)
ACE_NAMESPACE_INLINE_FUNCTION
int 
isatty (ACE_HANDLE handle)
ACE_NAMESPACE_INLINE_FUNCTION
off_t 
lseek (ACE_HANDLE handle, off_t offset, int whence)
ACE_Export long num_processors (void)
 Get the number of CPUs configured in the machine.

ACE_Export long num_processors_online (void)
 Get the number of CPUs currently online.

ACE_NAMESPACE_INLINE_FUNCTION
int 
pipe (ACE_HANDLE handles[])
ACE_Export ssize_t pread (ACE_HANDLE handle, void *buf, size_t nbyte, off_t offset)
ACE_Export ssize_t pwrite (ACE_HANDLE handle, const void *buf, size_t nbyte, ACE_LOFF_T offset)
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
read (ACE_HANDLE handle, void *buf, size_t len)
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
read (ACE_HANDLE handle, void *buf, size_t len, ACE_OVERLAPPED *)
ACE_Export ssize_t read_n (ACE_HANDLE handle, void *buf, size_t len, size_t *bytes_transferred=0)
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
readlink (const char *path, char *buf, size_t bufsiz)
ACE_NAMESPACE_INLINE_FUNCTION
void * 
sbrk (ptrdiff_t brk)
ACE_NAMESPACE_INLINE_FUNCTION
int 
setgid (gid_t)
ACE_NAMESPACE_INLINE_FUNCTION
int 
setegid (gid_t)
ACE_NAMESPACE_INLINE_FUNCTION
int 
setpgid (pid_t pid, pid_t pgid)
ACE_NAMESPACE_INLINE_FUNCTION
int 
setregid (gid_t rgid, gid_t egid)
ACE_NAMESPACE_INLINE_FUNCTION
int 
setreuid (uid_t ruid, uid_t euid)
ACE_NAMESPACE_INLINE_FUNCTION
pid_t 
setsid (void)
ACE_NAMESPACE_INLINE_FUNCTION
int 
setuid (uid_t)
ACE_NAMESPACE_INLINE_FUNCTION
int 
seteuid (uid_t)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sleep (u_int seconds)
ACE_NAMESPACE_INLINE_FUNCTION
int 
sleep (const ACE_Time_Value &tv)
ACE_Export int string_to_argv (ACE_TCHAR *buf, int &argc, ACE_TCHAR **&argv, bool substitute_env_args=true)
ACE_NAMESPACE_INLINE_FUNCTION
void 
swab (const void *src, void *dest, ssize_t n)
ACE_NAMESPACE_INLINE_FUNCTION
long 
sysconf (int)
ACE_NAMESPACE_INLINE_FUNCTION
long 
sysinfo (int cmd, char *buf, long count)
ACE_NAMESPACE_INLINE_FUNCTION
int 
truncate (const ACE_TCHAR *filename, ACE_LOFF_T length)
ACE_NAMESPACE_INLINE_FUNCTION
u_long 
ualarm (u_long usecs, u_long interval=0)
ACE_NAMESPACE_INLINE_FUNCTION
u_long 
ualarm (const ACE_Time_Value &tv, const ACE_Time_Value &tv_interval=ACE_Time_Value::zero)
ACE_NAMESPACE_INLINE_FUNCTION
int 
unlink (const char *path)
ACE_NAMESPACE_INLINE_FUNCTION
int 
unlink (const wchar_t *path)
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
write (ACE_HANDLE handle, const void *buf, size_t nbyte)
ACE_NAMESPACE_INLINE_FUNCTION
ssize_t 
write (ACE_HANDLE handle, const void *buf, size_t nbyte, ACE_OVERLAPPED *)
ACE_Export ssize_t write_n (ACE_HANDLE handle, const void *buf, size_t len, size_t *bytes_transferred=0)
ACE_NAMESPACE_INLINE_FUNCTION
wint_t 
fgetwc (FILE *fp)
ACE_Export wchar_t * wcscat_emulation (wchar_t *destination, const wchar_t *source)
 Emulated wcscat - Appends a string.

ACE_Export wchar_t * wcschr_emulation (const wchar_t *string, wint_t c)
 Emulated wcschr - Finds a character in a string.

ACE_Export int wcscmp_emulation (const ACE_WCHAR_T *string1, const ACE_WCHAR_T *string2)
 Emulated wcscmp - Compares strings.

ACE_Export wchar_t * wcscpy_emulation (wchar_t *destination, const wchar_t *source)
 Emulated wcscpy - Copies a string.

ACE_Export size_t wcscspn_emulation (const wchar_t *string, const wchar_t *reject)
 Emulated wcscspn.

ACE_Export int wcsicmp_emulation (const wchar_t *string1, const wchar_t *string2)
 Emulated wcsicmp - Performs a case insensitive comparison of strings.

ACE_Export size_t wcslen_emulation (const ACE_WCHAR_T *string)
 Emulated wcslen - Returns the length of a string.

ACE_Export ACE_WCHAR_T * wcsncat_emulation (ACE_WCHAR_T *destination, const ACE_WCHAR_T *source, size_t count)
 Emulated wcscat - Appends a string.

ACE_Export int wcsncmp_emulation (const ACE_WCHAR_T *string1, const ACE_WCHAR_T *string2, size_t len)
 Emulated wcsncmp - Compares two arrays.

ACE_Export ACE_WCHAR_T * wcsncpy_emulation (ACE_WCHAR_T *destination, const ACE_WCHAR_T *source, size_t len)
 Emulated wcsncpy - Copies an array.

ACE_Export int wcsnicmp_emulation (const wchar_t *string1, const wchar_t *string2, size_t len)
ACE_Export wchar_t * wcspbrk_emulation (const wchar_t *string, const wchar_t *charset)
 Emulated wcspbrk - Searches for characters in a string.

ACE_Export wchar_t * wcsrchr_emulation (wchar_t *string, wint_t c)
ACE_Export const wchar_t * wcsrchr_emulation (const wchar_t *string, wint_t c)
ACE_Export size_t wcsspn_emulation (const wchar_t *string, const wchar_t *charset)
 Emulated wcsspn.

ACE_Export wchar_t * wcsstr_emulation (const wchar_t *string, const wchar_t *charset)
 Emulated wcsstr - Performs a case insensitive comparison of two strings.

ACE_NAMESPACE_INLINE_FUNCTION
u_int 
wslen (const WChar *)
ACE_NAMESPACE_INLINE_FUNCTION
WChar
wscpy (WChar *, const WChar *)
ACE_NAMESPACE_INLINE_FUNCTION
int 
wscmp (const WChar *, const WChar *)
ACE_NAMESPACE_INLINE_FUNCTION
int 
wsncmp (const WChar *, const WChar *, size_t len)
ACE_NAMESPACE_INLINE_FUNCTION
wint_t 
ungetwc (wint_t c, FILE *fp)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_accept (ACE_HANDLE fildes, ACE_HANDLE resfd, struct t_call *call)
ACE_NAMESPACE_INLINE_FUNCTION
char * 
t_alloc (ACE_HANDLE fildes, int struct_type, int fields)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_bind (ACE_HANDLE fildes, struct t_bind *req, struct t_bind *ret)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_close (ACE_HANDLE fildes)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_connect (ACE_HANDLE fildes, struct t_call *sndcall, struct t_call *rcvcall)
ACE_NAMESPACE_INLINE_FUNCTION
void 
t_error (const char *errmsg)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_free (char *ptr, int struct_type)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_getinfo (ACE_HANDLE fildes, struct t_info *info)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_getname (ACE_HANDLE fildes, struct netbuf *namep, int type)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_getstate (ACE_HANDLE fildes)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_listen (ACE_HANDLE fildes, struct t_call *call)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_look (ACE_HANDLE fildes)
ACE_NAMESPACE_INLINE_FUNCTION
ACE_HANDLE 
t_open (char *path, int oflag, struct t_info *info)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_optmgmt (ACE_HANDLE handle, ACE_TOPTMGMT *req, ACE_TOPTMGMT *ret)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_rcv (ACE_HANDLE fildes, char *buf, unsigned int nbytes, int *flags)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_rcvdis (ACE_HANDLE fildes, struct t_discon *discon)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_rcvrel (ACE_HANDLE fildes)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_rcvudata (ACE_HANDLE fildes, struct t_unitdata *unitdata, int *flags)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_rcvuderr (ACE_HANDLE fildes, struct t_uderr *uderr)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_snd (ACE_HANDLE fildes, const char *buf, unsigned int nbytes, int flags)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_snddis (ACE_HANDLE fildes, struct t_call *call)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_sndrel (ACE_HANDLE fildes)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_sync (ACE_HANDLE fildes)
ACE_NAMESPACE_INLINE_FUNCTION
int 
t_unbind (ACE_HANDLE fildes)

Variables

ACE_Export OSVERSIONINFO win32_versioninfo_
ACE_Export HINSTANCE win32_resource_module_
ACE_Export int socket_initialized_
 Keeps track of whether we've already initialized WinSock...


Detailed Description

This namespace defines an OS independent programming API that shields developers from nonportable aspects of writing efficient system programs on Win32, POSIX and other versions of UNIX, and various real-time operating systems.

This namespace encapsulates the differences between various OS platforms. When porting ACE to a new platform, this class is the place to focus on. Once this file is ported to a new platform, pretty much everything else comes for "free." See <www.cs.wustl.edu/~schmidt/ACE_wrappers/etc/ACE-porting.html> for instructions on porting ACE. Please see the README file in this directory for complete information on the meaning of the various macros.


Typedef Documentation

typedef ACE_WCHAR_T ACE_OS::WChar
 

Definition at line 45 of file OS_NS_wchar.h.


Enumeration Type Documentation

enum ACE_OS::ACE_HRTimer_Op
 

Enumeration values:
ACE_HRTIMER_START 
ACE_HRTIMER_INCR 
ACE_HRTIMER_STOP 
ACE_HRTIMER_GETTIME 

Definition at line 161 of file OS_NS_time.h.

00162     {
00163       ACE_HRTIMER_START = 0x0,  // Only use these if you can stand
00164       ACE_HRTIMER_INCR = 0x1,   // for interrupts to be disabled during
00165       ACE_HRTIMER_STOP = 0x2,   // the timed interval!!!!
00166       ACE_HRTIMER_GETTIME = 0xFFFF
00167     };


Function Documentation

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE void ACE_OS::_exit int  status = 0  ) 
 

Definition at line 23 of file OS_NS_stdlib.inl.

References ACE_OS_TRACE.

Referenced by ACE::fork(), and ACE_Process::spawn().

00024 {
00025   ACE_OS_TRACE ("ACE_OS::_exit");
00026 #if defined (ACE_VXWORKS)
00027   ::exit (status);
00028 #elif !defined (ACE_HAS_WINCE)
00029   ::_exit (status);
00030 #else
00031   ::TerminateProcess (::GetCurrentProcess (),
00032                       status);
00033 #endif /* ACE_VXWORKS */
00034 }

ACE_INLINE void ACE_OS::abort void   ) 
 

Definition at line 37 of file OS_NS_stdlib.inl.

References exit().

Referenced by ACE_Log_Msg::log().

00038 {
00039 #if !defined (ACE_HAS_WINCE)
00040   ::abort ();
00041 #else
00042   // @@ CE doesn't support abort?
00043   exit (1);
00044 #endif /* !ACE_HAS_WINCE */
00045 }

ACE_HANDLE ACE_OS::accept ACE_HANDLE  handle,
struct sockaddr *  addr,
int *  addrlen,
const ACE_Accept_QoS_Params qos_params
 

QoS-enabled , which passes to . If the OS platform doesn't support QoS-enabled then the are ignored and the BSD-style is called.

Definition at line 19 of file OS_NS_sys_socket.cpp.

References accept(), ACE_SOCKCALL_RETURN, ACE_SOCKET_LEN, ACE_Accept_QoS_Params::callback_data(), and ACE_Accept_QoS_Params::qos_condition_callback().

00023 {
00024 # if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00025   ACE_SOCKCALL_RETURN (::WSAAccept ((ACE_SOCKET) handle,
00026                                     addr,
00027                                     (ACE_SOCKET_LEN *) addrlen,
00028                                     (LPCONDITIONPROC) qos_params.qos_condition_callback (),
00029                                     qos_params.callback_data ()),
00030                        ACE_HANDLE,
00031                        ACE_INVALID_HANDLE);
00032 # else
00033   ACE_UNUSED_ARG (qos_params);
00034   return ACE_OS::accept (handle,
00035                          addr,
00036                          addrlen);
00037 # endif /* ACE_HAS_WINSOCK2 */
00038 }

ACE_INLINE ACE_HANDLE ACE_OS::accept ACE_HANDLE  handle,
struct sockaddr *  addr,
int *  addrlen
 

BSD-style (no QoS).

Definition at line 29 of file OS_NS_sys_socket.inl.

References ACE_OS_TRACE, ACE_SOCKCALL_RETURN, ACE_SOCKET_LEN, and EWOULDBLOCK.

Referenced by accept(), ACE_ATM_Acceptor::accept(), and ACE_POSIX_Asynch_Accept::handle_input().

00032 {
00033   ACE_OS_TRACE ("ACE_OS::accept");
00034   // On a non-blocking socket with no connections to accept, this
00035   // system call will return EWOULDBLOCK or EAGAIN, depending on the
00036   // platform.  UNIX 98 allows either errno, and they may be the same
00037   // numeric value.  So to make life easier for upper ACE layers as
00038   // well as application programmers, always change EAGAIN to
00039   // EWOULDBLOCK.  Rather than hack the ACE_OSCALL_RETURN macro, it's
00040   // handled explicitly here.  If the ACE_OSCALL macro ever changes,
00041   // this function needs to be reviewed.  On Win32, the regular macros
00042   // can be used, as this is not an issue.
00043 
00044 #if defined (ACE_WIN32)
00045   ACE_SOCKCALL_RETURN (::accept ((ACE_SOCKET) handle,
00046                                  addr,
00047                                  (ACE_SOCKET_LEN *) addrlen),
00048                        ACE_HANDLE,
00049                        ACE_INVALID_HANDLE);
00050 #else
00051 #  if defined (ACE_HAS_BROKEN_ACCEPT_ADDR)
00052   // Apparently some platforms like VxWorks can't correctly deal with
00053   // a NULL addr.
00054 
00055    sockaddr_in fake_addr;
00056    int fake_addrlen;
00057 
00058    if (addrlen == 0)
00059      addrlen = &fake_addrlen;
00060 
00061    if (addr == 0)
00062      {
00063        addr = (sockaddr *) &fake_addr;
00064        *addrlen = sizeof fake_addr;
00065      }
00066 #  endif /* ACE_HAS_BROKEN_ACCEPT_ADDR */
00067   ACE_HANDLE ace_result = ::accept ((ACE_SOCKET) handle,
00068                                     addr,
00069                                     (ACE_SOCKET_LEN *) addrlen);
00070 
00071 # if !(defined (EAGAIN) && defined (EWOULDBLOCK) && EAGAIN == EWOULDBLOCK)
00072   // Optimize this code out if we can detect that EAGAIN ==
00073   // EWOULDBLOCK at compile time.  If we cannot detect equality at
00074   // compile-time (e.g. if EAGAIN or EWOULDBLOCK are not preprocessor
00075   // macros) perform the check at run-time.  The goal is to avoid two
00076   // TSS accesses in the _REENTRANT case when EAGAIN == EWOULDBLOCK.
00077   if (ace_result == ACE_INVALID_HANDLE
00078 #  if !defined (EAGAIN) || !defined (EWOULDBLOCK)
00079       && EAGAIN != EWOULDBLOCK
00080 #  endif  /* !EAGAIN || !EWOULDBLOCK */
00081       && errno == EAGAIN)
00082     {
00083       errno = EWOULDBLOCK;
00084     }
00085 # endif /* EAGAIN != EWOULDBLOCK*/
00086 
00087   return ace_result;
00088 
00089 #endif /* defined (ACE_WIN32) */
00090 }

ACE_INLINE int ACE_OS::access const wchar_t *  path,
int  amode
 

Definition at line 68 of file OS_NS_unistd.inl.

References access().

00069 {
00070 #if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
00071   ACE_OSCALL_RETURN (::_waccess (path, amode), int, -1);
00072 #else /* ACE_WIN32 && !ACE_HAS_WINCE */
00073   return ACE_OS::access (ACE_Wide_To_Ascii (path).char_rep (), amode);
00074 #endif /* ACE_WIN32 && !ACE_HAS_WINCE */
00075 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_OS::access const char *  path,
int  amode
 

Definition at line 36 of file OS_NS_unistd.inl.

References access(), ACE_LIB_TEXT, ACE_NOTSUP_RETURN, ACE_OS_TRACE, ACE_TEXT_CHAR_TO_TCHAR, fclose(), and fopen().

Referenced by access(), ACE_Filecache_Object::ACE_Filecache_Object(), ACE_Local_Name_Space<, ACE_LOCK >::create_manager_i(), ACE::ldfind(), open(), and ACE_Configuration_Heap::open().

00037 {
00038   ACE_OS_TRACE ("ACE_OS::access");
00039 #if defined (ACE_LACKS_ACCESS)
00040 #  if defined (ACE_HAS_WINCE) || defined (ACE_VXWORKS)
00041   // @@ WINCE: There should be a Win32 API that can do this.
00042   // Hard coded read access here.
00043   ACE_UNUSED_ARG (amode);
00044   FILE* handle = ACE_OS::fopen (ACE_TEXT_CHAR_TO_TCHAR(path),
00045                                 ACE_LIB_TEXT ("r"));
00046   if (handle != 0)
00047     {
00048       ACE_OS::fclose (handle);
00049       return 0;
00050     }
00051   return (-1);
00052 #  else
00053     ACE_UNUSED_ARG (path);
00054     ACE_UNUSED_ARG (amode);
00055     ACE_NOTSUP_RETURN (-1);
00056 #  endif  // ACE_HAS_WINCE
00057 #elif defined(ACE_WIN32)
00058   // Windows doesn't support checking X_OK(6)
00059   ACE_OSCALL_RETURN (::access (path, amode & 6), int, -1);
00060 #else
00061   ACE_OSCALL_RETURN (::access (path, amode), int, -1);
00062 #endif /* ACE_LACKS_ACCESS */
00063 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_OS::ace_isalnum ACE_TCHAR  c  ) 
 

Returns true if the character is an alphanumeric character.

Definition at line 13 of file OS_NS_ctype.inl.

References ACE_TCHAR.

Referenced by ACE_Get_Opt::long_option().

00014 {
00015 #if defined (ACE_USES_WCHAR)
00016   return iswalnum (c);
00017 #else /* ACE_USES_WCHAR */
00018   return isalnum ((unsigned char) c);
00019 #endif /* ACE_USES_WCHAR */
00020 }

ACE_INLINE int ACE_OS::ace_isalpha ACE_TCHAR  c  ) 
 

Returns true if the character is an alphabetic character.

Definition at line 23 of file OS_NS_ctype.inl.

References ACE_TCHAR.

00024 {
00025 #if defined (ACE_USES_WCHAR)
00026   return iswalpha (c);
00027 #else /* ACE_USES_WCHAR */
00028   return isalpha ((unsigned char) c);
00029 #endif /* ACE_USES_WCHAR */
00030 }

ACE_INLINE int ACE_OS::ace_iscntrl ACE_TCHAR  c  ) 
 

Returns true if the character is a control character.

Definition at line 33 of file OS_NS_ctype.inl.

References ACE_TCHAR.

00034 {
00035 #if defined (ACE_USES_WCHAR)
00036   return iswcntrl (c);
00037 #else /* ACE_USES_WCHAR */
00038   return iscntrl ((unsigned char) c);
00039 #endif /* ACE_USES_WCHAR */
00040 }

ACE_INLINE int ACE_OS::ace_isdigit ACE_TCHAR  c  ) 
 

Returns true if the character is a decimal-digit character.

Definition at line 43 of file OS_NS_ctype.inl.

References ACE_TCHAR.

Referenced by ACE_SOCK_Dgram::make_multicast_ifaddr6(), and ACE_Svc_Conf_Lexer::scan().

00044 {
00045 #if defined (ACE_USES_WCHAR)
00046   return iswdigit (c);
00047 #else /* ACE_USES_WCHAR */
00048   return isdigit ((unsigned char) c);
00049 #endif /* ACE_USES_WCHAR */
00050 }

ACE_INLINE int ACE_OS::ace_isgraph ACE_TCHAR  c  ) 
 

Returns true if the character is a printable character other than a space.

Definition at line 53 of file OS_NS_ctype.inl.

References ACE_TCHAR.

00054 {
00055 #if defined (ACE_USES_WCHAR)
00056   return iswgraph (c);
00057 #else /* ACE_USES_WCHAR */
00058   return isgraph ((unsigned char) c);
00059 #endif /* ACE_USES_WCHAR */
00060 }

ACE_INLINE int ACE_OS::ace_islower ACE_TCHAR  c  ) 
 

Returns true if the character is a lowercase character.

Definition at line 63 of file OS_NS_ctype.inl.

References ACE_TCHAR.

00064 {
00065 #if defined (ACE_USES_WCHAR)
00066   return iswlower (c);
00067 #else /* ACE_USES_WCHAR */
00068   return islower ((unsigned char) c);
00069 #endif /* ACE_USES_WCHAR */
00070 }

ACE_INLINE int ACE_OS::ace_isprint ACE_TCHAR  c  ) 
 

Returns true if the character is a printable character.

Definition at line 73 of file OS_NS_ctype.inl.

References ACE_TCHAR.

Referenced by ACE::format_hexdump().

00074 {
00075 #if defined (ACE_USES_WCHAR)
00076   return iswprint (c);
00077 #else /* ACE_USES_WCHAR */
00078   return isprint ((unsigned char) c);
00079 #endif /* ACE_USES_WCHAR */
00080 }

ACE_INLINE int ACE_OS::ace_ispunct ACE_TCHAR  c  ) 
 

Returns true if the character is a punctuation character.

Definition at line 83 of file OS_NS_ctype.inl.

References ACE_TCHAR.

00084 {
00085 #if defined (ACE_USES_WCHAR)
00086   return iswpunct (c);
00087 #else /* ACE_USES_WCHAR */
00088   return ispunct ((unsigned char) c);
00089 #endif /* ACE_USES_WCHAR */
00090 }

ACE_INLINE int ACE_OS::ace_isspace ACE_TCHAR  c  ) 
 

Returns true if the character is a space character.

Definition at line 93 of file OS_NS_ctype.inl.

References ACE_TCHAR.

Referenced by ACE_Base64::decode(), ACE_Base64::length(), ACE_Ini_ImpExp::squish(), and string_to_argv().

00094 {
00095 #if defined (ACE_USES_WCHAR)
00096   return iswspace (c);
00097 #else /* ACE_USES_WCHAR */
00098   return isspace ((unsigned char) c);
00099 #endif /* ACE_USES_WCHAR */
00100 }

ACE_INLINE int ACE_OS::ace_isupper ACE_TCHAR  c  ) 
 

Returns true if the character is an uppercase character.

Definition at line 103 of file OS_NS_ctype.inl.

References ACE_TCHAR.

00104 {
00105 #if defined (ACE_USES_WCHAR)
00106   return iswupper (c);
00107 #else /* ACE_USES_WCHAR */
00108   return isupper ((unsigned char) c);
00109 #endif /* ACE_USES_WCHAR */
00110 }

ACE_INLINE int ACE_OS::ace_isxdigit ACE_TCHAR  c  ) 
 

Returns true if the character is a hexadecimal-digit character.

Definition at line 113 of file OS_NS_ctype.inl.

References ACE_TCHAR.

00114 {
00115 #if defined (ACE_USES_WCHAR)
00116   return iswxdigit (c);
00117 #else /* ACE_USES_WCHAR */
00118   return isxdigit ((unsigned char) c);
00119 #endif /* ACE_USES_WCHAR */
00120 }

ACE_INLINE int ACE_OS::ace_tolower int  c  ) 
 

Converts a character to lower case (char version).

Definition at line 123 of file OS_NS_ctype.inl.

Referenced by equal_char(), ACE_Svc_Conf_Lexer::scan(), strcasecmp_emulation(), strncasecmp_emulation(), and wcsicmp_emulation().

00124 {
00125   return tolower (c);
00126 }

ACE_INLINE int ACE_OS::ace_toupper int  c  ) 
 

Converts a character to upper case (char version).

Definition at line 137 of file OS_NS_ctype.inl.

00138 {
00139   return toupper (c);
00140 }

ACE_INLINE wint_t ACE_OS::ace_towlower wint_t  c  ) 
 

Converts a character to lower case (wchar_t version).

Definition at line 130 of file OS_NS_ctype.inl.

Referenced by wcsicmp_emulation(), and wcsnicmp_emulation().

00131 {
00132   return towlower (c);
00133 }

ACE_INLINE wint_t ACE_OS::ace_towupper wint_t  c  ) 
 

Converts a character to upper case (wchar_t version).

Definition at line 144 of file OS_NS_ctype.inl.

00145 {
00146   return towupper (c);
00147 }

ACE_INLINE u_int ACE_OS::alarm u_int  secs  ) 
 

Definition at line 79 of file OS_NS_unistd.inl.

References ACE_NOTSUP_RETURN, and ACE_OS_TRACE.

00080 {
00081   ACE_OS_TRACE ("ACE_OS::alarm");
00082 #if defined (ACE_LACKS_ALARM)
00083   ACE_UNUSED_ARG (secs);
00084   ACE_NOTSUP_RETURN (0);
00085 #else
00086   return ::alarm (secs);
00087 #endif /* ACE_LACKS_ALARM */
00088 }

ACE_INLINE long ACE_OS::allocation_granularity void   ) 
 

Definition at line 109 of file OS_NS_unistd.inl.

References getpagesize().

Referenced by ACE::round_to_allocation_granularity().

00110 {
00111 #if defined (ACE_WIN32)
00112   SYSTEM_INFO sys_info;
00113   ::GetSystemInfo (&sys_info);
00114   return sys_info.dwAllocationGranularity;
00115 #else
00116   return ACE_OS::getpagesize ();
00117 #endif /* ACE_WIN32 */
00118 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL int ACE_OS::argv_to_string ACE_TCHAR **  argv,
ACE_TCHAR *&  buf,
bool  substitute_env_args = true
 

Definition at line 40 of file OS_NS_unistd.cpp.

References ACE_LIB_TEXT, ACE_NEW_RETURN, ACE_TCHAR, ACE_TEXT_ALWAYS_CHAR, ACE_TEXT_CHAR_TO_TCHAR, getenv(), strecpy(), and strlen().

Referenced by ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T(), ACE_ARGV_T< CHAR_TYPE >::argv_to_string(), and fork_exec().

00043 {
00044   if (argv == 0 || argv[0] == 0)
00045     return 0;
00046 
00047   size_t buf_len = 0;
00048 
00049   // Determine the length of the buffer.
00050 
00051   for (int i = 0; argv[i] != 0; i++)
00052     {
00053 #if !defined (ACE_LACKS_ENV)
00054       // Account for environment variables.
00055       if (substitute_env_args && argv[i][0] == ACE_LIB_TEXT ('$'))
00056         {
00057 #  if defined (ACE_WIN32) || !defined (ACE_HAS_WCHAR)
00058           ACE_TCHAR *temp = 0;
00059           // Win32 is the only platform with a wide-char ACE_OS::getenv().
00060           if ((temp = ACE_OS::getenv (&argv[i][1])) != 0)
00061             buf_len += ACE_OS::strlen (temp);
00062           else
00063             buf_len += ACE_OS::strlen (argv[i]);
00064 #  else
00065           // This is an ACE_HAS_WCHAR platform and not ACE_WIN32.
00066           // Convert the env variable name for getenv(), then add
00067           // the length of the returned char *string. Later, when we
00068           // actually use the returned env variable value, convert it
00069           // as well.
00070           char *ctemp = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (&argv[i][1]));
00071           if (ctemp == 0)
00072             buf_len += ACE_OS::strlen (argv[i]);
00073           else
00074             buf_len += ACE_OS::strlen (ctemp);
00075 #  endif /* ACE_WIN32 || !ACE_HAS_WCHAR */
00076         }
00077       else
00078 #endif /* ACE_LACKS_ENV */
00079         buf_len += ACE_OS::strlen (argv[i]);
00080 
00081       // Add one for the extra space between each string.
00082       buf_len++;
00083     }
00084 
00085   // Step through all argv params and copy each one into buf; separate
00086   // each param with white space.
00087 
00088   ACE_NEW_RETURN (buf,
00089                   ACE_TCHAR[buf_len + 1],
00090                   0);
00091 
00092   // Initial null charater to make it a null string.
00093   buf[0] = '\0';
00094   ACE_TCHAR *end = buf;
00095   int j;
00096 
00097   for (j = 0; argv[j] != 0; j++)
00098     {
00099 
00100 #if !defined (ACE_LACKS_ENV)
00101       // Account for environment variables.
00102       if (substitute_env_args && argv[j][0] == ACE_LIB_TEXT ('$'))
00103         {
00104 #  if defined (ACE_WIN32) || !defined (ACE_HAS_WCHAR)
00105           // Win32 is the only platform with a wide-char ACE_OS::getenv().
00106           ACE_TCHAR *temp = ACE_OS::getenv (&argv[j][1]);
00107           if (temp != 0)
00108             end = ACE_OS::strecpy (end, temp);
00109           else
00110             end = ACE_OS::strecpy (end, argv[j]);
00111 #  else
00112           // This is an ACE_HAS_WCHAR platform and not ACE_WIN32.
00113           // Convert the env variable name for getenv(), then convert
00114           // the returned char *string back to wchar_t.
00115           char *ctemp = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (&argv[j][1]));
00116           if (ctemp == 0)
00117             end = ACE_OS::strecpy (end, argv[j]);
00118           else
00119             end = ACE_OS::strecpy (end, ACE_TEXT_CHAR_TO_TCHAR (ctemp));
00120 #  endif /* ACE_WIN32 || !ACE_HAS_WCHAR */
00121         }
00122       else
00123 #endif /* ACE_LACKS_ENV */
00124         end = ACE_OS::strecpy (end, argv[j]);
00125 
00126       // Replace the null char that strecpy put there with white
00127       // space.
00128       end[-1] = ' ';
00129     }
00130 
00131   // Null terminate the string.
00132   *end = '\0';
00133   // The number of arguments.
00134   return j;
00135 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE char * ACE_OS::asctime const struct tm *  tm  ) 
 

Definition at line 14 of file OS_NS_time.inl.

References ACE_NOTSUP_RETURN, and ACE_OS_TRACE.

Referenced by ctime().

00015 {
00016   ACE_OS_TRACE ("ACE_OS::asctime");
00017 #if defined (ACE_LACKS_ASCTIME)
00018   ACE_UNUSED_ARG (t);
00019   ACE_NOTSUP_RETURN (0);
00020 #else
00021   ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::asctime (t), char *, 0);
00022 #endif /* ACE_LACKS_ASCTIME */
00023 }

ACE_INLINE char * ACE_OS::asctime_r const struct tm *  tm,
char *  buf,
int  buflen
 

Definition at line 26 of file OS_NS_time.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, asctime_r(), and strsncpy().

Referenced by asctime_r().

00027 {
00028   ACE_OS_TRACE ("ACE_OS::asctime_r");
00029 #if defined (ACE_HAS_REENTRANT_FUNCTIONS)
00030 # if defined (ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R)
00031   char *result;
00032 #   if defined (DIGITAL_UNIX)
00033   ACE_OSCALL (::_Pasctime_r (t, buf), char *, 0, result);
00034 #   else
00035   ACE_OSCALL (::asctime_r (t, buf), char *, 0, result);
00036 #   endif /* DIGITAL_UNIX */
00037   ACE_OS::strsncpy (buf, result, buflen);
00038   return buf;
00039 # else
00040 #   if defined (ACE_HAS_SIZET_PTR_ASCTIME_R_AND_CTIME_R)
00041   ACE_OSCALL_RETURN (::asctime_r (t, buf, reinterpret_cast<size_t*>(&buflen)), char *, 0);
00042 #   else
00043   ACE_OSCALL_RETURN (::asctime_r (t, buf, buflen), char *, 0);
00044 #   endif /* ACE_HAS_SIZET_PTR_ASCTIME_R_AND_CTIME_R */
00045 # endif /* ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R */
00046 #elif defined (ACE_LACKS_ASCTIME_R)
00047   ACE_UNUSED_ARG (t);
00048   ACE_UNUSED_ARG (buf);
00049   ACE_UNUSED_ARG (buflen);
00050   ACE_NOTSUP_RETURN (0);
00051 #else
00052   char *result = 0;
00053   ACE_OSCALL (ACE_STD_NAMESPACE::asctime (t), char *, 0, result);
00054   ACE_OS::strsncpy (buf, result, buflen);
00055   return buf;
00056 #endif /* ACE_HAS_REENTRANT_FUNCTIONS */
00057 }

ACE_INLINE int ACE_OS::atexit ACE_EXIT_HOOK  func  ) 
 

Definition at line 48 of file OS_NS_stdlib.inl.

References ACE_OS_Object_Manager::at_exit(), and ACE_OS_Object_Manager::instance().

00049 {
00050   return ACE_OS_Object_Manager::instance ()->at_exit (func);
00051 }

ACE_INLINE int ACE_OS::atoi const wchar_t *  s  ) 
 

Definition at line 61 of file OS_NS_stdlib.inl.

References atoi().

00062 {
00063 #if defined (ACE_WIN32)
00064   ACE_OSCALL_RETURN (::_wtoi (s), int, -1);
00065 #else /* ACE_WIN32 */
00066   return ACE_OS::atoi (ACE_Wide_To_Ascii(s).char_rep());
00067 #endif /* ACE_WIN32 */
00068 }

ACE_INLINE int ACE_OS::atoi const char *  s  ) 
 

Definition at line 54 of file OS_NS_stdlib.inl.

References atoi().

Referenced by atoi(), atop(), ACE_High_Res_Timer::get_env_global_scale_factor(), ACE_Service_Manager::init(), ACE_SOCK_Dgram::make_multicast_ifaddr6(), ACE_Logging_Strategy::parse_args(), ACE_Service_Config::parse_args_i(), ACE_Registry_ImpExp::process_previous_line_format(), and ACE_INET_Addr::set_interface().

00055 {
00056   ACE_OSCALL_RETURN (::atoi (s), int, -1);
00057 }

ACE_INLINE void * ACE_OS::atop const wchar_t *  s  ) 
 

Definition at line 94 of file OS_NS_stdlib.inl.

References atoi().

00095 {
00096 #  if defined (ACE_WIN64)
00097   __int64 ip = ::_wtoi64 (s);
00098 #  else
00099   int ip = ACE_OS::atoi (s);
00100 #  endif /* ACE_WIN64 */
00101   void *p = reinterpret_cast<void *> (ip);
00102   return p;
00103 }

ACE_INLINE void * ACE_OS::atop const char *  s  ) 
 

Definition at line 76 of file OS_NS_stdlib.inl.

References ACE_TRACE.

Referenced by ACE_Name_Options::parse_args().

00077 {
00078   ACE_TRACE ("ACE_OS::atop");
00079   // It would be nice to make use of Basic_Types.h here, but that
00080   // file relies on OS.h. Fortunately, most platforms have int
00081   // the same as pointer size (IA32, IA64), with Win64 being the
00082   // exception.
00083 #if defined (ACE_WIN64)
00084   __int64 ip = ::_atoi64 (s);
00085 #else
00086   int ip = ::atoi (s);
00087 #endif /* ACE_WIN64 */
00088   void *p = reinterpret_cast<void *> (ip);
00089   return p;
00090 }

ACE_INLINE int ACE_OS::bind ACE_HANDLE  s,
struct sockaddr *  name,
int  namelen
 

BSD-style (no QoS).

Definition at line 93 of file OS_NS_sys_socket.inl.

References ACE_OS_TRACE, ACE_SOCKCALL_RETURN, and ACE_SOCKET_LEN.

Referenced by ACE::bind_port(), ACE_WIN32_Asynch_Connect::connect_i(), ACE_POSIX_Asynch_Connect::connect_i(), ACE_SOCK_CODgram::open(), ACE_ATM_Stream::open(), ACE_ATM_Acceptor::open(), ACE_Asynch_Acceptor< HANDLER >::open(), ACE_SOCK_SEQPACK_Connector::shared_connect_start(), ACE_SOCK_Connector::shared_connect_start(), ACE_SOCK_SEQPACK_Acceptor::shared_open(), ACE_SOCK_Dgram::shared_open(), ACE_SOCK_Acceptor::shared_open(), and ACE_ICMP_Socket::shared_open().

00094 {
00095   ACE_OS_TRACE ("ACE_OS::bind");
00096   ACE_SOCKCALL_RETURN (::bind ((ACE_SOCKET) handle,
00097                                addr,
00098                                (ACE_SOCKET_LEN) addrlen), int, -1);
00099 }

ACE_INLINE void * ACE_OS::bsearch const void *  key,
const void *  base,
size_t  nel,
size_t  size,
ACE_COMPARE_FUNC 
 

Definition at line 107 of file OS_NS_stdlib.inl.

References ACE_COMPARE_FUNC, and ACE_NOTSUP_RETURN.

00112 {
00113 #if !defined (ACE_LACKS_BSEARCH)
00114   return ::bsearch (key, base, nel, size, compar);
00115 #else
00116   ACE_UNUSED_ARG (key);
00117   ACE_UNUSED_ARG (base);
00118   ACE_UNUSED_ARG (nel);
00119   ACE_UNUSED_ARG (size);
00120   ACE_UNUSED_ARG (compar);
00121   ACE_NOTSUP_RETURN (0);
00122 #endif /* ACE_LACKS_BSEARCH */
00123 }

void * ACE_OS::calloc size_t  elements,
size_t  sizeof_elements
 

Definition at line 38 of file OS_NS_stdlib.cpp.

References ACE_CALLOC_FUNC, and ACE_MALLOC_FUNC.

00039 {
00040 #if !defined (ACE_HAS_WINCE)
00041   return ACE_CALLOC_FUNC (elements, sizeof_elements);
00042 #else
00043   // @@ This will probably not work since it doesn't consider
00044   // alignment properly.
00045   return ACE_MALLOC_FUNC (elements * sizeof_elements);
00046 #endif /* ACE_HAS_WINCE */
00047 }

ACE_INLINE double ACE_OS::ceil double  x  ) 
 

This method computes the smallest integral value not less than x.

Definition at line 22 of file OS_NS_math.inl.

00023   {
00024     // This method computes the smallest integral value not less than x.
00025     if (x < 0)
00026       return static_cast<long> (x);
00027     else if (static_cast<long> (x) == x)
00028       return x;
00029     else
00030       return static_cast<long> (x) + 1;
00031   }

ACE_INLINE int ACE_OS::chdir const wchar_t *  path  ) 
 

Definition at line 143 of file OS_NS_unistd.inl.

References chdir().

00144 {
00145 #if defined (ACE_WIN32)
00146   ACE_OSCALL_RETURN (::_wchdir (path), int, -1);
00147 #else /* ACE_WIN32 */
00148   return ACE_OS::chdir (ACE_Wide_To_Ascii (path).char_rep ());
00149 #endif /* ACE_WIN32 */
00150 }

ACE_INLINE int ACE_OS::chdir const char *  path  ) 
 

Definition at line 122 of file OS_NS_unistd.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and chdir().

Referenced by chdir(), ACE::daemonize(), and ACE_Process::spawn().

00123 {
00124   ACE_OS_TRACE ("ACE_OS::chdir");
00125 #if defined (ACE_HAS_NONCONST_CHDIR)
00126   ACE_OSCALL_RETURN (::chdir (const_cast<char *> (path)), int, -1);
00127 
00128 #elif defined (ACE_WIN32) && defined (__IBMCPP__) && (__IBMCPP__ >= 400)
00129   ACE_OSCALL_RETURN (::_chdir (const_cast<char *> (path)), int, -1);
00130 
00131 #elif defined (ACE_HAS_WINCE)
00132   ACE_UNUSED_ARG (path);
00133   ACE_NOTSUP_RETURN (-1);
00134 
00135 #else
00136   ACE_OSCALL_RETURN (::chdir (path), int, -1);
00137 
00138 #endif /* ACE_HAS_NONCONST_CHDIR */
00139 }

void ACE_OS::cleanup_tss const u_int  main_thread  ) 
 

Call TSS destructors for the current thread. If the current thread is the main thread, then the argument must be 1. For private use of ACE_Object_Manager and ACE_Thread_Adapter only.

Definition at line 1152 of file OS_NS_Thread.cpp.

References ACE_Base_Thread_Adapter::close_log_msg(), and TSS_Cleanup_Instance::valid().

Referenced by DllMain(), ACE_Object_Manager::fini(), ACE_OS_Thread_Adapter::invoke(), ACE_Thread_Adapter::invoke_i(), and thr_exit().

01153 {
01154 #if defined (ACE_HAS_TSS_EMULATION) || defined (ACE_WIN32)
01155   { // scope the cleanup instance
01156     // Call TSS destructors for current thread.
01157     TSS_Cleanup_Instance cleanup;
01158     if (cleanup.valid ())
01159       {
01160         cleanup->thread_exit ();
01161       }
01162   }
01163 #endif /* ACE_HAS_TSS_EMULATION || ACE_WIN32 */
01164 
01165   if (main_thread)
01166     {
01167 #if !defined (ACE_HAS_TSS_EMULATION)  &&  !defined (ACE_HAS_MINIMAL_ACE_OS)
01168       // Just close the ACE_Log_Msg for the current (which should be
01169       // main) thread.  We don't have TSS emulation; if there's native
01170       // TSS, it should call its destructors when the main thread
01171       // exits.
01172       ACE_Base_Thread_Adapter::close_log_msg ();
01173 #endif /* ! ACE_HAS_TSS_EMULATION  &&  ! ACE_HAS_MINIMAL_ACE_OS */
01174 
01175 #if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION)
01176       // Finally, free up the ACE_TSS_Cleanup instance.  This method gets
01177       // called by the ACE_Object_Manager.
01178       TSS_Cleanup_Instance cleanup(TSS_Cleanup_Instance::DESTROY);
01179       if (cleanup.valid ())
01180       {
01181         ; // the pointer deletes the Cleanup when it goes out of scope
01182       }
01183 
01184 #endif /* WIN32 || ACE_HAS_TSS_EMULATION */
01185 
01186 #if defined (ACE_HAS_TSS_EMULATION)
01187       ACE_TSS_Emulation::tss_close ();
01188 #endif /* ACE_HAS_TSS_EMULATION */
01189     }
01190 }

ACE_INLINE void ACE_OS::clearerr FILE *  fp  ) 
 

Definition at line 369 of file OS_NS_stdio.inl.

Referenced by ACE_Svc_Conf_Lexer::input().

00370 {
00371 #if defined (__ace_clearerr_hack)
00372   __ace_clearerr(fp);
00373 #else
00374    ::clearerr(fp);
00375 #endif /* __ace_clearerr_hack */
00376 }

ACE_INLINE int ACE_OS::clock_gettime clockid_t  ,
struct timespec
 

Definition at line 60 of file OS_NS_time.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, clock_gettime(), and clockid_t.

Referenced by clock_gettime(), and gethrtime().

00061 {
00062   ACE_OS_TRACE ("ACE_OS::clock_gettime");
00063 #if defined (ACE_HAS_CLOCK_GETTIME)
00064   ACE_OSCALL_RETURN (::clock_gettime (clockid, ts), int, -1);
00065 #else
00066   ACE_UNUSED_ARG (clockid);
00067   ACE_UNUSED_ARG (ts);
00068   ACE_NOTSUP_RETURN (-1);
00069 #endif /* ACE_HAS_CLOCK_GETTIME */
00070 }

ACE_INLINE int ACE_OS::clock_settime clockid_t  ,
const struct timespec
 

Definition at line 73 of file OS_NS_time.inl.

References ACE_NOTSUP_RETURN, clock_settime(), and clockid_t.

Referenced by clock_settime().

00074 {
00075 #if defined (ACE_HAS_CLOCK_SETTIME)
00076 #  if defined (ACE_HAS_NONCONST_CLOCK_SETTIME)
00077   ACE_OSCALL_RETURN (::clock_settime (clockid, const_cast<struct timespec *>(ts)), int, -1);
00078 #  else
00079   ACE_OSCALL_RETURN (::clock_settime (clockid, ts), int, -1);
00080 #  endif /* ACE_HAS_NONCONST_CLOCK_SETTIME */
00081 #else
00082   ACE_UNUSED_ARG (clockid);
00083   ACE_UNUSED_ARG (ts);
00084   ACE_NOTSUP_RETURN (-1);
00085 #endif /* ACE_HAS_CLOCK_SETTIME */
00086 }

ACE_INLINE int ACE_OS::close ACE_HANDLE  handle  ) 
 

Definition at line 190 of file OS_NS_unistd.inl.

References ACE_ADAPT_RETVAL, and ACE_OS_TRACE.

Referenced by ACE_Filecache_Object::ACE_Filecache_Object(), ACE_Mutex::ACE_Mutex(), ACE_WIN32_Proactor::close(), ACE_TLI_Stream::close(), ACE_SPIPE::close(), ACE_FILE::close(), ACE_FIFO_Recv::close(), ACE_FIFO::close(), ACE_Dev_Poll_Reactor::close(), ACE_DEV::close(), ACE_Mem_Map::close_filemapping_handle(), ACE_Mem_Map::close_handle(), ACE_Handle_Gobbler::close_remaining_handles(), ACE_SPIPE_Connector::connect(), ACE_SPIPE_Acceptor::create_new_instance(), ACE::daemonize(), dlopen(), event_init(), filesize(), flock_destroy(), fopen(), fork_exec(), ACE_Handle_Gobbler::free_handles(), ACE::get_bcast_addr(), ACE::get_ip_interfaces(), getmacaddress(), ACE_Filecache_Object::release(), ACE_Process_Options::release_handles(), sema_destroy(), sema_init(), ACE_Process::spawn(), ACE::terminate_process(), ACE_Filecache_Handle::~ACE_Filecache_Handle(), ACE_Filecache_Object::~ACE_Filecache_Object(), and ACE_Process::~ACE_Process().

00191 {
00192   ACE_OS_TRACE ("ACE_OS::close");
00193 #if defined (ACE_WIN32)
00194   ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::CloseHandle (handle), ace_result_), int, -1);
00195 #else
00196   ACE_OSCALL_RETURN (::close (handle), int, -1);
00197 #endif /* ACE_WIN32 */
00198 }

ACE_INLINE void ACE_OS::closedir ACE_DIR  ) 
 

Definition at line 13 of file OS_NS_dirent.inl.

References ACE_DIR.

Referenced by ACE_Dirent::close(), ACE_Dirent::open(), scandir_emulation(), and ACE_Dirent::~ACE_Dirent().

00014 {
00015 #if defined (ACE_HAS_DIRENT)
00016 # if defined (ACE_WIN32) && defined (ACE_LACKS_CLOSEDIR)
00017   ACE_OS::closedir_emulation (d);
00018   delete [] d->directory_name_;
00019   delete d;
00020 # elif defined (ACE_HAS_WCLOSEDIR) && defined (ACE_USES_WCHAR)
00021   ::wclosedir (d);
00022 # else /* ACE_WIN32 && ACE_LACKS_CLOSEDIR */
00023   ::closedir (d);
00024 # endif /* ACE_WIN32 && ACE_LACKS_CLOSEDIR */
00025 
00026 #else /* ACE_HAS_DIRENT */
00027   ACE_UNUSED_ARG (d);
00028 #endif /* ACE_HAS_DIRENT */
00029 }

ACE_INLINE int ACE_OS::closesocket ACE_HANDLE  s  ) 
 

BSD-style (no QoS).

Definition at line 102 of file OS_NS_sys_socket.inl.

References ACE_OS_TRACE, ACE_SHUTDOWN_WRITE, ACE_SOCKCALL_RETURN, closesocket(), and shutdown().

Referenced by ACE_WIN32_Asynch_Accept::accept(), ACE_SOCK::close(), ACE_POSIX_Asynch_Accept::close(), ACE_Pipe::close(), ACE_Process::close_dup_handles(), ACE_Process::close_passed_handles(), closesocket(), ACE_WIN32_Asynch_Accept_Result::complete(), ACE_Asynch_Acceptor< HANDLER >::handle_accept(), ACE_Asynch_Connector< HANDLER >::handle_connect(), ACE_POSIX_Asynch_Accept::handle_input(), ACE::ipv6_enabled(), ACE_Asynch_Acceptor< HANDLER >::open(), ACE_WIN32_Asynch_Connect::post_result(), ACE_POSIX_Asynch_Connect::post_result(), ACE_AIOCB_Notify_Pipe_Manager::~ACE_AIOCB_Notify_Pipe_Manager(), and ACE_Asynch_Acceptor< HANDLER >::~ACE_Asynch_Acceptor().

00103 {
00104   ACE_OS_TRACE ("ACE_OS::closesocket");
00105 #if defined (ACE_WIN32)
00106   ACE_OS::shutdown (handle, ACE_SHUTDOWN_WRITE);
00107   ACE_SOCKCALL_RETURN (::closesocket ((SOCKET) handle), int, -1);
00108 #else
00109   ACE_OSCALL_RETURN (::close (handle), int, -1);
00110 #endif /* ACE_WIN32 */
00111 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE char * ACE_OS::compile const char *  instring,
char *  expbuf,
char *  endbuf
 

Definition at line 11 of file OS_NS_regex.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and compile().

Referenced by compile(), ACE_Local_Name_Space<, ACE_LOCK >::list_type_entries_i(), and ACE_Local_Name_Space<, ACE_LOCK >::list_types_i().

00012 {
00013   ACE_OS_TRACE ("ACE_OS::compile");
00014 #if defined (ACE_HAS_REGEX)
00015   ACE_OSCALL_RETURN (::compile (instring, expbuf, endbuf), char *, 0);
00016 #else
00017   ACE_UNUSED_ARG (instring);
00018   ACE_UNUSED_ARG (expbuf);
00019   ACE_UNUSED_ARG (endbuf);
00020 
00021   ACE_NOTSUP_RETURN (0);
00022 #endif /* ACE_HAS_REGEX */
00023 }

ACE_INLINE int ACE_OS::cond_broadcast ACE_cond_t *  cv  ) 
 

Definition at line 214 of file OS_NS_Thread.inl.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, ACE_OS_TRACE, and cond_broadcast().

Referenced by ACE_Condition_Thread_Mutex::broadcast(), ACE_Condition< MUTEX >::broadcast(), ACE_Condition< ACE_Recursive_Thread_Mutex >::broadcast(), cond_broadcast(), event_destroy(), event_pulse(), event_signal(), ACE_Condition_Thread_Mutex::remove(), ACE_Condition< MUTEX >::remove(), and rw_unlock().

00215 {
00216   ACE_OS_TRACE ("ACE_OS::cond_broadcast");
00217 # if defined (ACE_HAS_THREADS)
00218 #   if defined (ACE_HAS_PTHREADS)
00219 #     if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6)
00220   ACE_OSCALL_RETURN (pthread_cond_broadcast (cv), int, -1);
00221 #     else
00222   int result;
00223   ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_cond_broadcast (cv),
00224                                        result),
00225                      int, -1);
00226 #     endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6 */
00227 #   elif defined (ACE_HAS_STHREADS)
00228   int result;
00229   ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::cond_broadcast (cv),
00230                                        result),
00231                      int, -1);
00232 #   endif /* ACE_HAS_STHREADS */
00233 # else
00234   ACE_UNUSED_ARG (cv);
00235   ACE_NOTSUP_RETURN (-1);
00236 # endif /* ACE_HAS_THREADS */
00237 }

ACE_INLINE int ACE_OS::cond_destroy ACE_cond_t *  cv  ) 
 

Definition at line 240 of file OS_NS_Thread.inl.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, ACE_OS_TRACE, and cond_destroy().

Referenced by cond_destroy(), event_destroy(), recursive_mutex_destroy(), ACE_Condition_Thread_Mutex::remove(), ACE_Condition< MUTEX >::remove(), ACE_Condition< ACE_Recursive_Thread_Mutex >::remove(), rwlock_destroy(), sema_destroy(), and sema_init().

00241 {
00242   ACE_OS_TRACE ("ACE_OS::cond_destroy");
00243 # if defined (ACE_HAS_THREADS)
00244 #   if defined (ACE_HAS_PTHREADS)
00245 #     if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6)
00246   ACE_OSCALL_RETURN (pthread_cond_destroy (cv), int, -1);
00247 #     else
00248   int result;
00249   ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_cond_destroy (cv), result), int, -1);
00250 #     endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6 */
00251 #   elif defined (ACE_HAS_STHREADS)
00252   int result;
00253   ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::cond_destroy (cv), result), int, -1);
00254 #   endif /* ACE_HAS_STHREADS */
00255 # else
00256   ACE_UNUSED_ARG (cv);
00257   ACE_NOTSUP_RETURN (-1);
00258 # endif /* ACE_HAS_THREADS */
00259 }

ACE_INLINE int ACE_OS::cond_init ACE_cond_t *  cv,
ACE_condattr_t &  attributes,
const wchar_t *  name,
void *  arg = 0
 

Definition at line 317 of file OS_NS_Thread.inl.

References cond_init().

00321 {
00322   return ACE_OS::cond_init (cv, attributes, ACE_Wide_To_Ascii (name).char_rep (), arg);
00323 }

ACE_INLINE int ACE_OS::cond_init ACE_cond_t *  cv,
short  type,
const wchar_t *  name,
void *  arg = 0
 

Definition at line 328 of file OS_NS_Thread.inl.

References cond_init().

00329 {
00330   return ACE_OS::cond_init (cv, type, ACE_Wide_To_Ascii (name).char_rep (), arg);
00331 }

ACE_INLINE int ACE_OS::cond_init ACE_cond_t *  cv,
ACE_condattr_t &  attributes,
const char *  name = 0,
void *  arg = 0
 

Definition at line 262 of file OS_NS_Thread.inl.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, cond_init(), and memset().

00266 {
00267   // ACE_OS_TRACE ("ACE_OS::cond_init");
00268   ACE_UNUSED_ARG (name);
00269   ACE_UNUSED_ARG (arg);
00270 # if defined (ACE_HAS_THREADS)
00271 #   if defined (ACE_HAS_PTHREADS)
00272   int result = -1;
00273 
00274 #     if defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600) && (ACE_VXWORKS <= 0x620)
00275   /* VxWorks 6.x API reference states:
00276    *   If the memory for the condition variable object has been allocated
00277    *   dynamically, it is a good policy to always zero out the
00278    *   block of memory so as to avoid spurious EBUSY return code
00279    *   when calling this routine.
00280    */
00281   ACE_OS::memset (cv, 0, sizeof (*cv));
00282 #     endif
00283 
00284   if (
00285 #     if defined  (ACE_HAS_PTHREADS_DRAFT4)
00286       pthread_cond_init (cv, attributes) == 0
00287 #     elif defined (ACE_HAS_PTHREADS_STD) || defined (ACE_HAS_PTHREADS_DRAFT7)
00288       ACE_ADAPT_RETVAL (pthread_cond_init (cv, &attributes), result) == 0
00289 #     else  /* this is draft 6 */
00290       pthread_cond_init (cv, &attributes) == 0
00291 #     endif /* ACE_HAS_PTHREADS_DRAFT4 */
00292       )
00293      result = 0;
00294   else
00295      result = -1;       // ACE_ADAPT_RETVAL used it for intermediate status
00296 
00297   return result;
00298 #   elif defined (ACE_HAS_STHREADS)
00299   int result;
00300   ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::cond_init (cv,
00301                                                     attributes.type,
00302                                                     arg),
00303                                        result),
00304                      int, -1);
00305 #   endif /* ACE_HAS_PTHREADS vs. ACE_HAS_STHREADS */
00306 # else
00307   ACE_UNUSED_ARG (cv);
00308   ACE_UNUSED_ARG (attributes);
00309   ACE_UNUSED_ARG (name);
00310   ACE_UNUSED_ARG (arg);
00311   ACE_NOTSUP_RETURN (-1);
00312 # endif /* ACE_HAS_THREADS */
00313 }

int ACE_OS::cond_init ACE_cond_t *  cv,
short  type = ACE_DEFAULT_SYNCH_TYPE,
const char *  name = 0,
void *  arg = 0
 

Definition at line 1810 of file OS_NS_Thread.cpp.

References condattr_destroy(), and condattr_init().

Referenced by ACE_Condition< MUTEX >::ACE_Condition(), ACE_Condition< ACE_Recursive_Thread_Mutex >::ACE_Condition(), ACE_Condition_Thread_Mutex::ACE_Condition_Thread_Mutex(), cond_init(), event_init(), recursive_mutex_init(), and sema_init().

01811 {
01812   ACE_condattr_t attributes;
01813   if (ACE_OS::condattr_init (attributes, type) == 0
01814       && ACE_OS::cond_init (cv, attributes, name, arg) == 0)
01815     {
01816       (void) ACE_OS::condattr_destroy (attributes);
01817       return 0;
01818     }
01819   return -1;
01820 }

ACE_INLINE int ACE_OS::cond_signal ACE_cond_t *  cv  ) 
 

Definition at line 335 of file OS_NS_Thread.inl.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, ACE_OS_TRACE, and cond_signal().

Referenced by cond_signal(), event_pulse(), event_signal(), recursive_mutex_cond_unlock(), recursive_mutex_unlock(), rw_unlock(), sema_post(), ACE_Condition_Thread_Mutex::signal(), ACE_Condition< MUTEX >::signal(), and ACE_Condition< ACE_Recursive_Thread_Mutex >::signal().

00336 {
00337   ACE_OS_TRACE ("ACE_OS::cond_signal");
00338 # if defined (ACE_HAS_THREADS)
00339 #   if defined (ACE_HAS_PTHREADS)
00340 #     if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6)
00341   ACE_OSCALL_RETURN (pthread_cond_signal (cv), int, -1);
00342 #     else
00343   int result;
00344   ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_cond_signal (cv), result),
00345                      int, -1);
00346 #     endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6 */
00347 #   elif defined (ACE_HAS_STHREADS)
00348   int result;
00349   ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::cond_signal (cv), result), int, -1);
00350 #   endif /* ACE_HAS_STHREADS */
00351 # else
00352   ACE_UNUSED_ARG (cv);
00353   ACE_NOTSUP_RETURN (-1);
00354 # endif /* ACE_HAS_THREADS */
00355 }

ACE_INLINE int ACE_OS::cond_timedwait ACE_cond_t *  cv,
ACE_mutex_t *  m,
ACE_Time_Value
 

Definition at line 384 of file OS_NS_Thread.inl.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, ACE_OS_TRACE, ACE_TIMESPEC_PTR, cond_timedwait(), cond_wait(), ETIME, ETIMEDOUT, gettimeofday(), and timespec_t.

Referenced by cond_timedwait(), event_timedwait(), recursive_mutex_lock(), sema_wait(), ACE_Condition_Thread_Mutex::wait(), ACE_Condition< MUTEX >::wait(), and ACE_Condition< ACE_Recursive_Thread_Mutex >::wait().

00387 {
00388   ACE_OS_TRACE ("ACE_OS::cond_timedwait");
00389 # if defined (ACE_HAS_THREADS)
00390   int result;
00391   timespec_t ts;
00392 
00393   if (timeout != 0)
00394     ts = *timeout; // Calls ACE_Time_Value::operator timespec_t().
00395 
00396 #   if defined (ACE_HAS_PTHREADS)
00397 
00398 #     if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6)
00399   if (timeout == 0)
00400     ACE_OSCALL (pthread_cond_wait (cv, external_mutex),
00401                 int, -1, result);
00402   else
00403     {
00404 
00405 #     if defined (ACE_LYNXOS_MAJOR) && (ACE_LYNXOS_MAJOR == 3) && (ACE_LYNXOS_MINOR == 0)
00406       // Note that we must convert between absolute time (which is
00407       // passed as a parameter) and relative time (which is what the
00408       // LynxOS pthread_cond_timedwait expects).  This differs from 1003.4a
00409       // draft 4.
00410 
00411       timespec_t relative_time = *timeout - ACE_OS::gettimeofday ();
00412 
00413       ACE_OSCALL (pthread_cond_timedwait (cv, external_mutex,
00414                                             &relative_time),
00415                   int, -1, result);
00416 #     else
00417       ACE_OSCALL (pthread_cond_timedwait (cv, external_mutex,
00418                                             (ACE_TIMESPEC_PTR) &ts),
00419                   int, -1, result);
00420 #     endif /* ACE_LYNXOS_MAJOR ... */
00421     }
00422 
00423 #     else
00424   ACE_OSCALL (ACE_ADAPT_RETVAL (timeout == 0
00425                                 ? pthread_cond_wait (cv, external_mutex)
00426                                 : pthread_cond_timedwait (cv, external_mutex,
00427                                                             (ACE_TIMESPEC_PTR) &ts),
00428                                 result),
00429               int, -1, result);
00430 #     endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6*/
00431   // We need to adjust this to make the POSIX and Solaris return
00432   // values consistent.  EAGAIN is from Pthreads DRAFT4 (HP-UX 10.20 and
00433   // down); EINTR is from LynxOS.
00434   if (result == -1 &&
00435       (errno == ETIMEDOUT || errno == EAGAIN || errno == EINTR))
00436     errno = ETIME;
00437 
00438 #   elif defined (ACE_HAS_STHREADS)
00439   ACE_OSCALL (ACE_ADAPT_RETVAL (timeout == 0
00440                                 ? ::cond_wait (cv, external_mutex)
00441                                 : ::cond_timedwait (cv,
00442                                                     external_mutex,
00443                                                     (timestruc_t*)&ts),
00444                                 result),
00445               int, -1, result);
00446 #   endif /* ACE_HAS_STHREADS */
00447   if (timeout != 0)
00448     timeout->set (ts); // Update the time value before returning.
00449 
00450   return result;
00451 # else
00452   ACE_UNUSED_ARG (cv);
00453   ACE_UNUSED_ARG (external_mutex);
00454   ACE_UNUSED_ARG (timeout);
00455   ACE_NOTSUP_RETURN (-1);
00456 # endif /* ACE_HAS_THREADS */
00457 }

ACE_INLINE int ACE_OS::cond_wait ACE_cond_t *  cv,
ACE_mutex_t *  m
 

Definition at line 358 of file OS_NS_Thread.inl.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, ACE_OS_TRACE, and cond_wait().

Referenced by cond_timedwait(), cond_wait(), event_wait(), recursive_mutex_cond_relock(), recursive_mutex_lock(), rw_rdlock(), rw_trywrlock_upgrade(), rw_wrlock(), sema_wait(), ACE_Condition_Thread_Mutex::wait(), ACE_Condition< MUTEX >::wait(), and ACE_Condition< ACE_Recursive_Thread_Mutex >::wait().

00360 {
00361   ACE_OS_TRACE ("ACE_OS::cond_wait");
00362 # if defined (ACE_HAS_THREADS)
00363 #   if defined (ACE_HAS_PTHREADS)
00364 #     if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6)
00365   ACE_OSCALL_RETURN (pthread_cond_wait (cv, external_mutex), int, -1);
00366 #     else
00367   int result;
00368   ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_cond_wait (cv, external_mutex), result),
00369                      int, -1);
00370 #     endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6 */
00371 #   elif defined (ACE_HAS_STHREADS)
00372   int result;
00373   ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::cond_wait (cv, external_mutex), result),
00374                      int, -1);
00375 #   endif /* ACE_HAS_PTHREADS */
00376 # else
00377   ACE_UNUSED_ARG (cv);
00378   ACE_UNUSED_ARG (external_mutex);
00379   ACE_NOTSUP_RETURN (-1);
00380 # endif /* ACE_HAS_THREADS */
00381 }

ACE_INLINE int ACE_OS::condattr_destroy ACE_condattr_t &  attributes  ) 
 

Definition at line 132 of file OS_NS_Thread.inl.

Referenced by cond_init(), and ACE_Condition_Attributes::~ACE_Condition_Attributes().

00133 {
00134 #if defined (ACE_HAS_THREADS)
00135 #   if defined (ACE_HAS_PTHREADS)
00136 
00137 #     if defined (ACE_HAS_PTHREADS_DRAFT4)
00138   pthread_condattr_delete (&attributes);
00139 #     else
00140   pthread_condattr_destroy (&attributes);
00141 #     endif /* ACE_HAS_PTHREADS_DRAFT4 */
00142 
00143 #   elif defined (ACE_HAS_STHREADS)
00144   attributes.type = 0;
00145 
00146 #   endif /* ACE_HAS_PTHREADS vs. ACE_HAS_STHREADS */
00147   return 0;
00148 # else
00149   ACE_UNUSED_ARG (attributes);
00150   return 0;
00151 # endif /* ACE_HAS_THREADS  */
00152 }

ACE_INLINE int ACE_OS::condattr_init ACE_condattr_t &  attributes,
int  type = ACE_DEFAULT_SYNCH_TYPE
 

Definition at line 155 of file OS_NS_Thread.inl.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, and memset().

Referenced by ACE_Condition_Attributes::ACE_Condition_Attributes(), and cond_init().

00157 {
00158   ACE_UNUSED_ARG (type);
00159 # if defined (ACE_HAS_THREADS)
00160 #   if defined (ACE_HAS_PTHREADS)
00161   int result = -1;
00162 
00163 #   if defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600) && (ACE_VXWORKS <= 0x620)
00164       /* Tests show that VxWorks 6.x pthread lib does not only
00165        * require zeroing of mutex/condition objects to function correctly
00166        * but also of the attribute objects.
00167        */
00168       ACE_OS::memset (&attributes, 0, sizeof (attributes));
00169 #   endif
00170   if (
00171 #     if defined  (ACE_HAS_PTHREADS_DRAFT4)
00172       pthread_condattr_create (&attributes) == 0
00173 #     elif defined (ACE_HAS_PTHREADS_STD) || defined (ACE_HAS_PTHREADS_DRAFT7)
00174       ACE_ADAPT_RETVAL (pthread_condattr_init (&attributes), result) == 0
00175 #       if defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED)
00176       && ACE_ADAPT_RETVAL (pthread_condattr_setpshared (&attributes, type),
00177                            result) == 0
00178 #       endif /* _POSIX_THREAD_PROCESS_SHARED && ! ACE_LACKS_CONDATTR_PSHARED */
00179 #     else  /* this is draft 6 */
00180       pthread_condattr_init (&attributes) == 0
00181 #       if !defined (ACE_LACKS_CONDATTR_PSHARED)
00182       && pthread_condattr_setpshared (&attributes, type) == 0
00183 #       endif /* ACE_LACKS_CONDATTR_PSHARED */
00184 #       if defined (ACE_HAS_PTHREAD_CONDATTR_SETKIND_NP)
00185       && pthread_condattr_setkind_np (&attributes, type) == 0
00186 #       endif /* ACE_HAS_PTHREAD_CONDATTR_SETKIND_NP */
00187 #     endif /* ACE_HAS_PTHREADS_DRAFT4 */
00188       )
00189      result = 0;
00190   else
00191      result = -1;       // ACE_ADAPT_RETVAL used it for intermediate status
00192 
00193   return result;
00194 #   elif defined (ACE_HAS_STHREADS)
00195   attributes.type = type;
00196 
00197   return 0;
00198 
00199 #   else
00200   ACE_UNUSED_ARG (attributes);
00201   ACE_UNUSED_ARG (type);
00202   ACE_NOTSUP_RETURN (-1);
00203 
00204 #   endif /* ACE_HAS_PTHREADS vs. ACE_HAS_STHREADS */
00205 
00206 # else
00207   ACE_UNUSED_ARG (attributes);
00208   ACE_UNUSED_ARG (type);
00209   ACE_NOTSUP_RETURN (-1);
00210 # endif /* ACE_HAS_THREADS */
00211 }

int ACE_OS::connect ACE_HANDLE  handle,
const sockaddr *  addr,
int  addrlen,
const ACE_QoS_Params qos_params
 

QoS-enabled , which passes to . If the OS platform doesn't support QoS-enabled then the are ignored and the BSD-style is called.

Definition at line 41 of file OS_NS_sys_socket.cpp.

References ACE_OS_TRACE, ACE_SOCKCALL_RETURN, ACE_SOCKET_LEN, ACE_QoS_Params::callee_data(), ACE_QoS_Params::caller_data(), connect(), ACE_QoS_Params::group_socket_qos(), and ACE_QoS_Params::socket_qos().

00045 {
00046   ACE_OS_TRACE ("ACE_OS::connect");
00047 # if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00048   ACE_SOCKCALL_RETURN (::WSAConnect ((ACE_SOCKET) handle,
00049                                      (const sockaddr *) addr,
00050                                      (ACE_SOCKET_LEN) addrlen,
00051                                      (WSABUF *) qos_params.caller_data (),
00052                                      (WSABUF *) qos_params.callee_data (),
00053                                      (QOS *) qos_params.socket_qos (),
00054                                      (QOS *) qos_params.group_socket_qos ()),
00055                        int, -1);
00056 # else
00057   ACE_UNUSED_ARG (qos_params);
00058   return ACE_OS::connect (handle,
00059                           const_cast <sockaddr *> (addr),
00060                           addrlen);
00061 # endif /* ACE_HAS_WINSOCK2 */
00062 }

ACE_INLINE int ACE_OS::connect ACE_HANDLE  handle,
struct sockaddr *  addr,
int  addrlen
 

BSD-style (no QoS).

Definition at line 114 of file OS_NS_sys_socket.inl.

References ACE_OS_TRACE, ACE_SOCKCALL_RETURN, and ACE_SOCKET_LEN.

Referenced by ACE_SOCK_SEQPACK_Connector::connect(), ACE_SOCK_Connector::connect(), connect(), ACE_ATM_Connector::connect(), ACE_SOCK_CODgram::open(), and ACE_Ping_Socket::send_echo_check().

00117 {
00118   ACE_OS_TRACE ("ACE_OS::connect");
00119   ACE_SOCKCALL_RETURN (::connect ((ACE_SOCKET) handle,
00120                                   addr,
00121                                   (ACE_SOCKET_LEN) addrlen), int, -1);
00122 }

ACE_INLINE ACE_HANDLE ACE_OS::creat const ACE_TCHAR filename,
mode_t  mode
 

Definition at line 16 of file OS_NS_sys_stat.inl.

References ACE_OS_TRACE, ACE_TCHAR, ACE_TEXT_ALWAYS_CHAR, creat(), mode_t, and open().

Referenced by creat(), and ACE_SPIPE_Acceptor::create_new_instance().

00017   {
00018     ACE_OS_TRACE ("ACE_OS::creat");
00019 #if defined (ACE_WIN32)
00020     return ACE_OS::open (filename, O_CREAT|O_TRUNC|O_WRONLY, mode);
00021 #else
00022     ACE_OSCALL_RETURN (::creat (ACE_TEXT_ALWAYS_CHAR (filename), mode),
00023                        ACE_HANDLE, ACE_INVALID_HANDLE);
00024 #endif /* ACE_WIN32 */
00025   }

ACE_INLINE ACE_TCHAR * ACE_OS::ctime const time_t *  t  ) 
 

Definition at line 92 of file OS_NS_time.inl.

References ACE_OS_TRACE, ACE_TCHAR, asctime(), ctime(), ctime_buf_size, ctime_r(), and localtime().

Referenced by ctime(), and ctime_r().

00093 {
00094   ACE_OS_TRACE ("ACE_OS::ctime");
00095 #if defined (ACE_HAS_BROKEN_CTIME)
00096   ACE_OSCALL_RETURN (::asctime (::localtime (t)), char *, 0);
00097 #elif defined (ACE_HAS_WINCE)
00098   static ACE_TCHAR buf [ctime_buf_size];
00099   return ACE_OS::ctime_r (t,
00100                           buf,
00101                           ctime_buf_size);
00102 #elif defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
00103   ACE_OSCALL_RETURN (::_wctime (t), wchar_t *, 0);
00104 #else
00105 #  if defined (ACE_USES_WCHAR)   /* Not Win32, else it would do the above */
00106   char *narrow_time;
00107   ACE_OSCALL (::ctime (t), char *, 0, narrow_time);
00108   if (narrow_time == 0)
00109     return 0;
00110   // ACE_Ascii_To_Wide::convert allocates (via new []) a wchar_t[]. If
00111   // we've done this before, free the previous one. Yes, this leaves a
00112   // small memory leak (26 characters) but there's no way around this
00113   // that I know of. (Steve Huston, 12-Feb-2003).
00114   static wchar_t *wide_time = 0;
00115   if (wide_time != 0)
00116     delete [] wide_time;
00117   wide_time = ACE_Ascii_To_Wide::convert (narrow_time);
00118   return wide_time;
00119 #  else
00120   ACE_OSCALL_RETURN (::ctime (t), char *, 0);
00121 #  endif /* ACE_USES_WCHAR */
00122 # endif /* ACE_HAS_BROKEN_CTIME */
00123 }

ACE_INLINE ACE_TCHAR * ACE_OS::ctime_r const time_t *  clock,
ACE_TCHAR buf,
int  buflen
 

Definition at line 127 of file OS_NS_time.inl.

References ACE_OS_TRACE, ACE_TCHAR, ctime(), ctime_buf_size, ctime_r(), and strsncpy().

Referenced by ctime(), ctime_r(), ACE_Log_Record::format_msg(), and ACE::timestamp().

00128 {
00129   ACE_OS_TRACE ("ACE_OS::ctime_r");
00130 
00131 #if defined (ACE_HAS_REENTRANT_FUNCTIONS)
00132 
00133   char *bufp = 0;
00134 #   if defined (ACE_USES_WCHAR)
00135   char narrow_buf[ctime_buf_size];
00136   bufp = narrow_buf;
00137 #   else
00138   bufp = buf;
00139 #   endif /* ACE_USES_WCHAR */
00140 
00141   if (buflen < ctime_buf_size)
00142     {
00143       errno = ERANGE;
00144       return 0;
00145     }
00146 #   if defined (ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R)
00147 #      if defined (DIGITAL_UNIX)
00148   ACE_OSCALL (::_Pctime_r (t, bufp), ACE_TCHAR *, 0, bufp);
00149 #      else /* DIGITAL_UNIX */
00150   ACE_OSCALL (::ctime_r (t, bufp), char *, 0, bufp);
00151 #      endif /* DIGITAL_UNIX */
00152 #   else /* ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R */
00153 
00154 #      if defined (ACE_HAS_SIZET_PTR_ASCTIME_R_AND_CTIME_R)
00155   bufp = ::ctime_r (t, bufp, reinterpret_cast<size_t*>(&buflen));
00156 #      else /* ACE_CTIME_R_RETURNS_INT */
00157   bufp = ::ctime_r (t, bufp, buflen);
00158 #      endif /* ACE_CTIME_R_RETURNS_INT */
00159 
00160 #   endif /* ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R */
00161 
00162   if (bufp == 0)
00163     return 0;
00164 
00165 #   if defined (ACE_USES_WCHAR)
00166   ACE_Ascii_To_Wide wide_buf (bufp);
00167   ACE_OS_String::strcpy (buf, wide_buf.wchar_rep ());
00168   return buf;
00169 #   else
00170   return bufp;
00171 #   endif /* ACE_USES_WCHAR */
00172 
00173 #else /* ACE_HAS_REENTRANT_FUNCTIONS */
00174   if (buflen < ctime_buf_size)
00175     {
00176       errno = ERANGE;
00177       return 0;
00178     }
00179 
00180   ACE_TCHAR *result;
00181 #     if defined (ACE_USES_WCHAR)
00182   ACE_OSCALL (::_wctime (t), wchar_t *, 0, result);
00183 #     else /* ACE_USES_WCHAR */
00184   ACE_OSCALL (::ctime (t), char *, 0, result);
00185 #     endif /* ACE_USES_WCHAR */
00186   if (result != 0)
00187     ACE_OS::strsncpy (buf, result, buflen);
00188   return buf;
00189 #endif /* ACE_HAS_REENTRANT_FUNCTIONS */
00190 }

ACE_INLINE wchar_t * ACE_OS::cuserid wchar_t *  user,
size_t  maxlen = ACE_MAX_USERID
 

Definition at line 480 of file OS_NS_stdio.inl.

References ACE_FAIL_RETURN, ACE_NEW_RETURN, cuserid(), and strcpy().

00481 {
00482 # if defined (ACE_WIN32)
00483   BOOL result = GetUserNameW (user, (u_long *) &maxlen);
00484   if (result == FALSE)
00485     ACE_FAIL_RETURN (0);
00486   else
00487     return user;
00488 # else /* ACE_WIN32 */
00489   char *char_user;
00490   wchar_t *result = 0;
00491 
00492   ACE_NEW_RETURN (char_user, char[maxlen + 1], 0);
00493 
00494   if (ACE_OS::cuserid (char_user, maxlen))
00495     {
00496       ACE_OS::strcpy (user, ACE_Ascii_To_Wide (char_user).wchar_rep ());
00497       result = user;
00498     }
00499 
00500   delete [] char_user;
00501 
00502   return result;
00503 # endif /* ACE_WIN32 */
00504 }

ACE_INLINE char * ACE_OS::cuserid char *  user,
size_t  maxlen = ACE_MAX_USERID
 

Definition at line 381 of file OS_NS_stdio.inl.

References ACE_FAIL_RETURN, ACE_NOTSUP_RETURN, ACE_OS_TRACE, strcpy(), and strlen().

Referenced by cuserid().

00382 {
00383   ACE_OS_TRACE ("ACE_OS::cuserid");
00384 #if defined (ACE_VXWORKS)
00385   ACE_UNUSED_ARG (maxlen);
00386   if (user == 0)
00387     {
00388       // Require that the user field be non-null, i.e., don't
00389       // allocate or use static storage.
00390       ACE_NOTSUP_RETURN (0);
00391     }
00392   else
00393     {
00394       ::remCurIdGet (user, 0);
00395       return user;
00396     }
00397 #elif defined (__QNXNTO__)
00398   ACE_UNUSED_ARG (user);
00399   ACE_UNUSED_ARG (maxlen);
00400   ACE_NOTSUP_RETURN (0);
00401 #elif defined (ACE_WIN32)
00402   BOOL result = GetUserNameA (user, (u_long *) &maxlen);
00403   if (result == FALSE)
00404     ACE_FAIL_RETURN (0);
00405   else
00406     return user;
00407 #elif defined (ACE_HAS_ALT_CUSERID)
00408 #  if defined (ACE_LACKS_PWD_FUNCTIONS)
00409 #    error Cannot use alternate cuserid() without POSIX password functions!
00410 #  endif  /* ACE_LACKS_PWD_FUNCTIONS */
00411 
00412   // POSIX.1 dropped the cuserid() function.
00413   // GNU GLIBC and other platforms correctly deprecate the cuserid()
00414   // function.
00415 
00416   if (maxlen == 0)
00417     {
00418       // It doesn't make sense to have a zero length user ID.
00419       errno = EINVAL;
00420       return 0;
00421     }
00422 
00423   struct passwd *pw = 0;
00424 
00425   // Make sure the file pointer is at the beginning of the password file
00426   ::setpwent ();
00427   // Should use ACE_OS::setpwent() but I didn't want to move this
00428   // method after it.
00429 
00430   // Use the effective user ID to determine the user name.
00431   pw = ::getpwuid (::geteuid ());
00432 
00433   // Make sure the password file is closed.
00434   ::endpwent ();
00435 
00436   size_t max_length = 0;
00437   char *userid = 0;
00438 
00439   if (user == 0)
00440     {
00441       // Not reentrant/thread-safe, but nothing else can be done if a
00442       // zero pointer was passed in as the destination.
00443 
00444 #if defined (_POSIX_SOURCE)
00445       const size_t ACE_L_cuserid = L_cuserid;
00446 #else
00447       const size_t ACE_L_cuserid = 9;  // 8 character user ID + NULL
00448 #endif  /* _POSIX_SOURCE */
00449 
00450       static char tmp[ACE_L_cuserid] = { '\0' };
00451       max_length = ACE_L_cuserid - 1; // Do not include NULL in length
00452 
00453       userid = tmp;
00454     }
00455   else
00456     {
00457       max_length = maxlen;
00458       userid = user;
00459     }
00460 
00461   // Extract the user name from the passwd structure.
00462   if (ACE_OS::strlen (pw->pw_name) <= max_length)
00463     {
00464       return ACE_OS::strcpy (userid, pw->pw_name);
00465     }
00466   else
00467     {
00468       errno = ENOSPC;  // Buffer is not large enough.
00469       return 0;
00470     }
00471 #else
00472   // Hackish because of missing buffer size!
00473   ACE_UNUSED_ARG (maxlen);
00474   ACE_OSCALL_RETURN (::ace_cuserid(user), char*, 0);
00475 #endif /* ACE_VXWORKS */
00476 }

ACE_NAMESPACE_INLINE_FUNCTION LPSECURITY_ATTRIBUTES default_win32_security_attributes LPSECURITY_ATTRIBUTES   ) 
 

Default Win32 Security Attributes definition.

ACE_NAMESPACE_INLINE_FUNCTION LPSECURITY_ATTRIBUTES default_win32_security_attributes_r LPSECURITY_ATTRIBUTES  ,
LPSECURITY_ATTRIBUTES  ,
SECURITY_DESCRIPTOR * 
 

Referenced by mmap(), and sema_init().

ACE_INLINE double ACE_OS::difftime time_t  t1,
time_t  t0
 

Definition at line 195 of file OS_NS_time.inl.

References ace_difftime().

Referenced by ACE_Filecache_Object::update().

00196 {
00197   return ::ace_difftime (t1, t0);
00198 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_OS::dlclose ACE_SHLIB_HANDLE  handle  ) 
 

Definition at line 26 of file OS_NS_dlfcn.inl.

References ACE_ADAPT_RETVAL, ACE_LIB_TEXT, ACE_NOTSUP_RETURN, ACE_OS_TRACE, ACE_SHLIB_HANDLE, dlclose(), and dlsym().

Referenced by ACE_DLL_Handle::close(), and dlclose().

00027 {
00028   ACE_OS_TRACE ("ACE_OS::dlclose");
00029 #if defined (ACE_LACKS_DLCLOSE)
00030   ACE_UNUSED_ARG (handle);
00031   return 0;
00032 #elif defined (ACE_HAS_SVR4_DYNAMIC_LINKING)
00033 
00034 # if !defined (ACE_HAS_AUTOMATIC_INIT_FINI)
00035   // SunOS4 does not automatically call _fini()!
00036   void *ptr;
00037 
00038   ACE_OSCALL (::dlsym (handle, ACE_LIB_TEXT ("_fini")), void *, 0, ptr);
00039 
00040   if (ptr != 0)
00041     (*((int (*)(void)) ptr)) (); // Call _fini hook explicitly.
00042 # endif /* ACE_HAS_AUTOMATIC_INIT_FINI */
00043 #if defined (_M_UNIX)
00044   ACE_OSCALL_RETURN (::_dlclose (handle), int, -1);
00045 #else /* _MUNIX */
00046     ACE_OSCALL_RETURN (::dlclose (handle), int, -1);
00047 #endif /* _M_UNIX */
00048 #elif defined (ACE_WIN32)
00049   ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::FreeLibrary (handle), ace_result_), int, -1);
00050 #elif defined (__hpux)
00051   // HP-UX 10.x and 32-bit 11.00 do not pay attention to the ref count
00052   // when unloading a dynamic lib.  So, if the ref count is more than
00053   // 1, do not unload the lib.  This will cause a library loaded more
00054   // than once to not be unloaded until the process runs down, but
00055   // that's life.  It's better than unloading a library that's in use.
00056   // So far as I know, there's no way to decrement the refcnt that the
00057   // kernel is looking at - the shl_descriptor is a copy of what the
00058   // kernel has, not the actual struct.  On 64-bit HP-UX using dlopen,
00059   // this problem has been fixed.
00060   struct shl_descriptor  desc;
00061   if (shl_gethandle_r (handle, &desc) == -1)
00062     return -1;
00063   if (desc.ref_count > 1)
00064     return 0;
00065 # if defined(__GNUC__) || __cplusplus >= 199707L
00066   ACE_OSCALL_RETURN (::shl_unload (handle), int, -1);
00067 # else
00068   ACE_OSCALL_RETURN (::cxxshl_unload (handle), int, -1);
00069 # endif  /* aC++ vs. Hp C++ */
00070 #else
00071   ACE_UNUSED_ARG (handle);
00072   ACE_NOTSUP_RETURN (-1);
00073 #endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */
00074 }

ACE_INLINE ACE_TCHAR * ACE_OS::dlerror void   ) 
 

Definition at line 77 of file OS_NS_dlfcn.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, ACE_TCHAR, ACE_TEXT_CHAR_TO_TCHAR, dlerror(), sprintf(), strerror(), and strncpy().

Referenced by dlerror(), and ACE_DLL_Handle::error().

00078 {
00079   ACE_OS_TRACE ("ACE_OS::dlerror");
00080 # if defined (ACE_HAS_SVR4_DYNAMIC_LINKING)
00081   const char *err;
00082 #   if defined(_M_UNIX)
00083   ACE_OSCALL (::_dlerror (), const char *, 0, err);
00084 #   else /* _M_UNIX */
00085   ACE_OSCALL (::dlerror (), const char *, 0, err);
00086 #   endif /* _M_UNIX */
00087   if (err == 0)
00088     return 0;
00089 #   if defined (ACE_USES_WCHAR)
00090   const size_t BufLen = 256;
00091   static wchar_t buf[BufLen];
00092   ACE_OS::strncpy (buf, ACE_TEXT_CHAR_TO_TCHAR (err), BufLen);
00093   return buf;
00094 #   else
00095   return const_cast <char *> (err);
00096 #   endif /* ACE_USES_WCHAR */
00097 # elif defined (__hpux) || defined (ACE_VXWORKS)
00098   ACE_OSCALL_RETURN (::strerror(errno), char *, 0);
00099 # elif defined (ACE_WIN32)
00100   static ACE_TCHAR buf[128];
00101 #   if defined (ACE_HAS_PHARLAP)
00102   ACE_OS::sprintf (buf, "error code %d", GetLastError());
00103 #   else
00104   ACE_TEXT_FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM,
00105                           0,
00106                           ::GetLastError (),
00107                           0,
00108                           buf,
00109                           sizeof buf / sizeof buf[0],
00110                           0);
00111 #   endif /* ACE_HAS_PHARLAP */
00112   return buf;
00113 # else
00114   ACE_NOTSUP_RETURN (0);
00115 # endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */
00116 }

ACE_INLINE ACE_SHLIB_HANDLE ACE_OS::dlopen const ACE_TCHAR filename,
int  mode = ACE_DEFAULT_SHLIB_MODE
 

Definition at line 119 of file OS_NS_dlfcn.inl.

References ACE_DEFAULT_FILE_PERMS, ACE_LIB_TEXT, ACE_NOTSUP_RETURN, ACE_OS_TRACE, ACE_SHLIB_HANDLE, ACE_TCHAR, ACE_TEXT_ALWAYS_CHAR, close(), dlsym(), last_error(), and open().

Referenced by ACE_DLL_Strategy< SVC_HANDLER >::make_svc_handler(), and ACE_DLL_Handle::open().

00121 {
00122   ACE_OS_TRACE ("ACE_OS::dlopen");
00123 
00124 # if defined (ACE_HAS_SVR4_DYNAMIC_LINKING)
00125   void *handle;
00126 #   if defined (ACE_HAS_SGIDLADD)
00127   ACE_OSCALL
00128     (::sgidladd (ACE_TEXT_ALWAYS_CHAR (fname), mode), void *, 0, handle);
00129 #   elif defined (_M_UNIX)
00130   ACE_OSCALL
00131     (::_dlopen (ACE_TEXT_ALWAYS_CHAR (fname), mode), void *, 0, handle);
00132 #   else
00133   ACE_OSCALL
00134     (::dlopen (ACE_TEXT_ALWAYS_CHAR (fname), mode), void *, 0, handle);
00135 #   endif /* ACE_HAS_SGIDLADD */
00136 #   if !defined (ACE_HAS_AUTOMATIC_INIT_FINI)
00137   if (handle != 0)
00138     {
00139       void *ptr;
00140       // Some systems (e.g., SunOS4) do not automatically call _init(), so
00141       // we'll have to call it manually.
00142 
00143       ACE_OSCALL (::dlsym (handle, ACE_LIB_TEXT ("_init")), void *, 0, ptr);
00144 
00145       if (ptr != 0 && (*((int (*)(void)) ptr)) () == -1) // Call _init hook explicitly.
00146         {
00147           // Close down the handle to prevent leaks.
00148           ::dlclose (handle);
00149           return 0;
00150         }
00151     }
00152 #   endif /* ACE_HAS_AUTOMATIC_INIT_FINI */
00153   return handle;
00154 # elif defined (ACE_WIN32)
00155   ACE_UNUSED_ARG (mode);
00156 
00157   ACE_WIN32CALL_RETURN (ACE_TEXT_LoadLibrary (fname), ACE_SHLIB_HANDLE, 0);
00158 # elif defined (__hpux)
00159 
00160 #   if defined(__GNUC__) || __cplusplus >= 199707L
00161   ACE_OSCALL_RETURN (::shl_load(fname, mode, 0L), ACE_SHLIB_HANDLE, 0);
00162 #   else
00163   ACE_OSCALL_RETURN (::cxxshl_load(fname, mode, 0L), ACE_SHLIB_HANDLE, 0);
00164 #   endif  /* aC++ vs. Hp C++ */
00165 # elif defined (ACE_VXWORKS) && !defined (__RTP__)
00166   MODULE* handle = 0;
00167   // Open readonly
00168   ACE_HANDLE filehandle = ACE_OS::open (fname,
00169                                         O_RDONLY,
00170                                         ACE_DEFAULT_FILE_PERMS);
00171 
00172   if (filehandle != ACE_INVALID_HANDLE)
00173     {
00174       ACE_OS::last_error(0);
00175       ACE_OSCALL ( ::loadModule (filehandle, LOAD_GLOBAL_SYMBOLS|LOAD_COMMON_MATCH_ALL ), MODULE *, 0, handle);
00176       int loaderror = ACE_OS::last_error();
00177       ACE_OS::close (filehandle);
00178 
00179       if ( (loaderror != 0) && (handle != 0) )
00180         {
00181           // ouch something went wrong most likely unresolved externals
00182           if (handle)
00183             ::unldByModuleId ( handle, 0 );
00184           handle = 0;
00185         }
00186     }
00187   else
00188     {
00189       // couldn't open file
00190       handle = 0;
00191     }
00192   return handle;
00193 # else
00194   ACE_UNUSED_ARG (fname);
00195   ACE_UNUSED_ARG (mode);
00196   ACE_NOTSUP_RETURN (0);
00197 # endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */
00198 }

ACE_INLINE void * ACE_OS::dlsym ACE_SHLIB_HANDLE  handle,
const ACE_TCHAR symbol
 

Definition at line 201 of file OS_NS_dlfcn.inl.

References ACE_NEW_RETURN, ACE_NOTSUP_RETURN, ACE_OS_TRACE, ACE_SHLIB_HANDLE, ACE_SHLIB_INVALID_HANDLE, ACE_TCHAR, dlsym(), strcpy(), and strlen().

Referenced by dlclose(), dlopen(), dlsym(), ACE_DLL_Strategy< SVC_HANDLER >::make_svc_handler(), and ACE_DLL_Handle::symbol().

00203 {
00204   ACE_OS_TRACE ("ACE_OS::dlsym");
00205 
00206 #if defined (ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE)
00207   // Check if the handle is valid before making any calls using it.
00208   if (handle == ACE_SHLIB_INVALID_HANDLE)
00209     return 0;
00210 #endif /* ACE_HAS_DLSYM_SEGFAULT_ON_INVALID_HANDLE */
00211 
00212   // Get the correct OS type.
00213 #if defined (ACE_HAS_WINCE)
00214   // CE (at least thru Pocket PC 2003) offers GetProcAddressW, not ...A, so
00215   // we always need a wide-char string.
00216   const wchar_t *symbolname = 0;
00217 #  if defined (ACE_USES_WCHAR)
00218   symbolname = sname;
00219 #  else
00220   ACE_Ascii_To_Wide sname_xlate (sname);
00221   symbolname = sname_xlate.wchar_rep ();
00222 #  endif /* ACE_USES_WCHAR */
00223 #elif defined (ACE_USES_WCHAR)
00224   // WinCE is WCHAR always; other platforms need a char * symbol name
00225   ACE_Wide_To_Ascii w_sname (sname);
00226   char *symbolname = w_sname.char_rep ();
00227 #elif defined (ACE_VXWORKS)
00228   char *symbolname = const_cast<char *> (sname);
00229 #else
00230   const char *symbolname = sname;
00231 #endif /* ACE_HAS_WINCE */
00232 
00233 # if defined (ACE_HAS_SVR4_DYNAMIC_LINKING)
00234 
00235 #   if defined (ACE_USES_ASM_SYMBOL_IN_DLSYM)
00236   int l = ACE_OS::strlen (symbolname) + 2;
00237   char *asm_symbolname = 0;
00238   ACE_NEW_RETURN (asm_symbolname, char[l], 0);
00239   ACE_OS::strcpy (asm_symbolname, "_") ;
00240   ACE_OS::strcpy (asm_symbolname + 1, symbolname) ;
00241   void *ace_result;
00242   ACE_OSCALL (::dlsym (handle, asm_symbolname), void *, 0, ace_result);
00243   delete [] asm_symbolname;
00244   return ace_result;
00245 #   elif defined (_M_UNIX)
00246   ACE_OSCALL_RETURN (::_dlsym (handle, symbolname), void *, 0);
00247 #   else
00248   ACE_OSCALL_RETURN (::dlsym (handle, symbolname), void *, 0);
00249 #   endif /* ACE_USES_ASM_SYMBOL_IN_DLSYM */
00250 
00251 # elif defined (ACE_WIN32)
00252 
00253   ACE_WIN32CALL_RETURN (::GetProcAddress (handle, symbolname), void *, 0);
00254 
00255 # elif defined (__hpux)
00256 
00257   void *value;
00258   int status;
00259   shl_t _handle = handle;
00260   ACE_OSCALL (::shl_findsym(&_handle, symbolname, TYPE_UNDEFINED, &value), int, -1, status);
00261   return status == 0 ? value : 0;
00262 
00263 # elif defined (ACE_VXWORKS) && !defined (__RTP__)
00264 
00265   // For now we use the VxWorks global symbol table
00266   // which resolves the most recently loaded symbols .. which resolve mostly what we want..
00267   ACE_UNUSED_ARG (handle);
00268   SYM_TYPE symtype;
00269   void *value = 0;
00270   STATUS status;
00271   ACE_OSCALL (::symFindByName(sysSymTbl, symbolname, (char **)&value, &symtype), int, -1, status);
00272 
00273   return status == OK ? value : 0;
00274 
00275 # else
00276 
00277   ACE_UNUSED_ARG (handle);
00278   ACE_UNUSED_ARG (symbolname);
00279   ACE_NOTSUP_RETURN (0);
00280 
00281 # endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */
00282 }

ACE_INLINE ACE_HANDLE ACE_OS::dup ACE_HANDLE  handle  ) 
 

Definition at line 201 of file OS_NS_unistd.inl.

References ACE_FAIL_RETURN, ACE_NOTSUP_RETURN, ACE_OS_TRACE, and dup().

Referenced by dup(), ACE_Filecache_Handle::handle(), ACE_Process_Options::set_handles(), and ACE_Process::spawn().

00202 {
00203   ACE_OS_TRACE ("ACE_OS::dup");
00204 #if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
00205   ACE_HANDLE new_fd;
00206   if (::DuplicateHandle(::GetCurrentProcess (),
00207                         handle,
00208                         ::GetCurrentProcess(),
00209                         &new_fd,
00210                         0,
00211                         TRUE,
00212                         DUPLICATE_SAME_ACCESS))
00213     return new_fd;
00214   else
00215     ACE_FAIL_RETURN (ACE_INVALID_HANDLE);
00216   /* NOTREACHED */
00217 #elif defined (ACE_LACKS_DUP)
00218   ACE_UNUSED_ARG (handle);
00219   ACE_NOTSUP_RETURN (-1);
00220 #elif defined (ACE_HAS_WINCE)
00221   ACE_UNUSED_ARG (handle);
00222   ACE_NOTSUP_RETURN (0);
00223 #else
00224   ACE_OSCALL_RETURN (::dup (handle), ACE_HANDLE, ACE_INVALID_HANDLE);
00225 #endif /* ACE_WIN32 && !ACE_HAS_WINCE */
00226 }

ACE_INLINE int ACE_OS::dup2 ACE_HANDLE  oldfd,
ACE_HANDLE  newfd
 

Definition at line 229 of file OS_NS_unistd.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and dup2().

Referenced by dup2(), and ACE_Process::spawn().

00230 {
00231   ACE_OS_TRACE ("ACE_OS::dup2");
00232 #if defined (ACE_LACKS_DUP2)
00233   // msvcrt has _dup2 ?!
00234   ACE_UNUSED_ARG (oldhandle);
00235   ACE_UNUSED_ARG (newhandle);
00236   ACE_NOTSUP_RETURN (-1);
00237 #else
00238   ACE_OSCALL_RETURN (::dup2 (oldhandle, newhandle), int, -1);
00239 #endif /* ACE_LACKS_DUP2 */
00240 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE void ACE_OS::endpwent void   ) 
 

Definition at line 12 of file OS_NS_pwd.inl.

00013 {
00014 #if !defined (ACE_LACKS_PWD_FUNCTIONS)
00015   ::endpwent ();
00016 #endif /* ! ACE_LACKS_PWD_FUNCTIONS */
00017 }

ACE_INLINE int ACE_OS::enum_protocols int *  protocols,
ACE_Protocol_Info protocol_buffer,
u_long *  buffer_length
 

Retrieve information about available transport protocols installed on the local machine. Windows specific...

Definition at line 125 of file OS_NS_sys_socket.inl.

References ACE_NOTSUP_RETURN, and ACE_SOCKCALL_RETURN.

00128 {
00129 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00130 
00131   ACE_SOCKCALL_RETURN (::WSAEnumProtocols (protocols,
00132                                            protocol_buffer,
00133                                            buffer_length),
00134                        int,
00135                        SOCKET_ERROR);
00136 
00137 #else
00138   ACE_UNUSED_ARG (protocols);
00139   ACE_UNUSED_ARG (protocol_buffer);
00140   ACE_UNUSED_ARG (buffer_length);
00141   ACE_NOTSUP_RETURN (-1);
00142 #endif /* ACE_HAS_WINSOCK2 */
00143 }

int ACE_OS::event_destroy ACE_event_t *  event  ) 
 

Definition at line 2454 of file OS_NS_Thread.cpp.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, ACE_TEXT_CHAR_TO_TCHAR, cond_broadcast(), cond_destroy(), EBUSY, free(), munmap(), mutex_destroy(), sema_destroy(), shm_unlink(), and thr_yield().

Referenced by ACE_WFMO_Reactor_Handler_Repository::make_changes_in_current_infos(), ACE_WFMO_Reactor_Handler_Repository::make_changes_in_suspension_infos(), ACE_WFMO_Reactor_Handler_Repository::make_changes_in_to_be_added_infos(), ACE_Event::remove(), sema_destroy(), and sema_init().

02455 {
02456 #if defined (ACE_WIN32)
02457   ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::CloseHandle (*event), ace_result_), int, -1);
02458 #elif defined (ACE_HAS_THREADS)
02459   if (event->eventdata_)
02460 {
02461       // mutex_destroy()/cond_destroy() are called in a loop if the object
02462       // is BUSY.  This avoids conditions where we fail to destroy these
02463       // objects because at time of destroy they were just being used in
02464       // another thread possibly causing deadlocks later on if they keep
02465       // being used after we're gone.
02466 
02467   if (event->eventdata_->type_ == USYNC_PROCESS)
02468   {
02469     if (event->name_)
02470     {
02471       // Only destroy the event data if we're the ones who initialized
02472       // it.
02473 
02474       int r1, r2;
02475 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
02476         (!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
02477      (!defined (ACE_USES_FIFO_SEM) && \
02478         (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
02479       // first destroy the mutex so locking after this will return errors
02480       while ((r1 = ACE_OS::mutex_destroy (&event->eventdata_->lock_)) == -1
02481               && errno == EBUSY)
02482       {
02483         ACE_OS::thr_yield ();
02484       }
02485 # else
02486       r1 = ACE_OS::sema_destroy(&event->lock_);
02487 # endif
02488 
02489 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED)) || \
02490     (!defined (ACE_USES_FIFO_SEM) && \
02491       (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_SEM_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
02492       // now fix event to manual reset, raise signal and broadcast until is's
02493       // possible to destroy the condition
02494       event->eventdata_->manual_reset_ = 1;
02495       while ((r2 = ACE_OS::cond_destroy (&event->eventdata_->condition_)) == -1
02496               && errno == EBUSY)
02497       {
02498         event->eventdata_->is_signaled_ = 1;
02499         ACE_OS::cond_broadcast (&event->eventdata_->condition_);
02500         ACE_OS::thr_yield ();
02501       }
02502 # else
02503       r2 = ACE_OS::sema_destroy(&event->semaphore_);
02504 # endif
02505       ACE_OS::munmap (event->eventdata_,
02506                       sizeof (ACE_eventdata_t));
02507       ACE_OS::shm_unlink (ACE_TEXT_CHAR_TO_TCHAR(event->name_));
02508       ACE_OS::free (event->name_);
02509       return r1 != 0 || r2 != 0 ? -1 : 0;
02510     }
02511     else
02512     {
02513       ACE_OS::munmap (event->eventdata_,
02514                       sizeof (ACE_eventdata_t));
02515 # if (!defined (ACE_HAS_PTHREADS) || !defined (_POSIX_THREAD_PROCESS_SHARED) || \
02516         (defined (ACE_LACKS_MUTEXATTR_PSHARED) && defined (ACE_LACKS_CONDATTR_PSHARED))) && \
02517      (defined (ACE_USES_FIFO_SEM) || \
02518         (defined (ACE_HAS_POSIX_SEM) && defined (ACE_HAS_POSIX_TIMEOUT) && defined (ACE_LACKS_NAMED_POSIX_SEM)))
02519       ACE_OS::sema_destroy(&event->lock_);
02520 # endif
02521 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED)) || \
02522     (!defined (ACE_USES_FIFO_SEM) && \
02523       (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_SEM_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
02524       return 0;
02525 # else
02526       return ACE_OS::sema_destroy(&event->semaphore_);
02527 # endif
02528     }
02529   }
02530   else
02531   {
02532     int r1, r2;
02533     // first destroy the mutex so locking after this will return errors
02534 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
02535         (!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
02536      (!defined (ACE_USES_FIFO_SEM) && \
02537         (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
02538       // first destroy the mutex so locking after this will return errors
02539       while ((r1 = ACE_OS::mutex_destroy (&event->eventdata_->lock_)) == -1
02540               && errno == EBUSY)
02541       {
02542         ACE_OS::thr_yield ();
02543       }
02544 # else
02545       r1 = ACE_OS::sema_destroy(&event->lock_);
02546 # endif
02547 
02548 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED)) || \
02549     (!defined (ACE_USES_FIFO_SEM) && \
02550       (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_SEM_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
02551     // now fix event to manual reset, raise signal and broadcast until is's
02552     // possible to destroy the condition
02553     event->eventdata_->manual_reset_ = 1;
02554     while ((r2 = ACE_OS::cond_destroy (&event->eventdata_->condition_)) == -1
02555             && errno == EBUSY)
02556     {
02557       event->eventdata_->is_signaled_ = 1;
02558       ACE_OS::cond_broadcast (&event->eventdata_->condition_);
02559       ACE_OS::thr_yield ();
02560     }
02561 # else
02562     r2 = ACE_OS::sema_destroy(&event->semaphore_);
02563 # endif
02564     delete event->eventdata_;
02565     return r1 != 0 || r2 != 0 ? -1 : 0;
02566   }
02567 }
02568 
02569   return 0;
02570 #else
02571   ACE_UNUSED_ARG (event);
02572   ACE_NOTSUP_RETURN (-1);
02573 #endif /* ACE_WIN32 */
02574 }

ACE_INLINE int ACE_OS::event_init ACE_event_t *  event,
int  manual_reset,
int  initial_state,
int  type,
const wchar_t *  name,
void *  arg = 0,
LPSECURITY_ATTRIBUTES  sa = 0
 

Definition at line 469 of file OS_NS_Thread.inl.

References ACE_FAIL_RETURN, and event_init().

00476 {
00477 #if defined (ACE_WIN32)
00478   ACE_UNUSED_ARG (type);
00479   ACE_UNUSED_ARG (arg);
00480   SECURITY_ATTRIBUTES sa_buffer;
00481   SECURITY_DESCRIPTOR sd_buffer;
00482   *event = ::CreateEventW (ACE_OS::default_win32_security_attributes_r
00483       (sa, &sa_buffer, &sd_buffer),
00484   manual_reset,
00485   initial_state,
00486   name);
00487   if (*event == 0)
00488     ACE_FAIL_RETURN (-1);
00489 
00490   return 0;
00491 #else  /* ACE_WIN32 */
00492   return ACE_OS::event_init (event,
00493                              manual_reset,
00494                              initial_state,
00495                              type,
00496                              ACE_Wide_To_Ascii (name).char_rep (),
00497                              arg,
00498                              sa);
00499 #endif /* ACE_WIN32 */
00500 }

int ACE_OS::event_init ACE_event_t *  event,
int  manual_reset = 0,
int  initial_state = 0,
int  type = ACE_DEFAULT_SYNCH_TYPE,
const char *  name = 0,
void *  arg = 0,
LPSECURITY_ATTRIBUTES  sa = 0
 

Definition at line 2577 of file OS_NS_Thread.cpp.

References ACE_DEFAULT_FILE_PERMS, ACE_FAIL_RETURN, ACE_NEW_RETURN, ACE_NOTSUP_RETURN, ACE_TEXT_CHAR_TO_TCHAR, close(), cond_init(), ftruncate(), MAP_FAILED, MAP_SHARED, mmap(), mutex_init(), PROT_RDWR, sema_init(), sema_post(), shm_open(), shm_unlink(), strcat(), strdup(), and strncpy().

Referenced by ACE_Event::ACE_Event(), event_init(), and sema_init().

02584 {
02585 #if defined (ACE_WIN32)
02586   ACE_UNUSED_ARG (type);
02587   ACE_UNUSED_ARG (arg);
02588   SECURITY_ATTRIBUTES sa_buffer;
02589   SECURITY_DESCRIPTOR sd_buffer;
02590 # if defined (ACE_HAS_WINCE)
02591   // @@todo (brunsch) This idea should be moved into ACE_OS_Win32.
02592   *event = ::CreateEventW (ACE_OS::default_win32_security_attributes_r
02593                              (sa, &sa_buffer, &sd_buffer),
02594                            manual_reset,
02595                            initial_state,
02596                            ACE_Ascii_To_Wide (name).wchar_rep ());
02597 # else /* ACE_HAS_WINCE */
02598   *event = ::CreateEventA (ACE_OS::default_win32_security_attributes_r
02599                              (sa, &sa_buffer, &sd_buffer),
02600                            manual_reset,
02601                            initial_state,
02602                            name);
02603 # endif /* ACE_HAS_WINCE */
02604   if (*event == 0)
02605     ACE_FAIL_RETURN (-1);
02606   else
02607     return 0;
02608 #elif defined (ACE_HAS_THREADS)
02609   ACE_UNUSED_ARG (sa);
02610   event->eventdata_ = 0;
02611   ACE_eventdata_t* evtdata;
02612 
02613   if (type == USYNC_PROCESS)
02614     {
02615       int owner = 0;
02616       // Let's see if the shared memory entity already exists.
02617       ACE_HANDLE fd = ACE_OS::shm_open (ACE_TEXT_CHAR_TO_TCHAR (name),
02618                                         O_RDWR | O_CREAT | O_EXCL,
02619                                         ACE_DEFAULT_FILE_PERMS);
02620       if (fd == ACE_INVALID_HANDLE)
02621         {
02622           if (errno == EEXIST)
02623             fd = ACE_OS::shm_open (ACE_TEXT_CHAR_TO_TCHAR (name),
02624                                    O_RDWR | O_CREAT,
02625                                    ACE_DEFAULT_FILE_PERMS);
02626           if (fd == ACE_INVALID_HANDLE)   // Still can't get it.
02627             return -1;
02628         }
02629       else
02630         {
02631           // We own this shared memory object!  Let's set its size.
02632           if (ACE_OS::ftruncate (fd, sizeof (ACE_eventdata_t)) == -1)
02633             {
02634               ACE_OS::close (fd);
02635               return -1;
02636             }
02637           owner = 1;
02638         }
02639 
02640       evtdata =
02641         (ACE_eventdata_t *) ACE_OS::mmap (0,
02642                                           sizeof (ACE_eventdata_t),
02643                                           PROT_RDWR,
02644                                           MAP_SHARED,
02645                                           fd,
02646                                           0);
02647       ACE_OS::close (fd);
02648       if (evtdata == MAP_FAILED)
02649         {
02650           if (owner)
02651             ACE_OS::shm_unlink (ACE_TEXT_CHAR_TO_TCHAR (name));
02652           return -1;
02653         }
02654 
02655       if (owner)
02656         {
02657           event->name_ = ACE_OS::strdup (name);
02658           if (event->name_ == 0)
02659             {
02660               ACE_OS::shm_unlink (ACE_TEXT_CHAR_TO_TCHAR (name));
02661               return -1;
02662             }
02663           event->eventdata_ = evtdata;
02664           event->eventdata_->type_ = type;
02665           event->eventdata_->manual_reset_ = manual_reset;
02666           event->eventdata_->is_signaled_ = initial_state;
02667           event->eventdata_->auto_event_signaled_ = false;
02668           event->eventdata_->waiting_threads_ = 0;
02669           event->eventdata_->signal_count_ = 0;
02670 
02671 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED)) || \
02672     (!defined (ACE_USES_FIFO_SEM) && \
02673       (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_SEM_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
02674           int result = ACE_OS::cond_init (&event->eventdata_->condition_,
02675                                           static_cast<short> (type),
02676                                           name,
02677                                           arg);
02678 # else
02679           char   sem_name[128];
02680           ACE_OS::strncpy (sem_name,
02681                            name,
02682                            sizeof (sem_name) - (1 + sizeof ("._ACE_EVTSEM_")));
02683           ACE_OS::strcat (sem_name, "._ACE_EVTSEM_");
02684           int result = ACE_OS::sema_init (&event->semaphore_,
02685                                           0,
02686                                           type,
02687                                           sem_name,
02688                                           arg);
02689 # endif
02690           if (result == 0)
02691 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
02692         (!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
02693      (!defined (ACE_USES_FIFO_SEM) && \
02694         (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
02695             result = ACE_OS::mutex_init (&event->eventdata_->lock_,
02696                                          type,
02697                                          name,
02698                                          (ACE_mutexattr_t *) arg);
02699 # else
02700           {
02701             char   lck_name[128];
02702             ACE_OS::strncpy
02703               (lck_name,
02704                name,
02705                sizeof (lck_name) - (1 + sizeof ("._ACE_EVTLCK_")));
02706             ACE_OS::strcat (lck_name, "._ACE_EVTLCK_");
02707             result = ACE_OS::sema_init (&event->lock_,
02708                                         0,
02709                                         type,
02710                                         lck_name,
02711                                         arg);
02712             if (result == 0)
02713               result = ACE_OS::sema_post (&event->lock_); /* Initially unlock */
02714           }
02715 # endif
02716           return result;
02717         }
02718       else
02719         {
02720           int result = 0;
02721 
02722           event->name_ = 0;
02723           event->eventdata_ = evtdata;
02724 #if (!defined (ACE_HAS_PTHREADS) || !defined (_POSIX_THREAD_PROCESS_SHARED) || defined (ACE_LACKS_CONDATTR_PSHARED)) && \
02725   (defined (ACE_USES_FIFO_SEM) || \
02726     (defined (ACE_HAS_POSIX_SEM) && defined (ACE_HAS_POSIX_SEM_TIMEOUT) && !defined (ACE_LACKS_NAMED_POSIX_SEM)))
02727           char   sem_name[128];
02728           ACE_OS::strncpy (sem_name,
02729                            name,
02730                            sizeof (sem_name) - (1 + sizeof ("._ACE_EVTSEM_")));
02731           ACE_OS::strcat (sem_name, "._ACE_EVTSEM_");
02732           result = ACE_OS::sema_init(&event->semaphore_,
02733                                      0,
02734                                      type,
02735                                      sem_name,
02736                                      arg);
02737 # endif
02738 
02739 # if (!defined (ACE_HAS_PTHREADS) || !defined (_POSIX_THREAD_PROCESS_SHARED) || \
02740         (defined (ACE_LACKS_MUTEXATTR_PSHARED) && defined (ACE_LACKS_CONDATTR_PSHARED))) && \
02741      (defined (ACE_USES_FIFO_SEM) || \
02742         (defined (ACE_HAS_POSIX_SEM) && defined (ACE_HAS_POSIX_TIMEOUT) && defined (ACE_LACKS_NAMED_POSIX_SEM)))
02743           if (result == 0)
02744             {
02745               char   lck_name[128];
02746               ACE_OS::strncpy
02747                 (lck_name,
02748                  name,
02749                  sizeof (lck_name) - (1 + sizeof ("._ACE_EVTLCK_")));
02750               ACE_OS::strcat (lck_name, "._ACE_EVTLCK_");
02751               result = ACE_OS::sema_init (&event->lock_,
02752                                           0,
02753                                           type,
02754                                           lck_name,
02755                                           arg);
02756             }
02757 # endif
02758           return result;
02759         }
02760 
02761       return 0;
02762     }
02763   else
02764     {
02765       ACE_NEW_RETURN (evtdata, ACE_eventdata_t, -1);
02766       event->name_ = 0;
02767       event->eventdata_ = evtdata;
02768       event->eventdata_->type_ = type;
02769       event->eventdata_->manual_reset_ = manual_reset;
02770       event->eventdata_->is_signaled_ = initial_state;
02771       event->eventdata_->auto_event_signaled_ = false;
02772       event->eventdata_->waiting_threads_ = 0;
02773       event->eventdata_->signal_count_ = 0;
02774 
02775 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED)) || \
02776     (!defined (ACE_USES_FIFO_SEM) && \
02777       (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_SEM_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
02778       int result = ACE_OS::cond_init (&event->eventdata_->condition_,
02779                                       static_cast<short> (type),
02780                                       name,
02781                                       arg);
02782 # else
02783       int result = ACE_OS::sema_init (&event->semaphore_,
02784                                       0,
02785                                       type,
02786                                       name,
02787                                       arg);
02788 # endif
02789       if (result == 0)
02790 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
02791         (!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
02792      (!defined (ACE_USES_FIFO_SEM) && \
02793         (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
02794         result = ACE_OS::mutex_init (&event->eventdata_->lock_,
02795                                      type,
02796                                      name,
02797                                      (ACE_mutexattr_t *) arg);
02798 # else
02799       result = ACE_OS::sema_init (&event->lock_,
02800                                   0,
02801                                   type,
02802                                   name,
02803                                   arg);
02804       if (result == 0)
02805         result = ACE_OS::sema_post(&event->lock_);    /* initially unlock */
02806 # endif
02807 
02808       return result;
02809     }
02810 #else
02811   ACE_UNUSED_ARG (event);
02812   ACE_UNUSED_ARG (manual_reset);
02813   ACE_UNUSED_ARG (initial_state);
02814   ACE_UNUSED_ARG (type);
02815   ACE_UNUSED_ARG (name);
02816   ACE_UNUSED_ARG (arg);
02817   ACE_UNUSED_ARG (sa);
02818   ACE_NOTSUP_RETURN (-1);
02819 #endif /* ACE_WIN32 */
02820 }

int ACE_OS::event_pulse ACE_event_t *  event  ) 
 

Definition at line 2823 of file OS_NS_Thread.cpp.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, cond_broadcast(), cond_signal(), mutex_lock(), mutex_unlock(), sema_post(), sema_wait(), and thr_yield().

Referenced by ACE_Event::pulse().

02824 {
02825 #if defined (ACE_WIN32)
02826   ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::PulseEvent (*event), ace_result_), int, -1);
02827 #elif defined (ACE_HAS_THREADS)
02828   int result = 0;
02829   int error = 0;
02830 
02831   // grab the lock first
02832 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
02833         (!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
02834      (!defined (ACE_USES_FIFO_SEM) && \
02835         (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
02836   if (ACE_OS::mutex_lock (&event->eventdata_->lock_) == 0)
02837 # else
02838   if (ACE_OS::sema_wait (&event->lock_) == 0)
02839 # endif
02840   {
02841     if (event->eventdata_->waiting_threads_ > 0)
02842     {
02843       // Manual-reset event.
02844       if (event->eventdata_->manual_reset_ == 1)
02845       {
02846         // Wakeup all waiters.
02847 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED)) || \
02848     (!defined (ACE_USES_FIFO_SEM) && \
02849       (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_SEM_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
02850         if (ACE_OS::cond_broadcast (&event->eventdata_->condition_) != 0)
02851         {
02852           result = -1;
02853           error = errno;
02854         }
02855         if (result == 0)
02856           event->eventdata_->signal_count_ = event->eventdata_->waiting_threads_;
02857 # else
02858         event->eventdata_->signal_count_ = event->eventdata_->waiting_threads_;
02859         for (unsigned long i=0; i<event->eventdata_->signal_count_ ;++i)
02860           if (ACE_OS::sema_post(&event->semaphore_) != 0)
02861           {
02862             event->eventdata_->signal_count_ = 0;
02863             result = -1;
02864             error = errno;
02865           }
02866 
02867         if (result == 0)
02868           while(event->eventdata_->signal_count_!=0 && event->eventdata_->waiting_threads_!=0)
02869             ACE_OS::thr_yield ();
02870 # endif
02871       }
02872       // Auto-reset event: wakeup one waiter.
02873       else
02874       {
02875 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED)) || \
02876     (!defined (ACE_USES_FIFO_SEM) && \
02877       (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_SEM_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
02878         if (ACE_OS::cond_signal (&event->eventdata_->condition_) != 0)
02879 # else
02880         if (ACE_OS::sema_post(&event->semaphore_) != 0)
02881 # endif
02882         {
02883           result = -1;
02884           error = errno;
02885         }
02886 
02887         event->eventdata_->auto_event_signaled_ = true;
02888       }
02889     }
02890 
02891     // Reset event.
02892     event->eventdata_->is_signaled_ = 0;
02893 
02894     // Now we can let go of the lock.
02895 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
02896         (!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
02897      (!defined (ACE_USES_FIFO_SEM) && \
02898         (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
02899     ACE_OS::mutex_unlock (&event->eventdata_->lock_);
02900 # else
02901     ACE_OS::sema_post (&event->lock_);
02902 # endif
02903     if (result == -1)
02904       // Reset errno in case mutex_unlock() also fails...
02905       errno = error;
02906   }
02907   else
02908     result = -1;
02909   return result;
02910 #else
02911   ACE_UNUSED_ARG (event);
02912   ACE_NOTSUP_RETURN (-1);
02913 #endif /* ACE_WIN32 */
02914 }

int ACE_OS::event_reset ACE_event_t *  event  ) 
 

Definition at line 2917 of file OS_NS_Thread.cpp.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, mutex_lock(), mutex_unlock(), sema_post(), and sema_wait().

Referenced by ACE_Event::reset(), sema_trywait(), and sema_wait().

02918 {
02919 #if defined (ACE_WIN32)
02920   ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::ResetEvent (*event), ace_result_), int, -1);
02921 #elif defined (ACE_HAS_THREADS)
02922   int result = 0;
02923 
02924   // Grab the lock first.
02925 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
02926         (!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
02927      (!defined (ACE_USES_FIFO_SEM) && \
02928         (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
02929   if (ACE_OS::mutex_lock (&event->eventdata_->lock_) == 0)
02930 # else
02931   if (ACE_OS::sema_wait (&event->lock_) == 0)
02932 # endif
02933   {
02934     // Reset event.
02935     event->eventdata_->is_signaled_ = 0;
02936     event->eventdata_->auto_event_signaled_ = false;
02937 
02938     // Now we can let go of the lock.
02939 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
02940         (!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
02941      (!defined (ACE_USES_FIFO_SEM) && \
02942         (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
02943     ACE_OS::mutex_unlock (&event->eventdata_->lock_);
02944 # else
02945     ACE_OS::sema_post (&event->lock_);
02946 # endif
02947   }
02948   else
02949     result = -1;
02950   return result;
02951 #else
02952   ACE_UNUSED_ARG (event);
02953   ACE_NOTSUP_RETURN (-1);
02954 #endif /* ACE_WIN32 */
02955 }

int ACE_OS::event_signal ACE_event_t *  event  ) 
 

Definition at line 2958 of file OS_NS_Thread.cpp.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, cond_broadcast(), cond_signal(), mutex_lock(), mutex_unlock(), sema_post(), and sema_wait().

Referenced by ACE_WIN32_Proactor::post_completion(), sema_post(), and ACE_Event::signal().

02959 {
02960 #if defined (ACE_WIN32)
02961   ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::SetEvent (*event), ace_result_), int, -1);
02962 #elif defined (ACE_HAS_THREADS)
02963   int result = 0;
02964   int error = 0;
02965 
02966   // grab the lock first
02967 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
02968         (!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
02969      (!defined (ACE_USES_FIFO_SEM) && \
02970         (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
02971   if (ACE_OS::mutex_lock (&event->eventdata_->lock_) == 0)
02972 # else
02973   if (ACE_OS::sema_wait (&event->lock_) == 0)
02974 # endif
02975   {
02976     // Manual-reset event.
02977     if (event->eventdata_->manual_reset_ == 1)
02978     {
02979       // wakeup all
02980 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED)) || \
02981     (!defined (ACE_USES_FIFO_SEM) && \
02982       (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_SEM_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
02983       if (ACE_OS::cond_broadcast (&event->eventdata_->condition_) != 0)
02984       {
02985         result = -1;
02986         error = errno;
02987       }
02988 # else
02989       if (ACE_OS::sema_post(&event->semaphore_) != 0)
02990       {
02991         result = -1;
02992         error = errno;
02993       }
02994 # endif
02995 
02996       if (result == 0)
02997         // signal event
02998         event->eventdata_->is_signaled_ = 1;
02999     }
03000     // Auto-reset event
03001     else
03002     {
03003       if (event->eventdata_->waiting_threads_ == 0)
03004         // No waiters: signal event.
03005         event->eventdata_->is_signaled_ = 1;
03006       // Waiters: wakeup one waiter.
03007 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED)) || \
03008     (!defined (ACE_USES_FIFO_SEM) && \
03009       (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_SEM_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
03010       else if (ACE_OS::cond_signal (&event->eventdata_->condition_) != 0)
03011 # else
03012       else if (ACE_OS::sema_post(&event->semaphore_) != 0)
03013 # endif
03014       {
03015         result = -1;
03016         error = errno;
03017       }
03018 
03019       event->eventdata_->auto_event_signaled_ = true;
03020     }
03021 
03022     // Now we can let go of the lock.
03023 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
03024         (!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
03025      (!defined (ACE_USES_FIFO_SEM) && \
03026         (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
03027     ACE_OS::mutex_unlock (&event->eventdata_->lock_);
03028 # else
03029     ACE_OS::sema_post (&event->lock_);
03030 # endif
03031 
03032     if (result == -1)
03033       // Reset errno in case mutex_unlock() also fails...
03034       errno = error;
03035   }
03036   else
03037     result = -1;
03038 
03039   return result;
03040 #else
03041   ACE_UNUSED_ARG (event);
03042   ACE_NOTSUP_RETURN (-1);
03043 #endif /* ACE_WIN32 */
03044 }

int ACE_OS::event_timedwait ACE_event_t *  event,
ACE_Time_Value timeout,
int  use_absolute_time = 1
 

Definition at line 3047 of file OS_NS_Thread.cpp.

References ACE_NOTSUP_RETURN, cond_timedwait(), ETIME, ETIMEDOUT, gettimeofday(), ACE_Time_Value::msec(), mutex_lock(), mutex_unlock(), ACE_Time_Value::sec(), sema_post(), sema_wait(), set_errno_to_last_error(), and ACE_Time_Value::usec().

Referenced by ACE_Event::wait().

03050 {
03051 #if defined (ACE_WIN32)
03052   DWORD result;
03053 
03054   if (timeout == 0)
03055     // Wait forever
03056     result = ::WaitForSingleObject (*event, INFINITE);
03057   else if (timeout->sec () == 0 && timeout->usec () == 0)
03058     // Do a "poll".
03059     result = ::WaitForSingleObject (*event, 0);
03060   else
03061   {
03062       // Wait for upto <relative_time> number of milliseconds.  Note
03063       // that we must convert between absolute time (which is passed
03064       // as a parameter) and relative time (which is what
03065       // WaitForSingleObjects() expects).
03066       // <timeout> parameter is given in absolute or relative value
03067       // depending on parameter <use_absolute_time>.
03068     int msec_timeout;
03069     if (use_absolute_time)
03070     {
03071           // Time is given in absolute time, we should use
03072           // gettimeofday() to calculate relative time
03073       ACE_Time_Value relative_time (*timeout - ACE_OS::gettimeofday ());
03074 
03075           // Watchout for situations where a context switch has caused
03076           // the current time to be > the timeout.  Thanks to Norbert
03077           // Rapp <NRapp@nexus-informatics.de> for pointing this.
03078       if (relative_time < ACE_Time_Value::zero)
03079         msec_timeout = 0;
03080       else
03081         msec_timeout = relative_time.msec ();
03082     }
03083     else
03084          // time is given in relative time, just convert it into
03085          // milliseconds and use it
03086       msec_timeout = timeout->msec ();
03087     result = ::WaitForSingleObject (*event, msec_timeout);
03088   }
03089 
03090   switch (result)
03091   {
03092     case WAIT_OBJECT_0:
03093       return 0;
03094     case WAIT_TIMEOUT:
03095       errno = ETIME;
03096       return -1;
03097     default:
03098       // This is a hack, we need to find an appropriate mapping...
03099       ACE_OS::set_errno_to_last_error ();
03100       return -1;
03101   }
03102 #elif defined (ACE_HAS_THREADS)
03103   int result = 0;
03104   int error = 0;
03105 
03106   // grab the lock first
03107 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
03108         (!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
03109      (!defined (ACE_USES_FIFO_SEM) && \
03110         (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
03111   if (ACE_OS::mutex_lock (&event->eventdata_->lock_) == 0)
03112 # else
03113   if (ACE_OS::sema_wait (&event->lock_) == 0)
03114 # endif
03115   {
03116     if (event->eventdata_->is_signaled_ == 1)
03117     // event is currently signaled
03118     {
03119       if (event->eventdata_->manual_reset_ == 0)
03120       {
03121         // AUTO: reset state
03122         event->eventdata_->is_signaled_ = 0;
03123         event->eventdata_->auto_event_signaled_ = false;
03124       }
03125     }
03126     else
03127     // event is currently not signaled
03128     {
03129       event->eventdata_->waiting_threads_++;
03130 
03131       ACE_Time_Value absolute_timeout = *timeout;
03132 
03133       // cond_timewait() expects absolute time, check
03134       // <use_absolute_time> flag.
03135       if (use_absolute_time == 0)
03136         absolute_timeout += ACE_OS::gettimeofday ();
03137 
03138       while (event->eventdata_->is_signaled_ == 0 &&
03139              event->eventdata_->auto_event_signaled_ == false)
03140       {
03141 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED)) || \
03142     (!defined (ACE_USES_FIFO_SEM) && \
03143       (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_SEM_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
03144         if (ACE_OS::cond_timedwait (&event->eventdata_->condition_,
03145                                     &event->eventdata_->lock_,
03146                                     &absolute_timeout) != 0)
03147         {
03148           result = -1;
03149           error = errno;
03150           break;
03151         }
03152 
03153         if (event->eventdata_->signal_count_ > 0)
03154         {
03155           event->eventdata_->signal_count_--;
03156           break;
03157         }
03158 # else
03159 #   if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_MUTEXATTR_PSHARED)) || \
03160       (!defined (ACE_USES_FIFO_SEM) && (!defined (ACE_HAS_POSIX_SEM) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
03161         if (ACE_OS::mutex_unlock (&event->eventdata_->lock_) != 0)
03162 #   else
03163         if (ACE_OS::sema_post (&event->lock_) != 0)
03164 #   endif
03165         {
03166           event->eventdata_->waiting_threads_--;
03167           return -1;
03168         }
03169 
03170         if (ACE_OS::sema_wait(&event->semaphore_, absolute_timeout) !=0)
03171         {
03172           result = -1;
03173           if (errno == ETIMEDOUT) // Semaphores time out with ETIMEDOUT (POSIX)
03174             error = ETIME;
03175           else
03176             error = errno;
03177         }
03178 
03179         bool signalled = false;
03180         if (result == 0 && event->eventdata_->signal_count_ > 0)
03181         {
03182           event->eventdata_->signal_count_--;
03183           signalled = true;
03184         }
03185 
03186 #   if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_MUTEXATTR_PSHARED)) || \
03187       (!defined (ACE_USES_FIFO_SEM) && (!defined (ACE_HAS_POSIX_SEM) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
03188         if (ACE_OS::mutex_lock (&event->eventdata_->lock_) != 0)
03189 #   else
03190         if (ACE_OS::sema_wait (&event->lock_) != 0)
03191 #   endif
03192         {
03193           event->eventdata_->waiting_threads_--;  // yes, I know it's not save
03194           return -1;
03195         }
03196 
03197         if (result)
03198           break;
03199 
03200         if (event->eventdata_->manual_reset_ == 1 && event->eventdata_->is_signaled_ == 1)
03201           if (ACE_OS::sema_post(&event->semaphore_) != 0)
03202           {
03203             result = -1;
03204             error = errno;
03205             break;
03206           }
03207 
03208         if (signalled)
03209           break;
03210 # endif
03211       }
03212 
03213       // Reset the auto_event_signaled_ to false now that we have
03214       // woken up.
03215       if (event->eventdata_->auto_event_signaled_ == true)
03216         event->eventdata_->auto_event_signaled_ = false;
03217 
03218       event->eventdata_->waiting_threads_--;
03219     }
03220 
03221     // Now we can let go of the lock.
03222 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
03223         (!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
03224      (!defined (ACE_USES_FIFO_SEM) && \
03225         (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
03226     ACE_OS::mutex_unlock (&event->eventdata_->lock_);
03227 # else
03228     ACE_OS::sema_post (&event->lock_);
03229 # endif
03230 
03231     if (result == -1)
03232       // Reset errno in case mutex_unlock() also fails...
03233       errno = error;
03234   }
03235   else
03236     result = -1;
03237   return result;
03238 #else
03239   ACE_UNUSED_ARG (event);
03240   ACE_UNUSED_ARG (timeout);
03241   ACE_UNUSED_ARG (use_absolute_time);
03242   ACE_NOTSUP_RETURN (-1);
03243 #endif /* ACE_WIN32 */
03244 }

int ACE_OS::event_wait ACE_event_t *  event  ) 
 

Definition at line 3247 of file OS_NS_Thread.cpp.

References ACE_NOTSUP_RETURN, cond_wait(), mutex_lock(), mutex_unlock(), sema_post(), sema_wait(), and set_errno_to_last_error().

Referenced by ACE_Event::wait().

03248 {
03249 #if defined (ACE_WIN32)
03250   switch (::WaitForSingleObject (*event, INFINITE))
03251 {
03252   case WAIT_OBJECT_0:
03253     return 0;
03254   default:
03255     ACE_OS::set_errno_to_last_error ();
03256     return -1;
03257 }
03258 #elif defined (ACE_HAS_THREADS)
03259   int result = 0;
03260   int error = 0;
03261 
03262   // grab the lock first
03263 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
03264         (!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
03265      (!defined (ACE_USES_FIFO_SEM) && \
03266         (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
03267   if (ACE_OS::mutex_lock (&event->eventdata_->lock_) == 0)
03268 # else
03269   if (ACE_OS::sema_wait (&event->lock_) == 0)
03270 # endif
03271   {
03272     if (event->eventdata_->is_signaled_ == 1)
03273     // Event is currently signaled.
03274     {
03275       if (event->eventdata_->manual_reset_ == 0)
03276         // AUTO: reset state
03277         event->eventdata_->is_signaled_ = 0;
03278     }
03279     else // event is currently not signaled
03280     {
03281       event->eventdata_->waiting_threads_++;
03282 
03283       while (event->eventdata_->is_signaled_ == 0 &&
03284              event->eventdata_->auto_event_signaled_ == false)
03285       {
03286 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED)) || \
03287     (!defined (ACE_USES_FIFO_SEM) && \
03288       (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_SEM_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
03289         if (ACE_OS::cond_wait (&event->eventdata_->condition_,
03290                                &event->eventdata_->lock_) != 0)
03291         {
03292           result = -1;
03293           error = errno;
03294           // Something went wrong...
03295           break;
03296         }
03297         if (event->eventdata_->signal_count_ > 0)
03298         {
03299           event->eventdata_->signal_count_--;
03300           break;
03301         }
03302 # else
03303 #   if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_MUTEXATTR_PSHARED)) || \
03304       (!defined (ACE_USES_FIFO_SEM) && (!defined (ACE_HAS_POSIX_SEM) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
03305         if (ACE_OS::mutex_unlock (&event->eventdata_->lock_) != 0)
03306 #   else
03307         if (ACE_OS::sema_post (&event->lock_) != 0)
03308 #   endif
03309         {
03310           event->eventdata_->waiting_threads_--;
03311           return -1;
03312         }
03313 
03314         if (ACE_OS::sema_wait(&event->semaphore_) !=0)
03315         {
03316           result = -1;
03317           error = errno;
03318         }
03319 
03320         bool signalled = false;
03321         if (result == 0 && event->eventdata_->signal_count_ > 0)
03322         {
03323           event->eventdata_->signal_count_--;
03324           signalled = true;
03325         }
03326 
03327 #   if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_MUTEXATTR_PSHARED)) || \
03328       (!defined (ACE_USES_FIFO_SEM) && (!defined (ACE_HAS_POSIX_SEM) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
03329         if (ACE_OS::mutex_lock (&event->eventdata_->lock_) != 0)
03330 #   else
03331         if (ACE_OS::sema_wait (&event->lock_) != 0)
03332 #   endif
03333         {
03334           event->eventdata_->waiting_threads_--;
03335           return -1;
03336         }
03337 
03338         if (result)
03339           break;
03340 
03341         if (event->eventdata_->manual_reset_ == 1 && event->eventdata_->is_signaled_ == 1)
03342           if (ACE_OS::sema_post(&event->semaphore_) != 0)
03343           {
03344             result = -1;
03345             error = errno;
03346             break;
03347           }
03348 
03349         if (signalled)
03350           break;
03351 # endif
03352     }
03353 
03354     // Reset it since we have woken up.
03355     if (event->eventdata_->auto_event_signaled_ == true)
03356       event->eventdata_->auto_event_signaled_ = false;
03357 
03358     event->eventdata_->waiting_threads_--;
03359   }
03360 
03361   // Now we can let go of the lock.
03362 # if (defined (ACE_HAS_PTHREADS) && defined (_POSIX_THREAD_PROCESS_SHARED) && \
03363         (!defined (ACE_LACKS_MUTEXATTR_PSHARED) || !defined (ACE_LACKS_CONDATTR_PSHARED))) || \
03364      (!defined (ACE_USES_FIFO_SEM) && \
03365         (!defined (ACE_HAS_POSIX_SEM) || !defined (ACE_HAS_POSIX_TIMEOUT) || defined (ACE_LACKS_NAMED_POSIX_SEM)))
03366     ACE_OS::mutex_unlock (&event->eventdata_->lock_);
03367 # else
03368     ACE_OS::sema_post (&event->lock_);
03369 # endif
03370 
03371   if (result == -1)
03372     // Reset errno in case mutex_unlock() also fails...
03373     errno = error;
03374 }
03375   else
03376     result = -1;
03377   return result;
03378 #else
03379   ACE_UNUSED_ARG (event);
03380   ACE_NOTSUP_RETURN (-1);
03381 #endif /* ACE_WIN32 */
03382 }

int ACE_OS::execl const char *  path,
const char *  arg0,
... 
 

Definition at line 138 of file OS_NS_unistd.cpp.

References ACE_NOTSUP_RETURN, and ACE_OS_TRACE.

00139 {
00140   ACE_OS_TRACE ("ACE_OS::execl");
00141   ACE_NOTSUP_RETURN (-1);
00142   // Need to write this code.
00143   // ACE_OSCALL_RETURN (::execv (path, argv), int, -1);
00144 }

int ACE_OS::execle const char *  path,
const char *  arg0,
... 
 

Definition at line 147 of file OS_NS_unistd.cpp.

References ACE_NOTSUP_RETURN, and ACE_OS_TRACE.

00148 {
00149   ACE_OS_TRACE ("ACE_OS::execle");
00150   ACE_NOTSUP_RETURN (-1);
00151   // Need to write this code.
00152   //  ACE_OSCALL_RETURN (::execve (path, argv, envp), int, -1);
00153 }

int ACE_OS::execlp const char *  file,
const char *  arg0,
... 
 

Definition at line 156 of file OS_NS_unistd.cpp.

References ACE_NOTSUP_RETURN, and ACE_OS_TRACE.

00157 {
00158   ACE_OS_TRACE ("ACE_OS::execlp");
00159   ACE_NOTSUP_RETURN (-1);
00160   // Need to write this code.
00161   //  ACE_OSCALL_RETURN (::execvp (file, argv), int, -1);
00162 }

ACE_INLINE int ACE_OS::execv const char *  path,
char *const  argv[]
 

Definition at line 243 of file OS_NS_unistd.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and execv().

Referenced by execv(), and fork_exec().

00245 {
00246   ACE_OS_TRACE ("ACE_OS::execv");
00247 #if defined (ACE_LACKS_EXEC)
00248   ACE_UNUSED_ARG (path);
00249   ACE_UNUSED_ARG (argv);
00250 
00251   ACE_NOTSUP_RETURN (-1);
00252 #elif defined (ACE_WIN32)
00253 # if defined (__BORLANDC__) /* VSB */
00254   return ::execv (path, argv);
00255 # elif defined (__MINGW32__)
00256   return ::_execv (path, (char *const *) argv);
00257 # else
00258   // Why this odd-looking code? If execv() returns at all, it's an error.
00259   // Windows defines this as returning an intptr_t rather than a simple int,
00260   // and the conversion triggers compile warnings. So just return -1 if
00261   // the call returns.
00262   ::_execv (path, (const char *const *) argv);
00263   return -1;
00264 # endif /* __BORLANDC__ */
00265 #else
00266   ACE_OSCALL_RETURN (::execv (path, argv), int, -1);
00267 #endif /* ACE_LACKS_EXEC */
00268 }

ACE_INLINE int ACE_OS::execve const char *  path,
char *const  argv[],
char *const  envp[]
 

Definition at line 271 of file OS_NS_unistd.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and execve().

Referenced by execve(), and ACE_Process::spawn().

00274 {
00275   ACE_OS_TRACE ("ACE_OS::execve");
00276 #if defined (ACE_LACKS_EXEC)
00277   ACE_UNUSED_ARG (path);
00278   ACE_UNUSED_ARG (argv);
00279   ACE_UNUSED_ARG (envp);
00280 
00281   ACE_NOTSUP_RETURN (-1);
00282 #elif defined (ACE_WIN32)
00283 # if defined (__BORLANDC__) /* VSB */
00284   return ::execve (path, argv, envp);
00285 # elif defined (__MINGW32__)
00286   return ::_execve (path, (char *const *) argv, (char *const *) envp);
00287 # else
00288   // Why this odd-looking code? If execv() returns at all, it's an error.
00289   // Windows defines this as returning an intptr_t rather than a simple int,
00290   // and the conversion triggers compile warnings. So just return -1 if
00291   // the call returns.
00292   ::_execve (path, (const char *const *) argv, (const char *const *) envp);
00293   return -1;
00294 # endif /* __BORLANDC__ */
00295 #else
00296   ACE_OSCALL_RETURN (::execve (path, argv, envp), int, -1);
00297 #endif /* ACE_LACKS_EXEC */
00298 }

ACE_INLINE int ACE_OS::execvp const char *  file,
char *const  argv[]
 

Definition at line 301 of file OS_NS_unistd.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and execvp().

Referenced by execvp(), and ACE_Process::spawn().

00303 {
00304   ACE_OS_TRACE ("ACE_OS::execvp");
00305 #if defined (ACE_LACKS_EXEC)
00306   ACE_UNUSED_ARG (file);
00307   ACE_UNUSED_ARG (argv);
00308 
00309   ACE_NOTSUP_RETURN (-1);
00310 #elif defined (ACE_WIN32)
00311 # if defined (__BORLANDC__) /* VSB */
00312   return ::execvp (file, argv);
00313 # elif defined (__MINGW32__)
00314   return ::_execvp (file, (char *const *) argv);
00315 # else
00316   // Why this odd-looking code? If execv() returns at all, it's an error.
00317   // Windows defines this as returning an intptr_t rather than a simple int,
00318   // and the conversion triggers compile warnings. So just return -1 if
00319   // the call returns.
00320   ::_execvp (file, (const char *const *) argv);
00321   return -1;
00322 # endif /* __BORLANDC__ */
00323 #else
00324   ACE_OSCALL_RETURN (::execvp (file, argv), int, -1);
00325 #endif /* ACE_LACKS_EXEC */
00326 }

void ACE_OS::exit int  status = 0  ) 
 

Definition at line 50 of file OS_NS_stdlib.cpp.

References ACE_OS_TRACE, and exit_hook_.

Referenced by abort(), ACE::daemonize(), fork_exec(), ACE_Svc_Conf_Lexer::input(), and ACE_Process::spawn().

00051 {
00052   ACE_OS_TRACE ("ACE_OS::exit");
00053 
00054 #if defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) && !defined (ACE_HAS_WINCE) && !defined (ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER)
00055   // Shut down the ACE_Object_Manager, if it had registered its exit_hook.
00056   // With ACE_HAS_NONSTATIC_OBJECT_MANAGER, the ACE_Object_Manager is
00057   // instantiated on the main's stack.  ::exit () doesn't destroy it.
00058   if (exit_hook_)
00059     (*exit_hook_) ();
00060 #endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER && !ACE_HAS_WINCE && !ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER */
00061 
00062 #if !defined (ACE_HAS_WINCE)
00063 # if defined (ACE_WIN32)
00064   ::ExitProcess ((UINT) status);
00065 # else
00066   ::exit (status);
00067 # endif /* ACE_WIN32 */
00068 #else
00069   // @@ This is not exactly the same as ExitProcess.  But this is the
00070   // closest one I can get.
00071   ::TerminateProcess (::GetCurrentProcess (), status);
00072 #endif /* ACE_HAS_WINCE */
00073 }

ACE_INLINE int ACE_OS::fattach int  handle,
const char *  path
 

Definition at line 81 of file OS_NS_stropts.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and fattach().

Referenced by fattach().

00082 {
00083   ACE_OS_TRACE ("ACE_OS::fattach");
00084 #if defined (ACE_HAS_STREAM_PIPES)
00085   ACE_OSCALL_RETURN (::fattach (handle, path), int, -1);
00086 #else
00087   ACE_UNUSED_ARG (handle);
00088   ACE_UNUSED_ARG (path);
00089 
00090   ACE_NOTSUP_RETURN (-1);
00091 #endif /* ACE_HAS_STREAM_PIPES */
00092 }

ACE_INLINE int ACE_OS::fclose FILE *  fp  ) 
 

Definition at line 509 of file OS_NS_stdio.inl.

References ACE_OS_TRACE.

Referenced by access(), ACE::count_interfaces(), ACE_Ini_ImpExp::export_config(), ACE_Registry_ImpExp::export_config(), ACE::get_ip_interfaces(), ACE_Capabilities::getent(), ACE_Logging_Strategy::handle_timeout(), ACE_Ini_ImpExp::import_config(), ACE_Registry_ImpExp::import_config(), ACE_Logging_Strategy::init(), ACE_Log_Msg::msg_ostream(), ACE_Service_Config::open_i(), ACE_Service_Gestalt::process_file(), ACE_Log_Msg::~ACE_Log_Msg(), and ACE_Read_Buffer::~ACE_Read_Buffer().

00510 {
00511   ACE_OS_TRACE ("ACE_OS::fclose");
00512   ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fclose (fp), int, -1);
00513 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_OS::fcntl ACE_HANDLE  handle,
int  cmd,
long  arg = 0
 

Definition at line 10 of file OS_NS_fcntl.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and fcntl().

Referenced by ACE::clr_flags(), ACE_IPC_SAP::disable(), ACE_IO_SAP::disable(), ACE_IPC_SAP::enable(), ACE_IO_SAP::enable(), fcntl(), ACE::get_flags(), ACE_Select_Reactor_Notify::open(), ACE_Dev_Poll_Reactor_Notify::open(), sema_init(), sema_trywait(), and ACE::set_flags().

00011 {
00012   ACE_OS_TRACE ("ACE_OS::fcntl");
00013 # if defined (ACE_LACKS_FCNTL)
00014   ACE_UNUSED_ARG (handle);
00015   ACE_UNUSED_ARG (cmd);
00016   ACE_UNUSED_ARG (arg);
00017   ACE_NOTSUP_RETURN (-1);
00018 # else
00019   ACE_OSCALL_RETURN (::fcntl (handle, cmd, arg), int, -1);
00020 # endif /* ACE_LACKS_FCNTL */
00021 }

ACE_INLINE int ACE_OS::fdetach const char *  file  ) 
 

Definition at line 95 of file OS_NS_stropts.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and fdetach().

Referenced by ACE_SPIPE_Acceptor::close(), and fdetach().

00096 {
00097   ACE_OS_TRACE ("ACE_OS::fdetach");
00098 #if defined (ACE_HAS_STREAM_PIPES)
00099   ACE_OSCALL_RETURN (::fdetach (file), int, -1);
00100 #else
00101   ACE_UNUSED_ARG (file);
00102 
00103   ACE_NOTSUP_RETURN (-1);
00104 #endif /* ACE_HAS_STREAM_PIPES */
00105 }

ACE_INLINE FILE * ACE_OS::fdopen ACE_HANDLE  handle,
const ACE_TCHAR mode
 

Definition at line 516 of file OS_NS_stdio.inl.

References ACE_OS_TRACE, ACE_TCHAR, ACE_TEXT_ALWAYS_CHAR, and ACE_TEXT_ALWAYS_WCHAR.

00517 {
00518   ACE_OS_TRACE ("ACE_OS::fdopen");
00519 # if defined (ACE_HAS_WINCE)
00520   ACE_OSCALL_RETURN (::_wfdopen (handle, ACE_TEXT_ALWAYS_WCHAR (mode)),
00521                      FILE*,
00522                      0);
00523 # elif defined (ACE_WIN32)
00524   // kernel file handle -> FILE* conversion...
00525   // Options: _O_APPEND, _O_RDONLY and _O_TEXT are lost
00526 
00527   FILE *file = 0;
00528 
00529 #if defined (ACE_LACKS_INTPTR_T)
00530   int crt_handle = ::_open_osfhandle (long (handle), 0);
00531 #else
00532   int crt_handle = ::_open_osfhandle (intptr_t (handle), 0);
00533 #endif
00534 
00535   if (crt_handle != -1)
00536     {
00537 #   if defined(ACE_HAS_NONCONST_FDOPEN) && !defined (ACE_USES_WCHAR)
00538       file = ::_fdopen (crt_handle, const_cast<ACE_TCHAR *> (mode));
00539 #   elif defined (ACE_HAS_NONCONST_FDOPEN) && defined (ACE_USES_WCHAR)
00540       file = ::_wfdopen (crt_handle, const_cast<ACE_TCHAR *> (mode));
00541 #   elif defined (ACE_USES_WCHAR)
00542       file = ::_wfdopen (crt_handle, mode);
00543 #   else
00544       file = ::_fdopen (crt_handle, mode);
00545 #   endif /* __BORLANDC__ */
00546 
00547       if (!file)
00548         {
00549 #   if (defined(__BORLANDC__) && __BORLANDC__ >= 0x0530)
00550           ::_rtl_close (crt_handle);
00551 #   else
00552           ::_close (crt_handle);
00553 #   endif /* (defined(__BORLANDC__) && __BORLANDC__ >= 0x0530) */
00554         }
00555     }
00556 
00557   return file;
00558 # else
00559   ACE_OSCALL_RETURN
00560     (::fdopen (handle, ACE_TEXT_ALWAYS_CHAR (mode)), FILE *, 0);
00561 # endif /* ACE_HAS_WINCE */
00562 }

ACE_INLINE int ACE_OS::fflush FILE *  fp  ) 
 

Definition at line 565 of file OS_NS_stdio.inl.

References ACE_OS_TRACE.

Referenced by ACE_Log_Record::print().

00566 {
00567   ACE_OS_TRACE ("ACE_OS::fflush");
00568 #if defined (ACE_VXWORKS)
00569   if (fp == 0)
00570     {
00571       // Do not allow fflush(0) on VxWorks
00572       return 0;
00573     }
00574 #endif /* ACE_VXWORKS */
00575 
00576   ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fflush (fp), int, -1);
00577 }

ACE_INLINE int ACE_OS::fgetc FILE *  fp  ) 
 

Definition at line 580 of file OS_NS_stdio.inl.

00581 {
00582   ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgetc (fp), int, -1);
00583 }

ACE_INLINE int ACE_OS::fgetpos FILE *  fp,
fpos_t *  pos
 

Definition at line 586 of file OS_NS_stdio.inl.

00587 {
00588   ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgetpos (fp, pos), int, -1);
00589 }

ACE_INLINE wchar_t * ACE_OS::fgets wchar_t *  buf,
int  size,
FILE *  fp
 

Definition at line 600 of file OS_NS_stdio.inl.

References ACE_OS_TRACE.

00601 {
00602   ACE_OS_TRACE ("ACE_OS::fgets");
00603   ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgetws (buf, size, fp), wchar_t *, 0);
00604 }

ACE_INLINE char * ACE_OS::fgets char *  buf,
int  size,
FILE *  fp
 

Definition at line 592 of file OS_NS_stdio.inl.

References ACE_OS_TRACE.

Referenced by ACE_Ini_ImpExp::import_config(), and ACE_Registry_ImpExp::import_config().

00593 {
00594   ACE_OS_TRACE ("ACE_OS::fgets");
00595   ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgets (buf, size, fp), char *, 0);
00596 }

ACE_NAMESPACE_INLINE_FUNCTION wint_t fgetwc FILE *  fp  ) 
 

ACE_INLINE ACE_LOFF_T ACE_OS::filesize const ACE_TCHAR handle  ) 
 

Definition at line 107 of file OS_NS_sys_stat.inl.

References ACE_LOFF_T, ACE_OS_TRACE, ACE_TCHAR, close(), filesize(), and open().

00108   {
00109     ACE_OS_TRACE ("ACE_OS::filesize");
00110 
00111     ACE_HANDLE h = ACE_OS::open (filename, O_RDONLY);
00112     if (h != ACE_INVALID_HANDLE)
00113       {
00114         ACE_LOFF_T size = ACE_OS::filesize (h);
00115         ACE_OS::close (h);
00116         return size;
00117       }
00118     else
00119       return -1;
00120   }

ACE_INLINE ACE_LOFF_T ACE_OS::filesize ACE_HANDLE  handle  ) 
 

Definition at line 99 of file OS_NS_sys_stat.inl.

References ACE_OS_TRACE, ACE_stat, and fstat().

Referenced by ACE_POSIX_Asynch_Transmit_Handler::ACE_POSIX_Asynch_Transmit_Handler(), filesize(), ACE_MMAP_Memory_Pool::handle_signal(), ACE_Mem_Map::map_it(), mmap(), ACE_FILE_IO::recvv(), ACE_MMAP_Memory_Pool::remap(), ACE_POSIX_Asynch_Transmit_File::transmit_file(), and ACE_Mem_Map::unmap().

00100   {
00101     ACE_OS_TRACE ("ACE_OS::filesize");
00102     ACE_stat sb;
00103     return ACE_OS::fstat (handle, &sb) == -1 ? -1 : sb.st_size;
00104   }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE void ACE_OS::flock_adjust_params ace_flock_t *  lock,
short  whence,
off_t &  start,
off_t &  len
 

Definition at line 26 of file OS_NS_stdio.inl.

References ACE_OS::ace_flock_t::handle_, and ACE_OS::ace_flock_t::overlapped_.

Referenced by flock_rdlock(), flock_tryrdlock(), flock_trywrlock(), flock_unlock(), and flock_wrlock().

00030 {
00031   switch (whence)
00032     {
00033     case SEEK_SET:
00034       break;
00035     case SEEK_CUR:
00036       start += SetFilePointer (lock->handle_, 0, 0, FILE_CURRENT);
00037       break;
00038     case SEEK_END:
00039       start += ::GetFileSize (lock->handle_, 0);
00040       break;
00041     }
00042   lock->overlapped_.Offset = start;
00043   if (len == 0)
00044     len = ::GetFileSize (lock->handle_,
00045                          0) - start;
00046 }

ACE_INLINE int ACE_OS::flock_destroy ace_flock_t *  lock,
int  unlink_file = 1
 

Definition at line 115 of file OS_NS_stdio.inl.

References ACE_OS_TRACE, close(), flock_unlock(), free(), ACE_OS::ace_flock_t::handle_, ACE_OS::ace_flock_t::lockname_, and unlink().

Referenced by ACE_File_Lock::remove().

00117 {
00118   ACE_OS_TRACE ("ACE_OS::flock_destroy");
00119   if (lock->handle_ != ACE_INVALID_HANDLE)
00120     {
00121       ACE_OS::flock_unlock (lock);
00122       // Close the handle.
00123       ACE_OS::close (lock->handle_);
00124       lock->handle_ = ACE_INVALID_HANDLE;
00125       if (lock->lockname_ != 0)
00126         {
00127           if (unlink_file)
00128             ACE_OS::unlink (lock->lockname_);
00129           ACE_OS::free (
00130             static_cast<void *> (const_cast<ACE_TCHAR *> (lock->lockname_)));
00131         }
00132       lock->lockname_ = 0;
00133     }
00134   return 0;
00135 }

ACE_INLINE int ACE_OS::flock_init ace_flock_t *  lock,
int  flags = 0,
const ACE_TCHAR name = 0,
mode_t  perms = 0
 

Definition at line 50 of file OS_NS_stdio.inl.

References ACE_OS_TRACE, ACE_TCHAR, ACE_OS::ace_flock_t::handle_, ACE_OS::ace_flock_t::lockname_, mode_t, ACE_OS::ace_flock_t::overlapped_, and strdup().

Referenced by ACE_File_Lock::ACE_File_Lock(), and ACE_File_Lock::open().

00054 {
00055   ACE_OS_TRACE ("ACE_OS::flock_init");
00056 #if defined (ACE_WIN32)
00057   // Once initialized, these values are never changed.
00058   lock->overlapped_.Internal = 0;
00059   lock->overlapped_.InternalHigh = 0;
00060   lock->overlapped_.OffsetHigh = 0;
00061   lock->overlapped_.hEvent = 0;
00062 #endif /* ACE_WIN32 */
00063   lock->handle_ = ACE_INVALID_HANDLE;
00064   lock->lockname_ = 0;
00065 
00066   if (name != 0)
00067     {
00068       ACE_OSCALL (ACE_OS::open (name, flags, perms),
00069                   ACE_HANDLE,
00070                   ACE_INVALID_HANDLE,
00071                   lock->handle_);
00072       if (lock->handle_ != ACE_INVALID_HANDLE)
00073         lock->lockname_ = ACE_OS::strdup (name);
00074       return lock->handle_ == ACE_INVALID_HANDLE ? -1 : 0;
00075     }
00076   else
00077     return 0;
00078 }

ACE_INLINE int ACE_OS::flock_rdlock ace_flock_t *  lock,
short  whence = 0,
off_t  start = 0,
off_t  len = 0
 

Definition at line 138 of file OS_NS_stdio.inl.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, ACE_OS_TRACE, flock_adjust_params(), ACE_OS::ace_flock_t::handle_, and ACE_OS::ace_flock_t::overlapped_.

Referenced by ACE_File_Lock::acquire_read().

00142 {
00143   ACE_OS_TRACE ("ACE_OS::flock_rdlock");
00144 #if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
00145   ACE_OS::flock_adjust_params (lock, whence, start, len);
00146 #  if defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)
00147   ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::LockFileEx (lock->handle_,
00148                                                         0,
00149                                                         0,
00150                                                         len,
00151                                                         0,
00152                                                         &lock->overlapped_),
00153                                           ace_result_), int, -1);
00154 #  else /* ACE_HAS_WINNT4 && (ACE_HAS_WINNT4 != 0) */
00155   ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::LockFile (lock->handle_,
00156                                                       lock->overlapped_.Offset,
00157                                                       0,
00158                                                       len,
00159                                                       0),
00160                                           ace_result_), int, -1);
00161 #  endif /* ACE_HAS_WINNT4 && (ACE_HAS_WINNT4 != 0) */
00162 #elif defined (ACE_LACKS_FILELOCKS)
00163   ACE_UNUSED_ARG (lock);
00164   ACE_UNUSED_ARG (whence);
00165   ACE_UNUSED_ARG (start);
00166   ACE_UNUSED_ARG (len);
00167   ACE_NOTSUP_RETURN (-1);
00168 #else
00169   lock->lock_.l_whence = whence;
00170   lock->lock_.l_start = start;
00171   lock->lock_.l_len = len;
00172   lock->lock_.l_type = F_RDLCK;         // set read lock
00173   // block, if no access
00174   ACE_OSCALL_RETURN (ACE_OS::fcntl (lock->handle_, F_SETLKW,
00175                                     reinterpret_cast<long> (&lock->lock_)),
00176                      int, -1);
00177 #endif /* ACE_WIN32 */
00178 }

ACE_INLINE int ACE_OS::flock_tryrdlock ace_flock_t *  lock,
short  whence = 0,
off_t  start = 0,
off_t  len = 0
 

Definition at line 181 of file OS_NS_stdio.inl.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, ACE_OS_TRACE, EBUSY, flock_adjust_params(), ACE_OS::ace_flock_t::handle_, and ACE_OS::ace_flock_t::overlapped_.

Referenced by ACE_File_Lock::tryacquire_read().

00185 {
00186   ACE_OS_TRACE ("ACE_OS::ace_flock_tryrdlock");
00187 #if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
00188 #  if defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)
00189   ACE_OS::flock_adjust_params (lock, whence, start, len);
00190   ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::LockFileEx (lock->handle_,
00191                                                         LOCKFILE_FAIL_IMMEDIATELY,
00192                                                         0,
00193                                                         len,
00194                                                         0,
00195                                                         &lock->overlapped_),
00196                                           ace_result_), int, -1);
00197 #  else /* ACE_HAS_WINNT4 && (ACE_HAS_WINNT4 != 0) */
00198   ACE_UNUSED_ARG (lock);
00199   ACE_UNUSED_ARG (whence);
00200   ACE_UNUSED_ARG (start);
00201   ACE_UNUSED_ARG (len);
00202   ACE_NOTSUP_RETURN (-1);
00203 #  endif /* ACE_HAS_WINNT4 && (ACE_HAS_WINNT4 != 0) */
00204 #elif defined (ACE_LACKS_FILELOCKS)
00205   ACE_UNUSED_ARG (lock);
00206   ACE_UNUSED_ARG (whence);
00207   ACE_UNUSED_ARG (start);
00208   ACE_UNUSED_ARG (len);
00209   ACE_NOTSUP_RETURN (-1);
00210 #else
00211   lock->lock_.l_whence = whence;
00212   lock->lock_.l_start = start;
00213   lock->lock_.l_len = len;
00214   lock->lock_.l_type = F_RDLCK;         // set read lock
00215 
00216   int result = 0;
00217   // Does not block, if no access, returns -1 and set errno = EBUSY;
00218   ACE_OSCALL (ACE_OS::fcntl (lock->handle_, F_SETLK,
00219                              reinterpret_cast<long> (&lock->lock_)),
00220               int, -1, result);
00221 
00222   if (result == -1 && (errno == EACCES || errno == EAGAIN))
00223     errno = EBUSY;
00224 
00225   return result;
00226 #endif /* ACE_WIN32 */
00227 }

ACE_INLINE int ACE_OS::flock_trywrlock ace_flock_t *  lock,
short  whence = 0,
off_t  start = 0,
off_t  len = 0
 

Definition at line 230 of file OS_NS_stdio.inl.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, ACE_OS_TRACE, EBUSY, flock_adjust_params(), ACE_OS::ace_flock_t::handle_, and ACE_OS::ace_flock_t::overlapped_.

Referenced by ACE_File_Lock::tryacquire_write(), and ACE_File_Lock::tryacquire_write_upgrade().

00234 {
00235   ACE_OS_TRACE ("ACE_OS::ace_flock_trywrlock");
00236 #if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
00237 #  if defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)
00238   ACE_OS::flock_adjust_params (lock, whence, start, len);
00239   ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::LockFileEx (lock->handle_,
00240                                                         LOCKFILE_FAIL_IMMEDIATELY | LOCKFILE_EXCLUSIVE_LOCK,
00241                                                         0,
00242                                                         len,
00243                                                         0,
00244                                                         &lock->overlapped_),
00245                                           ace_result_), int, -1);
00246 #  else /* ACE_HAS_WINNT4 && (ACE_HAS_WINNT4 != 0) */
00247   ACE_UNUSED_ARG (lock);
00248   ACE_UNUSED_ARG (whence);
00249   ACE_UNUSED_ARG (start);
00250   ACE_UNUSED_ARG (len);
00251   ACE_NOTSUP_RETURN (-1);
00252 #  endif /* ACE_HAS_WINNT4 && (ACE_HAS_WINNT4 != 0) */
00253 #elif defined (ACE_LACKS_FILELOCKS)
00254   ACE_UNUSED_ARG (lock);
00255   ACE_UNUSED_ARG (whence);
00256   ACE_UNUSED_ARG (start);
00257   ACE_UNUSED_ARG (len);
00258   ACE_NOTSUP_RETURN (-1);
00259 #else
00260   lock->lock_.l_whence = whence;
00261   lock->lock_.l_start = start;
00262   lock->lock_.l_len = len;
00263   lock->lock_.l_type = F_WRLCK;         // set write lock
00264 
00265   int result = 0;
00266   // Does not block, if no access, returns -1 and set errno = EBUSY;
00267   ACE_OSCALL (ACE_OS::fcntl (lock->handle_,
00268                              F_SETLK,
00269                              reinterpret_cast<long> (&lock->lock_)),
00270               int, -1, result);
00271 
00272   if (result == -1 && (errno == EACCES || errno == EAGAIN))
00273     errno = EBUSY;
00274 
00275   return result;
00276 #endif /* ACE_WIN32 */
00277 }

ACE_INLINE int ACE_OS::flock_unlock ace_flock_t *  lock,
short  whence = 0,
off_t  start = 0,
off_t  len = 0
 

Definition at line 81 of file OS_NS_stdio.inl.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, ACE_OS_TRACE, flock_adjust_params(), ACE_OS::ace_flock_t::handle_, and ACE_OS::ace_flock_t::overlapped_.

Referenced by flock_destroy(), and ACE_File_Lock::release().

00085 {
00086   ACE_OS_TRACE ("ACE_OS::flock_unlock");
00087 #if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
00088   ACE_OS::flock_adjust_params (lock, whence, start, len);
00089   ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::UnlockFile (lock->handle_,
00090                                                         lock->overlapped_.Offset,
00091                                                         0,
00092                                                         len,
00093                                                         0),
00094                                           ace_result_), int, -1);
00095 #elif defined (ACE_LACKS_FILELOCKS)
00096   ACE_UNUSED_ARG (lock);
00097   ACE_UNUSED_ARG (whence);
00098   ACE_UNUSED_ARG (start);
00099   ACE_UNUSED_ARG (len);
00100   ACE_NOTSUP_RETURN (-1);
00101 #else
00102   lock->lock_.l_whence = whence;
00103   lock->lock_.l_start = start;
00104   lock->lock_.l_len = len;
00105   lock->lock_.l_type = F_UNLCK;   // Unlock file.
00106 
00107   // release lock
00108   ACE_OSCALL_RETURN (ACE_OS::fcntl (lock->handle_, F_SETLK,
00109                                     reinterpret_cast<long> (&lock->lock_)),
00110                      int, -1);
00111 #endif /* ACE_WIN32 */
00112 }

ACE_INLINE int ACE_OS::flock_wrlock ace_flock_t *  lock,
short  whence = 0,
off_t  start = 0,
off_t  len = 0
 

Definition at line 280 of file OS_NS_stdio.inl.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, ACE_OS_TRACE, flock_adjust_params(), ACE_OS::ace_flock_t::handle_, and ACE_OS::ace_flock_t::overlapped_.

Referenced by ACE_File_Lock::acquire_write().

00284 {
00285   ACE_OS_TRACE ("ACE_OS::flock_wrlock");
00286 #if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
00287   ACE_OS::flock_adjust_params (lock, whence, start, len);
00288 #  if defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)
00289   ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::LockFileEx (lock->handle_,
00290                                                         LOCKFILE_EXCLUSIVE_LOCK,
00291                                                         0,
00292                                                         len,
00293                                                         0,
00294                                                         &lock->overlapped_),
00295                                           ace_result_), int, -1);
00296 #  else /* ACE_HAS_WINNT4 && (ACE_HAS_WINNT4 != 0) */
00297   ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::LockFile (lock->handle_,
00298                                                       lock->overlapped_.Offset,
00299                                                       0,
00300                                                       len,
00301                                                       0),
00302                                           ace_result_), int, -1);
00303 #  endif /* ACE_HAS_WINNT4 && (ACE_HAS_WINNT4 != 0) */
00304 #elif defined (ACE_LACKS_FILELOCKS)
00305   ACE_UNUSED_ARG (lock);
00306   ACE_UNUSED_ARG (whence);
00307   ACE_UNUSED_ARG (start);
00308   ACE_UNUSED_ARG (len);
00309   ACE_NOTSUP_RETURN (-1);
00310 #else
00311   lock->lock_.l_whence = whence;
00312   lock->lock_.l_start = start;
00313   lock->lock_.l_len = len;
00314   lock->lock_.l_type = F_WRLCK;         // set write lock
00315   // block, if no access
00316   ACE_OSCALL_RETURN (ACE_OS::fcntl (lock->handle_, F_SETLKW,
00317                                     reinterpret_cast<long> (&lock->lock_)),
00318                      int, -1);
00319 #endif /* ACE_WIN32 */
00320 }

ACE_INLINE double ACE_OS::floor double  x  ) 
 

This method computes the largest integral value not greater than x.

Definition at line 10 of file OS_NS_math.inl.

00011   {
00012     // This method computes the largest integral value not greater than x.
00013     if(x > 0)
00014       return static_cast<long> (x);
00015     else if (static_cast<long> (x) == x)
00016       return x;
00017     else
00018       return static_cast<long>(x) - 1;
00019   }

FILE * ACE_OS::fopen const wchar_t *  filename,
const ACE_TCHAR mode
 

Definition at line 164 of file OS_NS_stdio.cpp.

References _O_TEXT, ACE_OS_TRACE, ACE_TCHAR, close(), fopen_mode_to_open_mode_converter(), and open().

00166 {
00167   ACE_OS_TRACE ("ACE_OS::fopen");
00168   int hmode = _O_TEXT;
00169 
00170   for (const ACE_TCHAR *mode_ptr = mode; *mode_ptr != 0; mode_ptr++)
00171     ACE_OS::fopen_mode_to_open_mode_converter (*mode_ptr, hmode);
00172 
00173   ACE_HANDLE handle = ACE_OS::open (filename, hmode);
00174   if (handle != ACE_INVALID_HANDLE)
00175     {
00176       hmode &= _O_TEXT | _O_RDONLY | _O_APPEND;
00177 
00178 #   if defined (ACE_LACKS_INTPTR_T)
00179       int fd = ::_open_osfhandle (long (handle), hmode);
00180 #   else
00181       int fd = ::_open_osfhandle (intptr_t (handle), hmode);
00182 #   endif
00183 
00184       if (fd != -1)
00185         {
00186 #   if defined (__BORLANDC__) && !defined (ACE_USES_WCHAR)
00187           FILE *fp = ::_fdopen (fd, const_cast<char *> (mode));
00188 #   elif defined (__BORLANDC__) && defined (ACE_USES_WCHAR)
00189           FILE *fp = ::_wfdopen (fd, const_cast<wchar_t *> (mode));
00190 #   elif defined (ACE_USES_WCHAR)
00191           FILE *fp = ::_wfdopen (fd, mode);
00192 #   else
00193           FILE *fp = ::fdopen (fd, mode);
00194 #   endif /* defined(__BORLANDC__) && !defined (ACE_USES_WCHAR)) */
00195           if (fp != 0)
00196           {
00197 #   if defined (ACE_USES_WCHAR)
00198             checkUnicodeFormat(fp);
00199 #   endif  // ACE_USES_WCHAR
00200             return fp;
00201           }
00202           ::_close (fd);
00203         }
00204 
00205       ACE_OS::close (handle);
00206     }
00207   return 0;
00208 }

FILE * ACE_OS::fopen const char *  filename,
const ACE_TCHAR mode
 

Definition at line 116 of file OS_NS_stdio.cpp.

References _O_TEXT, ACE_OS_TRACE, ACE_TCHAR, close(), fopen_mode_to_open_mode_converter(), and open().

Referenced by access(), ACE::count_interfaces(), ACE_Ini_ImpExp::export_config(), ACE_Registry_ImpExp::export_config(), ACE::get_ip_interfaces(), ACE_Capabilities::getent(), ACE_Logging_Strategy::handle_timeout(), ACE_Ini_ImpExp::import_config(), ACE_Registry_ImpExp::import_config(), ACE_Logging_Strategy::init(), ACE::ldopen(), ACE_Service_Config::open_i(), and ACE_Service_Gestalt::process_file().

00118 {
00119   ACE_OS_TRACE ("ACE_OS::fopen");
00120   int hmode = _O_TEXT;
00121 
00122   for (const ACE_TCHAR *mode_ptr = mode; *mode_ptr != 0; mode_ptr++)
00123     ACE_OS::fopen_mode_to_open_mode_converter (*mode_ptr, hmode);
00124 
00125   ACE_HANDLE handle = ACE_OS::open (filename, hmode);
00126   if (handle != ACE_INVALID_HANDLE)
00127     {
00128       hmode &= _O_TEXT | _O_RDONLY | _O_APPEND;
00129 
00130 #   if defined (ACE_LACKS_INTPTR_T)
00131       int fd = ::_open_osfhandle (long (handle), hmode);
00132 #   else
00133       int fd = ::_open_osfhandle (intptr_t (handle), hmode);
00134 #   endif
00135 
00136       if (fd != -1)
00137         {
00138 #   if defined (__BORLANDC__) && !defined (ACE_USES_WCHAR)
00139           FILE *fp = ::_fdopen (fd, const_cast<ACE_TCHAR *> (mode));
00140 #   elif defined (__BORLANDC__) && defined (ACE_USES_WCHAR)
00141           FILE *fp = ::_wfdopen (fd, const_cast<ACE_TCHAR *> (mode));
00142 #   elif defined (ACE_USES_WCHAR)
00143           FILE *fp = ::_wfdopen (fd, mode);
00144 #   else
00145           FILE *fp = ::fdopen (fd, mode);
00146 #   endif /* defined(__BORLANDC__) && !defined (ACE_USES_WCHAR)) */
00147           if (fp != 0)
00148           {
00149 #   if defined (ACE_USES_WCHAR)
00150             checkUnicodeFormat(fp);
00151 #   endif  // ACE_USES_WCHAR
00152             return fp;
00153           }
00154           ::_close (fd);
00155         }
00156 
00157       ACE_OS::close (handle);
00158     }
00159   return 0;
00160 }

ACE_INLINE void ACE_OS::fopen_mode_to_open_mode_converter ACE_TCHAR  x,
int &  hmode
 

Translate fopen's mode char to open's mode. This helper function is here to avoid maintaining several pieces of identical code.

Definition at line 324 of file OS_NS_stdio.inl.

References _O_BINARY, _O_TEXT, ACE_BIT_DISABLED, ACE_CLR_BITS, ACE_LIB_TEXT, ACE_SET_BITS, and ACE_TCHAR.

Referenced by fopen().

00325 {
00326     switch (x)
00327       {
00328       case ACE_LIB_TEXT ('r'):
00329         if (ACE_BIT_DISABLED (hmode, _O_RDWR))
00330           {
00331             ACE_CLR_BITS (hmode, _O_WRONLY);
00332             ACE_SET_BITS (hmode, _O_RDONLY);
00333           }
00334         break;
00335       case ACE_LIB_TEXT ('w'):
00336         if (ACE_BIT_DISABLED (hmode, _O_RDWR))
00337           {
00338             ACE_CLR_BITS (hmode, _O_RDONLY);
00339             ACE_SET_BITS (hmode, _O_WRONLY);
00340           }
00341         ACE_SET_BITS (hmode, _O_CREAT | _O_TRUNC);
00342         break;
00343       case ACE_LIB_TEXT ('a'):
00344         if (ACE_BIT_DISABLED (hmode, _O_RDWR))
00345           {
00346             ACE_CLR_BITS (hmode, _O_RDONLY);
00347             ACE_SET_BITS (hmode, _O_WRONLY);
00348           }
00349         ACE_SET_BITS (hmode, _O_CREAT | _O_APPEND);
00350         break;
00351       case ACE_LIB_TEXT ('+'):
00352         ACE_CLR_BITS (hmode, _O_RDONLY | _O_WRONLY);
00353         ACE_SET_BITS (hmode, _O_RDWR);
00354         break;
00355       case ACE_LIB_TEXT ('t'):
00356         ACE_CLR_BITS (hmode, _O_BINARY);
00357         ACE_SET_BITS (hmode, _O_TEXT);
00358         break;
00359       case ACE_LIB_TEXT ('b'):
00360         ACE_CLR_BITS (hmode, _O_TEXT);
00361         ACE_SET_BITS (hmode, _O_BINARY);
00362         break;
00363       }
00364 }

pid_t ACE_OS::fork const ACE_TCHAR program_name  ) 
 

Forks and exec's a process in a manner that works on Solaris and NT. argv[0] must be the full path name to the executable.

Definition at line 165 of file OS_NS_unistd.cpp.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, ACE_TCHAR, pid_t, and ACE_Base_Thread_Adapter::sync_log_msg().

00166 {
00167   ACE_OS_TRACE ("ACE_OS::fork");
00168 # if defined (ACE_LACKS_FORK)
00169   ACE_UNUSED_ARG (program_name);
00170   ACE_NOTSUP_RETURN (pid_t (-1));
00171 # else
00172   pid_t pid =
00173 # if defined (ACE_HAS_STHREADS)
00174     ::fork1 ();
00175 #else
00176     ::fork ();
00177 #endif /* ACE_HAS_STHREADS */
00178 
00179 #if !defined (ACE_HAS_MINIMAL_ACE_OS)
00180   if (pid == 0)
00181     ACE_Base_Thread_Adapter::sync_log_msg (program_name);
00182 #endif /* ! ACE_HAS_MINIMAL_ACE_OS */
00183 
00184   return pid;
00185 # endif /* ACE_WIN32 */
00186 }

ACE_INLINE pid_t ACE_OS::fork void   ) 
 

Forks and exec's a process in a manner that works on Solaris and NT. argv[0] must be the full path name to the executable.

Definition at line 329 of file OS_NS_unistd.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and pid_t.

Referenced by ACE::daemonize(), ACE::fork(), and fork_exec().

00330 {
00331   ACE_OS_TRACE ("ACE_OS::fork");
00332 #if defined (ACE_LACKS_FORK)
00333   ACE_NOTSUP_RETURN (pid_t (-1));
00334 #else
00335   ACE_OSCALL_RETURN (::fork (), pid_t, -1);
00336 #endif /* ACE_LACKS_FORK */
00337 }

pid_t ACE_OS::fork_exec ACE_TCHAR argv[]  ) 
 

Forks and exec's a process in a manner that works on Solaris and NT. argv[0] must be the full path name to the executable.

Definition at line 192 of file OS_NS_unistd.cpp.

References ACE_NEW_NORETURN, ACE_TCHAR, argv_to_string(), close(), execv(), exit(), fork(), memset(), and pid_t.

00193 {
00194 # if defined (ACE_WIN32)
00195   ACE_TCHAR *buf;
00196 
00197   if (ACE_OS::argv_to_string (argv, buf) != -1)
00198     {
00199       PROCESS_INFORMATION process_info;
00200 #   if !defined (ACE_HAS_WINCE)
00201       ACE_TEXT_STARTUPINFO startup_info;
00202       ACE_OS::memset ((void *) &startup_info,
00203                       0,
00204                       sizeof startup_info);
00205       startup_info.cb = sizeof startup_info;
00206 
00207       if (ACE_TEXT_CreateProcess (0,
00208                                   buf,
00209                                   0, // No process attributes.
00210                                   0,  // No thread attributes.
00211                                   TRUE, // Allow handle inheritance.
00212                                   0, // Don't create a new console window.
00213                                   0, // No environment.
00214                                   0, // No current directory.
00215                                   &startup_info,
00216                                   &process_info))
00217 #   else
00218       if (ACE_TEXT_CreateProcess (0,
00219                                   buf,
00220                                   0, // No process attributes.
00221                                   0,  // No thread attributes.
00222                                   FALSE, // Can's inherit handles on CE
00223                                   0, // Don't create a new console window.
00224                                   0, // No environment.
00225                                   0, // No current directory.
00226                                   0, // Can't use startup info on CE
00227                                   &process_info))
00228 #   endif /* ! ACE_HAS_WINCE */
00229         {
00230           // Free resources allocated in kernel.
00231           ACE_OS::close (process_info.hThread);
00232           ACE_OS::close (process_info.hProcess);
00233           // Return new process id.
00234           delete [] buf;
00235           return process_info.dwProcessId;
00236         }
00237     }
00238 
00239   // CreateProcess failed.
00240   return -1;
00241 # else
00242       pid_t result = ACE_OS::fork ();
00243 
00244 #   if defined (ACE_USES_WCHAR)
00245       // Wide-char builds need to convert the command-line args to
00246       // narrow char strings for execv().
00247       char **cargv;
00248       int arg_count;
00249 #   endif /* ACE_HAS_WCHAR */
00250 
00251       switch (result)
00252         {
00253         case -1:
00254           // Error.
00255           return -1;
00256         case 0:
00257           // Child process.
00258 #   if defined (ACE_USES_WCHAR)
00259           for (arg_count = 0; argv[arg_count] != 0; ++arg_count)
00260             ;
00261           ++arg_count;    // Need a 0-pointer end-of-array marker
00262           ACE_NEW_NORETURN (cargv, char*[arg_count]);
00263           if (cargv == 0)
00264             ACE_OS::exit (errno);
00265           --arg_count;    // Back to 0-indexed
00266           cargv[arg_count] = 0;
00267           while (--arg_count >= 0)
00268             cargv[arg_count] = ACE_Wide_To_Ascii::convert (argv[arg_count]);
00269           // Don't worry about freeing the cargv or the strings it points to.
00270           // Either the process will be replaced, or we'll exit.
00271           if (ACE_OS::execv (cargv[0], cargv) == -1)
00272             ACE_OS::exit (errno);
00273 #   else
00274           if (ACE_OS::execv (argv[0], argv) == -1)
00275             {
00276               // The OS layer should not print stuff out
00277               // ACE_ERROR ((LM_ERROR,
00278               //             "%p Exec failed\n"));
00279 
00280               // If the execv fails, this child needs to exit.
00281               ACE_OS::exit (errno);
00282             }
00283 #   endif /* ACE_HAS_WCHAR */
00284 
00285         default:
00286           // Server process.  The fork succeeded.
00287           return result;
00288         }
00289 # endif /* ACE_WIN32 */
00290 }

int ACE_OS::fprintf FILE *  fp,
const wchar_t *  format,
... 
 

Definition at line 227 of file OS_NS_stdio.cpp.

References ACE_NOTSUP_RETURN, and ACE_OS_TRACE.

00228 {
00229   ACE_OS_TRACE ("ACE_OS::fprintf");
00230 
00231 # if !defined (ACE_HAS_VFWPRINTF)
00232   ACE_UNUSED_ARG (fp);
00233   ACE_UNUSED_ARG (format);
00234   ACE_NOTSUP_RETURN (-1);
00235 
00236 # else
00237   int result = 0;
00238   va_list ap;
00239   va_start (ap, format);
00240   ACE_OSCALL (ACE_STD_NAMESPACE::vfwprintf (fp, format, ap), int, -1, result);
00241   va_end (ap);
00242   return result;
00243 
00244 # endif /* ACE_HAS_VFWPRINTF */
00245 }

int ACE_OS::fprintf FILE *  fp,
const char *  format,
... 
 

Definition at line 214 of file OS_NS_stdio.cpp.

References ACE_OS_TRACE.

Referenced by ACE_Service_Type::dump(), ACE_ATM_Stream::get_vpi_vci(), ACE_Svc_Conf_Lexer::input(), ACE_Service_Gestalt::insert(), ACE_Log_Msg::log(), ACE_Service_Config::open_i(), ACE_Name_Options::parse_args(), ACE_Log_Record::print(), ACE_Stats::print_summary(), socket_fini(), and socket_init().

00215 {
00216   ACE_OS_TRACE ("ACE_OS::fprintf");
00217   int result = 0;
00218   va_list ap;
00219   va_start (ap, format);
00220   ACE_OSCALL (::vfprintf (fp, format, ap), int, -1, result);
00221   va_end (ap);
00222   return result;
00223 }

ACE_INLINE int ACE_OS::fputs const wchar_t *  s,
FILE *  stream
 

Definition at line 645 of file OS_NS_stdio.inl.

References ACE_OS_TRACE.

00646 {
00647   ACE_OS_TRACE ("ACE_OS::fputs");
00648   ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fputws (s, stream), int, -1);
00649 }

ACE_INLINE int ACE_OS::fputs const char *  s,
FILE *  stream
 

Definition at line 637 of file OS_NS_stdio.inl.

References ACE_OS_TRACE.

Referenced by ACE_Ini_ImpExp::export_section(), and ACE_Registry_ImpExp::export_section().

00638 {
00639   ACE_OS_TRACE ("ACE_OS::fputs");
00640   ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fputs (s, stream), int, -1);
00641 }

ACE_INLINE size_t ACE_OS::fread void *  ptr,
size_t  size,
size_t  nelems,
FILE *  fp
 

Definition at line 653 of file OS_NS_stdio.inl.

References ACE_OS_TRACE.

Referenced by ACE_Svc_Conf_Lexer::input().

00654 {
00655   ACE_OS_TRACE ("ACE_OS::fread");
00656   ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fread (ptr, size, nelems, fp),
00657                      size_t,
00658                      0);
00659 }

void ACE_OS::free void *   ) 
 

Definition at line 76 of file OS_NS_stdlib.cpp.

References ACE_FREE_FUNC, and ACE_MALLOC_T.

Referenced by ACE_ARGV_T< CHAR_TYPE >::add(), ACE_TLI_Acceptor::close(), ACE_Dirent_Selector::close(), ACE_ATM_QoS::construct_options(), ACE::count_interfaces(), ACE_Name_Options::database(), event_destroy(), flock_destroy(), ACE_ATM_Stream::get_vpi_vci(), ACE::ldfind(), ACE_Local_Name_Space<, ACE_LOCK >::list_type_entries_i(), ACE_Local_Name_Space<, ACE_LOCK >::list_types_i(), ACE_Log_Msg::local_host(), ACE_Name_Options::nameserver_host(), ACE_Name_Options::namespace_dir(), ACE_Log_Msg::open(), ACE_Name_Binding::operator=(), ACE_Name_Options::process_name(), putenv(), ACE_Mutex::remove(), ACE_Auto_String_Free::reset(), scandir_emulation(), sema_destroy(), ACE_SPIPE_Addr::set(), ACE_INET_Addr::string_to_addr(), ACE_Log_Msg::sync(), tempnam(), ACE_ARGV_T< CHAR_TYPE >::~ACE_ARGV_T(), ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter(), ACE_Configuration_Section_Key_Heap::~ACE_Configuration_Section_Key_Heap(), ACE_Hash_Map_Entry< const ACE_TCHAR *, ACE_Filecache_Object * >::~ACE_Hash_Map_Entry(), ACE_Log_Msg::~ACE_Log_Msg(), ACE_Malloc_FIFO_Iterator_T<, ACE_LOCK, ACE_CB >::~ACE_Malloc_FIFO_Iterator_T(), ACE_Malloc_LIFO_Iterator_T<, ACE_LOCK, ACE_CB >::~ACE_Malloc_LIFO_Iterator_T(), ACE_Name_Binding::~ACE_Name_Binding(), ACE_Name_Options::~ACE_Name_Options(), and ACE_Strategy_Acceptor< SVC_HANDLER, >::~ACE_Strategy_Acceptor().

00077 {
00078   ACE_FREE_FUNC (ACE_MALLOC_T (ptr));
00079 }

ACE_INLINE FILE * ACE_OS::freopen const ACE_TCHAR filename,
const ACE_TCHAR mode,
FILE *  stream
 

Definition at line 662 of file OS_NS_stdio.inl.

References ACE_OS_TRACE, ACE_TCHAR, ACE_TEXT_ALWAYS_CHAR, and ACE_TEXT_ALWAYS_WCHAR.

00663 {
00664   ACE_OS_TRACE ("ACE_OS::freopen");
00665 #if defined (ACE_WIN32) && (defined(ACE_USES_WCHAR) || defined(ACE_HAS_WINCE))
00666   ACE_OSCALL_RETURN (::_wfreopen (ACE_TEXT_ALWAYS_WCHAR (filename),
00667                                   ACE_TEXT_ALWAYS_WCHAR (mode),
00668                                   stream),
00669                      FILE *, 0);
00670 #else
00671   ACE_OSCALL_RETURN
00672     (ACE_STD_NAMESPACE::freopen (ACE_TEXT_ALWAYS_CHAR (filename),
00673                                  ACE_TEXT_ALWAYS_CHAR (mode),
00674                                  stream),
00675      FILE *, 0);
00676 #endif /* ACE_WIN32 && ACE_USES_WCHAR */
00677 }

ACE_INLINE int ACE_OS::fseek FILE *  fp,
long  offset,
int  ptrname
 

Definition at line 680 of file OS_NS_stdio.inl.

Referenced by rewind().

00681 {
00682 # if defined (ACE_WIN32)
00683 #   if SEEK_SET != FILE_BEGIN || SEEK_CUR != FILE_CURRENT || SEEK_END != FILE_END
00684   //#error Windows NT is evil AND rude!
00685   switch (whence)
00686     {
00687     case SEEK_SET:
00688       whence = FILE_BEGIN;
00689       break;
00690     case SEEK_CUR:
00691       whence = FILE_CURRENT;
00692       break;
00693     case SEEK_END:
00694       whence = FILE_END;
00695       break;
00696     default:
00697       errno = EINVAL;
00698       return -1; // rather safe than sorry
00699     }
00700 #   endif  /* SEEK_SET != FILE_BEGIN || SEEK_CUR != FILE_CURRENT || SEEK_END != FILE_END */
00701 # endif   /* ACE_WIN32 */
00702   ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fseek (fp, offset, whence), int, -1);
00703 }

ACE_INLINE int ACE_OS::fsetpos FILE *  fp,
fpos_t *  pos
 

Definition at line 706 of file OS_NS_stdio.inl.

References fsetpos().

Referenced by fsetpos().

00707 {
00708   ACE_OSCALL_RETURN (::fsetpos (fp, pos), int, -1);
00709 }

ACE_INLINE int ACE_OS::fstat ACE_HANDLE  ,
ACE_stat
 

Definition at line 51 of file OS_NS_sys_stat.inl.

References ACE_OS_TRACE, ACE_Time_Value, and set_errno_to_last_error().

Referenced by ACE_Select_Reactor_T< ACE_SELECT_REACTOR_TOKEN >::check_handles(), filesize(), and ACE_FILE::get_info().

00052   {
00053     ACE_OS_TRACE ("ACE_OS::fstat");
00054 # if 1
00055     BY_HANDLE_FILE_INFORMATION fdata;
00056 
00057     if (::GetFileInformationByHandle (handle, &fdata) == FALSE)
00058       {
00059         ACE_OS::set_errno_to_last_error ();
00060         return -1;
00061       }
00062     else if (fdata.nFileSizeHigh != 0)
00063       {
00064         errno = EINVAL;
00065         return -1;
00066       }
00067     else
00068       {
00069         stp->st_size = fdata.nFileSizeLow;
00070         stp->st_atime = ACE_Time_Value (fdata.ftLastAccessTime).sec ();
00071         stp->st_mtime = ACE_Time_Value (fdata.ftLastWriteTime).sec ();
00072         stp->st_ctime = ACE_Time_Value (fdata.ftCreationTime).sec ();
00073         stp->st_nlink = static_cast<short> (fdata.nNumberOfLinks);
00074         stp->st_dev = stp->st_rdev = 0; // No equivalent conversion.
00075         stp->st_mode = S_IXOTH | S_IROTH |
00076           (fdata.dwFileAttributes & FILE_ATTRIBUTE_READONLY ? 0 : S_IWOTH) |
00077           (fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? S_IFDIR : S_IFREG);
00078       }
00079     return 0;
00080 # else /* 1 */
00081     // This implementation close the handle.
00082     int retval = -1;
00083     int fd = ::_open_osfhandle ((long) handle, 0);
00084     if (fd != -1)
00085       retval = ::_fstat (fd, stp);
00086 
00087     ::_close (fd);
00088     // Remember to close the file handle.
00089     return retval;
00090 # endif /* 1 */
00091   }

ACE_INLINE int ACE_OS::fsync ACE_HANDLE  handle  ) 
 

Definition at line 340 of file OS_NS_unistd.inl.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, ACE_OS_TRACE, and fsync().

Referenced by fsync().

00341 {
00342   ACE_OS_TRACE ("ACE_OS::fsync");
00343 # if defined (ACE_LACKS_FSYNC)
00344   ACE_UNUSED_ARG (handle);
00345   ACE_NOTSUP_RETURN (-1);
00346 # elif defined (ACE_WIN32)
00347   ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::FlushFileBuffers (handle), ace_result_), int, -1);
00348 # else
00349   ACE_OSCALL_RETURN (::fsync (handle), int, -1);
00350 # endif /* ACE_LACKS_FSYNC */
00351 }

ACE_INLINE long ACE_OS::ftell FILE *  fp  ) 
 

Definition at line 712 of file OS_NS_stdio.inl.

Referenced by ACE_Logging_Strategy::handle_timeout().

00713 {
00714   ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::ftell (fp), long, -1);
00715 }

ACE_INLINE int ACE_OS::ftruncate ACE_HANDLE  ,
ACE_LOFF_T 
 

Definition at line 354 of file OS_NS_unistd.inl.

References ACE_ADAPT_RETVAL, ACE_FAIL_RETURN, ACE_LOFF_T, ACE_OS_TRACE, and ftruncate().

Referenced by ACE_Mutex::ACE_Mutex(), event_init(), ftruncate(), ACE_Mem_Map::remove(), sema_init(), and ACE_FILE::truncate().

00355 {
00356   ACE_OS_TRACE ("ACE_OS::ftruncate");
00357 #if defined (ACE_WIN32)
00358 #  if !defined (ACE_LACKS_SETFILEPOINTEREX)
00359   LARGE_INTEGER loff;
00360   loff.QuadPart = offset;
00361   if (::SetFilePointerEx (handle, loff, 0, FILE_BEGIN) != (unsigned) -1)
00362 #  else
00363   if (::SetFilePointer (handle, offset, 0, FILE_BEGIN) != (unsigned) -1)
00364 #  endif
00365     ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::SetEndOfFile (handle), ace_result_), int, -1);
00366   else
00367     ACE_FAIL_RETURN (-1);
00368 #else
00369   ACE_OSCALL_RETURN (::ftruncate (handle, offset), int, -1);
00370 #endif /* ACE_WIN32 */
00371 }

ACE_INLINE size_t ACE_OS::fwrite const void *  ptr,
size_t  size,
size_t  nitems,
FILE *  fp
 

Definition at line 718 of file OS_NS_stdio.inl.

References ACE_OS_TRACE.

00719 {
00720   ACE_OS_TRACE ("ACE_OS::fwrite");
00721   ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fwrite (ptr, size, nitems, fp),
00722                      size_t,
00723                      0);
00724 }

ACE_NAMESPACE_INLINE_FUNCTION HINSTANCE get_win32_resource_module void   ) 
 

Return the handle of the module containing ACE's resources. By default, for a DLL build of ACE this is a handle to the ACE DLL itself, and for a static build it is a handle to the executable.

ACE_NAMESPACE_INLINE_FUNCTION const OSVERSIONINFO& get_win32_versioninfo void   ) 
 

Return the win32 OSVERSIONINFO structure.

ACE_INLINE wchar_t * ACE_OS::getcwd wchar_t *  ,
size_t 
 

Definition at line 390 of file OS_NS_unistd.inl.

References ACE_NOTSUP_RETURN, getcwd(), and strsncpy().

00391 {
00392 #  if defined (ACE_HAS_WINCE)
00393   ACE_UNUSED_ARG (buf);
00394   ACE_UNUSED_ARG (size);
00395   ACE_NOTSUP_RETURN (0);
00396 #  elif defined (ACE_WIN32)
00397   return ::_wgetcwd (buf, static_cast<int> (size));
00398 #  else
00399   char *narrow_buf = new char[size];
00400   char *result = 0;
00401   result = ACE_OS::getcwd (narrow_buf, size);
00402   ACE_Ascii_To_Wide wide_buf (result);
00403   delete [] narrow_buf;
00404   if (result != 0)
00405     ACE_OS::strsncpy (buf, wide_buf.wchar_rep (), size);
00406   return result == 0 ? 0 : buf;
00407 #  endif /* ACE_WIN32 */
00408 }

ACE_INLINE char * ACE_OS::getcwd char *  ,
size_t 
 

Definition at line 374 of file OS_NS_unistd.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and getcwd().

Referenced by getcwd().

00375 {
00376   ACE_OS_TRACE ("ACE_OS::getcwd");
00377 #if defined (ACE_LACKS_GETCWD)
00378   ACE_UNUSED_ARG (buf);
00379   ACE_UNUSED_ARG (size);
00380   ACE_NOTSUP_RETURN (0);
00381 #elif defined (ACE_WIN32)
00382   return ::getcwd (buf, static_cast<int> (size));
00383 #else
00384   ACE_OSCALL_RETURN (::getcwd (buf, size), char *, 0);
00385 #endif /* ACE_LACKS_GETCWD */
00386 }

ACE_INLINE gid_t ACE_OS::getegid void   ) 
 

Definition at line 423 of file OS_NS_unistd.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, getegid(), and gid_t.

Referenced by getegid().

00424 {
00425   ACE_OS_TRACE ("ACE_OS::getegid");
00426 #if defined (ACE_LACKS_GETEGID)
00427   ACE_NOTSUP_RETURN (static_cast<gid_t> (-1));
00428 # else
00429   ACE_OSCALL_RETURN (::getegid (), gid_t, static_cast<gid_t> (-1));
00430 # endif /* ACE_LACKS_GETEGID */
00431 }

ACE_INLINE wchar_t * ACE_OS::getenv const wchar_t *  symbol  ) 
 

Definition at line 139 of file OS_NS_stdlib.inl.

References ACE_NOTSUP_RETURN.

00140 {
00141 #if defined (ACE_LACKS_ENV)
00142   ACE_UNUSED_ARG (symbol);
00143   ACE_NOTSUP_RETURN (0);
00144 #else
00145   ACE_OSCALL_RETURN (::_wgetenv (symbol), wchar_t *, 0);
00146 #endif /* ACE_LACKS_ENV */
00147 }

ACE_INLINE char * ACE_OS::getenv const char *  symbol  ) 
 

Definition at line 126 of file OS_NS_stdlib.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and getenv().

Referenced by ACE_Get_Opt::ACE_Get_Opt(), ACE_Log_Msg::ACE_Log_Msg(), argv_to_string(), ACE::debug(), ACE_Env_Value< T >::fetch_value(), ACE_High_Res_Timer::get_env_global_scale_factor(), ACE::get_temp_dir(), getenv(), ACE::ldfind(), and strenvdup().

00127 {
00128   ACE_OS_TRACE ("ACE_OS::getenv");
00129 #if defined (ACE_LACKS_ENV)
00130   ACE_UNUSED_ARG (symbol);
00131   ACE_NOTSUP_RETURN (0);
00132 #else /* ACE_LACKS_ENV */
00133   ACE_OSCALL_RETURN (::getenv (symbol), char *, 0);
00134 #endif /* ACE_LACKS_ENV */
00135 }

ACE_TCHAR * ACE_OS::getenvstrings void   ) 
 

Definition at line 91 of file OS_NS_stdlib.cpp.

References ACE_NOTSUP_RETURN.

Referenced by ACE_Process_Options::inherit_environment().

00092 {
00093 #if defined (ACE_LACKS_ENV)
00094   ACE_NOTSUP_RETURN (0);
00095 #elif defined (ACE_WIN32)
00096 # if defined (ACE_USES_WCHAR)
00097   return ::GetEnvironmentStringsW ();
00098 # else /* ACE_USES_WCHAR */
00099   return ::GetEnvironmentStrings ();
00100 # endif /* ACE_USES_WCHAR */
00101 #else /* ACE_WIN32 */
00102   ACE_NOTSUP_RETURN (0);
00103 #endif /* ACE_WIN32 */
00104 }

ACE_INLINE uid_t ACE_OS::geteuid void   ) 
 

Definition at line 501 of file OS_NS_unistd.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, geteuid(), and uid_t.

Referenced by geteuid().

00502 {
00503   ACE_OS_TRACE ("ACE_OS::geteuid");
00504 #if defined (ACE_LACKS_GETEUID)
00505   ACE_NOTSUP_RETURN (static_cast<uid_t> (-1));
00506 # else
00507   ACE_OSCALL_RETURN (::geteuid (), uid_t, (uid_t) -1);
00508 # endif /* ACE_LACKS_GETEUID */
00509 }

ACE_INLINE gid_t ACE_OS::getgid void   ) 
 

Definition at line 412 of file OS_NS_unistd.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, getgid(), and gid_t.

Referenced by getgid(), and ACE_SPIPE_Addr::set().

00413 {
00414   ACE_OS_TRACE ("ACE_OS::getgid");
00415 #if defined (ACE_LACKS_GETGID)
00416   ACE_NOTSUP_RETURN (static_cast<gid_t> (-1));
00417 # else
00418   ACE_OSCALL_RETURN (::getgid (), gid_t, static_cast<gid_t> (-1));
00419 # endif /* ACE_LACKS_GETGID */
00420 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE struct hostent * ACE_OS::gethostbyaddr const char *  addr,
int  length,
int  type
 

Definition at line 48 of file OS_NS_netdb.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, ACE_SOCKCALL_RETURN, ACE_SOCKET_LEN, and gethostbyaddr().

Referenced by ACE_INET_Addr::get_host_name_i(), gethostbyaddr(), gethostbyaddr_r(), and getipnodebyaddr().

00049 {
00050   ACE_OS_TRACE ("ACE_OS::gethostbyaddr");
00051 # if defined (ACE_LACKS_GETHOSTBYADDR)
00052   ACE_UNUSED_ARG (addr);
00053   ACE_UNUSED_ARG (length);
00054   ACE_UNUSED_ARG (type);
00055   ACE_NOTSUP_RETURN (0);
00056 # elif defined (ACE_HAS_NONCONST_GETBY)
00057   ACE_SOCKCALL_RETURN (::gethostbyaddr (const_cast<char *> (addr),
00058                                         (ACE_SOCKET_LEN) length,
00059                                         type),
00060                        struct hostent *,
00061                        0);
00062 # else
00063   ACE_SOCKCALL_RETURN (::gethostbyaddr (addr,
00064                                         (ACE_SOCKET_LEN) length,
00065                                         type),
00066                        struct hostent *,
00067                        0);
00068 # endif /* ACE_HAS_NONCONST_GETBY */
00069 }

ACE_INLINE struct hostent * ACE_OS::gethostbyaddr_r const char *  addr,
int  length,
int  type,
struct hostent *  result,
ACE_HOSTENT_DATA  buffer,
int *  h_errnop
 

Definition at line 76 of file OS_NS_netdb.inl.

References ACE_HOSTENT_DATA, ACE_OS_TRACE, ACE_SOCKCALL_RETURN, ACE_SOCKET_LEN, gethostbyaddr(), gethostbyaddr_r(), and memset().

Referenced by ACE_INET_Addr::get_host_name_i(), and gethostbyaddr_r().

00082 {
00083   ACE_OS_TRACE ("ACE_OS::gethostbyaddr_r");
00084 # if defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
00085 #   if defined (AIX) || defined (DIGITAL_UNIX)
00086   ACE_OS::memset (buffer, 0, sizeof (ACE_HOSTENT_DATA));
00087 
00088   if (::gethostbyaddr_r ((char *) addr, length, type, result,
00089                          (struct hostent_data *) buffer)== 0)
00090     return result;
00091   else
00092     {
00093       *h_errnop = h_errno;
00094       return (struct hostent *) 0;
00095     }
00096 # elif defined (__GLIBC__)
00097   // GNU C library has a different signature
00098   ACE_OS::memset (buffer, 0, sizeof (ACE_HOSTENT_DATA));
00099 
00100   if (::gethostbyaddr_r ((char *) addr,
00101                          length,
00102                          type,
00103                          result,
00104                          buffer,
00105                          sizeof (ACE_HOSTENT_DATA),
00106                          &result,
00107                          h_errnop) == 0)
00108     return result;
00109   else
00110     return (struct hostent *) 0;
00111 #   else
00112 #     if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
00113   ACE_UNUSED_ARG (result);
00114   ACE_UNUSED_ARG (h_errnop);
00115   ACE_NETDBCALL_RETURN (::gethostbyaddr (addr, (ACE_SOCKET_LEN) length, type),
00116                         struct hostent *, 0,
00117                         buffer, sizeof (ACE_HOSTENT_DATA));
00118 #     else
00119   ACE_SOCKCALL_RETURN (::gethostbyaddr_r (addr, length, type, result,
00120                                           buffer, sizeof (ACE_HOSTENT_DATA),
00121                                           h_errnop),
00122                        struct hostent *, 0);
00123 #     endif /* ACE_LACKS_NETDB_REENTRANT_FUNCTIONS */
00124 #   endif /* defined (AIX) || defined (DIGITAL_UNIX) */
00125 # elif defined (ACE_HAS_NONCONST_GETBY)
00126   ACE_UNUSED_ARG (result);
00127   ACE_UNUSED_ARG (buffer);
00128   ACE_UNUSED_ARG (h_errnop);
00129   ACE_SOCKCALL_RETURN (::gethostbyaddr (const_cast<char *> (addr),
00130                                         (ACE_SOCKET_LEN) length,
00131                                         type),
00132                        struct hostent *,
00133                        0);
00134 # else
00135   ACE_UNUSED_ARG (h_errnop);
00136   ACE_UNUSED_ARG (buffer);
00137   ACE_UNUSED_ARG (result);
00138 
00139   ACE_SOCKCALL_RETURN (::gethostbyaddr (addr,
00140                                         (ACE_SOCKET_LEN) length,
00141                                         type),
00142                        struct hostent *,
00143                        0);
00144 # endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE) */
00145 }

ACE_INLINE struct hostent * ACE_OS::gethostbyname const char *  name  ) 
 

Definition at line 152 of file OS_NS_netdb.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, ACE_SOCKCALL_RETURN, and gethostbyname().

Referenced by ACE::get_bcast_addr(), gethostbyname(), gethostbyname_r(), getipnodebyname(), getmacaddress(), ACE_SOCK_Dgram_Bcast::mk_broadcast(), and ACE_INET_Addr::set().

00153 {
00154   ACE_OS_TRACE ("ACE_OS::gethostbyname");
00155 # if defined (ACE_LACKS_GETHOSTBYNAME)
00156   ACE_UNUSED_ARG (name);
00157   ACE_NOTSUP_RETURN (0);
00158 # elif defined (ACE_HAS_NONCONST_GETBY)
00159   ACE_SOCKCALL_RETURN (::gethostbyname (const_cast<char *> (name)),
00160                        struct hostent *,
00161                        0);
00162 # else
00163   ACE_SOCKCALL_RETURN (::gethostbyname (name),
00164                        struct hostent *,
00165                        0);
00166 # endif /* ACE_HAS_NONCONST_GETBY */
00167 }

ACE_INLINE struct hostent * ACE_OS::gethostbyname_r const char *  name,
struct hostent *  result,
ACE_HOSTENT_DATA  buffer,
int *  h_errnop
 

Definition at line 174 of file OS_NS_netdb.inl.

References ACE_HOSTENT_DATA, ACE_NOTSUP_RETURN, ACE_OS_TRACE, ACE_SOCKCALL_RETURN, gethostbyname(), gethostbyname_r(), and memset().

Referenced by gethostbyname_r(), and ACE_INET_Addr::set().

00178 {
00179   ACE_OS_TRACE ("ACE_OS::gethostbyname_r");
00180 #if defined (ACE_LACKS_GETHOSTBYNAME)
00181   ACE_UNUSED_ARG (name);
00182   ACE_UNUSED_ARG (result);
00183   ACE_UNUSED_ARG (buffer);
00184   ACE_UNUSED_ARG (h_errnop);
00185   ACE_NOTSUP_RETURN (0);
00186 # elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
00187 #   if defined (DIGITAL_UNIX) || \
00188        (defined (ACE_AIX_MINOR_VERS) && (ACE_AIX_MINOR_VERS > 2))
00189   ACE_UNUSED_ARG (result);
00190   ACE_UNUSED_ARG (buffer);
00191   ACE_UNUSED_ARG (h_errnop);
00192 
00193   // gethostbyname returns thread-specific storage on Digital Unix and
00194   // AIX 4.3
00195   ACE_SOCKCALL_RETURN (::gethostbyname (name), struct hostent *, 0);
00196 #   elif defined (AIX)
00197   ACE_OS::memset (buffer, 0, sizeof (ACE_HOSTENT_DATA));
00198 
00199   if (::gethostbyname_r (name, result, (struct hostent_data *) buffer) == 0)
00200     return result;
00201   else
00202     {
00203       *h_errnop = h_errno;
00204       return (struct hostent *) 0;
00205     }
00206 # elif defined (__GLIBC__)
00207   // GNU C library has a different signature
00208   ACE_OS::memset (buffer, 0, sizeof (ACE_HOSTENT_DATA));
00209 
00210   if (::gethostbyname_r (name,
00211                          result,
00212                          buffer,
00213                          sizeof (ACE_HOSTENT_DATA),
00214                          &result,
00215                          h_errnop) == 0)
00216     return result;
00217   else
00218     return (struct hostent *) 0;
00219 #   else
00220 #     if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
00221   ACE_UNUSED_ARG (result);
00222   ACE_UNUSED_ARG (h_errnop);
00223   ACE_NETDBCALL_RETURN (::gethostbyname (name),
00224                         struct hostent *, 0,
00225                         buffer, sizeof (ACE_HOSTENT_DATA));
00226 #     else
00227   ACE_SOCKCALL_RETURN (::gethostbyname_r (name, result, buffer,
00228                                           sizeof (ACE_HOSTENT_DATA),
00229                                           h_errnop),
00230                        struct hostent *,
00231                        0);
00232 #     endif /* ACE_LACKS_NETDB_REENTRANT_FUNCTIONS */
00233 #   endif /* defined (AIX) || defined (DIGITAL_UNIX) */
00234 # elif defined (ACE_HAS_NONCONST_GETBY)
00235   ACE_UNUSED_ARG (result);
00236   ACE_UNUSED_ARG (buffer);
00237   ACE_UNUSED_ARG (h_errnop);
00238   ACE_SOCKCALL_RETURN (::gethostbyname (const_cast<char *> (name)),
00239                        struct hostent *,
00240                        0);
00241 # else
00242   ACE_UNUSED_ARG (result);
00243   ACE_UNUSED_ARG (buffer);
00244   ACE_UNUSED_ARG (h_errnop);
00245 
00246   ACE_SOCKCALL_RETURN (::gethostbyname (name),
00247                        struct hostent *,
00248                        0);
00249 # endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE) */
00250 }

ACE_INLINE ACE_hrtime_t ACE_OS::gethrtime const  ACE_HRTimer_Op = ACE_HRTIMER_GETTIME  ) 
 

Definition at line 206 of file OS_NS_time.inl.

References ACE_GETHRTIME_NAME, ACE_hrtime_t, ACE_ONE_SECOND_IN_NSECS, ACE_OS_TRACE, ACE_UINT64, clock_gettime(), CLOCK_REALTIME, gettimeofday(), memcpy(), ACE_Time_Value::sec(), timespec::tv_nsec, timespec::tv_sec, and ACE_Time_Value::usec().

Referenced by ACE_High_Res_Timer::calibrate(), ACE_High_Res_Timer::gettime(), ACE_Metrics_Cache< ACE_LOCK, ALLOCATOR >::report_dequeue_start(), ACE_Metrics_Cache< ACE_LOCK, ALLOCATOR >::report_dequeue_stop(), ACE_Metrics_Cache< ACE_LOCK, ALLOCATOR >::report_enqueue_start(), ACE_Metrics_Cache< ACE_LOCK, ALLOCATOR >::report_enqueue_stop(), and ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::timeprobe().

00207 {
00208   ACE_OS_TRACE ("ACE_OS::gethrtime");
00209 #if defined (ACE_HAS_HI_RES_TIMER)
00210   ACE_UNUSED_ARG (op);
00211   return ::gethrtime ();
00212 #elif defined (ACE_HAS_AIX_HI_RES_TIMER)
00213   ACE_UNUSED_ARG (op);
00214   timebasestruct_t tb;
00215 
00216   ::read_real_time(&tb, TIMEBASE_SZ);
00217   ::time_base_to_time(&tb, TIMEBASE_SZ);
00218 
00219   return ACE_hrtime_t(tb.tb_high) * ACE_ONE_SECOND_IN_NSECS + tb.tb_low;
00220 #elif defined (ghs) && defined (ACE_HAS_PENTIUM) && !defined (ACE_WIN32)
00221   ACE_UNUSED_ARG (op);
00222   // Use .obj/gethrtime.o, which was compiled with g++.
00223   return ACE_GETHRTIME_NAME ();
00224 #elif (defined(__KCC) || defined (__GNUG__) || defined (__INTEL_COMPILER)) && !defined (ACE_WIN32) && !defined(ACE_VXWORKS) && defined (ACE_HAS_PENTIUM)
00225   ACE_UNUSED_ARG (op);
00226 # if defined (ACE_LACKS_LONGLONG_T)
00227   double now;
00228 # else  /* ! ACE_LACKS_LONGLONG_T */
00229   ACE_hrtime_t now;
00230 # endif /* ! ACE_LACKS_LONGLONG_T */
00231 
00232   // See comments about the RDTSC Pentium instruction for the ACE_WIN32
00233   // version of ACE_OS::gethrtime (), below.
00234   //
00235   // Read the high-res tick counter directly into memory variable "now".
00236   // The A constraint signifies a 64-bit int.
00237   asm volatile ("rdtsc" : "=A" (now) : : "memory");
00238 
00239 # if defined (ACE_LACKS_LONGLONG_T)
00240   ACE_UINT32 least, most;
00241   ACE_OS::memcpy (&least, &now, sizeof (ACE_UINT32));
00242   ACE_OS::memcpy (&most, (u_char *) &now + sizeof (ACE_UINT32),
00243                   sizeof (ACE_UINT32));
00244 
00245   ACE_hrtime_t ret (least, most);
00246   return ret;
00247 # else  /* ! ACE_LACKS_LONGLONG_T */
00248   return now;
00249 # endif /* ! ACE_LACKS_LONGLONG_T */
00250 #elif defined (linux) && defined (ACE_HAS_ALPHA_TIMER)
00251   // NOTE:  alphas only have a 32 bit tick (cycle) counter.  The rpcc
00252   // instruction actually reads 64 bits, but the high 32 bits are
00253   // implementation-specific.  Linux and Digital Unix, for example,
00254   // use them for virtual tick counts, i.e., taking into account only
00255   // the time that the process was running.  This information is from
00256   // David Mosberger's article, see comment below.
00257   ACE_UINT32 now;
00258 
00259   // The following statement is based on code published by:
00260   // Mosberger, David, "How to Make Your Applications Fly, Part 1",
00261   // Linux Journal Issue 42, October 1997, page 50.  It reads the
00262   // high-res tick counter directly into the memory variable.
00263   asm volatile ("rpcc %0" : "=r" (now) : : "memory");
00264 
00265   return now;
00266 #elif defined (ACE_WIN32)
00267   ACE_UNUSED_ARG(op);
00268   LARGE_INTEGER freq;
00269 
00270   ::QueryPerformanceCounter (&freq);
00271 
00272 #  if defined (ACE_LACKS_LONGLONG_T)
00273   ACE_UINT64 uint64_freq (freq.u.LowPart,
00274                           static_cast<unsigned int> (freq.u.HighPart));
00275   return uint64_freq;
00276 #  else
00277   return freq.QuadPart;
00278 #  endif //ACE_LACKS_LONGLONG_T
00279 
00280 #elif defined (ACE_HAS_POWERPC_TIMER) && (defined (ghs) || defined (__GNUG__))
00281   // PowerPC w/ GreenHills or g++.
00282 
00283   ACE_UNUSED_ARG (op);
00284   u_long most;
00285   u_long least;
00286 
00287 #if defined (ghs)
00288   ACE_OS::readPPCTimeBase (most, least);
00289 #else
00290   u_long scratch;
00291 
00292   do {
00293     asm volatile ("mftbu %0\n"
00294           "mftb  %1\n"
00295           "mftbu %2"
00296           : "=r" (most), "=r" (least), "=r" (scratch));
00297   } while (most != scratch);
00298 #endif
00299 
00300 #if defined (ACE_LACKS_LONGLONG_T)
00301   return ACE_U_LongLong (least, most);
00302 #else  /* ! ACE_LACKS_LONGLONG_T */
00303   return 0x100000000llu * most  +  least;
00304 #endif /* ! ACE_LACKS_LONGLONG_T */
00305 
00306 #elif defined (ACE_HAS_CLOCK_GETTIME)
00307   // e.g., VxWorks (besides POWERPC && GreenHills) . . .
00308   ACE_UNUSED_ARG (op);
00309   struct timespec ts;
00310 
00311   ACE_OS::clock_gettime (
00312 #if defined (ACE_HAS_CLOCK_GETTIME_MONOTONIC)
00313          CLOCK_MONOTONIC,
00314 #endif /* !ACE_HAS_CLOCK_GETTIME_MONOTONIC */
00315          CLOCK_REALTIME,
00316          &ts);
00317 
00318   // Carefully create the return value to avoid arithmetic overflow
00319   // if ACE_hrtime_t is ACE_U_LongLong.
00320   return static_cast<ACE_hrtime_t> (ts.tv_sec) *
00321     ACE_U_ONE_SECOND_IN_NSECS  +  static_cast<ACE_hrtime_t> (ts.tv_nsec);
00322 #else
00323   ACE_UNUSED_ARG (op);
00324   const ACE_Time_Value now = ACE_OS::gettimeofday ();
00325 
00326   // Carefully create the return value to avoid arithmetic overflow
00327   // if ACE_hrtime_t is ACE_U_LongLong.
00328   return (static_cast<ACE_hrtime_t> (now.sec ()) * (ACE_UINT32) 1000000  +
00329           static_cast<ACE_hrtime_t> (now.usec ())) * (ACE_UINT32) 1000;
00330 #endif /* ACE_HAS_HI_RES_TIMER */
00331 }

ACE_INLINE struct hostent * ACE_OS::getipnodebyaddr const void *  src,
size_t  len,
int  family
 

Definition at line 255 of file OS_NS_netdb.inl.

References ACE_NOTSUP_RETURN, and gethostbyaddr().

00256 {
00257 #if defined (ACE_HAS_IPV6) && !defined (ACE_WIN32)
00258 #  if defined (ACE_LACKS_GETIPNODEBYADDR)
00259   ACE_UNUSED_ARG (src);
00260   ACE_UNUSED_ARG (len);
00261   ACE_UNUSED_ARG (family);
00262   ACE_NOTSUP_RETURN (0);
00263 #  else
00264   struct hostent *hptr;
00265   int errnum;
00266   if ((hptr = ::getipnodebyaddr (src, len, family, &errnum)) == 0)
00267     {
00268       errno = errnum;
00269     }
00270   return hptr;
00271 #  endif /* ACE_LACKS_GETIPNODEBYADDR */
00272 #else
00273   // IPv4-only implementation
00274   if (family == AF_INET)
00275     return ACE_OS::gethostbyaddr (static_cast<const char *> (src),
00276                                   static_cast<int> (len),
00277                                   family);
00278 
00279   ACE_NOTSUP_RETURN (0);
00280 # endif /* defined (ACE_HAS_IPV6) && !defined (ACE_WIN32) */
00281 }

ACE_INLINE struct hostent * ACE_OS::getipnodebyname const char *  name,
int  family,
int  flags = 0
 

Definition at line 284 of file OS_NS_netdb.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, ACE_SOCKCALL_RETURN, and gethostbyname().

00285 {
00286   ACE_OS_TRACE ("ACE_OS::getipnodebyname");
00287 # if defined (ACE_HAS_IPV6) && !defined (ACE_WIN32)
00288 #   if defined (ACE_LACKS_GETIPNODEBYNAME)
00289   ACE_UNUSED_ARG (flags);
00290 #     if defined (ACE_HAS_NONCONST_GETBY)
00291   ACE_SOCKCALL_RETURN (::gethostbyname2 (const_cast<char *> (name),
00292                                          family),
00293                        struct hostent *, 0);
00294 #     else
00295   ACE_SOCKCALL_RETURN (::gethostbyname2 (name, family),
00296                        struct hostent *, 0);
00297 #     endif /* ACE_HAS_NONCONST_GETBY */
00298 #   else
00299   struct hostent *hptr;
00300   int errnum;
00301   if ((hptr = ::getipnodebyname (name, family, flags, &errnum)) == 0)
00302     {
00303       errno = errnum;
00304     }
00305   return hptr;
00306 #   endif /* ACE_LACKS_GETIPNODEBYNAME */
00307 # else
00308   // IPv4-only implementation
00309   ACE_UNUSED_ARG (flags);
00310   if (family == AF_INET)
00311     return ACE_OS::gethostbyname (name);
00312 
00313   ACE_NOTSUP_RETURN (0);
00314 # endif /* defined (ACE_HAS_IPV6) && !defined (ACE_WIN32) */
00315 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_END_VERSIONED_NAMESPACE_DECL ACE_BEGIN_VERSIONED_NAMESPACE_DECL int ACE_OS::getmacaddress struct macaddr_node_t *  node  ) 
 

Definition at line 213 of file OS_NS_netdb.cpp.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, ACE_TCHAR, close(), gethostbyname(), hostname(), ioctl(), MAXHOSTNAMELEN, memcpy(), memset(), ACE_OS::macaddr_node_t::node, socket(), sprintf(), and strcpy().

Referenced by ACE_Utils::UUID_Generator::init().

00214 {
00215   ACE_OS_TRACE ("ACE_OS::getmacaddress");
00216 
00217 #if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
00218 # if !defined (ACE_HAS_PHARLAP)
00219     /** Define a structure for use with the netbios routine */
00220     struct ADAPTERSTAT
00221     {
00222       ADAPTER_STATUS adapt;
00223       NAME_BUFFER    NameBuff [30];
00224     };
00225 
00226     NCB         ncb;
00227     LANA_ENUM   lenum;
00228     unsigned char result;
00229 
00230     ACE_OS::memset (&ncb, 0, sizeof(ncb));
00231     ncb.ncb_command = NCBENUM;
00232     ncb.ncb_buffer  = reinterpret_cast<unsigned char*> (&lenum);
00233     ncb.ncb_length  = sizeof(lenum);
00234 
00235     result = Netbios (&ncb);
00236 
00237     for(int i = 0; i < lenum.length; i++)
00238       {
00239         ACE_OS::memset (&ncb, 0, sizeof(ncb));
00240         ncb.ncb_command  = NCBRESET;
00241         ncb.ncb_lana_num = lenum.lana [i];
00242 
00243         /** Reset the netbios */
00244         result = Netbios (&ncb);
00245 
00246         if (ncb.ncb_retcode != NRC_GOODRET)
00247         {
00248           return -1;
00249         }
00250 
00251         ADAPTERSTAT adapter;
00252         ACE_OS::memset (&ncb, 0, sizeof (ncb));
00253         ACE_OS::strcpy (reinterpret_cast<char*> (ncb.ncb_callname), "*");
00254         ncb.ncb_command     = NCBASTAT;
00255         ncb.ncb_lana_num    = lenum.lana[i];
00256         ncb.ncb_buffer      = reinterpret_cast<unsigned char*> (&adapter);
00257         ncb.ncb_length      = sizeof (adapter);
00258 
00259         result = Netbios (&ncb);
00260 
00261         if (result == 0)
00262         {
00263           ACE_OS::memcpy (node->node,
00264               adapter.adapt.adapter_address,
00265               6);
00266           return 0;
00267         }
00268       }
00269     return 0;
00270 # else
00271 #   if defined (ACE_HAS_PHARLAP_RT)
00272       DEVHANDLE ip_dev = (DEVHANDLE)0;
00273       EK_TCPIPCFG *devp;
00274       size_t i;
00275       ACE_TCHAR dev_name[16];
00276 
00277       for (i = 0; i < 10; i++)
00278         {
00279           // Ethernet.
00280           ACE_OS::sprintf (dev_name,
00281                            "ether%d",
00282                            i);
00283           ip_dev = EtsTCPGetDeviceHandle (dev_name);
00284           if (ip_dev != 0)
00285             break;
00286         }
00287       if (ip_dev == 0)
00288         return -1;
00289       devp = EtsTCPGetDeviceCfg (ip_dev);
00290       if (devp == 0)
00291         return -1;
00292       ACE_OS::memcpy (node->node,
00293             &devp->EthernetAddress[0],
00294             6);
00295       return 0;
00296 #   else
00297       ACE_UNUSED_ARG (node);
00298       ACE_NOTSUP_RETURN (-1);
00299 #   endif /* ACE_HAS_PHARLAP_RT */
00300 # endif /* ACE_HAS_PHARLAP */
00301 #elif defined (sun)
00302 
00303   /** obtain the local host name */
00304   char hostname [MAXHOSTNAMELEN];
00305   ACE_OS::hostname (hostname, sizeof (hostname));
00306 
00307   /** Get the hostent to use with ioctl */
00308   struct hostent *phost =
00309     ACE_OS::gethostbyname (hostname);
00310 
00311   if (phost == 0)
00312     return -1;
00313 
00314   ACE_HANDLE handle =
00315     ACE_OS::socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP);
00316 
00317   if (handle == ACE_INVALID_HANDLE)
00318     return -1;
00319 
00320   char **paddrs = phost->h_addr_list;
00321 
00322   struct arpreq ar;
00323 
00324   struct sockaddr_in *psa =
00325     (struct sockaddr_in *)&(ar.arp_pa);
00326 
00327   ACE_OS::memset (&ar,
00328                   0,
00329                   sizeof (struct arpreq));
00330 
00331   psa->sin_family = AF_INET;
00332 
00333   ACE_OS::memcpy (&(psa->sin_addr),
00334                   *paddrs,
00335                   sizeof (struct in_addr));
00336 
00337   if (ACE_OS::ioctl (handle,
00338                      SIOCGARP,
00339                      &ar) == -1)
00340     {
00341       ACE_OS::close (handle);
00342       return -1;
00343     }
00344 
00345   ACE_OS::close (handle);
00346 
00347   ACE_OS::memcpy (node->node,
00348                   ar.arp_ha.sa_data,
00349                   6);
00350 
00351   return 0;
00352 
00353 #elif defined (linux)
00354 
00355   struct ifreq ifr;
00356 
00357   ACE_HANDLE handle =
00358     ACE_OS::socket (PF_INET, SOCK_DGRAM, 0);
00359 
00360   if (handle == ACE_INVALID_HANDLE)
00361     return -1;
00362 
00363   ACE_OS::strcpy (ifr.ifr_name, "eth0");
00364 
00365   if (ACE_OS::ioctl (handle/*s*/, SIOCGIFHWADDR, &ifr) < 0)
00366     {
00367       ACE_OS::close (handle);
00368       return -1;
00369     }
00370 
00371   struct sockaddr* sa =
00372     (struct sockaddr *) &ifr.ifr_addr;
00373 
00374   ACE_OS::close (handle);
00375 
00376   ACE_OS::memcpy (node->node,
00377                   sa->sa_data,
00378                   6);
00379 
00380   return 0;
00381 
00382 #else
00383   ACE_UNUSED_ARG (node);
00384   ACE_NOTSUP_RETURN (-1);
00385 #endif
00386 }

ACE_INLINE int ACE_OS::getmsg ACE_HANDLE  handle,
struct strbuf ctl,
struct strbuf data,
int *  flags
 

Definition at line 39 of file OS_NS_stropts.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and getmsg().

Referenced by getmsg(), ACE_SPIPE_Stream::recv(), and ACE_FIFO_Recv_Msg::recv().

00043 {
00044   ACE_OS_TRACE ("ACE_OS::getmsg");
00045 #if defined (ACE_HAS_STREAM_PIPES)
00046   ACE_OSCALL_RETURN (::getmsg (handle, ctl, data, flags), int, -1);
00047 #else
00048   ACE_UNUSED_ARG (handle);
00049   ACE_UNUSED_ARG (ctl);
00050   ACE_UNUSED_ARG (data);
00051   ACE_UNUSED_ARG (flags);
00052 
00053   // I'm not sure how to implement this correctly.
00054   ACE_NOTSUP_RETURN (-1);
00055 #endif /* ACE_HAS_STREAM_PIPES */
00056 }

ACE_INLINE int ACE_OS::getopt int  argc,
char *const *  argv,
const char *  optstring
 

Definition at line 434 of file OS_NS_unistd.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and getopt().

Referenced by getopt().

00435 {
00436   ACE_OS_TRACE ("ACE_OS::getopt");
00437 #if defined (ACE_LACKS_GETOPT)
00438   ACE_UNUSED_ARG (argc);
00439   ACE_UNUSED_ARG (argv);
00440   ACE_UNUSED_ARG (optstring);
00441   ACE_NOTSUP_RETURN (-1);
00442 # else
00443   ACE_OSCALL_RETURN (::getopt (argc, argv, optstring), int, -1);
00444 # endif /* ACE_LACKS_GETOPT */
00445 }

ACE_INLINE long ACE_OS::getpagesize void   ) 
 

Definition at line 91 of file OS_NS_unistd.inl.

References ACE_OS_TRACE.

Referenced by allocation_granularity(), ACE_WIN32_Asynch_Write_File_Result::complete(), ACE_WIN32_Asynch_Read_File_Result::complete(), ACE_WIN32_Asynch_Read_File::readv(), ACE::round_to_pagesize(), and ACE_WIN32_Asynch_Write_File::writev().

00092 {
00093   ACE_OS_TRACE ("ACE_OS::getpagesize");
00094 #if defined (ACE_WIN32) && !defined (ACE_HAS_PHARLAP)
00095   SYSTEM_INFO sys_info;
00096   ::GetSystemInfo (&sys_info);
00097   return (long) sys_info.dwPageSize;
00098 #elif defined (_SC_PAGESIZE)
00099   return ::sysconf (_SC_PAGESIZE);
00100 #elif defined (ACE_HAS_GETPAGESIZE)
00101   return ::getpagesize ();
00102 #else
00103   // Use the default set in config.h
00104   return ACE_PAGE_SIZE;
00105 #endif /* ACE_WIN32 */
00106 }

ACE_INLINE int ACE_OS::getpeername ACE_HANDLE  handle,
struct sockaddr *  addr,
int *  addrlen
 

BSD-style (no QoS).

Definition at line 146 of file OS_NS_sys_socket.inl.

References ACE_OS_TRACE, ACE_SOCKCALL, ACE_SOCKCALL_RETURN, ACE_SOCKET_LEN, getpeername(), and memset().

Referenced by ACE_SOCK_SEQPACK_Connector::complete(), ACE_SOCK_Connector::complete(), ACE_ATM_Stream::get_peer_name(), ACE_SOCK::get_remote_addr(), ACE_SOCK_SEQPACK_Association::get_remote_addrs(), getpeername(), and ACE_Asynch_Connector< HANDLER >::parse_address().

00148 {
00149   ACE_OS_TRACE ("ACE_OS::getpeername");
00150 
00151 #if defined (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO) \
00152          && (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO == 1)
00153   int result;
00154   ACE_SOCKCALL (::getpeername ((ACE_SOCKET) handle,
00155                                addr,
00156                                (ACE_SOCKET_LEN *) addrlen),
00157                int,
00158                 -1,
00159                 result);
00160 
00161   // Some platforms, like older versions of the Linux kernel, do not
00162   // initialize the sin_zero field since that field is generally only
00163   // used for padding/alignment purposes.  On those platforms
00164   // memcmp()-based comparisons of the sockaddr_in structure, such as
00165   // the one in the ACE_INET_Addr equality operator, may fail due to
00166   // random bytes in the sin_zero field even though that field is
00167   // unused.  Prevent equality comparison of two different sockaddr_in
00168   // instances that refer to the same socket from failing by
00169   // explicitly initializing the sockaddr_in::sin_zero field to a
00170   // consistent value, e.g. zero.
00171   if (result != -1 && addr->sa_family == AF_INET)
00172     {
00173       ACE_OS::memset (reinterpret_cast<struct sockaddr_in *> (addr)->sin_zero,
00174                       0,
00175                       sizeof (reinterpret_cast<struct sockaddr_in *> (addr)->sin_zero));
00176     }
00177 
00178   return result;
00179 #else
00180   ACE_SOCKCALL_RETURN (::getpeername ((ACE_SOCKET) handle,
00181                                       addr,
00182                                       (ACE_SOCKET_LEN *) addrlen),
00183                        int,
00184                        -1);
00185 #endif /* ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO */
00186 }

ACE_INLINE pid_t ACE_OS::getpgid pid_t  pid  ) 
 

Definition at line 448 of file OS_NS_unistd.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, getpgid(), and pid_t.

Referenced by getpgid().

00449 {
00450   ACE_OS_TRACE ("ACE_OS::getpgid");
00451 #if defined (ACE_LACKS_GETPGID)
00452   ACE_UNUSED_ARG (pid);
00453   ACE_NOTSUP_RETURN (-1);
00454 #elif defined (linux) && __GLIBC__ > 1 && __GLIBC_MINOR__ >= 0
00455   // getpgid() is from SVR4, which appears to be the reason why GLIBC
00456   // doesn't enable its prototype by default.
00457   // Rather than create our own extern prototype, just use the one
00458   // that is visible (ugh).
00459   ACE_OSCALL_RETURN (::__getpgid (pid), pid_t, -1);
00460 #else
00461   ACE_OSCALL_RETURN (::getpgid (pid), pid_t, -1);
00462 #endif /* ACE_LACKS_GETPGID */
00463 }

ACE_INLINE pid_t ACE_OS::getpid void   ) 
 

Definition at line 466 of file OS_NS_unistd.inl.

References ACE_NOTSUP_RETURN.

Referenced by ACE_IPC_SAP::enable(), ACE_IO_SAP::enable(), ACE_Log_Msg::getpid(), ACE_SPIPE_Stream::recv_handle(), and ACE_Log_Msg::sync().

00467 {
00468   // ACE_OS_TRACE ("ACE_OS::getpid");
00469 #if defined (ACE_LACKS_GETPID)
00470   ACE_NOTSUP_RETURN (-1);
00471 #elif defined (ACE_WIN32)
00472   return ::GetCurrentProcessId ();
00473 #else
00474   ACE_OSCALL_RETURN (::getpid (), int, -1);
00475 #endif /* ACE_LACKS_GETPID */
00476 }

ACE_INLINE int ACE_OS::getpmsg ACE_HANDLE  handle,
struct strbuf ctl,
struct strbuf data,
int *  band,
int *  flags
 

Definition at line 59 of file OS_NS_stropts.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and getpmsg().

Referenced by getpmsg(), and ACE_SPIPE_Stream::recv().

00064 {
00065   ACE_OS_TRACE ("ACE_OS::getpmsg");
00066 #if defined (ACE_HAS_STREAM_PIPES)
00067   ACE_OSCALL_RETURN (::getpmsg (handle, ctl, data, band, flags), int, -1);
00068 #else
00069   ACE_UNUSED_ARG (handle);
00070   ACE_UNUSED_ARG (ctl);
00071   ACE_UNUSED_ARG (data);
00072   ACE_UNUSED_ARG (band);
00073   ACE_UNUSED_ARG (flags);
00074 
00075   // I'm not sure how to implement this correctly.
00076   ACE_NOTSUP_RETURN (-1);
00077 #endif /* ACE_HAS_STREAM_PIPES */
00078 }

ACE_INLINE pid_t ACE_OS::getppid void   ) 
 

Definition at line 479 of file OS_NS_unistd.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, getppid(), and pid_t.

Referenced by getppid().

00480 {
00481   ACE_OS_TRACE ("ACE_OS::getppid");
00482 #if defined (ACE_LACKS_GETPPID)
00483   ACE_NOTSUP_RETURN (-1);
00484 #else
00485   ACE_OSCALL_RETURN (::getppid (), pid_t, -1);
00486 #endif /* ACE_LACKS_GETPPID */
00487 }

ACE_INLINE struct protoent * ACE_OS::getprotobyname const char *  name  ) 
 

Definition at line 318 of file OS_NS_netdb.inl.

References ACE_NOTSUP_RETURN, ACE_SOCKCALL_RETURN, and getprotobyname().

Referenced by getprotobyname(), and getprotobyname_r().

00319 {
00320 #if defined (ACE_LACKS_GETPROTOBYNAME)
00321   ACE_UNUSED_ARG (name);
00322   ACE_NOTSUP_RETURN (0);
00323 #elif defined (ACE_HAS_NONCONST_GETBY)
00324   ACE_SOCKCALL_RETURN (::getprotobyname (const_cast<char *> (name)),
00325                        struct protoent *,
00326                        0);
00327 #else
00328   ACE_SOCKCALL_RETURN (::getprotobyname (name),
00329                        struct protoent *,
00330                        0);
00331 #endif /* ACE_LACKS_GETPROTOBYNAME */
00332 }

ACE_INLINE struct protoent * ACE_OS::getprotobyname_r const char *  name,
struct protoent *  result,
ACE_PROTOENT_DATA  buffer
 

Definition at line 335 of file OS_NS_netdb.inl.

References ACE_NOTSUP_RETURN, ACE_PROTOENT_DATA, ACE_SOCKCALL_RETURN, getprotobyname(), and getprotobyname_r().

Referenced by getprotobyname_r().

00338 {
00339 #if defined (ACE_LACKS_GETPROTOBYNAME)
00340   ACE_UNUSED_ARG (name);
00341   ACE_UNUSED_ARG (result);
00342   ACE_UNUSED_ARG (buffer);
00343   ACE_NOTSUP_RETURN (0);
00344 #elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
00345 # if defined (AIX) || defined (DIGITAL_UNIX)
00346   if (::getprotobyname_r (name, result, (struct protoent_data *) buffer) == 0)
00347     return result;
00348   else
00349     return 0;
00350 # elif defined (__GLIBC__)
00351   // GNU C library has a different signature
00352   if (::getprotobyname_r (name,
00353                           result,
00354                           buffer,
00355                           sizeof (ACE_PROTOENT_DATA),
00356                           &result) == 0)
00357     return result;
00358   else
00359     return 0;
00360 # else
00361 #   if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
00362   ACE_UNUSED_ARG (result);
00363   ACE_NETDBCALL_RETURN (::getprotobyname (name),
00364                         struct protoent *, 0,
00365                         buffer, sizeof (ACE_PROTOENT_DATA));
00366 #   else
00367     ACE_SOCKCALL_RETURN (::getprotobyname_r (name,
00368                                              result,
00369                                              buffer,
00370                                              sizeof (ACE_PROTOENT_DATA)),
00371                        struct protoent *, 0);
00372 #   endif /* ACE_LACKS_NETDB_REENTRANT_FUNCTIONS */
00373 # endif /* defined (AIX) || defined (DIGITAL_UNIX) */
00374 #elif defined (ACE_HAS_NONCONST_GETBY)
00375   ACE_UNUSED_ARG (result);
00376   ACE_UNUSED_ARG (buffer);
00377   ACE_SOCKCALL_RETURN (::getprotobyname (const_cast<char *> (name)),
00378                        struct protoent *, 0);
00379 #else
00380   ACE_UNUSED_ARG (buffer);
00381   ACE_UNUSED_ARG (result);
00382 
00383   ACE_SOCKCALL_RETURN (::getprotobyname (name),
00384                        struct protoent *,
00385                        0);
00386 #endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) !defined (UNIXWARE) */
00387 }

ACE_INLINE struct protoent * ACE_OS::getprotobynumber int  proto  ) 
 

Definition at line 390 of file OS_NS_netdb.inl.

References ACE_NOTSUP_RETURN, ACE_SOCKCALL_RETURN, and getprotobynumber().

Referenced by getprotobynumber(), and getprotobynumber_r().

00391 {
00392 #if defined (ACE_LACKS_GETPROTOBYNUMBER)
00393   ACE_UNUSED_ARG (proto);
00394   ACE_NOTSUP_RETURN (0);
00395 #else
00396   ACE_SOCKCALL_RETURN (::getprotobynumber (proto),
00397                        struct protoent *, 0);
00398 #endif /* ACE_LACKS_GETPROTOBYNUMBER */
00399 }

ACE_INLINE struct protoent * ACE_OS::getprotobynumber_r int  proto,
struct protoent *  result,
ACE_PROTOENT_DATA  buffer
 

Definition at line 402 of file OS_NS_netdb.inl.

References ACE_NOTSUP_RETURN, ACE_PROTOENT_DATA, ACE_SOCKCALL_RETURN, getprotobynumber(), and getprotobynumber_r().

Referenced by getprotobynumber_r().

00405 {
00406 #if defined (ACE_LACKS_GETPROTOBYNUMBER)
00407   ACE_UNUSED_ARG (proto);
00408   ACE_UNUSED_ARG (result);
00409   ACE_UNUSED_ARG (buffer);
00410   ACE_NOTSUP_RETURN (0);
00411 #elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
00412 # if defined (AIX) || defined (DIGITAL_UNIX)
00413   if (::getprotobynumber_r (proto, result, (struct protoent_data *) buffer) == 0)
00414     return result;
00415   else
00416     return 0;
00417 # elif defined (__GLIBC__)
00418   // GNU C library has a different signature
00419   if (::getprotobynumber_r (proto,
00420                             result,
00421                             buffer,
00422                             sizeof (ACE_PROTOENT_DATA),
00423                             &result) == 0)
00424     return result;
00425   else
00426     return 0;
00427 # else
00428 #   if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
00429   ACE_UNUSED_ARG (result);
00430   ACE_NETDBCALL_RETURN (::getprotobynumber (proto),
00431                         struct protoent *, 0,
00432                         buffer, sizeof (ACE_PROTOENT_DATA));
00433 #   else
00434   ACE_SOCKCALL_RETURN (::getprotobynumber_r (proto, result, buffer, sizeof (ACE_PROTOENT_DATA)),
00435                        struct protoent *, 0);
00436 #   endif /* ACE_LACKS_NETDB_REENTRANT_FUNCTIONS */
00437 # endif /* defined (AIX) || defined (DIGITAL_UNIX) */
00438 #else
00439   ACE_UNUSED_ARG (buffer);
00440   ACE_UNUSED_ARG (result);
00441 
00442   ACE_SOCKCALL_RETURN (::getprotobynumber (proto),
00443                        struct protoent *, 0);
00444 #endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE) */
00445 }

ACE_INLINE struct passwd * ACE_OS::getpwent void   ) 
 

Definition at line 20 of file OS_NS_pwd.inl.

References ACE_NOTSUP_RETURN.

00021 {
00022 #if !defined (ACE_LACKS_PWD_FUNCTIONS)
00023   return ::getpwent ();
00024 #else
00025   ACE_NOTSUP_RETURN (0);
00026 #endif /* ! ACE_LACKS_PWD_FUNCTIONS */
00027 }

ACE_INLINE struct passwd * ACE_OS::getpwnam const char *  user  ) 
 

Definition at line 30 of file OS_NS_pwd.inl.

References ACE_NOTSUP_RETURN.

00031 {
00032 #if !defined (ACE_LACKS_PWD_FUNCTIONS)
00033   return ::getpwnam (name);
00034 # else
00035   ACE_UNUSED_ARG (name);
00036   ACE_NOTSUP_RETURN (0);
00037 #endif /* ACE_LACKS_PWD_FUNCTIONS */
00038 }

ACE_INLINE struct passwd * ACE_OS::getpwnam_r const char *  name,
struct passwd *  pwent,
char *  buffer,
int  buflen
 

Definition at line 41 of file OS_NS_pwd.inl.

References ACE_NOTSUP_RETURN.

00043 {
00044 #if defined (ACE_HAS_POSIX_GETPWNAM_R)
00045   struct passwd *result;
00046   int status;
00047 
00048   status = ::getpwnam_r (name, pwent, buffer, buflen, &result);
00049 
00050   if (status != 0)
00051   {
00052     errno = status;
00053     result = 0;
00054   }
00055   return result;
00056 #elif !defined (ACE_LACKS_PWD_FUNCTIONS)
00057 # if defined (ACE_HAS_REENTRANT_FUNCTIONS)
00058 #   if !defined (ACE_LACKS_PWD_REENTRANT_FUNCTIONS)
00059 #     if defined (ACE_HAS_PTHREADS_STD) && \
00060       !defined (ACE_HAS_STHREADS) || \
00061       defined (HPUX_11)  || \
00062       defined (__USLC__) // Added by Roland Gigler for SCO UnixWare 7.
00063   struct passwd *result;
00064   int status;
00065 #       if defined (DIGITAL_UNIX)
00066   ::_Pgetpwnam_r (name, pwent, buffer, buflen, &result);
00067 #       else
00068   // VAC++ doesn't correctly grok the ::getpwnam_r - the function is redefined
00069   // in pwd.h, and that redefinition is used here
00070 #         if defined (__IBMCPP__) && (__IBMCPP__ >= 400)   /* VAC++ 4 */
00071   status = _posix_getpwnam_r (name, pwent, buffer, buflen, &result);
00072 #         else
00073   status = ::getpwnam_r (name, pwent, buffer, buflen, &result);
00074 #         endif /* __IBMCPP__ && (__IBMCPP__ >= 400) */
00075   if (status != 0)
00076     {
00077       errno = status;
00078       result = 0;
00079     }
00080 #       endif /* (DIGITAL_UNIX) */
00081   return result;
00082 #     elif defined (AIX)
00083   if (::getpwnam_r (name, pwent, buffer, buflen) == -1)
00084     return 0;
00085   else
00086     return pwent;
00087 #     else
00088   return ::getpwnam_r (name, pwent, buffer, buflen);
00089 #     endif /* ACE_HAS_PTHREADS_STD */
00090 #   else
00091   ACE_UNUSED_ARG (name);
00092   ACE_UNUSED_ARG (pwent);
00093   ACE_UNUSED_ARG (buffer);
00094   ACE_UNUSED_ARG (buflen);
00095   ACE_NOTSUP_RETURN (0);
00096 #   endif /* ! ACE_LACKS_PWD_REENTRANT_FUNCTIONS */
00097 # else
00098   ACE_UNUSED_ARG (name);
00099   ACE_UNUSED_ARG (pwent);
00100   ACE_UNUSED_ARG (buffer);
00101   ACE_UNUSED_ARG (buflen);
00102   ACE_NOTSUP_RETURN (0);
00103 # endif /* ACE_HAS_REENTRANT_FUNCTIONS */
00104 #else
00105   ACE_UNUSED_ARG (name);
00106   ACE_UNUSED_ARG (pwent);
00107   ACE_UNUSED_ARG (buffer);
00108   ACE_UNUSED_ARG (buflen);
00109   ACE_NOTSUP_RETURN (0);
00110 #endif /* ACE_HAS_POSIX_GETPWNAM_R */
00111 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_OS::getrlimit int  resource,
struct rlimit *  rl
 

Definition at line 11 of file OS_NS_sys_resource.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and getrlimit().

Referenced by getrlimit(), ACE::max_handles(), and ACE::set_handle_limit().

00012 {
00013   ACE_OS_TRACE ("ACE_OS::getrlimit");
00014 
00015 #if defined (ACE_LACKS_RLIMIT)
00016   ACE_UNUSED_ARG (resource);
00017   ACE_UNUSED_ARG (rl);
00018 
00019   ACE_NOTSUP_RETURN (-1);
00020 #else
00021 # if defined (ACE_HAS_RLIMIT_RESOURCE_ENUM)
00022   ACE_OSCALL_RETURN (::getrlimit ((ACE_HAS_RLIMIT_RESOURCE_ENUM) resource, rl), int, -1);
00023 # else
00024   ACE_OSCALL_RETURN (::getrlimit (resource, rl), int, -1);
00025 # endif /* ACE_HAS_RLIMIT_RESOURCE_ENUM */
00026 #endif /* ACE_LACKS_RLIMIT */
00027 }

ACE_INLINE int ACE_OS::getrusage int  who,
struct rusage rusage
 

Definition at line 30 of file OS_NS_sys_resource.inl.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, ACE_OS_TRACE, getrusage(), rusage::ru_stime, and rusage::ru_utime.

Referenced by getrusage(), ACE_Profile_Timer::start(), and ACE_Profile_Timer::stop().

00031 {
00032   ACE_OS_TRACE ("ACE_OS::getrusage");
00033 
00034 #if defined (ACE_HAS_SYSCALL_GETRUSAGE)
00035   // This nonsense is necessary for HP/UX...
00036   ACE_OSCALL_RETURN (::syscall (SYS_GETRUSAGE, who, ru), int, -1);
00037 #elif defined (ACE_HAS_GETRUSAGE)
00038 # if defined (ACE_WIN32)
00039   ACE_UNUSED_ARG (who);
00040 
00041   FILETIME dummy_1;
00042   FILETIME dummy_2;
00043   ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::GetProcessTimes (::GetCurrentProcess(),
00044                                                              &dummy_1,   // start
00045                                                              &dummy_2,     // exited
00046                                                              &ru->ru_stime,
00047                                                              &ru->ru_utime),
00048                                           ace_result_),
00049                         int, -1);
00050 # else
00051 #   if defined (ACE_HAS_RUSAGE_WHO_ENUM)
00052   ACE_OSCALL_RETURN (::getrusage ((ACE_HAS_RUSAGE_WHO_ENUM) who, ru), int, -1);
00053 #   else
00054   ACE_OSCALL_RETURN (::getrusage (who, ru), int, -1);
00055 #   endif /* ACE_HAS_RUSAGE_WHO_ENUM */
00056 # endif /* ACE_WIN32 */
00057 #else
00058   ACE_UNUSED_ARG (who);
00059   ACE_UNUSED_ARG (ru);
00060   ACE_NOTSUP_RETURN (-1);
00061 #endif /* ACE_HAS_SYSCALL_GETRUSAGE */
00062 }

ACE_INLINE struct servent * ACE_OS::getservbyname const char *  svc,
const char *  proto
 

Definition at line 448 of file OS_NS_netdb.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, ACE_SOCKCALL_RETURN, and getservbyname().

Referenced by getservbyname(), and getservbyname_r().

00449 {
00450   ACE_OS_TRACE ("ACE_OS::getservbyname");
00451 #if defined (ACE_LACKS_GETSERVBYNAME)
00452   ACE_UNUSED_ARG (svc);
00453   ACE_UNUSED_ARG (proto);
00454   ACE_NOTSUP_RETURN (0);
00455 #elif defined (ACE_HAS_NONCONST_GETBY)
00456   ACE_SOCKCALL_RETURN (::getservbyname (const_cast<char *> (svc),
00457                                         const_cast<char *> (proto)),
00458                        struct servent *,
00459                        0);
00460 #else
00461   ACE_SOCKCALL_RETURN (::getservbyname (svc,
00462                                         proto),
00463                        struct servent *,
00464                        0);
00465 #endif /* ACE_HAS_NONCONST_GETBY */
00466 }

ACE_INLINE struct servent * ACE_OS::getservbyname_r const char *  svc,
const char *  proto,
struct servent *  result,
ACE_SERVENT_DATA  buf
 

Definition at line 469 of file OS_NS_netdb.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, ACE_SERVENT_DATA, ACE_SOCKCALL_RETURN, getservbyname(), getservbyname_r(), and memset().

Referenced by get_port_number_from_name(), and getservbyname_r().

00473 {
00474   ACE_OS_TRACE ("ACE_OS::getservbyname_r");
00475 #if defined (ACE_LACKS_GETSERVBYNAME)
00476   ACE_UNUSED_ARG (svc);
00477   ACE_UNUSED_ARG (proto);
00478   ACE_UNUSED_ARG (result);
00479   ACE_UNUSED_ARG (buf);
00480   ACE_NOTSUP_RETURN (0);
00481 #elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE)
00482 # if defined (AIX) || defined (DIGITAL_UNIX)
00483   ACE_OS::memset (buf, 0, sizeof (ACE_SERVENT_DATA));
00484 
00485   if (::getservbyname_r (svc, proto, result, (struct servent_data *) buf) == 0)
00486     return result;
00487   else
00488     return (struct servent *) 0;
00489 # elif defined (__GLIBC__)
00490   // GNU C library has a different signature
00491   ACE_OS::memset (buf, 0, sizeof (ACE_SERVENT_DATA));
00492 
00493   if (::getservbyname_r (svc,
00494                          proto,
00495                          result,
00496                          buf,
00497                          sizeof (ACE_SERVENT_DATA),
00498                          &result) == 0)
00499     return result;
00500   else
00501     return (struct servent *) 0;
00502 # else
00503 #   if defined(ACE_LACKS_NETDB_REENTRANT_FUNCTIONS)
00504   ACE_UNUSED_ARG (result);
00505   ACE_NETDBCALL_RETURN (::getservbyname (svc, proto),
00506                         struct servent *, 0,
00507                         buf, sizeof (ACE_SERVENT_DATA));
00508 #   else
00509   ACE_SOCKCALL_RETURN (::getservbyname_r (svc, proto, result, buf,
00510                                           sizeof (ACE_SERVENT_DATA)),
00511                        struct servent *, 0);
00512 #   endif /* ACE_LACKS_NETDB_REENTRANT_FUNCTIONS */
00513 # endif /* defined (AIX) || defined (DIGITAL_UNIX) */
00514 #elif defined (ACE_HAS_NONCONST_GETBY)
00515   ACE_UNUSED_ARG (buf);
00516   ACE_UNUSED_ARG (result);
00517   ACE_SOCKCALL_RETURN (::getservbyname (const_cast<char *> (svc),
00518                                         const_cast<char *> (proto)),
00519                        struct servent *,
00520                        0);
00521 #else
00522   ACE_UNUSED_ARG (buf);
00523   ACE_UNUSED_ARG (result);
00524 
00525   ACE_SOCKCALL_RETURN (::getservbyname (svc,
00526                                         proto),
00527                        struct servent *,
00528                        0);
00529 #endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE) */
00530 }

ACE_INLINE int ACE_OS::getsockname ACE_HANDLE  handle,
struct sockaddr *  addr,
int *  addrlen
 

BSD-style (no QoS).

Definition at line 189 of file OS_NS_sys_socket.inl.

References ACE_OS_TRACE, ACE_SOCKCALL, ACE_SOCKCALL_RETURN, ACE_SOCKET_LEN, getsockname(), and memset().

Referenced by ACE_SOCK::get_local_addr(), ACE_ATM_Acceptor::get_local_addr(), ACE_SOCK_SEQPACK_Association::get_local_addrs(), getsockname(), ACE_Asynch_Connector< HANDLER >::parse_address(), and ACE_SOCK_SEQPACK_Connector::shared_connect_start().

00192 {
00193   ACE_OS_TRACE ("ACE_OS::getsockname");
00194 #if defined (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO) \
00195          && (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO == 1)
00196   int result;
00197   ACE_SOCKCALL (::getsockname ((ACE_SOCKET) handle,
00198                                addr,
00199                                (ACE_SOCKET_LEN *) addrlen),
00200                int, -1, result);
00201 
00202   // Some platforms, like older versions of the Linux kernel, do not
00203   // initialize the sin_zero field since that field is generally only
00204   // used for padding/alignment purposes.  On those platforms
00205   // memcmp()-based comparisons of the sockaddr_in structure, such as
00206   // the one in the ACE_INET_Addr equality operator, may fail due to
00207   // random bytes in the sin_zero field even though that field is
00208   // unused.  Prevent equality comparison of two different sockaddr_in
00209   // instances that refer to the same socket from failing by
00210   // explicitly initializing the sockaddr_in::sin_zero field to a
00211   // consistent value, e.g. zero.
00212   if (result != -1 && addr->sa_family == AF_INET)
00213     {
00214       ACE_OS::memset (reinterpret_cast<struct sockaddr_in *> (addr)->sin_zero,
00215                       0,
00216                       sizeof (reinterpret_cast<struct sockaddr_in *> (addr)->sin_zero));
00217     }
00218 
00219   return result;
00220 #else
00221   ACE_SOCKCALL_RETURN (::getsockname ((ACE_SOCKET) handle,
00222                                       addr,
00223                                       (ACE_SOCKET_LEN *) addrlen),
00224                        int, -1);
00225 #endif /* ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO */
00226 }

ACE_INLINE int ACE_OS::getsockopt ACE_HANDLE  handle,
int  level,
int  optname,
char *  optval,
int *  optlen
 

BSD-style (no QoS).

Definition at line 229 of file OS_NS_sys_socket.inl.

References ACE_OS_TRACE, ACE_SOCKCALL_RETURN, ACE_SOCKET_LEN, and getsockopt().

Referenced by ACE_SOCK::get_option(), ACE_ATM_Stream::get_vpi_vci(), getsockopt(), ACE_WIN32_Asynch_Connect::handle_output(), ACE_POSIX_Asynch_Connect::handle_output(), and ACE::handle_timed_complete().

00234 {
00235   ACE_OS_TRACE ("ACE_OS::getsockopt");
00236   ACE_SOCKCALL_RETURN (::getsockopt ((ACE_SOCKET) handle,
00237                                      level,
00238                                      optname,
00239                                      optval,
00240                                      (ACE_SOCKET_LEN *) optlen),
00241                        int,
00242                        -1);
00243 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_Time_Value ACE_OS::gettimeofday void   ) 
 

Definition at line 25 of file OS_NS_sys_time.inl.

References ACE_Time_Value, CLOCK_REALTIME, timespec::tv_nsec, and timespec::tv_sec.

Referenced by ACE_Buffered_Svc_Handler<, >::ACE_Buffered_Svc_Handler(), ACE_Dev_Poll_Reactor::Token_Guard::acquire(), ACE_Dev_Poll_Reactor::Token_Guard::acquire_quietly(), ACE_TP_Token_Guard::acquire_read_token(), ACE_TP_Token_Guard::acquire_token(), ACE_High_Res_Timer::calibrate(), cond_timedwait(), ACE_SPIPE_Connector::connect(), ACE_Dynamic_Message_Queue<>::dequeue_head(), ACE_Dynamic_Message_Queue<>::enqueue_i(), event_timedwait(), ACE_Utils::UUID_Generator::get_systemtime(), gethrtime(), ACE_High_Res_Timer::gettime(), ACE_High_Res_Timer::gettimeofday(), ACE_POSIX_CB_Proactor::handle_events_i(), ACE_Buffered_Svc_Handler<, >::put(), ACE_Ping_Socket::receive_echo_reply(), ACE::recv(), ACE::recvfrom(), ACE::recvmsg(), ACE::recvv(), ACE_Dynamic_Message_Queue<>::remove_messages(), ACE_Async_Timer_Queue_Adapter< TQ >::schedule_ualarm(), sema_wait(), ACE::send(), ACE::sendmsg(), ACE::sendto(), ACE::sendv(), ACE_Countdown_Time::start(), ACE_Countdown_Time::stop(), ACE_Thread_Timer_Queue_Adapter< TQ >::svc(), time(), ACE::timestamp(), ACE_Thread_Manager::wait(), ACE_Process_Manager::wait(), and ACE_NT_Service::wait_for_service_state().

00026 {
00027   // ACE_OS_TRACE ("ACE_OS::gettimeofday");
00028 
00029 #if !defined (ACE_HAS_WINCE)&& !defined (ACE_WIN32)
00030   timeval tv;
00031   int result = 0;
00032 #endif // !defined (ACE_HAS_WINCE)&& !defined (ACE_WIN32)
00033 
00034 #if (0)
00035   struct timespec ts;
00036 
00037   ACE_OSCALL (ACE_OS::clock_gettime (CLOCK_REALTIME, &ts), int, -1, result);
00038   tv.tv_sec = ts.tv_sec;
00039   tv.tv_usec = ts.tv_nsec / 1000L;  // timespec has nsec, but timeval has usec
00040 
00041 #elif defined (ACE_HAS_WINCE)
00042   SYSTEMTIME tsys;
00043   FILETIME   tfile;
00044   ::GetSystemTime (&tsys);
00045   ::SystemTimeToFileTime (&tsys, &tfile);
00046   return ACE_Time_Value (tfile);
00047 #elif defined (ACE_WIN32)
00048   FILETIME   tfile;
00049   ::GetSystemTimeAsFileTime (&tfile);
00050   return ACE_Time_Value (tfile);
00051 #if 0
00052   // From Todd Montgomery...
00053   struct _timeb tb;
00054   ::_ftime (&tb);
00055   tv.tv_sec = tb.time;
00056   tv.tv_usec = 1000 * tb.millitm;
00057 #endif /* 0 */
00058 #elif defined (ACE_HAS_AIX_HI_RES_TIMER)
00059   timebasestruct_t tb;
00060 
00061   ::read_real_time (&tb, TIMEBASE_SZ);
00062   ::time_base_to_time (&tb, TIMEBASE_SZ);
00063 
00064   tv.tv_sec = tb.tb_high;
00065   tv.tv_usec = tb.tb_low / 1000L;
00066 #else
00067 # if defined (ACE_HAS_TIMEZONE_GETTIMEOFDAY) || \
00068   defined(ACE_HAS_VOIDPTR_GETTIMEOFDAY) || \
00069   (defined (ACE_HAS_SVR4_GETTIMEOFDAY) && !defined (m88k) && !defined (SCO))
00070   ACE_OSCALL (::gettimeofday (&tv, 0), int, -1, result);
00071 # elif defined (ACE_VXWORKS)
00072   // Assumes that struct timespec is same size as struct timeval,
00073   // which assumes that time_t is a long: it currently (VxWorks
00074   // 5.2/5.3) is.
00075   struct timespec ts;
00076 
00077   ACE_OSCALL (ACE_OS::clock_gettime (CLOCK_REALTIME, &ts), int, -1, result);
00078   tv.tv_sec = ts.tv_sec;
00079   tv.tv_usec = ts.tv_nsec / 1000L;  // timespec has nsec, but timeval has usec
00080 # else
00081   ACE_OSCALL (::gettimeofday (&tv), int, -1, result);
00082 # endif /* ACE_HAS_SVR4_GETTIMEOFDAY */
00083 #endif /* 0 */
00084 #if !defined (ACE_HAS_WINCE)&& !defined (ACE_WIN32)
00085   if (result == -1)
00086     return ACE_Time_Value (-1);
00087   else
00088     return ACE_Time_Value (tv);
00089 #endif // !defined (ACE_HAS_WINCE)&& !defined (ACE_WIN32)
00090 }

ACE_INLINE uid_t ACE_OS::getuid void   ) 
 

Definition at line 490 of file OS_NS_unistd.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, getuid(), and uid_t.

Referenced by getuid(), and ACE_SPIPE_Addr::set().

00491 {
00492   ACE_OS_TRACE ("ACE_OS::getuid");
00493 #if defined (ACE_LACKS_GETUID)
00494   ACE_NOTSUP_RETURN (static_cast<uid_t> (-1));
00495 # else
00496   ACE_OSCALL_RETURN (::getuid (), uid_t, static_cast<uid_t> (-1));
00497 # endif /* ACE_LACKS_GETUID*/
00498 }

ACE_INLINE struct tm * ACE_OS::gmtime const time_t *  clock  ) 
 

Definition at line 334 of file OS_NS_time.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and gmtime().

Referenced by gmtime(), and gmtime_r().

00335 {
00336   ACE_OS_TRACE ("ACE_OS::gmtime");
00337 #if defined (ACE_LACKS_GMTIME)
00338   ACE_UNUSED_ARG (t);
00339   ACE_NOTSUP_RETURN (0);
00340 #else
00341   ACE_OSCALL_RETURN (::gmtime (t), struct tm *, 0);
00342 #endif /* ACE_LACKS_GMTIME */
00343 }

ACE_INLINE struct tm * ACE_OS::gmtime_r const time_t *  clock,
struct tm *  res
 

Definition at line 346 of file OS_NS_time.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, gmtime(), and gmtime_r().

Referenced by gmtime_r().

00347 {
00348   ACE_OS_TRACE ("ACE_OS::gmtime_r");
00349 #if defined (ACE_HAS_REENTRANT_FUNCTIONS)
00350 # if defined (DIGITAL_UNIX)
00351   ACE_OSCALL_RETURN (::_Pgmtime_r (t, res), struct tm *, 0);
00352 # else
00353   ACE_OSCALL_RETURN (::gmtime_r (t, res), struct tm *, 0);
00354 # endif /* DIGITAL_UNIX */
00355 #elif defined (ACE_LACKS_GMTIME_R)
00356   ACE_UNUSED_ARG (t);
00357   ACE_UNUSED_ARG (res);
00358   ACE_NOTSUP_RETURN (0);
00359 #else
00360   struct tm *result;
00361   ACE_OSCALL (::gmtime (t), struct tm *, 0, result) ;
00362   if (result != 0)
00363     *res = *result;
00364   return res;
00365 #endif /* ACE_HAS_REENTRANT_FUNCTIONS */
00366 }

ACE_NAMESPACE_INLINE_FUNCTION int hostname wchar_t *  name,
size_t  maxnamelen
 

ACE_NAMESPACE_INLINE_FUNCTION int hostname char *  name,
size_t  maxnamelen
 

Referenced by ACE_TPQ_Entry::ACE_TPQ_Entry(), ACE_INET_Addr::get_host_name_i(), getmacaddress(), ACE_MEM_Addr::initialize_local(), ACE_Predefined_Naming_Contexts::is_local_host(), ACE_Naming_Context::open(), and uname().

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE unsigned long ACE_OS::inet_addr const char *  name  ) 
 

Definition at line 11 of file OS_NS_arpa_inet.inl.

References ACE_OS_TRACE.

Referenced by inet_aton().

00012 {
00013   ACE_OS_TRACE ("ACE_OS::inet_addr");
00014 #if defined (ACE_HAS_NONCONST_GETBY)
00015   return ::inet_addr (const_cast <char*> (name));
00016 #else
00017   return ::inet_addr (name);
00018 #endif /* ACE_HAS_NONCONST_GETBY */
00019 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL int ACE_OS::inet_aton const char *  strptr,
struct in_addr *  addr
 

Definition at line 15 of file OS_NS_arpa_inet.cpp.

References INADDR_NONE, inet_addr(), inet_aton(), and strcmp().

Referenced by inet_aton(), inet_pton(), and ACE_INET_Addr::set().

00016 {
00017 #if defined (ACE_LACKS_INET_ATON)
00018 #  if defined (ACE_WIN32)
00019   // Windows Server 2003 changed the behavior of a zero-length input
00020   // string to inet_addr(). It used to return 0 (INADDR_ANY) but now
00021   // returns -1 (INADDR_NONE). It will return INADDR_ANY for a 1-space
00022   // string, though, as do previous versions of Windows.
00023   if (host_name == 0 || host_name[0] == '\0')
00024     host_name = " ";
00025 #  endif /* ACE_WIN32 */
00026   unsigned long ip_addr = ACE_OS::inet_addr (host_name);
00027 
00028   if (ip_addr == INADDR_NONE
00029       // Broadcast addresses are weird...
00030       && ACE_OS::strcmp (host_name, "255.255.255.255") != 0)
00031     return 0;
00032   else if (addr == 0)
00033     return 0;
00034   else
00035     {
00036       addr->s_addr = ip_addr;  // Network byte ordered
00037       return 1;
00038     }
00039 #elif defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x620)
00040   // inet_aton() returns OK (0) on success and ERROR (-1) on failure.
00041   // Must reset errno first. Refer to WindRiver SPR# 34949, SPR# 36026
00042   ::errnoSet(0);
00043   int result = ERROR;
00044   ACE_OSCALL (::inet_aton (const_cast <char*>(host_name), addr), int, ERROR, result);
00045   return (result == ERROR) ? 0 : 1;
00046 #else
00047   // inet_aton() returns 0 upon failure, not -1 since -1 is a valid
00048   // address (255.255.255.255).
00049   ACE_OSCALL_RETURN (::inet_aton (host_name, addr), int, 0);
00050 #endif  /* ACE_LACKS_INET_ATON */
00051 }

ACE_INLINE char * ACE_OS::inet_ntoa const struct in_addr  addr  ) 
 

Definition at line 22 of file OS_NS_arpa_inet.inl.

References ACE_OS_TRACE, and inet_ntoa().

Referenced by ACE_INET_Addr::get_host_addr(), and inet_ntoa().

00023 {
00024   ACE_OS_TRACE ("ACE_OS::inet_ntoa");
00025   ACE_OSCALL_RETURN (::inet_ntoa (addr),
00026                      char *,
00027                      0);
00028 }

ACE_INLINE const char * ACE_OS::inet_ntop int  family,
const void *  addrptr,
char *  strptr,
size_t  len
 

Definition at line 31 of file OS_NS_arpa_inet.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, INET_ADDRSTRLEN, inet_ntop(), sprintf(), strcpy(), and strlen().

Referenced by ACE_INET_Addr::get_host_addr(), and inet_ntop().

00032 {
00033   ACE_OS_TRACE ("ACE_OS::inet_ntop");
00034 
00035 #if defined (ACE_HAS_IPV6) && !defined (ACE_WIN32)
00036   ACE_OSCALL_RETURN (::inet_ntop (family, addrptr, strptr, len), const char *, 0);
00037 #else
00038   const u_char *p = reinterpret_cast<const u_char *> (addrptr);
00039 
00040   if (family == AF_INET)
00041     {
00042       char temp[INET_ADDRSTRLEN];
00043 
00044       // Stevens uses snprintf() in his implementation but snprintf()
00045       // doesn't appear to be very portable.  For now, hope that using
00046       // sprintf() will not cause any string/memory overrun problems.
00047       ACE_OS::sprintf (temp,
00048                        "%d.%d.%d.%d",
00049                        p[0], p[1], p[2], p[3]);
00050 
00051       if (ACE_OS::strlen (temp) >= len)
00052         {
00053           errno = ENOSPC;
00054           return 0; // Failure
00055         }
00056 
00057       ACE_OS::strcpy (strptr, temp);
00058       return strptr;
00059     }
00060 
00061   ACE_NOTSUP_RETURN(0);
00062 #endif /* ACE_HAS_IPV6 */
00063 }

ACE_INLINE int ACE_OS::inet_pton int  family,
const char *  strptr,
void *  addrptr
 

Definition at line 65 of file OS_NS_arpa_inet.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, inet_aton(), inet_pton(), and memcpy().

Referenced by inet_pton().

00066 {
00067   ACE_OS_TRACE ("ACE_OS::inet_pton");
00068 
00069 #if defined (ACE_HAS_IPV6) && !defined (ACE_WIN32)
00070   ACE_OSCALL_RETURN (::inet_pton (family, strptr, addrptr), int, -1);
00071 #else
00072   if (family == AF_INET)
00073     {
00074       struct in_addr in_val;
00075 
00076       if (ACE_OS::inet_aton (strptr, &in_val))
00077         {
00078           ACE_OS::memcpy (addrptr, &in_val, sizeof (struct in_addr));
00079           return 1; // Success
00080         }
00081 
00082       return 0; // Input is not a valid presentation format
00083     }
00084 
00085   ACE_NOTSUP_RETURN(-1);
00086 #endif  /* ACE_HAS_IPV6 */
00087 }

int ACE_OS::ioctl ACE_HANDLE  socket,
unsigned long  io_control_code,
ACE_QoS ace_qos,
unsigned long *  bytes_returned,
void *  buffer_p = 0,
unsigned long  buffer = 0,
ACE_OVERLAPPED overlapped = 0,
ACE_OVERLAPPED_COMPLETION_FUNC  func = 0
 

QoS-enabled when the I/O control code is either SIO_SET_QOS or SIO_GET_QOS.

Definition at line 52 of file OS_NS_stropts.cpp.

References ACE_NEW_RETURN, ACE_NOTSUP_RETURN, ACE_OVERLAPPED, ACE_OVERLAPPED_COMPLETION_FUNC, ACE_SOCKCALL_RETURN, iovec::iov_len, ACE_QoS::provider_specific(), ACE_QoS::receiving_flowspec(), and ACE_QoS::sending_flowspec().

00060 {
00061 # if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00062 
00063   QOS qos;
00064   unsigned long qos_len = sizeof (QOS);
00065 
00066   if (io_control_code == SIO_SET_QOS)
00067     {
00068       qos.SendingFlowspec = *(ace_qos.sending_flowspec ());
00069       qos.ReceivingFlowspec = *(ace_qos.receiving_flowspec ());
00070       qos.ProviderSpecific = (WSABUF) ace_qos.provider_specific ();
00071 
00072       qos_len += ace_qos.provider_specific ().iov_len;
00073 
00074       ACE_SOCKCALL_RETURN (::WSAIoctl ((ACE_SOCKET) socket,
00075                                        io_control_code,
00076                                        &qos,
00077                                        qos_len,
00078                                        buffer_p,
00079                                        buffer,
00080                                        bytes_returned,
00081                                        (WSAOVERLAPPED *) overlapped,
00082                                        func),
00083                            int,
00084                            SOCKET_ERROR);
00085     }
00086   else
00087     {
00088       unsigned long dwBufferLen = 0;
00089 
00090       // Query for the buffer size.
00091       int result = ::WSAIoctl ((ACE_SOCKET) socket,
00092                                 io_control_code,
00093                                 NULL,
00094                                 0,
00095                                 &dwBufferLen,
00096                                 sizeof (dwBufferLen),
00097                                 bytes_returned,
00098                                 NULL,
00099                                 NULL);
00100 
00101 
00102       if (result == SOCKET_ERROR)
00103           {
00104                 unsigned long dwErr = ::WSAGetLastError ();
00105 
00106                 if (dwErr == WSAEWOULDBLOCK)
00107                 {
00108                         errno = dwErr;
00109                         return -1;
00110                 }
00111                 else
00112                         if (dwErr != WSAENOBUFS)
00113                         {
00114                                 errno = dwErr;
00115                                 return -1;
00116                         }
00117           }
00118 
00119     char *qos_buf;
00120         ACE_NEW_RETURN (qos_buf,
00121                                         char [dwBufferLen],
00122                                         -1);
00123 
00124         QOS *qos = reinterpret_cast<QOS*> (qos_buf);
00125 
00126         result = ::WSAIoctl ((ACE_SOCKET) socket,
00127                                    io_control_code,
00128                        NULL,
00129                        0,
00130                        qos,
00131                        dwBufferLen,
00132                        bytes_returned,
00133                        NULL,
00134                        NULL);
00135 
00136     if (result == SOCKET_ERROR)
00137                 return result;
00138 
00139     ACE_Flow_Spec sending_flowspec (qos->SendingFlowspec.TokenRate,
00140                                     qos->SendingFlowspec.TokenBucketSize,
00141                                     qos->SendingFlowspec.PeakBandwidth,
00142                                     qos->SendingFlowspec.Latency,
00143                                     qos->SendingFlowspec.DelayVariation,
00144 #  if defined(ACE_HAS_WINSOCK2_GQOS)
00145                                     qos->SendingFlowspec.ServiceType,
00146                                     qos->SendingFlowspec.MaxSduSize,
00147                                     qos->SendingFlowspec.MinimumPolicedSize,
00148 #  else /* ACE_HAS_WINSOCK2_GQOS */
00149                                     0,
00150                                     0,
00151                                     0,
00152 #  endif /* ACE_HAS_WINSOCK2_GQOS */
00153                                     0,
00154                                     0);
00155 
00156     ACE_Flow_Spec receiving_flowspec (qos->ReceivingFlowspec.TokenRate,
00157                                       qos->ReceivingFlowspec.TokenBucketSize,
00158                                       qos->ReceivingFlowspec.PeakBandwidth,
00159                                       qos->ReceivingFlowspec.Latency,
00160                                       qos->ReceivingFlowspec.DelayVariation,
00161 #  if defined(ACE_HAS_WINSOCK2_GQOS)
00162                                       qos->ReceivingFlowspec.ServiceType,
00163                                       qos->ReceivingFlowspec.MaxSduSize,
00164                                       qos->ReceivingFlowspec.MinimumPolicedSize,
00165 #  else /* ACE_HAS_WINSOCK2_GQOS */
00166                                       0,
00167                                       0,
00168                                       0,
00169 #  endif /* ACE_HAS_WINSOCK2_GQOS */
00170                                       0,
00171                                       0);
00172 
00173        ace_qos.sending_flowspec (&sending_flowspec);
00174        ace_qos.receiving_flowspec (&receiving_flowspec);
00175        ace_qos.provider_specific (*((struct iovec *) (&qos->ProviderSpecific)));
00176 
00177 
00178       return result;
00179     }
00180 
00181 # else
00182   ACE_UNUSED_ARG (socket);
00183   ACE_UNUSED_ARG (io_control_code);
00184   ACE_UNUSED_ARG (ace_qos);
00185   ACE_UNUSED_ARG (bytes_returned);
00186   ACE_UNUSED_ARG (buffer_p);
00187   ACE_UNUSED_ARG (buffer);
00188   ACE_UNUSED_ARG (overlapped);
00189   ACE_UNUSED_ARG (func);
00190   ACE_NOTSUP_RETURN (-1);
00191 # endif /* ACE_HAS_WINSOCK2 */
00192 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL int ACE_OS::ioctl ACE_HANDLE  socket,
unsigned long  io_control_code,
void *  in_buffer_p,
unsigned long  in_buffer,
void *  out_buffer_p,
unsigned long  out_buffer,
unsigned long *  bytes_returned,
ACE_OVERLAPPED overlapped,
ACE_OVERLAPPED_COMPLETION_FUNC  func
 

QoS-enabled .

Definition at line 14 of file OS_NS_stropts.cpp.

References ACE_NOTSUP_RETURN, ACE_OVERLAPPED, ACE_OVERLAPPED_COMPLETION_FUNC, and ACE_SOCKCALL_RETURN.

00023 {
00024 # if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00025   ACE_SOCKCALL_RETURN (::WSAIoctl ((ACE_SOCKET) socket,
00026                                    io_control_code,
00027                                    in_buffer_p,
00028                                    in_buffer,
00029                                    out_buffer_p,
00030                                    out_buffer,
00031                                    bytes_returned,
00032                                    (WSAOVERLAPPED *) overlapped,
00033                                    func),
00034                        int,
00035                        SOCKET_ERROR);
00036 # else
00037   ACE_UNUSED_ARG (socket);
00038   ACE_UNUSED_ARG (io_control_code);
00039   ACE_UNUSED_ARG (in_buffer_p);
00040   ACE_UNUSED_ARG (in_buffer);
00041   ACE_UNUSED_ARG (out_buffer_p);
00042   ACE_UNUSED_ARG (out_buffer);
00043   ACE_UNUSED_ARG (bytes_returned);
00044   ACE_UNUSED_ARG (overlapped);
00045   ACE_UNUSED_ARG (func);
00046   ACE_NOTSUP_RETURN (-1);
00047 # endif /* ACE_HAS_WINSOCK2 */
00048 }

ACE_INLINE int ACE_OS::ioctl ACE_HANDLE  handle,
ACE_IOCTL_TYPE_ARG2  cmd,
void *  = 0
 

UNIX-style .

Definition at line 108 of file OS_NS_stropts.inl.

References ACE_OS_TRACE, ACE_SOCKCALL_RETURN, and ioctl().

Referenced by ACE_SPIPE_Acceptor::accept(), ACE::clr_flags(), ACE_TLI_Connector::connect(), ACE_IPC_SAP::control(), ACE_IO_SAP::control(), ACE::count_interfaces(), ACE_SPIPE_Acceptor::create_new_instance(), ACE_IPC_SAP::disable(), ACE_IPC_SAP::enable(), ACE::get_bcast_addr(), ACE::get_ip_interfaces(), getmacaddress(), ioctl(), ACE_SOCK_Dgram::make_multicast_ifaddr(), ACE_SOCK_Dgram_Bcast::mk_broadcast(), ACE_Pipe::open(), ACE_ATM_Acceptor::open(), open_new_endpoint(), ACE_SOCK_Dgram::recv(), ACE_SPIPE_Stream::recv_handle(), ACE_SOCK_IO::recvv(), ACE_SPIPE_Stream::send_handle(), ACE::set_flags(), and ACE_Dev_Poll_Reactor::work_pending_i().

00111 {
00112   ACE_OS_TRACE ("ACE_OS::ioctl");
00113 
00114 #if defined (ACE_WIN32)
00115   ACE_SOCKET sock = (ACE_SOCKET) handle;
00116   ACE_SOCKCALL_RETURN (::ioctlsocket (sock, cmd, reinterpret_cast<unsigned long *> (val)), int, -1);
00117 #elif defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x620)
00118   ACE_OSCALL_RETURN (::ioctl (handle, cmd, reinterpret_cast<int> (val)),
00119                      int, -1);
00120 #else
00121   ACE_OSCALL_RETURN (::ioctl (handle, cmd, val), int, -1);
00122 #endif /* ACE_WIN32 */
00123 }

ACE_INLINE int ACE_OS::isastream ACE_HANDLE  handle  ) 
 

Definition at line 126 of file OS_NS_stropts.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and isastream().

Referenced by ACE_UPIPE_Connector::connect(), and isastream().

00127 {
00128   ACE_OS_TRACE ("ACE_OS::isastream");
00129 #if defined (ACE_HAS_STREAM_PIPES)
00130   ACE_OSCALL_RETURN (::isastream (handle), int, -1);
00131 #else
00132   ACE_UNUSED_ARG (handle);
00133 
00134   ACE_NOTSUP_RETURN (-1);
00135 #endif /* ACE_HAS_STREAM_PIPES */
00136 }

ACE_INLINE int ACE_OS::isatty ACE_HANDLE  handle  ) 
 

Definition at line 593 of file OS_NS_unistd.inl.

00594 {
00595 #if defined (ACE_LACKS_ISATTY)
00596   ACE_UNUSED_ARG (handle);
00597   return 0;
00598 #else
00599 # if defined (ACE_LACKS_INTPTR_T)
00600    int fd = ::_open_osfhandle (long (handle), 0);
00601 # else
00602    int fd = ::_open_osfhandle (intptr_t (handle), 0);
00603 # endif
00604   int status = ::_isatty (fd);
00605   ::_close (fd);
00606   return status;
00607 #endif /* ACE_LACKS_ISATTY */
00608 }

ACE_INLINE int ACE_OS::isatty int  handle  ) 
 

Definition at line 578 of file OS_NS_unistd.inl.

References ACE_OS_TRACE, and isatty().

Referenced by isatty().

00579 {
00580   ACE_OS_TRACE ("ACE_OS::isatty");
00581 #if defined (ACE_LACKS_ISATTY)
00582   ACE_UNUSED_ARG (handle);
00583   return 0;
00584 # elif defined (ACE_WIN32)
00585   return ::_isatty (handle);
00586 # else
00587   ACE_OSCALL_RETURN (::isatty (handle), int, -1);
00588 # endif /* ACE_LACKS_ISATTY */
00589 }

ACE_INLINE wchar_t * ACE_OS::itoa int  value,
wchar_t *  string,
int  radix
 

Converts an integer to a string.

Definition at line 164 of file OS_NS_stdlib.inl.

References itow_emulation().

00165 {
00166 #if defined (ACE_LACKS_ITOW)
00167   return ACE_OS::itow_emulation (value, string, radix);
00168 #else /* ACE_LACKS_ITOW */
00169   return ::_itow (value, string, radix);
00170 #endif /* ACE_LACKS_ITOW */
00171 }

ACE_INLINE char * ACE_OS::itoa int  value,
char *  string,
int  radix
 

Converts an integer to a string.

Definition at line 151 of file OS_NS_stdlib.inl.

References itoa_emulation().

00152 {
00153 #if !defined (ACE_HAS_ITOA)
00154   return ACE_OS::itoa_emulation (value, string, radix);
00155 #elif defined (ACE_ITOA_EQUIVALENT)
00156   return ACE_ITOA_EQUIVALENT (value, string, radix);
00157 #else /* !ACE_HAS_ITOA */
00158   return ::itoa (value, string, radix);
00159 #endif /* !ACE_HAS_ITOA */
00160 }

char * ACE_OS::itoa_emulation int  value,
char *  string,
int  radix
 

Emulated itoa - Converts an integer to a string.

Definition at line 108 of file OS_NS_stdlib.cpp.

Referenced by itoa().

00109 {
00110   char *e = string;
00111   char *b = string;
00112 
00113   // Short circuit if 0
00114 
00115   if (value == 0)
00116     {
00117       string[0] = '0';
00118       string[1] = 0;
00119       return string;
00120     }
00121 
00122   // If negative and base 10, print a - and then do the
00123   // number.
00124 
00125   if (value < 0 && radix == 10)
00126     {
00127       string[0] = '-';
00128       ++b;
00129       ++e; // Don't overwrite the negative sign.
00130       value = -value; // Drop negative sign so character selection is correct.
00131     }
00132 
00133   // Convert to base <radix>, but in reverse order
00134 
00135   while (value != 0)
00136     {
00137       int mod = value % radix;
00138       value = value / radix;
00139 
00140       *e++ = (mod < 10) ? '0' + mod : 'a' + mod - 10;
00141     }
00142 
00143   *e-- = 0;
00144 
00145   // Now reverse the string to get the correct result
00146 
00147   while (e > b)
00148     {
00149       char temp = *e;
00150       *e = *b;
00151       *b = temp;
00152       ++b;
00153       --e;
00154     }
00155 
00156   return string;
00157 }

wchar_t * ACE_OS::itow_emulation int  value,
wchar_t *  string,
int  radix
 

Emulated itow - Converts an integer to a string.

Definition at line 162 of file OS_NS_stdlib.cpp.

Referenced by itoa().

00163 {
00164   wchar_t *e = string;
00165   wchar_t *b = string;
00166 
00167   // Short circuit if 0
00168 
00169   if (value == 0)
00170     {
00171       string[0] = '0';
00172       string[1] = 0;
00173       return string;
00174     }
00175 
00176   // If negative and base 10, print a - and then do the
00177   // number.
00178 
00179   if (value < 0 && radix == 10)
00180     {
00181       string[0] = '-';
00182       b++;
00183     }
00184 
00185   // Convert to base <radix>, but in reverse order
00186 
00187   while (value != 0)
00188     {
00189       int mod = value % radix;
00190       value = value / radix;
00191 
00192       *e++ = (mod < 10) ? '0' + mod : 'a' + mod - 10;
00193     }
00194 
00195   *e-- = 0;
00196 
00197   // Now reverse the string to get the correct result
00198 
00199   while (e > b)
00200   {
00201     wchar_t temp = *e;
00202     *e = *b;
00203     *b = temp;
00204     ++b;
00205     --e;
00206   }
00207 
00208   return string;
00209 }

ACE_HANDLE ACE_OS::join_leaf ACE_HANDLE  socket,
const sockaddr *  name,
int  namelen,
const ACE_QoS_Params qos_params
 

Joins a leaf node into a QoS-enabled multi-point session.

Definition at line 65 of file OS_NS_sys_socket.cpp.

References ACE_NOTSUP_RETURN, ACE_SOCKCALL_RETURN, ACE_QoS_Params::callee_data(), ACE_QoS_Params::caller_data(), ACE_QoS_Params::flags(), ACE_QoS_Params::group_socket_qos(), ACE_QoS::provider_specific(), ACE_QoS::receiving_flowspec(), ACE_QoS::sending_flowspec(), and ACE_QoS_Params::socket_qos().

Referenced by ACE_ATM_Connector::add_leaf().

00069 {
00070 # if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00071 
00072   QOS qos;
00073   // Construct the WinSock2 QOS structure.
00074 
00075   qos.SendingFlowspec = *(qos_params.socket_qos ()->sending_flowspec ());
00076   qos.ReceivingFlowspec = *(qos_params.socket_qos ()->receiving_flowspec ());
00077   qos.ProviderSpecific = (WSABUF) qos_params.socket_qos ()->provider_specific ();
00078 
00079   ACE_SOCKCALL_RETURN (::WSAJoinLeaf ((ACE_SOCKET) socket,
00080                                       name,
00081                                       namelen,
00082                                       (WSABUF *) qos_params.caller_data (),
00083                                       (WSABUF *) qos_params.callee_data (),
00084                                       &qos,
00085                                       (QOS *) qos_params.group_socket_qos (),
00086                                       qos_params.flags ()),
00087                        ACE_HANDLE,
00088                        ACE_INVALID_HANDLE);
00089 
00090 # else
00091   ACE_UNUSED_ARG (socket);
00092   ACE_UNUSED_ARG (name);
00093   ACE_UNUSED_ARG (namelen);
00094   ACE_UNUSED_ARG (qos_params);
00095   ACE_NOTSUP_RETURN (ACE_INVALID_HANDLE);
00096 # endif /* ACE_HAS_WINSOCK2 */
00097 }

ACE_INLINE int ACE_OS::kill pid_t  pid,
int  signum
 

Definition at line 14 of file OS_NS_signal.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, kill(), and pid_t.

Referenced by ACE_Process::kill(), kill(), ACE::process_active(), ACE_Process::running(), ACE_Process_Manager::terminate(), ACE::terminate_process(), and thr_kill().

00015 {
00016   ACE_OS_TRACE ("ACE_OS::kill");
00017 #if defined (ACE_LACKS_KILL)
00018   ACE_UNUSED_ARG (pid);
00019   ACE_UNUSED_ARG (signum);
00020   ACE_NOTSUP_RETURN (-1);
00021 #else
00022   ACE_OSCALL_RETURN (::kill (pid, signum), int, -1);
00023 #endif /* ACE_LACKS_KILL */
00024 }

ACE_INLINE void ACE_OS::last_error int   ) 
 

Definition at line 29 of file OS_NS_errno.inl.

References ACE_OS_TRACE.

00030 {
00031   ACE_OS_TRACE ("ACE_OS::last_error");
00032 #if defined (ACE_WIN32)
00033   ::SetLastError (error);
00034 #endif /* ACE_WIN32 */
00035   errno = error;
00036 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_OS::last_error void   ) 
 

Definition at line 10 of file OS_NS_errno.inl.

Referenced by ACE_POSIX_Asynch_Accept::accept(), ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >::connect_i(), dlopen(), ACE_Service_Repository::insert(), ACE_Log_Msg::last_error_adapter(), ACE_Service_Gestalt::process_directives_i(), set_errno_to_last_error(), set_errno_to_wsa_last_error(), set_scheduling_params(), and t_getname().

00011 {
00012   // ACE_OS_TRACE ("ACE_OS::last_error");
00013 
00014 #if defined (ACE_WIN32)
00015   // ACE_OS::last_error() prefers errnor since started out as a way to
00016   // avoid directly accessing errno in ACE code - particularly the ACE
00017   // C++ socket wrapper facades.  On Windows, some things that would
00018   // use errno on UNIX require ::GetLastError(), so this method tries
00019   // to shield the rest of ACE from having to know about this.
00020   int lerror = ::GetLastError ();
00021   int lerrno = errno;
00022   return lerrno == 0 ? lerror : lerrno;
00023 #else
00024   return errno;
00025 #endif /* ACE_WIN32 */
00026 }

ACE_INLINE int ACE_OS::listen ACE_HANDLE  handle,
int  backlog
 

BSD-style (no QoS).

Definition at line 246 of file OS_NS_sys_socket.inl.

References ACE_OS_TRACE, ACE_SOCKCALL_RETURN, and listen().

Referenced by listen(), ACE_ATM_Acceptor::open(), ACE_Asynch_Acceptor< HANDLER >::open(), ACE_SOCK_SEQPACK_Acceptor::shared_open(), and ACE_SOCK_Acceptor::shared_open().

00247 {
00248   ACE_OS_TRACE ("ACE_OS::listen");
00249   ACE_SOCKCALL_RETURN (::listen ((ACE_SOCKET) handle, backlog), int, -1);
00250 }

ACE_INLINE struct tm * ACE_OS::localtime const time_t *  clock  ) 
 

Definition at line 369 of file OS_NS_time.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and localtime().

Referenced by ctime(), localtime(), and localtime_r().

00370 {
00371   ACE_OS_TRACE ("ACE_OS::localtime");
00372 #if defined (ACE_LACKS_LOCALTIME)
00373   ACE_UNUSED_ARG (t);
00374   ACE_NOTSUP_RETURN (0);
00375 #else
00376   ACE_OSCALL_RETURN (::localtime (t), struct tm *, 0);
00377 #endif /* ACE_LACKS_LOCALTIME */
00378 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL struct tm * ACE_OS::localtime_r const time_t *  clock,
struct tm *  res
 

Definition at line 226 of file OS_NS_time.cpp.

References ACE_NOTSUP_RETURN, ACE_OS_GUARD, ACE_OS_TRACE, localtime(), and localtime_r().

Referenced by localtime_r(), and ACE_Date_Time::update().

00227 {
00228   ACE_OS_TRACE ("ACE_OS::localtime_r");
00229 #if defined (ACE_HAS_REENTRANT_FUNCTIONS)
00230 # if defined (DIGITAL_UNIX)
00231   ACE_OSCALL_RETURN (::_Plocaltime_r (t, res), struct tm *, 0);
00232 # else
00233   ACE_OSCALL_RETURN (::localtime_r (t, res), struct tm *, 0);
00234 # endif /* DIGITAL_UNIX */
00235 #elif !defined (ACE_HAS_WINCE)
00236   ACE_OS_GUARD
00237 
00238   ACE_UNUSED_ARG (res);
00239   struct tm * res_ptr;
00240   ACE_OSCALL (::localtime (t), struct tm *, 0, res_ptr);
00241   if (res_ptr == 0)
00242     return 0;
00243   else
00244     {
00245       *res = *res_ptr;
00246       return res;
00247     }
00248 #elif defined (ACE_HAS_WINCE)
00249   // This is really stupid, converting FILETIME to timeval back and
00250   // forth.  It assumes FILETIME and DWORDLONG are the same structure
00251   // internally.
00252 
00253   TIME_ZONE_INFORMATION pTz;
00254 
00255   const unsigned short int __mon_yday[2][13] =
00256   {
00257     /* Normal years.  */
00258     { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
00259     /* Leap years.  */
00260     { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
00261   };
00262 
00263   ULARGE_INTEGER _100ns;
00264   ::GetTimeZoneInformation (&pTz);
00265 
00266   _100ns.QuadPart = (DWORDLONG) *t * 10000 * 1000 + ACE_Time_Value::FILETIME_to_timval_skew;
00267   FILETIME file_time;
00268   file_time.dwLowDateTime = _100ns.LowPart;
00269   file_time.dwHighDateTime = _100ns.HighPart;
00270 
00271   FILETIME localtime;
00272   SYSTEMTIME systime;
00273   FileTimeToLocalFileTime (&file_time, &localtime);
00274   FileTimeToSystemTime (&localtime, &systime);
00275 
00276   res->tm_hour = systime.wHour;
00277 
00278   if(pTz.DaylightBias!=0)
00279     res->tm_isdst = 1;
00280   else
00281     res->tm_isdst = 1;
00282 
00283    int iLeap;
00284    iLeap = (res->tm_year % 4 == 0 && (res->tm_year% 100 != 0 || res->tm_year % 400 == 0));
00285    // based on leap select which group to use
00286 
00287    res->tm_mday = systime.wDay;
00288    res->tm_min = systime.wMinute;
00289    res->tm_mon = systime.wMonth - 1;
00290    res->tm_sec = systime.wSecond;
00291    res->tm_wday = systime.wDayOfWeek;
00292    res->tm_yday = __mon_yday[iLeap][systime.wMonth] + systime.wDay;
00293    res->tm_year = systime.wYear;// this the correct year but bias the value to start at the 1900
00294    res->tm_year = res->tm_year - 1900;
00295 
00296    return res;
00297 #else
00298   // @@ Same as ACE_OS::localtime (), you need to implement it
00299   //    yourself.
00300   ACE_UNUSED_ARG (t);
00301   ACE_UNUSED_ARG (res);
00302   ACE_NOTSUP_RETURN (0);
00303 #endif /* ACE_HAS_REENTRANT_FUNCTIONS */
00304 }

ACE_INLINE off_t ACE_OS::lseek ACE_HANDLE  handle,
off_t  offset,
int  whence
 

Definition at line 613 of file OS_NS_unistd.inl.

References ACE_FAIL_RETURN, ACE_OS_TRACE, ACE_SYSCALL_FAILED, and lseek().

Referenced by ACE_MMAP_Memory_Pool::commit_backing_store_name(), lseek(), pread(), ACE_MMAP_Memory_Pool::protect(), pwrite(), ACE_FILE::seek(), ACE_MMAP_Memory_Pool::sync(), ACE_FILE::tell(), and ACE_Mem_Map::unmap().

00614 {
00615   ACE_OS_TRACE ("ACE_OS::lseek");
00616 #if defined (ACE_WIN32)
00617 # if SEEK_SET != FILE_BEGIN || SEEK_CUR != FILE_CURRENT || SEEK_END != FILE_END
00618   //#error Windows NT is evil AND rude!
00619   switch (whence)
00620     {
00621     case SEEK_SET:
00622       whence = FILE_BEGIN;
00623       break;
00624     case SEEK_CUR:
00625       whence = FILE_CURRENT;
00626       break;
00627     case SEEK_END:
00628       whence = FILE_END;
00629       break;
00630     default:
00631       errno = EINVAL;
00632       return static_cast<off_t> (-1); // rather safe than sorry
00633     }
00634 # endif  /* SEEK_SET != FILE_BEGIN || SEEK_CUR != FILE_CURRENT || SEEK_END != FILE_END */
00635   DWORD result = ::SetFilePointer (handle, offset, 0, whence);
00636   if (result == ACE_SYSCALL_FAILED)
00637     ACE_FAIL_RETURN (static_cast<off_t> (-1));
00638   else
00639     return result;
00640 #else
00641   ACE_OSCALL_RETURN (::lseek (handle, offset, whence), off_t, -1);
00642 #endif /* ACE_WIN32 */
00643 }

ACE_INLINE int ACE_OS::lstat const wchar_t *  ,
ACE_stat
 

Definition at line 139 of file OS_NS_sys_stat.inl.

References ACE_OS_TRACE, lstat(), and stat().

00140   {
00141     ACE_OS_TRACE ("ACE_OS::lstat");
00142 # if defined (ACE_LACKS_LSTAT)
00143     return ACE_OS::stat (file, stp);
00144 # else
00145     return ACE_OS::lstat (ACE_Wide_To_Ascii (file).char_rep (), stp);
00146 # endif /* ACE_LACKS_LSTAT */
00147   }

ACE_INLINE int ACE_OS::lstat const char *  ,
ACE_stat
 

Definition at line 123 of file OS_NS_sys_stat.inl.

References ACE_OS_TRACE, lstat(), and stat().

Referenced by lstat().

00124   {
00125     ACE_OS_TRACE ("ACE_OS::lstat");
00126 # if defined (ACE_LACKS_LSTAT)
00127     return ACE_OS::stat (file, stp);
00128 # elif defined (ACE_HAS_X86_STAT_MACROS)
00129     // Solaris for intel uses an macro for lstat(), this macro is a
00130     // wrapper for _lxstat().
00131     ACE_OSCALL_RETURN (::_lxstat (_STAT_VER, file, stp), int, -1);
00132 # else /* !ACE_HAS_X86_STAT_MACROS */
00133     ACE_OSCALL_RETURN (::lstat (file, stp), int, -1);
00134 # endif /* ACE_LACKS_LSTAT */
00135   }

int ACE_OS::lwp_getparams ACE_Sched_Params  ) 
 

Definition at line 3389 of file OS_NS_Thread.cpp.

References ACE_id_t, ACE_NOTSUP_RETURN, ACE_SCHED_FIFO, ACE_SCHED_OTHER, ACE_SCOPE_THREAD, memcpy(), memset(), priority_control(), sched_params(), and scheduling_class().

Referenced by thr_setprio().

03390 {
03391 #if defined (ACE_HAS_STHREADS) || defined (sun)
03392   // Get the class TS and RT class IDs.
03393   ACE_id_t rt_id;
03394   ACE_id_t ts_id;
03395   if (ACE_OS::scheduling_class ("RT", rt_id) == -1
03396       || ACE_OS::scheduling_class ("TS", ts_id) == -1)
03397     return -1;
03398 
03399   // Get this LWP's scheduling parameters.
03400   pcparms_t pcparms;
03401   // The following is just to avoid Purify warnings about unitialized
03402   // memory reads.
03403   ACE_OS::memset (&pcparms, 0, sizeof pcparms);
03404   pcparms.pc_cid = PC_CLNULL;
03405 
03406   if (ACE_OS::priority_control (P_LWPID,
03407                                 P_MYID,
03408                                 PC_GETPARMS,
03409                                 (char *) &pcparms) == -1)
03410     return -1;
03411   else if (pcparms.pc_cid == rt_id)
03412     {
03413       // RT class.
03414       rtparms_t rtparms;
03415       ACE_OS::memcpy (&rtparms, pcparms.pc_clparms, sizeof rtparms);
03416 
03417       sched_params.policy (ACE_SCHED_FIFO);
03418       sched_params.priority (rtparms.rt_pri);
03419       sched_params.scope (ACE_SCOPE_THREAD);
03420       ACE_Time_Value quantum (rtparms.rt_tqsecs,
03421                               rtparms.rt_tqnsecs == RT_TQINF
03422                               ? 0 : rtparms.rt_tqnsecs * 1000);
03423       sched_params.quantum (quantum);
03424       return 0;
03425     }
03426   else if (pcparms.pc_cid == ts_id)
03427     {
03428       /* TS class */
03429       tsparms_t tsparms;
03430       ACE_OS::memcpy (&tsparms, pcparms.pc_clparms, sizeof tsparms);
03431 
03432       sched_params.policy (ACE_SCHED_OTHER);
03433       sched_params.priority (tsparms.ts_upri);
03434       sched_params.scope (ACE_SCOPE_THREAD);
03435       return 0;
03436     }
03437   else
03438     return -1;
03439 
03440 #else  /* ! ACE_HAS_STHREADS && ! sun */
03441   ACE_UNUSED_ARG (sched_params);
03442   ACE_NOTSUP_RETURN (-1);
03443 #endif /* ! ACE_HAS_STHREADS && ! sun */
03444 }

int ACE_OS::lwp_setparams const ACE_Sched_Params  ) 
 

Definition at line 3447 of file OS_NS_Thread.cpp.

References ACE_NOTSUP_RETURN, ACE_SCOPE_LWP, sched_params(), and ACE_Sched_Params::scope().

Referenced by thr_create(), and thr_setprio().

03448 {
03449 #if defined (ACE_HAS_STHREADS) || defined (sun)
03450   ACE_Sched_Params lwp_params (sched_params);
03451   lwp_params.scope (ACE_SCOPE_LWP);
03452   return ACE_OS::sched_params (lwp_params);
03453 #else  /* ! ACE_HAS_STHREADS && ! sun */
03454   ACE_UNUSED_ARG (sched_params);
03455   ACE_NOTSUP_RETURN (-1);
03456 #endif /* ! ACE_HAS_STHREADS && ! sun */
03457 }

ACE_INLINE int ACE_OS::madvise caddr_t  addr,
size_t  len,
int  map_advice
 

Definition at line 25 of file OS_NS_sys_mman.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, caddr_t, and madvise().

Referenced by ACE_Mem_Map::advise(), and madvise().

00026 {
00027   ACE_OS_TRACE ("ACE_OS::madvise");
00028 #if !defined (ACE_LACKS_MADVISE)
00029   ACE_OSCALL_RETURN (::madvise (addr, len, map_advice), int, -1);
00030 #else
00031   ACE_UNUSED_ARG (addr);
00032   ACE_UNUSED_ARG (len);
00033   ACE_UNUSED_ARG (map_advice);
00034   ACE_NOTSUP_RETURN (-1);
00035 #endif /* ACE_WIN32 */
00036 }

void * ACE_OS::malloc size_t   ) 
 

Definition at line 213 of file OS_NS_stdlib.cpp.

References ACE_MALLOC_FUNC.

Referenced by ACE_ATM_QoS::ACE_ATM_QoS(), ACE_Name_Options::ACE_Name_Options(), ACE_ATM_QoS::construct_options(), ACE::count_interfaces(), ACE_ATM_Stream::get_vpi_vci(), ACE_Static_Object_Lock::instance(), ACE::ldfind(), scandir_emulation(), and tempnam().

00214 {
00215   return ACE_MALLOC_FUNC (nbytes);
00216 }

ACE_INLINE void * ACE_OS::memchr void *  s,
int  c,
size_t  len
 

Finds characters in a buffer (void version).

Definition at line 23 of file OS_NS_string.inl.

References memchr().

00024 {
00025   return const_cast<void *> (ACE_OS::memchr (static_cast<const void *> (s),
00026                                              c,
00027                                              len));
00028 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE const void * ACE_OS::memchr const void *  s,
int  c,
size_t  len
 

Finds characters in a buffer (const void version).

Definition at line 13 of file OS_NS_string.inl.

References memchr_emulation().

Referenced by memchr().

00014 {
00015 #if defined (ACE_HAS_MEMCHR)
00016   return ::memchr (s, c, len);
00017 #else /* ACE_HAS_MEMCHR */
00018   return ACE_OS::memchr_emulation (s, c, len);
00019 #endif /* ACE_HAS_MEMCHR */
00020 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL const void * ACE_OS::memchr_emulation const void *  s,
int  c,
size_t  len
 

Emulated memchr - Finds a character in a buffer.

Definition at line 27 of file OS_NS_string.cpp.

Referenced by memchr().

00028 {
00029   const unsigned char *t = (const unsigned char *) s;
00030   const unsigned char *e = (const unsigned char *) s + len;
00031 
00032   while (t < e)
00033     if (((int) *t) == c)
00034       return t;
00035     else
00036       t++;
00037 
00038   return 0;
00039 }

ACE_INLINE int ACE_OS::memcmp const void *  t,
const void *  s,
size_t  len
 

Compares two buffers.

Definition at line 31 of file OS_NS_string.inl.

Referenced by ACE_String_Base< CHAR >::compare(), ACE_INET_Addr::get_host_name_i(), ACE_CDR::LongDouble::operator!=(), ACE_String_Base< CHAR >::operator==(), ACE_NS_String::operator==(), ACE_INET_Addr::operator==(), ACE_CDR::LongDouble::operator==(), ACE_ATM_Addr::operator==(), and strnstr().

00032 {
00033   return ::memcmp (t, s, len);
00034 }

ACE_INLINE void * ACE_OS::memcpy void *  t,
const void *  s,
size_t  len
 

Copies one buffer to another.

Definition at line 37 of file OS_NS_string.inl.

Referenced by ACE_TLI_Acceptor::accept(), ACE_ATM_QoS::ACE_ATM_QoS(), ACE_Handle_Set::ACE_Handle_Set(), ACE_Message_Block::ACE_Message_Block(), ACE_Metrics_Timeprobe< ACE_LOCK, ALLOCATOR >::ACE_Metrics_Timeprobe(), ACE_Name_Request::ACE_Name_Request(), ACE_NS_String::ACE_NS_String(), ACE_SString::ACE_SString(), ACE_ATM_Addr::addr_to_string(), ACE_String_Base< CHAR >::append(), ACE_Data_Block::clone(), ACE_InputCDR::clone_from(), ACE_TLI_Connector::connect(), ACE_ATM_QoS::construct_options(), ACE_Obstack_T< CHAR >::copy(), ACE_Message_Block::copy(), ACE_ARGV_T< CHAR_TYPE >::create_buf_from_queue(), ACE_Active_Map_Manager_Key::decode(), ACE_Active_Map_Manager_Key::encode(), ACE::get_bcast_addr(), ACE_Configuration_Heap::get_binary_value(), ACE_INET_Addr::get_host_name_i(), ACE_INET_Addr::get_ip_address(), ACE_ATM_Acceptor::get_local_addr(), ACE_TLI::get_option(), ACE_ATM_Stream::get_vpi_vci(), gethrtime(), getmacaddress(), ACE_Timer_Heap_T< TYPE, FUNCTOR, ACE_LOCK >::grow_heap(), ACE_Registry_ImpExp::import_config(), ACE_Timeprobe_Ex< ACE_LOCK, ALLOCATOR >::increase_size(), inet_pton(), ACE_Utils::UUID_Generator::init(), ACE_ATM_Addr::init(), ACE_Svc_Conf_Lexer::input(), ACE_Codeset_Registry::locale_to_registry_i(), lwp_getparams(), ACE_SOCK_Dgram::make_multicast_ifaddr6(), ACE_SOCK_Dgram_Bcast::mk_broadcast(), ACE_Name_Request::name(), ACE_Metrics_Timeprobe< ACE_LOCK, ALLOCATOR >::probe_name(), putmsg(), ACE_InputCDR::read_array(), ACE_UPIPE_Stream::recv(), ACE_SOCK_Dgram::recv(), ACE_MEM_IO::recv(), ACE_Codeset_Registry::registry_to_locale_i(), ACE_Obstack_T< CHAR >::request(), scandir_emulation(), ACE_SOCK_Dgram::send(), ACE_MEM_IO::send(), ACE_String_Base< CHAR >::set(), ACE_SPIPE_Addr::set(), ACE_Netlink_Addr::set(), ACE_INET_Addr::set(), ACE_ATM_Addr::set(), ACE_UNIX_Addr::set_addr(), ACE_SPIPE_Addr::set_addr(), ACE_ATM_Addr::set_addr(), ACE_INET_Addr::set_address(), ACE_Configuration_Heap::set_binary_value(), ACE_TLI::set_option(), set_scheduling_params(), ACE_Process_Options::setenv_i(), ACE_SOCK_SEQPACK_Connector::shared_connect_start(), ACE_SOCK_SEQPACK_Acceptor::shared_open(), ACE_Data_Block::size(), ACE_ATM_Addr::string_to_addr(), ACE_Name_Request::value(), and ACE_OutputCDR::write_array().

00038 {
00039 #if defined (ACE_HAS_MEMCPY_LOOP_UNROLL)
00040   return fast_memcpy (t, s, len);
00041 #else
00042   return ::memcpy (t, s, len);
00043 #endif /* ACE_HAS_MEMCPY_LOOP_UNROLL */
00044 }

ACE_INLINE void * ACE_OS::memmove void *  t,
const void *  s,
size_t  len
 

Moves one buffer to another.

Definition at line 47 of file OS_NS_string.inl.

Referenced by ACE_Message_Block::crunch(), ACE_Svc_Conf_Lexer::scan(), and ACE_Svc_Conf_Lexer::yylex().

00048 {
00049   return ::memmove (t, s, len);
00050 }

ACE_INLINE void * ACE_OS::memset void *  s,
int  c,
size_t  len
 

Fills a buffer with a character value.

Definition at line 53 of file OS_NS_string.inl.

Referenced by ACE_ATM_Addr::ACE_ATM_Addr(), ACE_ATM_QoS::ACE_ATM_QoS(), ACE_DEV_Addr::ACE_DEV_Addr(), ACE_INET_Addr::ACE_INET_Addr(), ACE_Mem_Map::ACE_Mem_Map(), ACE_Ping_Socket::ACE_Ping_Socket(), ACE_Process::ACE_Process(), ACE_Process_Options::ACE_Process_Options(), ACE_Profile_Timer::ACE_Profile_Timer(), ACE_SPIPE_Addr::ACE_SPIPE_Addr(), ACE_Token_Request::ACE_Token_Request(), ACE_UNIX_Addr::ACE_UNIX_Addr(), ACE_Malloc_T< ACE_MEM_POOL_2, ACE_LOCK, ACE_CB >::calloc(), ACE_Dynamic_Cached_Allocator< ACE_LOCK >::calloc(), ACE_Cached_Allocator< T, ACE_LOCK >::calloc(), ACE_Static_Allocator_Base::calloc(), ACE_New_Allocator::calloc(), cond_init(), condattr_init(), ACE::count_interfaces(), ACE_Thread::disablecancel(), fork_exec(), ACE::get_bcast_addr(), ACE::get_ip_interfaces(), ACE_SOCK_SEQPACK_Association::get_local_addrs(), ACE_ATM_Stream::get_peer_name(), ACE_SOCK_SEQPACK_Association::get_remote_addrs(), ACE_ATM_Stream::get_vpi_vci(), gethostbyaddr_r(), gethostbyname_r(), getmacaddress(), getpeername(), getservbyname_r(), getsockname(), ACE_Filecache_Object::init(), ACE_ATM_Addr::init(), lwp_getparams(), ACE_SOCK_Dgram::make_multicast_ifaddr6(), ACE_Dev_Poll_Reactor::mask_ops_i(), mutex_init(), ACE_ATM_Stream::open(), ACE_ATM_Acceptor::open(), ACE_Sched_Params::priority_max(), ACE_Sched_Params::priority_min(), ACE_Ping_Socket::receive_echo_reply(), ACE_Dev_Poll_Reactor::register_handler_i(), ACE_INET_Addr::reset(), ACE_String_Base< CHAR >::resize(), ACE_Dev_Poll_Reactor::resume_handler_i(), scheduling_class(), ACE_Ping_Socket::send_echo_check(), ACE_TTY_IO::Serial_Params::Serial_Params(), ACE_UNIX_Addr::set(), ACE_SPIPE_Addr::set(), ACE_Netlink_Addr::set(), ACE_INET_Addr::set(), ACE_DEV_Addr::set(), ACE_INET_Addr::set_address(), ACE_ATM_QoS::set_cbr_rate(), ACE::set_handle_limit(), set_scheduling_params(), ACE_SOCK_SEQPACK_Acceptor::shared_open(), ACE_SOCK_Acceptor::shared_open(), ACE_Dev_Poll_Reactor::suspend_handler_i(), thr_create(), and thr_setprio().

00054 {
00055   return ::memset (s, c, len);
00056 }

ACE_INLINE int ACE_OS::mkdir const wchar_t *  path,
mode_t  mode = ACE_DEFAULT_DIR_PERMS
 

Definition at line 172 of file OS_NS_sys_stat.inl.

References ACE_ADAPT_RETVAL, mkdir(), and mode_t.

00173   {
00174 #if defined (ACE_HAS_WINCE)
00175     ACE_UNUSED_ARG (mode);
00176     ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (CreateDirectoryW (path, 0),
00177                                             ace_result_),
00178                           int, -1);
00179 #elif defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
00180     ACE_UNUSED_ARG (mode);
00181     ACE_OSCALL_RETURN (::_wmkdir (path), int, -1);
00182 #else
00183     return ACE_OS::mkdir (ACE_Wide_To_Ascii (path).char_rep (), mode);
00184 #endif /* ACE_HAS_WINCE */
00185   }

ACE_INLINE int ACE_OS::mkdir const char *  path,
mode_t  mode = ACE_DEFAULT_DIR_PERMS
 

Definition at line 151 of file OS_NS_sys_stat.inl.

References ACE_ADAPT_RETVAL, ACE_TEXT_CHAR_TO_TCHAR, mkdir(), and mode_t.

Referenced by mkdir().

00152   {
00153 #if defined (ACE_WIN32) && defined (__IBMCPP__) && (__IBMCPP__ >= 400)
00154     ACE_UNUSED_ARG (mode);
00155     ACE_OSCALL_RETURN (::_mkdir (const_cast <char *> (path)), int, -1);
00156 #elif defined (ACE_HAS_WINCE)
00157     ACE_UNUSED_ARG (mode);
00158     ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::CreateDirectory (ACE_TEXT_CHAR_TO_TCHAR (path), 0),
00159                                             ace_result_),
00160                           int, -1);
00161 #elif defined (ACE_MKDIR_LACKS_MODE)
00162     ACE_UNUSED_ARG (mode);
00163     ACE_OSCALL_RETURN (::mkdir (path), int, -1);
00164 #else
00165     ACE_OSCALL_RETURN (::mkdir (path, mode), int, -1);
00166 #endif
00167   }

ACE_INLINE int ACE_OS::mkfifo const ACE_TCHAR file,
mode_t  mode = ACE_DEFAULT_FILE_PERMS
 

Definition at line 190 of file OS_NS_sys_stat.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, ACE_TCHAR, ACE_TEXT_ALWAYS_CHAR, mkfifo(), and mode_t.

Referenced by mkfifo(), ACE_FIFO::open(), and sema_init().

00191   {
00192     ACE_OS_TRACE ("ACE_OS::mkfifo");
00193 #if defined (ACE_LACKS_MKFIFO)
00194     ACE_UNUSED_ARG (file);
00195     ACE_UNUSED_ARG (mode);
00196     ACE_NOTSUP_RETURN (-1);
00197 #else
00198     ACE_OSCALL_RETURN (::mkfifo (ACE_TEXT_ALWAYS_CHAR (file), mode), int, -1);
00199 #endif /* ACE_LACKS_MKFIFO */
00200   }

ACE_INLINE ACE_HANDLE ACE_OS::mkstemp wchar_t *  s  ) 
 

Definition at line 186 of file OS_NS_stdlib.inl.

References ACE_TEXT_ALWAYS_CHAR, and ACE_TEXT_WCHAR_TO_TCHAR.

00187 {
00188 #  if !defined (ACE_LACKS_MKSTEMP)
00189   return ::mkstemp (ACE_TEXT_WCHAR_TO_TCHAR (ACE_TEXT_ALWAYS_CHAR (s)));
00190 #  else
00191   return ACE_OS::mkstemp_emulation (ACE_TEXT_WCHAR_TO_TCHAR (s));
00192 #  endif  /* !ACE_LACKS_MKSTEMP */
00193 }

ACE_INLINE ACE_HANDLE ACE_OS::mkstemp char *  s  ) 
 

Definition at line 175 of file OS_NS_stdlib.inl.

References ACE_TEXT_CHAR_TO_TCHAR.

Referenced by ACE_FILE_Connector::connect().

00176 {
00177 #if !defined (ACE_LACKS_MKSTEMP)
00178   return ::mkstemp (s);
00179 #else
00180   return ACE_OS::mkstemp_emulation (ACE_TEXT_CHAR_TO_TCHAR (s));
00181 #endif  /* !ACE_LACKS_MKSTEMP */
00182 }

ACE_INLINE wchar_t * ACE_OS::mktemp wchar_t *  s  ) 
 

Definition at line 209 of file OS_NS_stdlib.inl.

References strcpy().

00210 {
00211 #    if defined (ACE_WIN32)
00212   return ::_wmktemp (s);
00213 #    else
00214   // For narrow-char filesystems, we must convert the wide-char input to
00215   // a narrow-char string for mktemp(), then convert the name back to
00216   // wide-char for the caller.
00217   ACE_Wide_To_Ascii narrow_s (s);
00218   if (::mktemp (narrow_s.char_rep ()) == 0)
00219     return 0;
00220   ACE_Ascii_To_Wide wide_s (narrow_s.char_rep ());
00221   ACE_OS::strcpy (s, wide_s.wchar_rep ());
00222   return s;
00223 #    endif
00224 }

ACE_INLINE char * ACE_OS::mktemp char *  s  ) 
 

Definition at line 198 of file OS_NS_stdlib.inl.

Referenced by ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool(), and ACE_FILE_Addr::set().

00199 {
00200 # if defined (ACE_WIN32)
00201   return ::_mktemp (s);
00202 # else /* ACE_WIN32 */
00203   return ::mktemp (s);
00204 # endif /* ACE_WIN32 */
00205 }

time_t ACE_OS::mktime struct tm *  timeptr  ) 
 

Definition at line 307 of file OS_NS_time.cpp.

References ACE_OS_GUARD, ACE_OS_TRACE, and ACE_Time_Value::sec().

00308 {
00309   ACE_OS_TRACE ("ACE_OS::mktime");
00310 #   if defined (ACE_HAS_WINCE)
00311   SYSTEMTIME t_sys;
00312   FILETIME t_file;
00313   t_sys.wSecond = t->tm_sec;
00314   t_sys.wMinute = t->tm_min;
00315   t_sys.wHour = t->tm_hour;
00316   t_sys.wDay = t->tm_mday;
00317   t_sys.wMonth = t->tm_mon + 1;  // SYSTEMTIME is 1-indexed, tm is 0-indexed
00318   t_sys.wYear = t->tm_year + 1900; // SYSTEMTIME is real; tm is since 1900
00319   t_sys.wDayOfWeek = t->tm_wday;  // Ignored in below function call.
00320   if (SystemTimeToFileTime (&t_sys, &t_file) == 0)
00321     return -1;
00322   ACE_Time_Value tv (t_file);
00323   return tv.sec ();
00324 #   else
00325 #     if defined (ACE_HAS_THREADS)  &&  !defined (ACE_HAS_MT_SAFE_MKTIME)
00326   ACE_OS_GUARD
00327 #     endif /* ACE_HAS_THREADS  &&  ! ACE_HAS_MT_SAFE_MKTIME */
00328 
00329   ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::mktime (t), time_t, (time_t) -1);
00330 #   endif /* ACE_HAS_WINCE */
00331 }

ACE_INLINE void * ACE_OS::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,
const ACE_TCHAR file_mapping_name = 0
 

Definition at line 39 of file OS_NS_sys_mman.inl.

References ACE_BIT_ENABLED, ACE_DEFAULT_FILE_PERMS, ACE_FAIL_RETURN, ACE_MMAP_TYPE, ACE_NOTSUP_RETURN, ACE_OS_TRACE, ACE_TCHAR, default_win32_security_attributes_r(), filesize(), MAP_FAILED, MAP_FIXED, MAP_PRIVATE, MAP_SHARED, and sprintf().

Referenced by ACE_Mutex::ACE_Mutex(), event_init(), ACE_Mem_Map::map_it(), sema_init(), and sendfile_emulation().

00048 {
00049   ACE_OS_TRACE ("ACE_OS::mmap");
00050 #if !defined (ACE_WIN32) || defined (ACE_HAS_PHARLAP)
00051   ACE_UNUSED_ARG (file_mapping_name);
00052 #endif /* !defined (ACE_WIN32) || defined (ACE_HAS_PHARLAP) */
00053 
00054 #if defined (ACE_WIN32) && !defined (ACE_HAS_PHARLAP)
00055 
00056 #  if defined(ACE_HAS_WINCE)
00057   ACE_UNUSED_ARG (addr);
00058   if (ACE_BIT_ENABLED (flags, MAP_FIXED))     // not supported
00059   {
00060     errno = EINVAL;
00061     return MAP_FAILED;
00062   }
00063 #  else
00064   if (!ACE_BIT_ENABLED (flags, MAP_FIXED))
00065     addr = 0;
00066   else if (addr == 0)   // can not map to address 0
00067   {
00068     errno = EINVAL;
00069     return MAP_FAILED;
00070   }
00071 #  endif
00072 
00073   int nt_flags = 0;
00074   ACE_HANDLE local_handle = ACE_INVALID_HANDLE;
00075 
00076   // Ensure that file_mapping is non-zero.
00077   if (file_mapping == 0)
00078     file_mapping = &local_handle;
00079 
00080   if (ACE_BIT_ENABLED (flags, MAP_PRIVATE))
00081     {
00082 #  if !defined(ACE_HAS_WINCE)
00083       prot = PAGE_WRITECOPY;
00084 #  endif  // ACE_HAS_WINCE
00085       nt_flags = FILE_MAP_COPY;
00086     }
00087   else if (ACE_BIT_ENABLED (flags, MAP_SHARED))
00088     {
00089       if (ACE_BIT_ENABLED (prot, PAGE_READONLY))
00090         nt_flags = FILE_MAP_READ;
00091       if (ACE_BIT_ENABLED (prot, PAGE_READWRITE))
00092         nt_flags = FILE_MAP_WRITE;
00093     }
00094 
00095   // Only create a new handle if we didn't have a valid one passed in.
00096   if (*file_mapping == ACE_INVALID_HANDLE)
00097     {
00098 #  if !defined(ACE_HAS_WINCE) && (!defined (ACE_HAS_WINNT4) || (ACE_HAS_WINNT4 == 0))
00099       int try_create = 1;
00100       if ((file_mapping_name != 0) && (*file_mapping_name != 0))
00101         {
00102           // On Win9x, we first try to OpenFileMapping to
00103           // file_mapping_name. Only if there is no mapping object
00104           // with that name, and the desired name is valid, do we try
00105           // CreateFileMapping.
00106 
00107           *file_mapping = ACE_TEXT_OpenFileMapping (nt_flags,
00108                                                     0,
00109                                                     file_mapping_name);
00110           if (*file_mapping != 0
00111               || (::GetLastError () == ERROR_INVALID_NAME
00112                   && ::GetLastError () == ERROR_FILE_NOT_FOUND))
00113             try_create = 0;
00114         }
00115 
00116       if (try_create)
00117 #  endif /* !ACE_HAS_WINCE && (ACE_HAS_WINNT4 || ACE_HAS_WINNT4 == 0) */
00118         {
00119           SECURITY_ATTRIBUTES sa_buffer;
00120           SECURITY_DESCRIPTOR sd_buffer;
00121           const LPSECURITY_ATTRIBUTES attr =
00122             ACE_OS::default_win32_security_attributes_r (sa,
00123                                                          &sa_buffer,
00124                                                          &sd_buffer);
00125 
00126           *file_mapping = ACE_TEXT_CreateFileMapping (file_handle,
00127                                                       attr,
00128                                                       prot,
00129                                                       0,
00130                                                       0,
00131                                                       file_mapping_name);
00132         }
00133     }
00134 
00135   if (*file_mapping == 0)
00136     ACE_FAIL_RETURN (MAP_FAILED);
00137 
00138 #  if defined (ACE_OS_EXTRA_MMAP_FLAGS)
00139   nt_flags |= ACE_OS_EXTRA_MMAP_FLAGS;
00140 #  endif /* ACE_OS_EXTRA_MMAP_FLAGS */
00141 
00142 #  if !defined (ACE_HAS_WINCE)
00143   void *addr_mapping = ::MapViewOfFileEx (*file_mapping,
00144                                           nt_flags,
00145                                           0,
00146                                           off,
00147                                           len,
00148                                           addr);
00149 #  else
00150   void *addr_mapping = ::MapViewOfFile (*file_mapping,
00151                                         nt_flags,
00152                                         0,
00153                                         off,
00154                                         len);
00155 #  endif /* ! ACE_HAS_WINCE */
00156 
00157   // Only close this down if we used the temporary.
00158   if (file_mapping == &local_handle)
00159     ::CloseHandle (*file_mapping);
00160 
00161   if (addr_mapping == 0)
00162     ACE_FAIL_RETURN (MAP_FAILED);
00163   else
00164     return addr_mapping;
00165 #elif defined (ACE_HAS_LYNXOS_BROKEN_MMAP)
00166   // The LynxOS mmap doesn't allow operations on plain
00167   // file descriptors.  So, create a shm object and use that.
00168   ACE_UNUSED_ARG (sa);
00169 
00170   char name [128];
00171   sprintf (name, "%d", file_handle);
00172 
00173   // Assumes that this was called by ACE_Mem_Map, so &file_mapping !=
00174   // 0.  Otherwise, we don't support the incomplete LynxOS mmap
00175   // implementation.  We do support it by creating a hidden shared
00176   // memory object, and using that for the mapping.
00177   int shm_handle;
00178   if (! file_mapping)
00179     file_mapping = &shm_handle;
00180   if ((*file_mapping = ::shm_open (name,
00181                                    O_RDWR | O_CREAT | O_TRUNC,
00182                                    ACE_DEFAULT_FILE_PERMS)) == -1)
00183     return MAP_FAILED;
00184   else
00185     {
00186       // The size of the shared memory object must be explicitly set on LynxOS.
00187       const off_t filesize = ACE_OS::filesize (file_handle);
00188       if (::ftruncate (*file_mapping, filesize) == -1)
00189         return MAP_FAILED;
00190       else
00191         {
00192 #  if defined (ACE_OS_EXTRA_MMAP_FLAGS)
00193           flags |= ACE_OS_EXTRA_MMAP_FLAGS;
00194 #  endif /* ACE_OS_EXTRA_MMAP_FLAGS */
00195           char *map = (char *) ::mmap ((ACE_MMAP_TYPE) addr,
00196                                        len,
00197                                        prot,
00198                                        flags,
00199                                        *file_mapping,
00200                                        off);
00201           if (map == MAP_FAILED)
00202             return MAP_FAILED;
00203           else
00204             // Finally, copy the file contents to the shared memory object.
00205             return ::read (file_handle, map, (int) filesize) == filesize
00206               ? map
00207               : MAP_FAILED;
00208         }
00209     }
00210 #elif !defined (ACE_LACKS_MMAP)
00211   ACE_UNUSED_ARG (sa);
00212 
00213 #  if defined (ACE_OS_EXTRA_MMAP_FLAGS)
00214   flags |= ACE_OS_EXTRA_MMAP_FLAGS;
00215 #  endif /* ACE_OS_EXTRA_MMAP_FLAGS */
00216   ACE_UNUSED_ARG (file_mapping);
00217 #  if defined (ACE_OPENVMS)
00218   ::fsync(file_handle);
00219 #  endif
00220   ACE_OSCALL_RETURN ((void *) ::mmap ((ACE_MMAP_TYPE) addr,
00221                                       len,
00222                                       prot,
00223                                       flags,
00224                                       file_handle,
00225                                       off),
00226                      void *, MAP_FAILED);
00227 #else
00228   ACE_UNUSED_ARG (addr);
00229   ACE_UNUSED_ARG (len);
00230   ACE_UNUSED_ARG (prot);
00231   ACE_UNUSED_ARG (flags);
00232   ACE_UNUSED_ARG (file_handle);
00233   ACE_UNUSED_ARG (off);
00234   ACE_UNUSED_ARG (file_mapping);
00235   ACE_UNUSED_ARG (sa);
00236   ACE_NOTSUP_RETURN (MAP_FAILED);
00237 #endif /* ACE_WIN32 && !ACE_HAS_PHARLAP */
00238 }

ACE_INLINE int ACE_OS::mprotect void *  addr,
size_t  len,
int  prot
 

Definition at line 246 of file OS_NS_sys_mman.inl.

References ACE_MMAP_TYPE, ACE_NOTSUP_RETURN, ACE_OS_TRACE, and mprotect().

Referenced by mprotect(), ACE_MMAP_Memory_Pool::protect(), and ACE_Mem_Map::protect().

00247 {
00248   ACE_OS_TRACE ("ACE_OS::mprotect");
00249 #if defined (ACE_WIN32) && !defined (ACE_HAS_PHARLAP)
00250   DWORD dummy; // Sigh!
00251   return ::VirtualProtect(addr, len, prot, &dummy) ? 0 : -1;
00252 #elif !defined (ACE_LACKS_MPROTECT)
00253   ACE_OSCALL_RETURN (::mprotect ((ACE_MMAP_TYPE) addr, len, prot), int, -1);
00254 #else
00255   ACE_UNUSED_ARG (addr);
00256   ACE_UNUSED_ARG (len);
00257   ACE_UNUSED_ARG (prot);
00258   ACE_NOTSUP_RETURN (-1);
00259 #endif /* ACE_WIN32 && !ACE_HAS_PHARLAP */
00260 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_OS::msgctl int  msqid,
int  cmd,
struct msqid_ds * 
 

Definition at line 10 of file OS_NS_sys_msg.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and msgctl().

Referenced by ACE_SV_Message_Queue::control(), and msgctl().

00011 {
00012   ACE_OS_TRACE ("ACE_OS::msgctl");
00013 #if defined (ACE_HAS_SYSV_IPC)
00014   ACE_OSCALL_RETURN (::msgctl (msqid, cmd, val), int, -1);
00015 #else
00016   ACE_UNUSED_ARG (msqid);
00017   ACE_UNUSED_ARG (cmd);
00018   ACE_UNUSED_ARG (val);
00019 
00020   ACE_NOTSUP_RETURN (-1);
00021 #endif /* ACE_HAS_SYSV_IPC */
00022 }

ACE_INLINE int ACE_OS::msgget key_t  key,
int  msgflg
 

Definition at line 25 of file OS_NS_sys_msg.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and msgget().

Referenced by msgget(), and ACE_SV_Message_Queue::open().

00026 {
00027   ACE_OS_TRACE ("ACE_OS::msgget");
00028 #if defined (ACE_HAS_SYSV_IPC)
00029   ACE_OSCALL_RETURN (::msgget (key, msgflg), int, -1);
00030 #else
00031   ACE_UNUSED_ARG (key);
00032   ACE_UNUSED_ARG (msgflg);
00033 
00034   ACE_NOTSUP_RETURN (-1);
00035 #endif /* ACE_HAS_SYSV_IPC */
00036 }

ACE_INLINE ssize_t ACE_OS::msgrcv int  int_id,
void *  buf,
size_t  len,
long  type,
int  flags
 

Definition at line 39 of file OS_NS_sys_msg.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and msgrcv().

Referenced by msgrcv(), and ACE_SV_Message_Queue::recv().

00041 {
00042   ACE_OS_TRACE ("ACE_OS::msgrcv");
00043 #if defined (ACE_HAS_SYSV_IPC)
00044   ACE_OSCALL_RETURN (::msgrcv (int_id, buf, len, type, flags),
00045                      int, -1);
00046 #else
00047   ACE_UNUSED_ARG (int_id);
00048   ACE_UNUSED_ARG (buf);
00049   ACE_UNUSED_ARG (len);
00050   ACE_UNUSED_ARG (type);
00051   ACE_UNUSED_ARG (flags);
00052 
00053   ACE_NOTSUP_RETURN (-1);
00054 #endif /* ACE_HAS_SYSV_IPC */
00055 }

ACE_INLINE int ACE_OS::msgsnd int  int_id,
const void *  buf,
size_t  len,
int  flags
 

Definition at line 58 of file OS_NS_sys_msg.inl.

References ACE_NOTSUP_RETURN, ACE_OS_TRACE, and msgsnd().

Referenced by msgsnd(), and ACE_SV_Message_Queue::send().

00059 {
00060   ACE_OS_TRACE ("ACE_OS::msgsnd");
00061 #if defined (ACE_HAS_SYSV_IPC)
00062 # if defined (ACE_HAS_NONCONST_MSGSND)
00063   ACE_OSCALL_RETURN (::msgsnd (int_id,
00064                                const_cast<void *> (buf), len, flags), int, -1);
00065 # else
00066   ACE_OSCALL_RETURN (::msgsnd (int_id, buf, len, flags), int, -1);
00067 # endif /* ACE_HAS_NONCONST_MSGSND */
00068 #else
00069   ACE_UNUSED_ARG (int_id);
00070   ACE_UNUSED_ARG (buf);
00071   ACE_UNUSED_ARG (len);
00072   ACE_UNUSED_ARG (flags);
00073 
00074   ACE_NOTSUP_RETURN (-1);
00075 #endif /* ACE_HAS_SYSV_IPC */
00076 }

ACE_INLINE int ACE_OS::msync void *  addr,
size_t  len,
int  sync
 

Definition at line 263 of file OS_NS_sys_mman.inl.

References ACE_ADAPT_RETVAL, ACE_MMAP_TYPE, ACE_NOTSUP_RETURN, ACE_OS_TRACE, and msync().

Referenced by msync(), ACE_MMAP_Memory_Pool::sync(), and ACE_Mem_Map::sync().

00264 {
00265   ACE_OS_TRACE ("ACE_OS::msync");
00266 #if defined (ACE_WIN32) && !defined (ACE_HAS_PHARLAP)
00267   ACE_UNUSED_ARG (sync);
00268 
00269   ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::FlushViewOfFile (addr, len), ace_result_), int, -1);
00270 #elif !defined (ACE_LACKS_MSYNC)
00271 # if !defined (ACE_HAS_BROKEN_NETBSD_MSYNC)
00272   ACE_OSCALL_RETURN (::msync ((ACE_MMAP_TYPE) addr, len, sync), int, -1);
00273 # else
00274   ACE_OSCALL_RETURN (::msync ((ACE_MMAP_TYPE) addr, len), int, -1);
00275   ACE_UNUSED_ARG (sync);
00276 # endif /* ACE_HAS_BROKEN_NETBSD_MSYNC */
00277 #else
00278   ACE_UNUSED_ARG (addr);
00279   ACE_UNUSED_ARG (len);
00280   ACE_UNUSED_ARG (sync);
00281   ACE_NOTSUP_RETURN (-1);
00282 #endif /* ACE_WIN32 && !ACE_HAS_PHARLAP */
00283 }

ACE_INLINE int ACE_OS::munmap void *  addr,
size_t  len
 

Definition at line 286 of file OS_NS_sys_mman.inl.

References ACE_ADAPT_RETVAL, ACE_MMAP_TYPE, ACE_NOTSUP_RETURN, ACE_OS_TRACE, and munmap().

Referenced by event_destroy(), munmap(), ACE_Mutex::remove(), sendfile_emulation(), and ACE_Mem_Map::unmap().

00287 {
00288   ACE_OS_TRACE ("ACE_OS::munmap");
00289 #if defined (ACE_WIN32)
00290   ACE_UNUSED_ARG (len);
00291 
00292   ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::UnmapViewOfFile (addr), ace_result_), int, -1);
00293 #elif !defined (ACE_LACKS_MMAP)
00294   ACE_OSCALL_RETURN (::munmap ((ACE_MMAP_TYPE) addr, len), int, -1);
00295 #else
00296   ACE_UNUSED_ARG (addr);
00297   ACE_UNUSED_ARG (len);
00298   ACE_NOTSUP_RETURN (-1);
00299 #endif /* ACE_WIN32 */
00300 }

int ACE_OS::mutex_destroy ACE_mutex_t *  m  ) 
 

Definition at line 2014 of file OS_NS_Thread.cpp.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, ACE_OS_TRACE, mutex_destroy(), and thread_mutex_destroy().

Referenced by event_destroy(), mutex_destroy(), ACE_Mutex::remove(), rwlock_destroy(), sema_destroy(), sema_init(), and thread_mutex_destroy().

02015 {
02016   ACE_OS_TRACE ("ACE_OS::mutex_destroy");
02017 #if defined (ACE_HAS_THREADS)
02018 # if defined (ACE_HAS_PTHREADS)
02019 #   if (defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6))
02020   ACE_OSCALL_RETURN (::pthread_mutex_destroy (m), int, -1);
02021 #   else
02022   int result;
02023   ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_mutex_destroy (m),
02024                      result), int, -1);
02025 #   endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6*/
02026 # elif defined (ACE_HAS_STHREADS)
02027   int result;
02028   ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::mutex_destroy (m), result), int, -1);
02029 # elif defined (ACE_HAS_WTHREADS)
02030   switch (m->type_)
02031 {
02032   case USYNC_PROCESS:
02033     ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::CloseHandle (m->proc_mutex_),
02034                           ace_result_),
02035     int, -1);
02036   case USYNC_THREAD:
02037     return ACE_OS::thread_mutex_destroy (&m->thr_mutex_);
02038   default:
02039     errno = EINVAL;
02040     return -1;
02041 }
02042   /* NOTREACHED */
02043 # elif defined (ACE_VXWORKS)
02044   return ::semDelete (*m) == OK ? 0 : -1;
02045 # endif /* Threads variety case */
02046 #else
02047   ACE_UNUSED_ARG (m);
02048   ACE_NOTSUP_RETURN (-1);
02049 #endif /* ACE_HAS_THREADS */
02050 }

int ACE_OS::mutex_init ACE_mutex_t *  m,
int  lock_scope,
const wchar_t *  name,
ACE_mutexattr_t *  arg = 0,
LPSECURITY_ATTRIBUTES  sa = 0,
int  lock_type = 0
 

Definition at line 2054 of file OS_NS_Thread.cpp.

References ACE_FAIL_RETURN, mutex_init(), and thread_mutex_init().

02060 {
02061 #if defined (ACE_HAS_THREADS) && defined (ACE_HAS_WTHREADS)
02062   m->type_ = lock_scope;
02063   SECURITY_ATTRIBUTES sa_buffer;
02064   SECURITY_DESCRIPTOR sd_buffer;
02065   switch (lock_scope)
02066   {
02067     case USYNC_PROCESS:
02068       m->proc_mutex_ =
02069       ::CreateMutexW (ACE_OS::default_win32_security_attributes_r
02070           (sa, &sa_buffer, &sd_buffer),
02071       FALSE,
02072       name);
02073       if (m->proc_mutex_ == 0)
02074         ACE_FAIL_RETURN (-1);
02075       else
02076         return 0;
02077     case USYNC_THREAD:
02078       return ACE_OS::thread_mutex_init (&m->thr_mutex_,
02079                                          lock_type,
02080                                          name,
02081                                          attributes);
02082   }
02083 
02084   errno = EINVAL;
02085   return -1;
02086 #else /* ACE_HAS_THREADS && ACE_HAS_WTHREADS */
02087   return ACE_OS::mutex_init (m,
02088                              lock_scope,
02089                              ACE_Wide_To_Ascii (name).char_rep (),
02090                              attributes,
02091                              sa,
02092                              lock_type);
02093 #endif /* ACE_HAS_THREADS && ACE_HAS_WTHREADS */
02094 }

int ACE_OS::mutex_init ACE_mutex_t *  m,
int  lock_scope = ACE_DEFAULT_SYNCH_TYPE,
const char *  name = 0,
ACE_mutexattr_t *  arg = 0,
LPSECURITY_ATTRIBUTES  sa = 0,
int  lock_type = 0
 

Definition at line 1832 of file OS_NS_Thread.cpp.

References ACE_ADAPT_RETVAL, ACE_FAIL_RETURN, ACE_NOTSUP_RETURN, memset(), mutex_init(), set_errno_to_last_error(), and thread_mutex_init().

Referenced by ACE_Mutex::ACE_Mutex(), event_init(), mutex_init(), sema_init(), and thread_mutex_init().

01838 {
01839   // ACE_OS_TRACE ("ACE_OS::mutex_init");
01840 #if defined (ACE_HAS_THREADS)
01841 # if defined (ACE_HAS_PTHREADS)
01842   ACE_UNUSED_ARG (name);
01843   ACE_UNUSED_ARG (sa);
01844 
01845 # if defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600) && (ACE_VXWORKS <= 0x620)
01846   /* Tests show that VxWorks 6.x pthread lib does not only
01847    * require zeroing of mutex/condition objects to function correctly
01848    * but also of the attribute objects.
01849    */
01850   pthread_mutexattr_t l_attributes = {0};
01851 # else
01852   pthread_mutexattr_t l_attributes;
01853 # endif
01854 
01855   if (attributes == 0)
01856     attributes = &l_attributes;
01857   int result = 0;
01858   int attr_init = 0;  // have we initialized the local attributes.
01859 
01860   // Only do these initializations if the <attributes> parameter
01861   // wasn't originally set.
01862   if (attributes == &l_attributes)
01863   {
01864 #   if defined (ACE_HAS_PTHREADS_DRAFT4)
01865       if (::pthread_mutexattr_create (attributes) == 0)
01866 #   elif defined (ACE_HAS_PTHREADS_DRAFT7) || defined (ACE_HAS_PTHREADS_STD)
01867       if (ACE_ADAPT_RETVAL (::pthread_mutexattr_init (attributes), result) == 0)
01868 #   else /* draft 6 */
01869       if (::pthread_mutexattr_init (attributes) == 0)
01870 #   endif /* ACE_HAS_PTHREADS_DRAFT4 */
01871 {
01872   result = 0;
01873   attr_init = 1; // we have initialized these attributes
01874 }
01875       else
01876         result = -1;        // ACE_ADAPT_RETVAL used it for intermediate status
01877   }
01878 
01879   if (result == 0 && lock_scope != 0)
01880 {
01881 #   if defined (ACE_HAS_PTHREADS_DRAFT7) || defined (ACE_HAS_PTHREADS_STD)
01882 #     if defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_MUTEXATTR_PSHARED)
01883       (void) ACE_ADAPT_RETVAL (::pthread_mutexattr_setpshared (attributes,
01884                                                                lock_scope),
01885                                result);
01886 #     endif /* _POSIX_THREAD_PROCESS_SHARED && !ACE_LACKS_MUTEXATTR_PSHARED */
01887 #   else /* Pthreads draft 6 */
01888 #     if !defined (ACE_LACKS_MUTEXATTR_PSHARED)
01889       if (::pthread_mutexattr_setpshared (attributes, lock_scope) != 0)
01890         result = -1;
01891 #     endif /* ACE_LACKS_MUTEXATTR_PSHARED */
01892 #   endif /* ACE_HAS_PTHREADS_DRAFT7 || ACE_HAS_PTHREADS_STD */
01893 }
01894 
01895   if (result == 0 && lock_type != 0)
01896 {
01897 #   if defined (ACE_HAS_PTHREADS_DRAFT4)
01898 #     if defined (ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP)
01899       if (::pthread_mutexattr_setkind_np (attributes, lock_type) != 0)
01900         result = -1;
01901 #     endif /* ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP */
01902 #   elif defined (ACE_HAS_RECURSIVE_MUTEXES)
01903       (void) ACE_ADAPT_RETVAL (::pthread_mutexattr_settype (attributes,
01904                                                             lock_type),
01905                                result);
01906 #   endif /* ACE_HAS_PTHREADS_DRAFT4 */
01907 }
01908 
01909   if (result == 0)
01910 {
01911 #   if defined (ACE_VXWORKS)&& (ACE_VXWORKS >= 0x600) && (ACE_VXWORKS <= 0x620)
01912       /* VxWorks 6.x API reference states:
01913        * If the memory for the mutex variable object has been allocated
01914        *   dynamically, it is a good policy to always zero out the
01915        *   block of memory so as to avoid spurious EBUSY return code
01916        *   when calling this routine.
01917        * Tests shows this to be necessary.
01918        */
01919       ACE_OS::memset (m, 0, sizeof (*m));
01920 #   endif
01921 #   if defined (ACE_HAS_PTHREADS_DRAFT4)
01922       if (::pthread_mutex_init (m, *attributes) == 0)
01923 #   elif defined (ACE_HAS_PTHREADS_DRAFT7) || defined (ACE_HAS_PTHREADS_STD)
01924       if (ACE_ADAPT_RETVAL (::pthread_mutex_init (m, attributes), result) == 0)
01925 #   else
01926       if (::pthread_mutex_init (m, attributes) == 0)
01927 #   endif /* ACE_HAS_PTHREADS_DRAFT4 */
01928         result = 0;
01929       else
01930         result = -1;        // ACE_ADAPT_RETVAL used it for intermediate status
01931 }
01932 
01933   // Only do the deletions if the <attributes> parameter wasn't
01934   // originally set.
01935   if (attributes == &l_attributes && attr_init)
01936 #   if defined (ACE_HAS_PTHREADS_DRAFT4)
01937   ::pthread_mutexattr_delete (&l_attributes);
01938 #   else
01939   ::pthread_mutexattr_destroy (&l_attributes);
01940 #   endif /* ACE_HAS_PTHREADS_DRAFT4 */
01941 
01942   return result;
01943 # elif defined (ACE_HAS_STHREADS)
01944   ACE_UNUSED_ARG (name);
01945   ACE_UNUSED_ARG (sa);
01946   ACE_UNUSED_ARG (lock_type);
01947   int result;
01948   ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::mutex_init (m,
01949                      lock_scope,
01950                      attributes),
01951   result),
01952   int, -1);
01953 # elif defined (ACE_HAS_WTHREADS)
01954   m->type_ = lock_scope;
01955 
01956   SECURITY_ATTRIBUTES sa_buffer;
01957   SECURITY_DESCRIPTOR sd_buffer;
01958   switch (lock_scope)
01959 {
01960   case USYNC_PROCESS:
01961 #   if defined (ACE_HAS_WINCE)
01962       // @@todo (brunsch) This idea should be moved into ACE_OS_Win32.
01963       m->proc_mutex_ =
01964   ::CreateMutexW (ACE_OS::default_win32_security_attributes_r
01965                           (sa, &sa_buffer, &sd_buffer),
01966                         FALSE,
01967                         ACE_Ascii_To_Wide (name).wchar_rep ());
01968 #   else /* ACE_HAS_WINCE */
01969       m->proc_mutex_ =
01970   ::CreateMutexA (ACE_OS::default_win32_security_attributes_r
01971                           (sa, &sa_buffer, &sd_buffer),
01972                         FALSE,
01973                         name);
01974 #   endif /* ACE_HAS_WINCE */
01975       if (m->proc_mutex_ == 0)
01976         ACE_FAIL_RETURN (-1);
01977       else
01978       {
01979           // Make sure to set errno to ERROR_ALREADY_EXISTS if necessary.
01980         ACE_OS::set_errno_to_last_error ();
01981         return 0;
01982       }
01983   case USYNC_THREAD:
01984     return ACE_OS::thread_mutex_init (&m->thr_mutex_,
01985                                        lock_type,
01986                                        name,
01987                                        attributes);
01988   default:
01989     errno = EINVAL;
01990     return -1;
01991 }
01992   /* NOTREACHED */
01993 
01994 # elif defined (ACE_VXWORKS)
01995   ACE_UNUSED_ARG (name);
01996   ACE_UNUSED_ARG (attributes);
01997   ACE_UNUSED_ARG (sa);
01998   ACE_UNUSED_ARG (lock_type);
01999 
02000   return (*m = ::semMCreate (lock_scope)) == 0 ? -1 : 0;
02001 # endif /* ACE_HAS_PTHREADS */
02002 #else
02003   ACE_UNUSED_ARG (m);
02004   ACE_UNUSED_ARG (lock_scope);
02005   ACE_UNUSED_ARG (name);
02006   ACE_UNUSED_ARG (attributes);
02007   ACE_UNUSED_ARG (sa);
02008   ACE_UNUSED_ARG (lock_type);
02009   ACE_NOTSUP_RETURN (-1);
02010 #endif /* ACE_HAS_THREADS */
02011 }

ACE_INLINE int ACE_OS::mutex_lock ACE_mutex_t *  m,
const ACE_Time_Value timeout
 

If == 0, calls <ACE_OS::mutex_lock(m)>. Otherwise, this method attempts to acquire a lock, but gives up if the lock has not been acquired by the given time, in which case it returns -1 with an errno on platforms that actually support timed mutexes. The timeout should be an absolute time. Note that the mutex should not be a recursive one, i.e., it should only be a standard mutex or an error checking mutex since some implementations of this method don't support recursive mutexes. If you want to use a recursive mutex see the methods below.

Definition at line 461 of file OS_NS_Thread.inl.

References mutex_lock().

00463 {
00464   return timeout == 0 ? ACE_OS::mutex_lock (m) : ACE_OS::mutex_lock (m, *timeout);
00465 }

int ACE_OS::mutex_lock ACE_mutex_t *  m,
const ACE_Time_Value timeout
 

This method attempts to acquire a lock, but gives up if the lock has not been acquired by the given time. If the lock is not acquired within the given amount of time, then this method returns -1 with an errno on platforms that actually support timed mutexes. The timeout should be an absolute time. Note that the mutex should not be a recursive one, i.e., it should only be a standard mutex or an error checking mutex since some implementations of this method don't support recursive mutexes. If you want to use a recursive mutex see the methods below.

Definition at line 2189 of file OS_NS_Thread.cpp.

References ACE_ADAPT_RETVAL, ACE_NOTSUP_RETURN, ACE_ONE_SECOND_IN_USECS, EBUSY, ETIME, ETIMEDOUT, ACE_Time_Value::msec(), ACE_Time_Value::sec(), set_errno_to_last_error(), timespec_t, and ACE_Time_Value::usec().

02191 {
02192 #if defined (ACE_HAS_THREADS) && defined (ACE_HAS_MUTEX_TIMEOUTS)
02193 
02194 #  if defined (ACE_HAS_PTHREADS)
02195   int result;
02196 
02197   // "timeout" should be an absolute time.
02198 
02199   timespec_t ts = timeout;  // Calls ACE_Time_Value::operator timespec_t().
02200 
02201   // Note that the mutex should not be a recursive one, i.e., it
02202   // should only be a standard mutex or an error checking mutex.
02203 
02204   ACE_OSCALL (ACE_ADAPT_RETVAL (::pthread_mutex_timedlock (m, &ts), result), int, -1, result);
02205 
02206   // We need to adjust this to make the errno values consistent.
02207   if (result == -1 && errno == ETIMEDOUT)
02208     errno = ETIME;
02209   return result;
02210 
02211 #  elif defined (ACE_HAS_WTHREADS)
02212   // Note that we must convert between absolute time (which is passed
02213   // as a parameter) and relative time (which is what the system call
02214   // expects).
02215   ACE_Time_Value relative_time (timeout - ACE_OS::gettimeofday ());
02216 
02217   switch (m->type_)
02218   {
02219     case USYNC_PROCESS:
02220       switch (::WaitForSingleObject (m->proc_mutex_,
02221                 relative_time.msec ()))
02222       {
02223         case WAIT_OBJECT_0:
02224         case WAIT_ABANDONED:
02225           // We will ignore abandonments in this method
02226           // Note that we still hold the lock
02227           return 0;
02228         case WAIT_TIMEOUT:
02229           errno = ETIME;
02230           return -1;
02231         default:
02232           // This is a hack, we need to find an appropriate mapping...
02233           ACE_OS::set_errno_to_last_error ();
02234           return -1;
02235       }
02236     case USYNC_THREAD:
02237       ACE_NOTSUP_RETURN (-1);
02238     default:
02239       errno = EINVAL;
02240       return -1;
02241   }
02242   /* NOTREACHED */
02243 
02244 #  elif defined (ACE_VXWORKS)
02245 
02246   // Note that we must convert between absolute time (which is passed
02247   // as a parameter) and relative time (which is what the system call
02248   // expects).
02249   ACE_Time_Value relative_time (timeout - ACE_OS::gettimeofday ());
02250 
02251   int ticks_per_sec = ::sysClkRateGet ();
02252 
02253   int ticks = relative