Remove a bunch of garbage for unsupported platforms.

This commit is contained in:
Adam Jackson 2009-06-12 12:33:22 -04:00
parent ced38e880b
commit bab9c572cd
9 changed files with 33 additions and 250 deletions

View file

@ -74,19 +74,6 @@ from The Open Group.
* If you want something other than (DE)ALLOCATE_LOCAL_FALLBACK
* for ALLOCATE/DEALLOCATE_LOCAL then you add that in here.
*/
# if defined(__HIGHC__)
# ifndef NCR
extern char *alloca();
# if HCVERSION < 21003
# define ALLOCATE_LOCAL(size) alloca((int)(size))
pragma on(alloca);
# else /* HCVERSION >= 21003 */
# define ALLOCATE_LOCAL(size) _Alloca((int)(size))
# endif /* HCVERSION < 21003 */
# else /* NCR */
# define ALLOCATE_LOCAL(size) alloca(size)
# endif
# endif /* defined(__HIGHC__) */
# ifdef __GNUC__
@ -101,20 +88,18 @@ from The Open Group.
* Test is easy, the new one is named __builtin_alloca and comes
* from alloca.h which #defines alloca.
*/
# ifndef NCR
# if defined(vax) || defined(sun) || defined(apollo) || defined(stellar) || defined(alloca)
# if defined(sun) || defined(alloca)
/*
* Some System V boxes extract alloca.o from /lib/libPW.a; if you
* decide that you don't want to use alloca, you might want to fix it here.
*/
/* alloca might be a macro taking one arg (hi, Sun!), so give it one. */
# if !defined(__sgi) && !defined(__QNX__) && !defined(__cplusplus)
# if !defined(__cplusplus)
# define __Xnullarg /* as nothing */
extern void *alloca(__Xnullarg);
# endif /* !__sgi && !__QNX && !__cplusplus */
# endif
# define ALLOCATE_LOCAL(size) alloca((int)(size))
# endif /* who does alloca */
# endif /* NCR */
# endif /* __GNUC__ */
#endif /* NO_ALLOCA */

32
Xarch.h
View file

@ -40,13 +40,9 @@
#else
#ifdef SVR4
#if defined(NCR) || defined(Mips) || defined(__sgi)
#include <sys/endian.h>
#else
#if !defined(sun)
#include <sys/byteorder.h>
#endif
#endif
#elif defined(CSRG_BASED)
#if defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/types.h>
@ -73,39 +69,13 @@
#if !defined(BYTE_ORDER) && defined(__BYTE_ORDER)
#define BYTE_ORDER __BYTE_ORDER
#endif
#elif defined(Lynx)
#if 0
/* LynxOS 2.4.0 has wrong defines in bsd/ip.h */
#include <bsd/in.h>
#include <bsd/in_systm.h>
#include <bsd/ip.h>
#endif
#endif
#ifndef BYTE_ORDER
#define LITTLE_ENDIAN 1234
#define BIG_ENDIAN 4321
#if defined(__QNX__) && !defined(__QNXNTO__)
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#if defined(__QNXNTO__)
#if defined(i386) || defined(__i386__) || defined(__x86__)
#define BYTE_ORDER LITTLE_ENDIAN
#else
#define BYTE_ORDER BIG_ENDIAN
#endif
#endif
#ifdef Lynx
#if defined(i386) || defined(__i386__) || defined(__x86__)
#define BYTE_ORDER LITTLE_ENDIAN
#else
#define BYTE_ORDER BIG_ENDIAN
#endif
#endif
#if (defined(sun) && defined(SVR4)) && !defined(Lynx)
#if defined(sun) && defined(SVR4)
#include <sys/isa_defs.h>
#ifdef _LITTLE_ENDIAN
#define BYTE_ORDER LITTLE_ENDIAN

View file

@ -66,7 +66,7 @@ void bcopy();
#undef bzero
#define bzero(b,len) memset(b,0,len)
#else
#if defined(SYSV) || defined(luna) || defined(sun) || defined(__sxg__)
#if defined(SYSV) || defined(sun)
#include <memory.h>
#define memmove(dst,src,len) bcopy((char *)(src),(char *)(dst),(int)(len))
#if defined(SYSV) && defined(_XBCOPYFUNC)

15
Xmd.h
View file

@ -57,18 +57,14 @@ SOFTWARE.
# include <sys/isa_defs.h> /* Solaris: defines _LP64 if necessary */
#endif
#ifdef CRAY
#define WORD64 /* 64-bit architecture */
#endif
#if defined (_LP64) || \
defined(__alpha) || defined(__alpha__) || \
defined(__ia64__) || defined(ia64) || \
defined(__sparc64__) || \
defined(__s390x__) || \
(defined(__hppa__) && defined(__LP64__)) || \
defined(__hppa__) && defined(__LP64__) || \
defined(__amd64__) || defined(amd64) || \
defined(__powerpc64__) || \
(defined(sgi) && (_MIPS_SZLONG == 64))
defined(__powerpc64__)
#define LONG64 /* 32/64-bit architecture */
#endif
@ -136,7 +132,7 @@ typedef long INT32;
typedef short INT16;
#endif
#if defined(__STDC__) || defined(sgi) || defined(_AIX)
#if defined(__STDC__)
typedef signed char INT8;
#else
typedef char INT8;
@ -157,13 +153,8 @@ typedef unsigned char CARD8;
typedef CARD32 BITS32;
typedef CARD16 BITS16;
#ifndef I_NEED_OS2_H
typedef CARD8 BYTE;
typedef CARD8 BOOL;
#else
#define BYTE CARD8
#define BOOL CARD8
#endif
/*
* definitions for sign-extending bitfields on 64-bit architectures

76
Xos.h
View file

@ -41,36 +41,17 @@ in this Software without prior written authorization from The Open Group.
#ifdef USG
#ifndef __TYPES__
#ifdef CRAY
#define word word_t
#endif /* CRAY */
#include <sys/types.h> /* forgot to protect it... */
#define __TYPES__
#endif /* __TYPES__ */
#else /* USG */
#if defined(_POSIX_SOURCE) && defined(MOTOROLA)
#undef _POSIX_SOURCE
#include <sys/types.h>
#define _POSIX_SOURCE
#else
# include <sys/types.h>
#endif
#endif /* USG */
#ifndef sgi
#if defined(__SCO__) || defined(__UNIXWARE__)
#include <stdint.h>
#endif
#endif
#ifdef _SEQUENT_
/*
* in_systm.h compatibility between SysV and BSD types u_char u_short u_long
* select.h for typedef of args to select, fd_set, may use SVR4 later
*/
#include <netinet/in_systm.h>
#include <sys/select.h>
#endif /* _SEQUENT_ */
/*
* Just about everyone needs the strings routines. We provide both forms here,
@ -112,9 +93,6 @@ in this Software without prior written authorization from The Open Group.
#else
#ifdef SYSV
#if defined(clipper) || defined(__clipper__)
#include <malloc.h>
#endif
#include <string.h>
#define index strchr
#define rindex strrchr
@ -141,7 +119,7 @@ extern int sys_nerr;
*/
#if defined(X_NOT_POSIX)
#include <fcntl.h>
#if defined(USL) || defined(CRAY) || defined(MOTOROLA) || (defined(__i386__) && (defined(SYSV) || defined(SVR4))) || defined(__sxg__)
#if defined(USL) || defined(__i386__) && (defined(SYSV) || defined(SVR4))
#include <unistd.h>
#endif
#ifdef WIN32
@ -158,16 +136,13 @@ extern int sys_nerr;
* Get struct timeval and struct tm
*/
#if defined(SYSV) && !defined(_SEQUENT_)
#if defined(SYSV)
#ifndef USL
#include <sys/time.h>
#endif
#include <time.h>
#ifdef CRAY
#undef word
#endif /* CRAY */
#if defined(USG) && !defined(CRAY) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__) && !defined(clipper) && !defined(__clipper__)
#if defined(USG)
struct timeval {
long tv_sec;
long tv_usec;
@ -180,12 +155,6 @@ struct timezone {
#endif /* USL_SHARELIB */
#endif /* USG */
#ifdef _SEQUENT_
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
#endif /* _SEQUENT_ */
#else /* not SYSV */
@ -211,15 +180,6 @@ struct timeval {
(t)->tv_sec = _gtodtmp.time; \
(t)->tv_usec = _gtodtmp.millitm * 1000; \
}
#elif defined(_SEQUENT_) || defined(Lynx)
#include <time.h>
#elif defined (__QNX__)
typedef unsigned long fd_mask;
/* Make sure we get 256 bit select masks */
#define FD_SETSIZE 256
#include <sys/select.h>
#include <sys/time.h>
#include <time.h>
#else
#include <sys/time.h>
#include <time.h>
@ -231,18 +191,13 @@ typedef unsigned long fd_mask;
#if defined(_XOPEN_XPG4) || defined(_XOPEN_UNIX) /* _XOPEN_UNIX is XPG4.2 */
#define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
#else
#if defined(SVR4) || defined(VMS) || defined(WIN32)
#if defined(SVR4) || defined(WIN32)
#define X_GETTIMEOFDAY(t) gettimeofday(t)
#else
#define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
#endif
#endif /* XPG4 else */
#ifdef __UNIXOS2__
typedef unsigned long fd_mask;
#include <limits.h>
#define MAX_PATH _POSIX_PATH_MAX
#endif
#ifdef __GNU__
#define PATH_MAX 4096
@ -251,31 +206,10 @@ typedef unsigned long fd_mask;
#endif
/* use POSIX name for signal */
#if defined(X_NOT_POSIX) && defined(SYSV) && !defined(SIGCHLD) && !defined(ISC)
#if defined(X_NOT_POSIX) && defined(SYSV) && !defined(SIGCHLD)
#define SIGCHLD SIGCLD
#endif
#ifdef ISC
#include <sys/bsdtypes.h>
#include <sys/limits.h>
#define NGROUPS 16
#endif
#if defined(ISC) || defined(__UNIXOS2__) || \
(defined(__linux__) && !defined(__GLIBC__)) || \
(defined(__QNX__) && !defined(UNIXCONN))
/*
* Some OS's may not have this
*/
#define X_NO_SYS_UN 1
struct sockaddr_un {
short sun_family;
char sun_path[108];
};
#endif
#include <X11/Xarch.h>
#endif /* _XOS_H_ */

94
Xos_r.h
View file

@ -37,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
@ -197,15 +197,6 @@ extern void XtProcessUnlock(
# 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 *****/
/*
@ -328,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)
@ -354,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;
@ -424,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__)
@ -482,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
@ -619,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) \
@ -942,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);
@ -987,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];
@ -1094,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);
@ -1108,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);
*/
@ -1123,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)? */

View file

@ -33,11 +33,6 @@ in this Software without prior written authorization from The Open Group.
* You may still have to define _POSIX_SOURCE to get it.
*/
#ifdef sony
#if !defined(SYSTYPE_SYSV) && !defined(_SYSTYPE_SYSV)
#define X_NOT_POSIX
#endif
#endif
#ifdef _SCO_DS
#ifndef __SCO__
@ -47,7 +42,7 @@ in this Software without prior written authorization from The Open Group.
#ifdef __i386__
#ifdef SYSV
#if !defined(ISC) && !defined(__SCO__) && !defined(_SEQUENT_) && \
#if !defined(__SCO__) && \
!defined(__UNIXWARE__) && !defined(sun)
#if !defined(_POSIX_SOURCE)
#define X_NOT_POSIX
@ -75,10 +70,6 @@ in this Software without prior written authorization from The Open Group.
#endif
#endif
#ifdef __UNIXOS2__
#define USGISH
#define NULL_NOT_ZERO
#endif
#ifdef __APPLE__
#define NULL_NOT_ZERO

View file

@ -59,29 +59,11 @@ from The Open Group.
/* Below is the monster branch from hell. Basically, most systems will drop to
* 'the branch below is the fallthrough for halfway modern systems', and include
* <sys/select.h>, so we get the FD_* macros. */
#if !defined(DGUX)
# if (defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE)
# if defined(SVR4) && !defined(FD_SETSIZE)
# include <sys/select.h>
# ifdef luna
# include <sysent.h>
# endif
# else /* not SVR4/CRAY/AIXv3 */
# if defined(AIXV4) /* AIX 4.2 fubar-ed <sys/select.h>, so try really hard. */
# if !defined(NFDBITS)
# include <sys/select.h>
# endif
# else /* the branch below is the fallthrough for halfway modern systems */
# ifdef __QNX__ /* Make sure we get 256 bit select masks */
# define FD_SETSIZE 256
# endif
# include <sys/select.h>
# endif
# endif
#else /* DGUX -- No sys/select in Intel DG/ux */
# include <sys/time.h>
# include <sys/types.h>
# include <unistd.h>
#endif
#include <X11/Xmd.h>
@ -110,21 +92,13 @@ typedef long fd_mask;
#define howmany(x,y) (((x)+((y)-1))/(y))
#endif
#if defined(BSD) && BSD < 198911 && !defined(luna)
#if defined(BSD) && BSD < 198911
typedef struct fd_set {
fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
} fd_set;
#endif
#ifndef hpux /* and perhaps old BSD ??? */
# define Select(n,r,w,e,t) select(n,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t)
#else
# ifndef _XPG4_EXTENDED /* HPUX 9.x and earlier */
# define Select(n,r,w,e,t) select(n,(int*)r,(int*)w,(int*)e,(struct timeval*)t)
# else
# define Select(n,r,w,e,t) select(n,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t)
# endif
#endif
#define __X_FDS_BITS @USE_FDS_BITS@

View file

@ -60,7 +60,7 @@ typedef struct mutex xmutex_rec;
#define xcondition_broadcast(cv) condition_broadcast(cv)
#define xcondition_set_name(cv,str) condition_set_name(cv,str)
#else /* !CTHREADS */
#if defined(SVR4) && !defined(__sgi) && !defined(_SEQUENT_)
#if defined(SVR4)
#include <thread.h>
#include <synch.h>
typedef thread_t xthread_t;