diff options
Diffstat (limited to 'X11/Xos_r.h')
-rw-r--r-- | X11/Xos_r.h | 103 |
1 files changed, 19 insertions, 84 deletions
diff --git a/X11/Xos_r.h b/X11/Xos_r.h index 7ce72ac13..f963b6410 100644 --- a/X11/Xos_r.h +++ b/X11/Xos_r.h @@ -1,5 +1,3 @@ -/* $Xorg: Xos_r.h,v 1.4 2001/02/09 02:03:22 xorgcvs Exp $ */ -/* $XdotOrg: proto/X11/Xos_r.h,v 1.5 2005/07/13 07:23:56 keithp Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -23,7 +21,6 @@ Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/include/Xos_r.h,v 1.18tsi Exp $ */ /* * Various and sundry Thread-Safe functions used by X11, Motif, and CDE. @@ -40,13 +37,13 @@ in this Software without prior written authorization from The Open Group. * * If you are on a platform that defines XTHREADS but does not have * MT-safe system API (e.g. UnixWare) you must define _Xos_processLock - * and _Xos_processUnlock macros before including this header. If - * you are on OSF/1 V3.2 and plan to use readdir(), you must also define - * _Xos_isThreadInitialized. For convenience XOS_USE_XLIB_LOCKING or - * XOS_USE_XT_LOCKING may be defined to obtain either Xlib-only or - * Xt-based versions of these macros. These macros won't result in - * truly thread-safe calls, but they are better than nothing. If you - * do not want locking in this situation define XOS_USE_NO_LOCKING. + * and _Xos_processUnlock macros before including this header. + * + * For convenience XOS_USE_XLIB_LOCKING or XOS_USE_XT_LOCKING may be defined + * to obtain either Xlib-only or Xt-based versions of these macros. These + * macros won't result in truly thread-safe calls, but they are better than + * nothing. If you do not want locking in this situation define + * XOS_USE_NO_LOCKING. * * NOTE: On systems lacking appropriate _r functions Gethostbyname(), * Gethostbyaddr(), and Getservbyname() do NOT copy the host or @@ -195,20 +192,11 @@ extern void XtProcessUnlock( * uses the older SVR4 thread-safe functions unless the POSIX ones * are specifically requested. Fix the feature test macro. */ -#if defined(sun) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && \ +#if defined(__sun) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && \ (_POSIX_C_SOURCE - 0 < 199506L) && !defined(_POSIX_PTHREAD_SEMANTICS) # undef _POSIX_THREAD_SAFE_FUNCTIONS #endif -/* - * LynxOS 3.1 defines _POSIX_THREAD_SAFE_FUNCTIONS but - * getpwuid_r has different semantics than defined by POSIX - */ -#if defined(Lynx) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) -# undef _POSIX_THREAD_SAFE_FUNCTIONS -#endif - - /***** <pwd.h> wrappers *****/ /* @@ -331,24 +319,16 @@ static __inline__ void _Xpw_copyPasswd(_Xgetpwparams p) (p).pwp ) #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(__APPLE__) -/* SVR4 threads, AIX 4.2.0 and earlier and OSF/1 3.2 and earlier pthreads */ # define X_NEEDS_PWPARAMS typedef struct { struct passwd pws; char pwbuf[X_LINE_MAX]; } _Xgetpwparams; -# if defined(_POSIX_REENTRANT_FUNCTIONS) || !defined(SVR4) || defined(Lynx) -# ifndef Lynx +# if defined(_POSIX_REENTRANT_FUNCTIONS) || !defined(SVR4) # define _XGetpwuid(u,p) \ ((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) # define _XGetpwnam(u,p) \ ((getpwnam_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) -# else /* Lynx */ -# define _XGetpwuid(u,p) \ -((getpwuid_r(&(p).pws,(u),(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) -# define _XGetpwnam(u,p) \ -((getpwnam_r(&(p).pws,(u),(p).pwbuf,sizeof((p).pwbuf)) == -1) ? NULL : &(p).pws) -# endif # else /* SVR4 */ # define _XGetpwuid(u,p) \ ((getpwuid_r((u),&(p).pws,(p).pwbuf,sizeof((p).pwbuf)) == NULL) ? NULL : &(p).pws) @@ -357,12 +337,6 @@ typedef struct { # endif /* SVR4 */ #else /* _POSIX_THREAD_SAFE_FUNCTIONS */ -/* Digital UNIX 4.0, but not (beta) T4.0-1 */ -# if defined(__osf__) -/* OSF/1 V4.0 <pwd.h> doesn't declare the _P routines, breaking under C++. */ -extern int _Pgetpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **); -extern int _Pgetpwnam_r(const char *, struct passwd *, char *, size_t, struct passwd **); -# endif # define X_NEEDS_PWPARAMS typedef struct { struct passwd pws; @@ -427,7 +401,6 @@ typedef int _Xgetservbynameparams; /* dummy */ # define _XGetservbyname(s,p,sp) getservbyname((s),(p)) #elif !defined(XOS_USE_MTSAFE_NETDBAPI) || defined(XNO_MTSAFE_NETDBAPI) -/* UnixWare 2.0, or other systems with thread support but no _r API. */ /* WARNING: The h_addr_list and s_aliases values are *not* copied! */ #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) @@ -485,9 +458,6 @@ typedef struct { */ # ifdef _POSIX_REENTRANT_FUNCTIONS # ifndef _POSIX_THREAD_SAFE_FUNCTIONS -# if defined(AIXV3) || defined(AIXV4) || defined(__osf__) -# define X_POSIX_THREAD_SAFE_FUNCTIONS 1 -# endif # endif # endif # ifdef _POSIX_THREAD_SAFE_FUNCTIONS @@ -565,7 +535,7 @@ typedef int _Xgetservbynameparams; /* dummy */ #if defined(X_INCLUDE_DIRENT_H) && !defined(_XOS_INCLUDED_DIRENT_H) # include <sys/types.h> -# if !defined(X_NOT_POSIX) || defined(SYSV) || defined(USG) +# if !defined(X_NOT_POSIX) || defined(SYSV) # include <dirent.h> # else # include <sys/dir.h> @@ -622,32 +592,10 @@ typedef struct { # endif } _Xreaddirparams; -# if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(AIXV3) || \ - defined(AIXV4) || defined(__APPLE__) -/* AIX defines the draft POSIX symbol, but uses the final API. */ +# if defined(_POSIX_THREAD_SAFE_FUNCTIONS) || defined(__APPLE__) /* POSIX final API, returns (int)0 on success. */ -# if defined(__osf__) -/* OSF/1 V4.0 <dirent.h> doesn't declare _Preaddir_r, breaking under C++. */ -extern int _Preaddir_r(DIR *, struct dirent *, struct dirent **); -# endif # define _XReaddir(d,p) \ (readdir_r((d), &((p).dir_entry), &((p).result)) ? NULL : (p).result) -# elif defined(_POSIX_REENTRANT_FUNCTIONS) && defined(__osf__) -/* - * OSF/1 V3.2 readdir_r() will SEGV if the main program is not - * explicitly linked with -lc_r. The library REQUIREDLIBS don't help. - * Assume that if threads have been initialized we're linked properly. - */ -# define _XReaddir(d,p) \ - ( (_Xos_isThreadInitialized) ? \ - (readdir_r((d), &((p).dir_entry)) ? NULL : &((p).dir_entry)) : \ - ((_Xos_processLock), \ - (((p).result = readdir((d))) ? \ - (memcpy(&((p).dir_entry), (p).result, (p).result->d_reclen), \ - ((p).result = &(p).dir_entry), 0) : \ - 0), \ - (_Xos_processUnlock), \ - (p).result) ) # elif defined(_POSIX_REENTRANT_FUNCTIONS) /* POSIX draft API, returns (int)0 on success. */ # define _XReaddir(d,p) \ @@ -945,8 +893,8 @@ typedef struct { (_Xos_processUnlock), \ (p).result ) -#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (defined(__osf__) || defined(hpV4)) -/* Returns (int)0 on success. OSF/1 v3.2, HP/UX 10 +#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(hpV4) +/* Returns (int)0 on success. * * extern int asctime_r(const struct tm *timeptr, char *buffer, int buflen); * extern int ctime_r(const time_t *timer, char *buffer, int buflen); @@ -967,7 +915,7 @@ typedef struct tm _Xltimeparams; # define _XGmtime(t,p) (gmtime_r((t),&(p)) ? NULL : &(p)) # define _XLocaltime(t,p) (localtime_r((t),&(p)) ? NULL : &(p)) -#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(sun) +#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(__sun) /* Returns NULL on failure. Solaris 2.5 * * extern char *asctime_r(const struct tm *tm,char *buf, int buflen); @@ -990,19 +938,12 @@ typedef struct tm _Xltimeparams; # define _XLocaltime(t,p) localtime_r((t),&(p)) #else /* defined(_POSIX_THREAD_SAFE_FUNCTIONS) */ -/* POSIX final API. OSF/1 v4.0, AIX, etc. - * +/* POSIX final API. * extern char *asctime_r(const struct tm *timeptr, char *buffer); * extern char *ctime_r(const time_t *timer, char *buffer); * extern struct tm *gmtime_r(const time_t *timer, struct tm *result); * extern struct tm *localtime_r(const time_t *timer, struct tm *result); */ -# if defined(__osf__) -/* OSF/1 V4.0 <time.h> doesn't declare the _P routines, breaking under C++. */ -extern char *_Pasctime_r(const struct tm *, char *); -extern char *_Pctime_r(const time_t *, char *); -extern struct tm *_Plocaltime_r(const time_t *, struct tm *); -# endif # ifdef TIMELEN typedef char _Xatimeparams[TIMELEN]; typedef char _Xctimeparams[TIMELEN]; @@ -1097,8 +1038,8 @@ typedef struct { (_Xos_processUnlock), \ (p).pgrp ) -#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (defined(sun) || defined(__osf__)) -/* Non-POSIX API. Solaris, DEC v3.2. +#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(__sun) +/* Non-POSIX API. Solaris. * * extern struct group *getgrgid_r(gid_t, struct group *, char *, int); * extern struct group *getgrnam_r(const char *, struct group *, char *, int); @@ -1111,8 +1052,7 @@ typedef struct { #define _XGetgrnam(n,p) getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf)) #elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) -/* Non-POSIX API. HP/UX 10, AIX 4. - * +/* Non-POSIX API. * extern int getgrgid_r(gid_t, struct group *, char *, int); * extern int getgrnam_r(const char *, struct group *, char *, int); */ @@ -1126,16 +1066,11 @@ typedef struct { ((getgrnam_r((n), &(p).grp, (p).buf, sizeof((p).buf)) ? NULL : &(p).grp)) #else -/* POSIX final API. DEC v4.0, IRIX 6.2. +/* POSIX final API. * * int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **); * int getgrnam_r(const char *, struct group *, char *, size_t, struct group **); */ -# if defined(__osf__) -/* OSF/1 V4.0 <grp.h> doesn't declare the _P routines, breaking under C++. */ -extern int _Pgetgrgid_r(gid_t, struct group *, char *, size_t, struct group **); -extern int _Pgetgrnam_r(const char *, struct group *, char *, size_t, struct group **); -# endif typedef struct { struct group grp; char buf[X_LINE_MAX]; /* Should be sysconf(_SC_GETGR_R_SIZE_MAX)? */ |