From 175a3416ef118a351d2dc97300df73afe94cfb9c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 12 Oct 2016 22:24:09 +0200 Subject: undef __UNIXOS2__ --- nx-X11/lib/xtrans/Xtransint.h | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'nx-X11/lib/xtrans/Xtransint.h') diff --git a/nx-X11/lib/xtrans/Xtransint.h b/nx-X11/lib/xtrans/Xtransint.h index 196eb6fc6..1458036ff 100644 --- a/nx-X11/lib/xtrans/Xtransint.h +++ b/nx-X11/lib/xtrans/Xtransint.h @@ -71,11 +71,7 @@ from The Open Group. */ #ifndef XTRANSDEBUG -# ifndef __UNIXOS2__ # define XTRANSDEBUG 1 -# else -# define XTRANSDEBUG 1 -# endif #endif #ifdef WIN32 @@ -98,9 +94,6 @@ from The Open Group. # endif # include # include -# ifdef __UNIXOS2__ -# include -# endif /* * Moved the setting of NEED_UTSNAME to this header file from Xtrans.c, @@ -167,11 +160,7 @@ from The Open Group. # endif /* TRANS_OPEN_MAX */ -# ifdef __UNIXOS2__ -# define ESET(val) -# else # define ESET(val) errno = val -# endif # define EGET() errno #else /* WIN32 */ -- cgit v1.2.3 From eb4ee6c32c5a6b484830fbd1c3c39a36031330e5 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 12 Oct 2016 22:44:21 +0200 Subject: undef hpux --- nx-X11/lib/xtrans/Xtransint.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/lib/xtrans/Xtransint.h') diff --git a/nx-X11/lib/xtrans/Xtransint.h b/nx-X11/lib/xtrans/Xtransint.h index 1458036ff..747252a22 100644 --- a/nx-X11/lib/xtrans/Xtransint.h +++ b/nx-X11/lib/xtrans/Xtransint.h @@ -100,7 +100,7 @@ from The Open Group. * to avoid a race condition. JKJ (6/5/97) */ -# if (defined(_POSIX_SOURCE) && !defined(AIXV3) && !defined(__QNX__)) || defined(hpux) || defined(USG) || defined(SVR4) || defined(__SCO__) +# if (defined(_POSIX_SOURCE) && !defined(AIXV3) && !defined(__QNX__)) || defined(USG) || defined(SVR4) || defined(__SCO__) # ifndef NEED_UTSNAME # define NEED_UTSNAME # endif -- cgit v1.2.3 From 89cea600a076608bbcb59cc207ca4ab60ca9f0ee Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 12 Oct 2016 22:47:36 +0200 Subject: undef AIXV3 --- nx-X11/lib/xtrans/Xtransint.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/lib/xtrans/Xtransint.h') diff --git a/nx-X11/lib/xtrans/Xtransint.h b/nx-X11/lib/xtrans/Xtransint.h index 747252a22..ef4483313 100644 --- a/nx-X11/lib/xtrans/Xtransint.h +++ b/nx-X11/lib/xtrans/Xtransint.h @@ -100,7 +100,7 @@ from The Open Group. * to avoid a race condition. JKJ (6/5/97) */ -# if (defined(_POSIX_SOURCE) && !defined(AIXV3) && !defined(__QNX__)) || defined(USG) || defined(SVR4) || defined(__SCO__) +# if (defined(_POSIX_SOURCE) && !defined(__QNX__)) || defined(USG) || defined(SVR4) || defined(__SCO__) # ifndef NEED_UTSNAME # define NEED_UTSNAME # endif -- cgit v1.2.3 From 4ab02b27c2a8ba0e913e0a3319360c3feacb59e3 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 12 Oct 2016 22:27:34 +0200 Subject: undef Lynx --- nx-X11/lib/xtrans/Xtransint.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'nx-X11/lib/xtrans/Xtransint.h') diff --git a/nx-X11/lib/xtrans/Xtransint.h b/nx-X11/lib/xtrans/Xtransint.h index ef4483313..d4e736d49 100644 --- a/nx-X11/lib/xtrans/Xtransint.h +++ b/nx-X11/lib/xtrans/Xtransint.h @@ -87,11 +87,7 @@ from The Open Group. #include #ifndef WIN32 -# ifndef Lynx # include -# else -# include -# endif # include # include -- cgit v1.2.3 From 0ca6e59996078472a3e3464e97232ce650893a29 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 12 Oct 2016 22:28:41 +0200 Subject: undef __QNX__ --- nx-X11/lib/xtrans/Xtransint.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nx-X11/lib/xtrans/Xtransint.h') diff --git a/nx-X11/lib/xtrans/Xtransint.h b/nx-X11/lib/xtrans/Xtransint.h index d4e736d49..203e5fabe 100644 --- a/nx-X11/lib/xtrans/Xtransint.h +++ b/nx-X11/lib/xtrans/Xtransint.h @@ -96,7 +96,7 @@ from The Open Group. * to avoid a race condition. JKJ (6/5/97) */ -# if (defined(_POSIX_SOURCE) && !defined(__QNX__)) || defined(USG) || defined(SVR4) || defined(__SCO__) +# if defined(_POSIX_SOURCE) || defined(USG) || defined(SVR4) || defined(__SCO__) # ifndef NEED_UTSNAME # define NEED_UTSNAME # endif @@ -133,7 +133,7 @@ from The Open Group. # ifdef NOFILE # define OPEN_MAX NOFILE # else -# if !defined(__UNIXOS2__) && !defined(__QNX__) +# if !defined(__UNIXOS2__) # define OPEN_MAX NOFILES_MAX # else # define OPEN_MAX 256 -- cgit v1.2.3 From e5b4532ab8576dd0927e3f549a1546fb3b37d8e1 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 7 Aug 2008 10:32:11 -0400 Subject: Drastically simplify TRANS_OPEN_MAX. If your OS doesn't have sysconf(3), then life is already hard for you. Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/xtrans/Xtransint.h | 53 ------------------------------------------- 1 file changed, 53 deletions(-) (limited to 'nx-X11/lib/xtrans/Xtransint.h') diff --git a/nx-X11/lib/xtrans/Xtransint.h b/nx-X11/lib/xtrans/Xtransint.h index 203e5fabe..19cd86062 100644 --- a/nx-X11/lib/xtrans/Xtransint.h +++ b/nx-X11/lib/xtrans/Xtransint.h @@ -103,59 +103,6 @@ from The Open Group. # include # endif -/* - * makedepend screws up on #undef OPEN_MAX, so we define a new symbol - */ - -# ifndef TRANS_OPEN_MAX - -# ifndef X_NOT_POSIX -# ifdef _POSIX_SOURCE -# include -# else -# define _POSIX_SOURCE -# include -# undef _POSIX_SOURCE -# endif -# endif -# ifndef OPEN_MAX -# if defined(_SC_OPEN_MAX) && !defined(__UNIXOS2__) -# define OPEN_MAX (sysconf(_SC_OPEN_MAX)) -# else -# ifdef SVR4 -# define OPEN_MAX 256 -# else -# include -# ifndef OPEN_MAX -# ifdef __OSF1__ -# define OPEN_MAX 256 -# else -# ifdef NOFILE -# define OPEN_MAX NOFILE -# else -# if !defined(__UNIXOS2__) -# define OPEN_MAX NOFILES_MAX -# else -# define OPEN_MAX 256 -# endif -# endif -# endif -# endif -# endif -# endif -# endif -# if defined(_SC_OPEN_MAX) -# define TRANS_OPEN_MAX OPEN_MAX -# else /* !__GNU__ */ -# if OPEN_MAX > 256 -# define TRANS_OPEN_MAX 256 -# else -# define TRANS_OPEN_MAX OPEN_MAX -# endif -# endif /*__GNU__*/ - -# endif /* TRANS_OPEN_MAX */ - # define ESET(val) errno = val # define EGET() errno -- cgit v1.2.3 From 64d51869fcc6ae4dd4c8d3e1d924fa2e4ccc75af Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 13 Oct 2016 00:16:30 +0200 Subject: whitespace cleanup empty lines and trailing whitespace --- nx-X11/lib/xtrans/Xtransint.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'nx-X11/lib/xtrans/Xtransint.h') diff --git a/nx-X11/lib/xtrans/Xtransint.h b/nx-X11/lib/xtrans/Xtransint.h index 19cd86062..3c15db2e5 100644 --- a/nx-X11/lib/xtrans/Xtransint.h +++ b/nx-X11/lib/xtrans/Xtransint.h @@ -53,10 +53,10 @@ from The Open Group. #define _XTRANSINT_H_ /* - * XTRANSDEBUG will enable the PRMSG() macros used in the X Transport - * Interface code. Each use of the PRMSG macro has a level associated with - * it. XTRANSDEBUG is defined to be a level. If the invocation level is =< - * the value of XTRANSDEBUG, then the message will be printed out to stderr. + * XTRANSDEBUG will enable the PRMSG() macros used in the X Transport + * Interface code. Each use of the PRMSG macro has a level associated with + * it. XTRANSDEBUG is defined to be a level. If the invocation level is =< + * the value of XTRANSDEBUG, then the message will be printed out to stderr. * Recommended levels are: * * XTRANSDEBUG=1 Error messages -- cgit v1.2.3 From f686bc3ebed90b7fb8bbbf8cce3d894971e42ca5 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Sun, 10 Feb 2008 19:04:40 -0800 Subject: Fixed #ifdef checks that were using i386 to use __i386__ """ It's simply obsolete, sloppy, compiler namespace pollution. The compiler is not allowed to predefine symbols that might conflict with ordinary identifiers. For backwards compatibility gcc currently predefines i386 when compiling for x86 32-bit (but not 64-bit), but that will go away. It is also not defined if you specify -ansi when invoking the compiler, because then it is seriously standards compliant. Other compilers shouldn't define it either. Correct code shouldn't rely on it being defined. However __i386__ is safe and proper. """ Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/xtrans/Xtransint.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'nx-X11/lib/xtrans/Xtransint.h') diff --git a/nx-X11/lib/xtrans/Xtransint.h b/nx-X11/lib/xtrans/Xtransint.h index 3c15db2e5..daa3e8fce 100644 --- a/nx-X11/lib/xtrans/Xtransint.h +++ b/nx-X11/lib/xtrans/Xtransint.h @@ -313,7 +313,7 @@ typedef struct _Xtransport_table { * systems, so they may be emulated. */ -#if (defined(SYSV) && defined(i386) && !defined(__SCO__)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__) +#if (defined(SYSV) && defined(__i386__) && !defined(__SCO__)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__) #define READV(ciptr, iov, iovcnt) TRANS(ReadV)(ciptr, iov, iovcnt) @@ -327,10 +327,10 @@ static int TRANS(ReadV)( #define READV(ciptr, iov, iovcnt) readv(ciptr->fd, iov, iovcnt) -#endif /* (SYSV && i386) || WIN32 || __sxg__ || */ +#endif /* (SYSV && __i386__) || WIN32 || __sxg__ || */ -#if (defined(SYSV) && defined(i386) && !defined(__SCO__)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__) +#if (defined(SYSV) && defined(__i386__) && !defined(__SCO__)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__) #define WRITEV(ciptr, iov, iovcnt) TRANS(WriteV)(ciptr, iov, iovcnt) -- cgit v1.2.3 From c4b775f6dc6f8361dc27ace5d2b40ec42c3381bf Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 13 Oct 2016 00:35:04 +0200 Subject: align license headers with Xorg/xtrans upstream --- nx-X11/lib/xtrans/Xtransint.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'nx-X11/lib/xtrans/Xtransint.h') diff --git a/nx-X11/lib/xtrans/Xtransint.h b/nx-X11/lib/xtrans/Xtransint.h index daa3e8fce..b7ca80541 100644 --- a/nx-X11/lib/xtrans/Xtransint.h +++ b/nx-X11/lib/xtrans/Xtransint.h @@ -24,9 +24,7 @@ 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. -*/ - -/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA + * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * * All Rights Reserved * -- cgit v1.2.3 From c3f43e832a8062169f999f3a5c298fe3f40ab9e8 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 13 Oct 2016 00:51:03 +0200 Subject: replace PRMSG by prmsg --- nx-X11/lib/xtrans/Xtransint.h | 105 +++++++++++++++++++++++------------------- 1 file changed, 58 insertions(+), 47 deletions(-) (limited to 'nx-X11/lib/xtrans/Xtransint.h') diff --git a/nx-X11/lib/xtrans/Xtransint.h b/nx-X11/lib/xtrans/Xtransint.h index b7ca80541..0da59f71d 100644 --- a/nx-X11/lib/xtrans/Xtransint.h +++ b/nx-X11/lib/xtrans/Xtransint.h @@ -306,6 +306,9 @@ typedef struct _Xtransport_table { /* Flags to preserve when setting others */ #define TRANS_KEEPFLAGS (TRANS_NOUNLINK|TRANS_ABSTRACT) +#ifdef XTRANS_TRANSPORT_C /* only provide static function prototypes when + building the transport.c file that has them in */ + /* * readv() and writev() don't exist or don't work correctly on some * systems, so they may be emulated. @@ -360,54 +363,62 @@ static int trans_mkdir ( * Some XTRANSDEBUG stuff */ -#if defined(XTRANSDEBUG) -/* add hack to the format string to avoid warnings about extra arguments - * to fprintf. +#ifdef XTRANSDEBUG +#include + +/* + * The X server provides ErrorF() & VErrorF(), for other software that uses + * xtrans, we provide our own simple versions. */ -#ifdef XTRANSDEBUGTIMESTAMP -#if defined(XSERV_t) && defined(TRANS_SERVER) -/* Use ErrorF() for the X server */ -#define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \ - int hack= 0, saveerrno=errno; \ - struct timeval tp;\ - gettimeofday(&tp,0); \ - ErrorF("%s",__xtransname); \ - ErrorF(x+hack,a,b,c); \ - ErrorF("timestamp (ms): %d\n",tp.tv_sec*1000+tp.tv_usec/1000); \ - errno=saveerrno; \ - } else ((void)0) -#else -#define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \ - int hack= 0, saveerrno=errno; \ - struct timeval tp;\ - gettimeofday(&tp,0); \ - fprintf(stderr, "%s",__xtransname); fflush(stderr); \ - fprintf(stderr, x+hack,a,b,c); fflush(stderr); \ - fprintf(stderr, "timestamp (ms): %d\n",tp.tv_sec*1000+tp.tv_usec/1000); \ - fflush(stderr); \ - errno=saveerrno; \ - } else ((void)0) -#endif /* XSERV_t && TRANS_SERVER */ -#else /* XTRANSDEBUGTIMESTAMP */ -#if defined(XSERV_t) && defined(TRANS_SERVER) -/* Use ErrorF() for the X server */ -#define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \ - int hack= 0, saveerrno=errno; \ - ErrorF("%s",__xtransname); \ - ErrorF(x+hack,a,b,c); \ - errno=saveerrno; \ - } else ((void)0) -#else -#define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \ - int hack= 0, saveerrno=errno; \ - fprintf(stderr, "%s",__xtransname); fflush(stderr); \ - fprintf(stderr, x+hack,a,b,c); fflush(stderr); \ - errno=saveerrno; \ - } else ((void)0) -#endif /* XSERV_t && TRANS_SERVER */ -#endif /* XTRANSDEBUGTIMESTAMP */ -#else -#define PRMSG(lvl,x,a,b,c) ((void)0) +# if defined(XSERV_t) && defined(TRANS_SERVER) +# include "os.h" +# else +static inline void _X_ATTRIBUTE_PRINTF(1, 0) +VErrorF(const char *f, va_list args) +{ + vfprintf(stderr, f, args); + fflush(stderr); +} + +static inline void _X_ATTRIBUTE_PRINTF(1, 2) +ErrorF(const char *f, ...) +{ + va_list args; + + va_start(args, f); + VErrorF(f, args); + va_end(args); +} +# endif /* xserver */ +#endif /* XTRANSDEBUG */ + +static inline void _X_ATTRIBUTE_PRINTF(2, 3) +prmsg(int lvl, const char *f, ...) +{ +#ifdef XTRANSDEBUG + va_list args; + + va_start(args, f); + if (lvl <= XTRANSDEBUG) { + int saveerrno = errno; + + ErrorF("%s", __xtransname); + VErrorF(f, args); + +# ifdef XTRANSDEBUGTIMESTAMP + { + struct timeval tp; + gettimeofday(&tp, 0); + ErrorF("timestamp (ms): %d\n", + tp.tv_sec * 1000 + tp.tv_usec / 1000); + } +# endif + errno = saveerrno; + } + va_end(args); #endif /* XTRANSDEBUG */ +} + +#endif /* XTRANS_TRANSPORT_C */ #endif /* _XTRANSINT_H_ */ -- cgit v1.2.3 From 603fe25544e464561b0c9435f8816b5ab80814e1 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 18 May 2016 12:38:02 -0400 Subject: remove CLTS code Remove CLTS code Never been used, as far as I can tell. Reviewed-by: Keith Packard Signed-off-by: Adam Jackson Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/xtrans/Xtransint.h | 32 -------------------------------- 1 file changed, 32 deletions(-) (limited to 'nx-X11/lib/xtrans/Xtransint.h') diff --git a/nx-X11/lib/xtrans/Xtransint.h b/nx-X11/lib/xtrans/Xtransint.h index 0da59f71d..c25f7c024 100644 --- a/nx-X11/lib/xtrans/Xtransint.h +++ b/nx-X11/lib/xtrans/Xtransint.h @@ -135,9 +135,6 @@ struct _XtransConnInfo { #define XTRANS_OPEN_COTS_CLIENT 1 #define XTRANS_OPEN_COTS_SERVER 2 -#define XTRANS_OPEN_CLTS_CLIENT 3 -#define XTRANS_OPEN_CLTS_SERVER 4 - typedef struct _Xtransport { char *TransName; @@ -165,29 +162,6 @@ typedef struct _Xtransport { #endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - - XtransConnInfo (*OpenCLTSClient)( - struct _Xtransport *, /* transport */ - char *, /* protocol */ - char *, /* host */ - char * /* port */ - ); - -#endif /* TRANS_CLIENT */ - -#ifdef TRANS_SERVER - - XtransConnInfo (*OpenCLTSServer)( - struct _Xtransport *, /* transport */ - char *, /* protocol */ - char *, /* host */ - char * /* port */ - ); - -#endif /* TRANS_SERVER */ - - #ifdef TRANS_REOPEN XtransConnInfo (*ReopenCOTSServer)( @@ -196,12 +170,6 @@ typedef struct _Xtransport { char * /* port */ ); - XtransConnInfo (*ReopenCLTSServer)( - struct _Xtransport *, /* transport */ - int, /* fd */ - char * /* port */ - ); - #endif /* TRANS_REOPEN */ -- cgit v1.2.3 From 793d587b46a7ec47ea62d99920de4dc607514604 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 13 Oct 2016 21:53:17 +0200 Subject: Remove __UNIXOS2__ references --- nx-X11/lib/xtrans/Xtransint.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nx-X11/lib/xtrans/Xtransint.h') diff --git a/nx-X11/lib/xtrans/Xtransint.h b/nx-X11/lib/xtrans/Xtransint.h index c25f7c024..2a138484b 100644 --- a/nx-X11/lib/xtrans/Xtransint.h +++ b/nx-X11/lib/xtrans/Xtransint.h @@ -282,7 +282,7 @@ typedef struct _Xtransport_table { * systems, so they may be emulated. */ -#if (defined(SYSV) && defined(__i386__) && !defined(__SCO__)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__) +#if (defined(SYSV) && defined(__i386__) && !defined(__SCO__)) || defined(WIN32) || defined(__sxg__) #define READV(ciptr, iov, iovcnt) TRANS(ReadV)(ciptr, iov, iovcnt) @@ -299,7 +299,7 @@ static int TRANS(ReadV)( #endif /* (SYSV && __i386__) || WIN32 || __sxg__ || */ -#if (defined(SYSV) && defined(__i386__) && !defined(__SCO__)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__) +#if (defined(SYSV) && defined(__i386__) && !defined(__SCO__)) || defined(WIN32) || defined(__sxg__) #define WRITEV(ciptr, iov, iovcnt) TRANS(WriteV)(ciptr, iov, iovcnt) -- cgit v1.2.3 From e65b106a8989bf5d71de613f5f8b9dcbd559d382 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 31 Oct 2016 02:29:18 +0100 Subject: Xtrans: update to Xorg/xtrans upstream (1.3.5+) This lifts xtrans to the state of this commit: commit 560d7550e23e9b14056b4a9b2569c2f256015f8a Author: Jeremy Huddleston Sequoia Date: Sat Sep 10 22:09:51 2016 -0700 Update strlcpy macro check to also check HAVE_STRLCPY xorg-server moved from HAS_STRLCPY to HAVE_STRLCPY in 2011 cf-xserver: d829a7c5cb42c979b58f3547136df5b05d906423 Signed-off-by: Jeremy Huddleston Sequoia --- nx-X11/lib/xtrans/Xtransint.h | 82 ++++++++++++++++++++++++++++++++----------- 1 file changed, 61 insertions(+), 21 deletions(-) (limited to 'nx-X11/lib/xtrans/Xtransint.h') diff --git a/nx-X11/lib/xtrans/Xtransint.h b/nx-X11/lib/xtrans/Xtransint.h index 2a138484b..2156bd52f 100644 --- a/nx-X11/lib/xtrans/Xtransint.h +++ b/nx-X11/lib/xtrans/Xtransint.h @@ -68,7 +68,7 @@ from The Open Group. * message. */ -#ifndef XTRANSDEBUG +#if !defined(XTRANSDEBUG) && defined(XTRANS_TRANSPORT_C) # define XTRANSDEBUG 1 #endif @@ -78,6 +78,10 @@ from The Open Group. #include "Xtrans.h" +#ifndef _X_UNUSED /* Defined in Xfuncproto.h in xproto >= 7.0.22 */ +# define _X_UNUSED /* */ +#endif + #ifdef XTRANSDEBUG # include #endif /* XTRANSDEBUG */ @@ -94,7 +98,7 @@ from The Open Group. * to avoid a race condition. JKJ (6/5/97) */ -# if defined(_POSIX_SOURCE) || defined(USG) || defined(SVR4) || defined(__SCO__) +# if defined(_POSIX_SOURCE) || defined(USG) || defined(SVR4) || defined(__SVR4) || defined(__SCO__) # ifndef NEED_UTSNAME # define NEED_UTSNAME # endif @@ -119,6 +123,16 @@ from The Open Group. #define X_TCP_PORT 6000 #endif +#if XTRANS_SEND_FDS + +struct _XtransConnFd { + struct _XtransConnFd *next; + int fd; + int do_close; +}; + +#endif + struct _XtransConnInfo { struct _Xtransport *transptr; int index; @@ -131,33 +145,35 @@ struct _XtransConnInfo { int addrlen; char *peeraddr; int peeraddrlen; + struct _XtransConnFd *recv_fds; + struct _XtransConnFd *send_fds; }; #define XTRANS_OPEN_COTS_CLIENT 1 #define XTRANS_OPEN_COTS_SERVER 2 typedef struct _Xtransport { - char *TransName; + const char *TransName; int flags; #ifdef TRANS_CLIENT XtransConnInfo (*OpenCOTSClient)( struct _Xtransport *, /* transport */ - char *, /* protocol */ - char *, /* host */ - char * /* port */ + const char *, /* protocol */ + const char *, /* host */ + const char * /* port */ ); #endif /* TRANS_CLIENT */ #ifdef TRANS_SERVER - char ** nolisten; + const char ** nolisten; XtransConnInfo (*OpenCOTSServer)( struct _Xtransport *, /* transport */ - char *, /* protocol */ - char *, /* host */ - char * /* port */ + const char *, /* protocol */ + const char *, /* host */ + const char * /* port */ ); #endif /* TRANS_SERVER */ @@ -167,7 +183,7 @@ typedef struct _Xtransport { XtransConnInfo (*ReopenCOTSServer)( struct _Xtransport *, /* transport */ int, /* fd */ - char * /* port */ + const char * /* port */ ); #endif /* TRANS_REOPEN */ @@ -185,7 +201,7 @@ typedef struct _Xtransport { int (*CreateListener)( XtransConnInfo, /* connection */ - char *, /* port */ + const char *, /* port */ unsigned int /* flags */ ); @@ -204,8 +220,8 @@ typedef struct _Xtransport { int (*Connect)( XtransConnInfo, /* connection */ - char *, /* host */ - char * /* port */ + const char *, /* host */ + const char * /* port */ ); #endif /* TRANS_CLIENT */ @@ -239,6 +255,18 @@ typedef struct _Xtransport { int /* size */ ); +#if XTRANS_SEND_FDS + int (*SendFd)( + XtransConnInfo, /* connection */ + int, /* fd */ + int /* do_close */ + ); + + int (*RecvFd)( + XtransConnInfo /* connection */ + ); +#endif + int (*Disconnect)( XtransConnInfo /* connection */ ); @@ -268,8 +296,10 @@ typedef struct _Xtransport_table { #define TRANS_LOCAL (1<<1) /* local transport */ #define TRANS_DISABLED (1<<2) /* Don't open this one */ #define TRANS_NOLISTEN (1<<3) /* Don't listen on this one */ -#define TRANS_NOUNLINK (1<<4) /* Dont unlink transport endpoints */ +#define TRANS_NOUNLINK (1<<4) /* Don't unlink transport endpoints */ #define TRANS_ABSTRACT (1<<5) /* Use abstract sockets if available */ +#define TRANS_NOXAUTH (1<<6) /* Don't verify authentication (because it's secure some other way at the OS layer) */ +#define TRANS_RECEIVED (1<<7) /* The fd for this has already been opened by someone else. */ /* Flags to preserve when setting others */ #define TRANS_KEEPFLAGS (TRANS_NOUNLINK|TRANS_ABSTRACT) @@ -277,12 +307,18 @@ typedef struct _Xtransport_table { #ifdef XTRANS_TRANSPORT_C /* only provide static function prototypes when building the transport.c file that has them in */ +#ifdef __clang__ +/* Not all clients make use of all provided statics */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-function" +#endif + /* * readv() and writev() don't exist or don't work correctly on some * systems, so they may be emulated. */ -#if (defined(SYSV) && defined(__i386__) && !defined(__SCO__)) || defined(WIN32) || defined(__sxg__) +#ifdef WIN32 #define READV(ciptr, iov, iovcnt) TRANS(ReadV)(ciptr, iov, iovcnt) @@ -296,10 +332,10 @@ static int TRANS(ReadV)( #define READV(ciptr, iov, iovcnt) readv(ciptr->fd, iov, iovcnt) -#endif /* (SYSV && __i386__) || WIN32 || __sxg__ || */ +#endif /* WIN32 */ -#if (defined(SYSV) && defined(__i386__) && !defined(__SCO__)) || defined(WIN32) || defined(__sxg__) +#ifdef WIN32 #define WRITEV(ciptr, iov, iovcnt) TRANS(WriteV)(ciptr, iov, iovcnt) @@ -313,20 +349,24 @@ static int TRANS(WriteV)( #define WRITEV(ciptr, iov, iovcnt) writev(ciptr->fd, iov, iovcnt) -#endif /* WIN32 || __sxg__ */ +#endif /* WIN32 */ static int is_numeric ( - char * /* str */ + const char * /* str */ ); #ifdef TRANS_SERVER static int trans_mkdir ( - char *, /* path */ + const char *, /* path */ int /* mode */ ); #endif +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + /* * Some XTRANSDEBUG stuff */ -- cgit v1.2.3