summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@herrb.eu>2020-04-25 12:17:43 +0200
committerMatthieu Herrb <matthieu@herrb.eu>2020-04-25 12:17:43 +0200
commit8cc0c865acafe588d3026bc6099f79dc46ffe7fb (patch)
tree17b8467200c0a52bd3be398d379a520fa0aed14d
parent7b11f59225542f653ecb91a84d07f91d8657d0c8 (diff)
parent3b5df889f58a99980a35a7b4a18eb4e7d2abeac4 (diff)
Merge remote-tracking branch 'origin/master' into obsd
-rw-r--r--Xtrans.c19
-rw-r--r--Xtrans.h2
-rw-r--r--Xtransint.h2
-rw-r--r--Xtranslcl.c1036
-rw-r--r--Xtranssock.c8
-rw-r--r--Xtransutil.c7
-rw-r--r--xtrans.m42
7 files changed, 12 insertions, 1064 deletions
diff --git a/Xtrans.c b/Xtrans.c
index 2045d05..2ff694a 100644
--- a/Xtrans.c
+++ b/Xtrans.c
@@ -75,10 +75,10 @@ from The Open Group.
#define TRANS_SOCKET_TCP_INDEX 7
#define TRANS_DNET_INDEX 8
#define TRANS_LOCAL_LOCAL_INDEX 9
-#define TRANS_LOCAL_PTS_INDEX 10
+/* 10 used to be PTS, but that's gone. */
#define TRANS_LOCAL_NAMED_INDEX 11
/* 12 used to be ISC, but that's gone. */
-#define TRANS_LOCAL_SCO_INDEX 13
+/* 13 used to be SCO, but that's gone. */
#define TRANS_SOCKET_INET6_INDEX 14
#define TRANS_LOCAL_PIPE_INDEX 15
@@ -100,18 +100,12 @@ Xtransport_table Xtransports[] = {
#endif /* UNIXCONN */
#if defined(LOCALCONN)
{ &TRANS(LocalFuncs), TRANS_LOCAL_LOCAL_INDEX },
-#ifndef __sun
- { &TRANS(PTSFuncs), TRANS_LOCAL_PTS_INDEX },
-#endif /* __sun */
#if defined(SVR4) || defined(__SVR4)
{ &TRANS(NAMEDFuncs), TRANS_LOCAL_NAMED_INDEX },
#endif
#ifdef __sun
{ &TRANS(PIPEFuncs), TRANS_LOCAL_PIPE_INDEX },
#endif /* __sun */
-#if defined(__SCO__) || defined(__UNIXWARE__)
- { &TRANS(SCOFuncs), TRANS_LOCAL_SCO_INDEX },
-#endif /* __SCO__ || __UNIXWARE__ */
#endif /* LOCALCONN */
};
@@ -189,10 +183,7 @@ TRANS(SelectTransport) (const char *protocol)
return NULL;
}
-#ifndef TEST_t
-static
-#endif /* TEST_t */
-int
+static int
TRANS(ParseAddress) (const char *address,
char **protocol, char **host, char **port)
@@ -649,7 +640,7 @@ TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg)
break;
case 1: /* Set to non-blocking mode */
-#if defined(O_NONBLOCK) && !defined(SCO325)
+#if defined(O_NONBLOCK)
ret = fcntl (fd, F_GETFL, 0);
if (ret != -1)
ret = fcntl (fd, F_SETFL, ret | O_NONBLOCK);
@@ -1321,7 +1312,7 @@ static int TRANS(WriteV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt)
#endif /* WIN32 */
-#if defined(_POSIX_SOURCE) || defined(USG) || defined(SVR4) || defined(__SVR4) || defined(__SCO__)
+#if defined(_POSIX_SOURCE) || defined(SVR4) || defined(__SVR4)
#ifndef NEED_UTSNAME
#define NEED_UTSNAME
#endif
diff --git a/Xtrans.h b/Xtrans.h
index 360b01b..281fb52 100644
--- a/Xtrans.h
+++ b/Xtrans.h
@@ -148,7 +148,7 @@ typedef long BytesReadable_t;
#endif
-#if defined(WIN32) || defined(USG)
+#if defined(WIN32)
/*
* TRANS(Readv) and TRANS(Writev) use struct iovec, normally found
diff --git a/Xtransint.h b/Xtransint.h
index 2156bd5..fe1f117 100644
--- a/Xtransint.h
+++ b/Xtransint.h
@@ -98,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(__SVR4) || defined(__SCO__)
+# if defined(_POSIX_SOURCE) || defined(SVR4) || defined(__SVR4)
# ifndef NEED_UTSNAME
# define NEED_UTSNAME
# endif
diff --git a/Xtranslcl.c b/Xtranslcl.c
index 26b7f63..f8a3976 100644
--- a/Xtranslcl.c
+++ b/Xtranslcl.c
@@ -78,11 +78,7 @@ from The Open Group.
#if defined(SVR4) || defined(__SVR4)
#include <sys/filio.h>
#endif
-#ifdef __sun
# include <stropts.h>
-#else
-# include <sys/stropts.h>
-#endif
#include <sys/wait.h>
#include <sys/types.h>
@@ -102,17 +98,10 @@ from The Open Group.
/* Types of local connections supported:
* - PTS
* - named pipes
- * - SCO
*/
-#if !defined(__sun)
-# define LOCAL_TRANS_PTS
-#endif
#if defined(SVR4) || defined(__SVR4)
# define LOCAL_TRANS_NAMED
#endif
-#if defined(__SCO__) || defined(__UNIXWARE__)
-# define LOCAL_TRANS_SCO
-#endif
static int TRANS(LocalClose)(XtransConnInfo ciptr);
@@ -220,448 +209,31 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr,
-#ifdef LOCAL_TRANS_PTS
-/* PTS */
-
-#if defined(SYSV) && !defined(__SCO__)
-#define SIGNAL_T int
-#else
-#define SIGNAL_T void
-#endif /* SYSV */
-
-typedef SIGNAL_T (*PFV)();
-
-extern PFV signal();
-
-extern char *ptsname(
- int
-);
-static void _dummy(int sig _X_UNUSED)
-
-{
-}
-#endif /* LOCAL_TRANS_PTS */
-
-#ifndef __sun
-#define X_STREAMS_DIR "/dev/X"
-#define DEV_SPX "/dev/spx"
-#else
#ifndef X11_t
#define X_STREAMS_DIR "/dev/X"
#else
#define X_STREAMS_DIR "/tmp/.X11-pipe"
#endif
-#endif
#define DEV_PTMX "/dev/ptmx"
#if defined(X11_t)
-#define PTSNODENAME "/dev/X/server."
-#ifdef __sun
#define NAMEDNODENAME "/tmp/.X11-pipe/X"
-#else
-#define NAMEDNODENAME "/dev/X/Nserver."
-
-#define SCORNODENAME "/dev/X%1sR"
-#define SCOSNODENAME "/dev/X%1sS"
-#endif /* !__sun */
#endif
#if defined(XIM_t)
-#ifdef __sun
#define NAMEDNODENAME "/tmp/.XIM-pipe/XIM"
-#else
-#define PTSNODENAME "/dev/X/XIM."
-#define NAMEDNODENAME "/dev/X/NXIM."
-#define SCORNODENAME "/dev/XIM.%sR"
-#define SCOSNODENAME "/dev/XIM.%sS"
-#endif
#endif
#if defined(FS_t) || defined (FONT_t)
-#ifdef __sun
#define NAMEDNODENAME "/tmp/.font-pipe/fs"
-#else
-/*
- * USL has already defined something here. We need to check with them
- * and see if their choice is usable here.
- */
-#define PTSNODENAME "/dev/X/fontserver."
-#define NAMEDNODENAME "/dev/X/Nfontserver."
-#define SCORNODENAME "/dev/fontserver.%sR"
-#define SCOSNODENAME "/dev/fontserver.%sS"
-#endif
#endif
#if defined(ICE_t)
-#ifdef __sun
#define NAMEDNODENAME "/tmp/.ICE-pipe/"
-#else
-#define PTSNODENAME "/dev/X/ICE."
-#define NAMEDNODENAME "/dev/X/NICE."
-#define SCORNODENAME "/dev/ICE.%sR"
-#define SCOSNODENAME "/dev/ICE.%sS"
-#endif
-#endif
-#if defined(TEST_t)
-#ifdef __sun
-#define NAMEDNODENAME "/tmp/.Test-unix/test"
-#endif
-#define PTSNODENAME "/dev/X/transtest."
-#define NAMEDNODENAME "/dev/X/Ntranstest."
-#define SCORNODENAME "/dev/transtest.%sR"
-#define SCOSNODENAME "/dev/transtest.%sS"
#endif
-#ifdef LOCAL_TRANS_PTS
-#ifdef TRANS_CLIENT
-
-static int
-TRANS(PTSOpenClient)(XtransConnInfo ciptr, const char *port)
-
-{
-#ifdef PTSNODENAME
- int fd,server,exitval,alarm_time,ret;
- char server_path[64];
- char *slave, namelen;
- char buf[20]; /* MAX_PATH_LEN?? */
- PFV savef;
- pid_t saved_pid;
-#endif
-
- prmsg(2,"PTSOpenClient(%s)\n", port);
-
-#if !defined(PTSNODENAME)
- prmsg(1,"PTSOpenClient: Protocol is not supported by a pts connection\n");
- return -1;
-#else
- if (port && *port ) {
- if( *port == '/' ) { /* A full pathname */
- snprintf(server_path, sizeof(server_path), "%s", port);
- } else {
- snprintf(server_path, sizeof(server_path), "%s%s",
- PTSNODENAME, port);
- }
- } else {
- snprintf(server_path, sizeof(server_path), "%s%d",
- PTSNODENAME, getpid());
- }
-
-
- /*
- * Open the node the on which the server is listening.
- */
-
- if ((server = open (server_path, O_RDWR)) < 0) {
- prmsg(1,"PTSOpenClient: failed to open %s\n", server_path);
- return -1;
- }
-
-
- /*
- * Open the streams based pipe that will be this connection.
- */
-
- if ((fd = open(DEV_PTMX, O_RDWR)) < 0) {
- prmsg(1,"PTSOpenClient: failed to open %s\n", DEV_PTMX);
- close(server);
- return(-1);
- }
-
- (void) grantpt(fd);
- (void) unlockpt(fd);
-
- slave = ptsname(fd); /* get name */
-
- if( slave == NULL ) {
- prmsg(1,"PTSOpenClient: failed to get ptsname()\n");
- close(fd);
- close(server);
- return -1;
- }
-
- /*
- * This is neccesary for the case where a program is setuid to non-root.
- * grantpt() calls /usr/lib/pt_chmod which is set-uid root. This program will
- * set the owner of the pt device incorrectly if the uid is not restored
- * before it is called. The problem is that once it gets restored, it
- * cannot be changed back to its original condition, hence the fork().
- */
-
- if(!(saved_pid=fork())) {
- uid_t saved_euid;
-
- saved_euid = geteuid();
- /** sets the euid to the actual/real uid **/
- if (setuid( getuid() ) == -1) {
- exit(1);
- }
- if( chown( slave, saved_euid, -1 ) < 0 ) {
- exit( 1 );
- }
-
- exit( 0 );
- }
-
- waitpid(saved_pid, &exitval, 0);
- if (WIFEXITED(exitval) && WEXITSTATUS(exitval) != 0) {
- close(fd);
- close(server);
- prmsg(1, "PTSOpenClient: cannot set the owner of %s\n",
- slave);
- return(-1);
- }
- if (chmod(slave, 0666) < 0) {
- close(fd);
- close(server);
- prmsg(1,"PTSOpenClient: Cannot chmod %s\n", slave);
- return(-1);
- }
-
- /*
- * write slave name to server
- */
-
- namelen = strlen(slave);
- buf[0] = namelen;
- (void) sprintf(&buf[1], slave);
- (void) write(server, buf, namelen+1);
- (void) close(server);
-
- /*
- * wait for server to respond
- */
-
- savef = signal(SIGALRM, _dummy);
- alarm_time = alarm (30); /* CONNECT_TIMEOUT */
-
- ret = read(fd, buf, 1);
-
- (void) alarm(alarm_time);
- (void) signal(SIGALRM, savef);
-
- if (ret != 1) {
- prmsg(1,
- "PTSOpenClient: failed to get acknoledgement from server\n");
- (void) close(fd);
- fd = -1;
- }
-
- /*
- * Everything looks good: fill in the XtransConnInfo structure.
- */
-
- if (TRANS(FillAddrInfo) (ciptr, slave, server_path) == 0)
- {
- prmsg(1,"PTSOpenClient: failed to fill in addr info\n");
- close(fd);
- return -1;
- }
-
- return(fd);
-
-#endif /* !PTSNODENAME */
-}
-
-#endif /* TRANS_CLIENT */
-
-
-#ifdef TRANS_SERVER
-
-static int
-TRANS(PTSOpenServer)(XtransConnInfo ciptr, const char *port)
-
-{
-#ifdef PTSNODENAME
- int fd, server;
- char server_path[64], *slave;
- int mode;
-#endif
-
- prmsg(2,"PTSOpenServer(%s)\n", port);
-
-#if !defined(PTSNODENAME)
- prmsg(1,"PTSOpenServer: Protocol is not supported by a pts connection\n");
- return -1;
-#else
- if (port && *port ) {
- if( *port == '/' ) { /* A full pathname */
- (void) sprintf(server_path, "%s", port);
- } else {
- (void) sprintf(server_path, "%s%s", PTSNODENAME, port);
- }
- } else {
- (void) sprintf(server_path, "%s%d", PTSNODENAME, getpid());
- }
-
-#ifdef HAS_STICKY_DIR_BIT
- mode = 01777;
-#else
- mode = 0777;
-#endif
- if (trans_mkdir(X_STREAMS_DIR, mode) == -1) {
- prmsg (1, "PTSOpenServer: mkdir(%s) failed, errno = %d\n",
- X_STREAMS_DIR, errno);
- return(-1);
- }
-
-#if 0
- if( (fd=open(server_path, O_RDWR)) >= 0 ) {
- /*
- * This doesn't prevent the server from starting up, and doesn't
- * prevent clients from trying to connect to the in-use PTS (which
- * is often in use by something other than another server).
- */
- prmsg(1, "PTSOpenServer: A server is already running on port %s\n", port);
- prmsg(1, "PTSOpenServer: Remove %s if this is incorrect.\n", server_path);
- close(fd);
- return(-1);
- }
-#else
- /* Just remove the old path (which is what happens with UNIXCONN) */
-#endif
-
- unlink(server_path);
-
- if( (fd=open(DEV_PTMX, O_RDWR)) < 0) {
- prmsg(1, "PTSOpenServer: Unable to open %s\n", DEV_PTMX);
- return(-1);
- }
-
- grantpt(fd);
- unlockpt(fd);
-
- if( (slave=ptsname(fd)) == NULL) {
- prmsg(1, "PTSOpenServer: Unable to get slave device name\n");
- close(fd);
- return(-1);
- }
-
- if( link(slave,server_path) < 0 ) {
- prmsg(1, "PTSOpenServer: Unable to link %s to %s\n", slave, server_path);
- close(fd);
- return(-1);
- }
-
- if( chmod(server_path, 0666) < 0 ) {
- prmsg(1, "PTSOpenServer: Unable to chmod %s to 0666\n", server_path);
- close(fd);
- return(-1);
- }
-
- if( (server=open(server_path, O_RDWR)) < 0 ) {
- prmsg(1, "PTSOpenServer: Unable to open server device %s\n", server_path);
- close(fd);
- return(-1);
- }
-
- close(server);
-
- /*
- * Everything looks good: fill in the XtransConnInfo structure.
- */
-
- if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
- {
- prmsg(1,"PTSOpenServer: failed to fill in addr info\n");
- close(fd);
- return -1;
- }
-
- return fd;
-
-#endif /* !PTSNODENAME */
-}
-
-static int
-TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
-
-{
- int newfd;
- int in;
- unsigned char length;
- char buf[256];
- struct sockaddr_un *sunaddr;
-
- prmsg(2,"PTSAccept(%x->%d)\n",ciptr,ciptr->fd);
-
- if( (in=read(ciptr->fd,&length,1)) <= 0 ){
- if( !in ) {
- prmsg(2,
- "PTSAccept: Incoming connection closed\n");
- }
- else {
- prmsg(1,
- "PTSAccept: Error reading incoming connection. errno=%d \n",
- errno);
- }
- *status = TRANS_ACCEPT_MISC_ERROR;
- return -1;
- }
-
- if( (in=read(ciptr->fd,buf,length)) <= 0 ){
- if( !in ) {
- prmsg(2,
- "PTSAccept: Incoming connection closed\n");
- }
- else {
- prmsg(1,
-"PTSAccept: Error reading device name for new connection. errno=%d \n",
- errno);
- }
- *status = TRANS_ACCEPT_MISC_ERROR;
- return -1;
- }
-
- buf[length] = '\0';
-
- if( (newfd=open(buf,O_RDWR)) < 0 ) {
- prmsg(1, "PTSAccept: Failed to open %s\n",buf);
- *status = TRANS_ACCEPT_MISC_ERROR;
- return -1;
- }
-
- write(newfd,"1",1);
-
- /*
- * Everything looks good: fill in the XtransConnInfo structure.
- */
-
- newciptr->addrlen=ciptr->addrlen;
- if( (newciptr->addr = malloc(newciptr->addrlen)) == NULL ) {
- prmsg(1,"PTSAccept: failed to allocate memory for peer addr\n");
- close(newfd);
- *status = TRANS_ACCEPT_BAD_MALLOC;
- return -1;
- }
-
- memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen);
-
- newciptr->peeraddrlen=sizeof(struct sockaddr_un);
- if( (sunaddr = malloc(newciptr->peeraddrlen)) == NULL ) {
- prmsg(1,"PTSAccept: failed to allocate memory for peer addr\n");
- free(newciptr->addr);
- close(newfd);
- *status = TRANS_ACCEPT_BAD_MALLOC;
- return -1;
- }
-
- sunaddr->sun_family=AF_UNIX;
- strcpy(sunaddr->sun_path,buf);
-#if defined(BSD44SOCKETS)
- sunaddr->sun_len=strlen(sunaddr->sun_path);
-#endif
-
- newciptr->peeraddr=(char *)sunaddr;
-
- *status = 0;
-
- return newfd;
-}
-
-#endif /* TRANS_SERVER */
-#endif /* LOCAL_TRANS_PTS */
#ifdef LOCAL_TRANS_NAMED
@@ -678,9 +250,6 @@ TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, const char *port)
int fd;
char server_path[64];
struct stat filestat;
-# ifndef __sun
- extern int isastream(int);
-# endif
#endif
prmsg(2,"NAMEDOpenClient(%s)\n", port);
@@ -935,387 +504,14 @@ TRANS(NAMEDAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
-#if defined(LOCAL_TRANS_SCO)
-
-/*
- * connect_spipe is used by the SCO connection type.
- */
-static int
-connect_spipe(int fd1, int fd2)
-{
- long temp;
- struct strfdinsert sbuf;
-
- sbuf.databuf.maxlen = -1;
- sbuf.databuf.len = -1;
- sbuf.databuf.buf = NULL;
- sbuf.ctlbuf.maxlen = sizeof(long);
- sbuf.ctlbuf.len = sizeof(long);
- sbuf.ctlbuf.buf = (caddr_t)&temp;
- sbuf.offset = 0;
- sbuf.fildes = fd2;
- sbuf.flags = 0;
-
- if( ioctl(fd1, I_FDINSERT, &sbuf) < 0 )
- return(-1);
-
- return(0);
-}
-
-/*
- * named_spipe is used by the SCO connection type.
- */
-
-static int
-named_spipe(int fd, char *path)
-
-{
- int oldUmask, ret;
- struct stat sbuf;
-
- oldUmask = umask(0);
-
- (void) fstat(fd, &sbuf);
- ret = mknod(path, 0020666, sbuf.st_rdev);
-
- umask(oldUmask);
-
- if (ret < 0) {
- ret = -1;
- } else {
- ret = fd;
- }
-
- return(ret);
-}
-
-#endif /* defined(LOCAL_TRANS_SCO) */
-#ifdef LOCAL_TRANS_SCO
-/* SCO */
-
-/*
- * 2002-11-09 (jkj@sco.com)
- *
- * This code has been modified to match what is in the actual SCO X server.
- * This greatly helps inter-operability between X11R6 and X11R5 (the native
- * SCO server). Mainly, it relies on streams nodes existing in /dev, not
- * creating them or unlinking them, which breaks the native X server.
- *
- * However, this is only for the X protocol. For all other protocols, we
- * do in fact create the nodes, as only X11R6 will use them, and this makes
- * it possible to have both types of clients running, otherwise we get all
- * kinds of nasty errors on startup for anything that doesnt use the X
- * protocol (like SM, when KDE starts up).
- */
-
-#ifdef TRANS_CLIENT
-
-static int
-TRANS(SCOOpenClient)(XtransConnInfo ciptr, const char *port)
-{
-#ifdef SCORNODENAME
- int fd, server, fl, ret;
- char server_path[64];
- struct strbuf ctlbuf;
- unsigned long alarm_time;
- void (*savef)();
- long temp;
- extern int getmsg(), putmsg();
-#endif
-
- prmsg(2,"SCOOpenClient(%s)\n", port);
- if (!port || !port[0])
- port = "0";
-
-#if !defined(SCORNODENAME)
- prmsg(2,"SCOOpenClient: Protocol is not supported by a SCO connection\n");
- return -1;
-#else
- (void) sprintf(server_path, SCORNODENAME, port);
-
- if ((server = open(server_path, O_RDWR)) < 0) {
- prmsg(1,"SCOOpenClient: failed to open %s\n", server_path);
- return -1;
- }
-
- if ((fd = open(DEV_SPX, O_RDWR)) < 0) {
- prmsg(1,"SCOOpenClient: failed to open %s\n", DEV_SPX);
- close(server);
- return -1;
- }
-
- (void) write(server, &server, 1);
- ctlbuf.len = 0;
- ctlbuf.maxlen = sizeof(long);
- ctlbuf.buf = (caddr_t)&temp;
- fl = 0;
-
- savef = signal(SIGALRM, _dummy);
- alarm_time = alarm(10);
-
- ret = getmsg(server, &ctlbuf, 0, &fl);
-
- (void) alarm(alarm_time);
- (void) signal(SIGALRM, savef);
-
- if (ret < 0) {
- prmsg(1,"SCOOpenClient: error from getmsg\n");
- close(fd);
- close(server);
- return -1;
- }
-
- /* The msg we got via getmsg is the result of an
- * I_FDINSERT, so if we do a putmsg with whatever
- * we recieved, we're doing another I_FDINSERT ...
- */
- (void) putmsg(fd, &ctlbuf, 0, 0);
- (void) fcntl(fd,F_SETFL,fcntl(fd,F_GETFL,0)|O_NDELAY);
-
- (void) close(server);
-
- /*
- * Everything looks good: fill in the XtransConnInfo structure.
- */
-
-#if defined(X11_t) && defined(__SCO__)
- ciptr->flags |= TRANS_NOUNLINK;
-#endif
- if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
- {
- prmsg(1,"SCOOpenClient: failed to fill addr info\n");
- close(fd);
- return -1;
- }
-
- return(fd);
-
-#endif /* !SCORNODENAME */
-}
-
-#endif /* TRANS_CLIENT */
-
-
-#ifdef TRANS_SERVER
-
-static int
-TRANS(SCOOpenServer)(XtransConnInfo ciptr, const char *port)
-{
-#ifdef SCORNODENAME
- char serverR_path[64];
- char serverS_path[64];
- struct flock mylock;
- int fdr = -1;
- int fds = -1;
-#endif
-
- prmsg(2,"SCOOpenServer(%s)\n", port);
- if (!port || !port[0])
- port = "0";
-
-#if !defined(SCORNODENAME)
- prmsg(1,"SCOOpenServer: Protocol is not supported by a SCO connection\n");
- return -1;
-#else
- (void) sprintf(serverR_path, SCORNODENAME, port);
- (void) sprintf(serverS_path, SCOSNODENAME, port);
-
-#if !defined(X11_t) || !defined(__SCO__)
- unlink(serverR_path);
- unlink(serverS_path);
-
- if ((fds = open(DEV_SPX, O_RDWR)) < 0 ||
- (fdr = open(DEV_SPX, O_RDWR)) < 0 ) {
- prmsg(1,"SCOOpenServer: failed to open %s\n", DEV_SPX);
- if (fds >= 0)
- close(fds);
- if (fdr >= 0)
- close(fdr);
- return -1;
- }
-
- if (named_spipe (fds, serverS_path) == -1) {
- prmsg(1,"SCOOpenServer: failed to create %s\n", serverS_path);
- close (fdr);
- close (fds);
- return -1;
- }
-
- if (named_spipe (fdr, serverR_path) == -1) {
- prmsg(1,"SCOOpenServer: failed to create %s\n", serverR_path);
- close (fdr);
- close (fds);
- return -1;
- }
-#else /* X11_t */
-
- fds = open (serverS_path, O_RDWR | O_NDELAY);
- if (fds < 0) {
- prmsg(1,"SCOOpenServer: failed to open %s\n", serverS_path);
- return -1;
- }
-
- /*
- * Lock the connection device for the duration of the server.
- * This resolves multiple server starts especially on SMP machines.
- */
- mylock.l_type = F_WRLCK;
- mylock.l_whence = 0;
- mylock.l_start = 0;
- mylock.l_len = 0;
- if (fcntl (fds, F_SETLK, &mylock) < 0) {
- prmsg(1,"SCOOpenServer: failed to lock %s\n", serverS_path);
- close (fds);
- return -1;
- }
-
- fdr = open (serverR_path, O_RDWR | O_NDELAY);
- if (fdr < 0) {
- prmsg(1,"SCOOpenServer: failed to open %s\n", serverR_path);
- close (fds);
- return -1;
- }
-#endif /* X11_t */
-
- if (connect_spipe(fds, fdr)) {
- prmsg(1,"SCOOpenServer: ioctl(I_FDINSERT) failed on %s\n",
- serverS_path);
- close (fdr);
- close (fds);
- return -1;
- }
-
- /*
- * Everything looks good: fill in the XtransConnInfo structure.
- */
-
-#if defined(X11_t) && defined(__SCO__)
- ciptr->flags |= TRANS_NOUNLINK;
-#endif
- if (TRANS(FillAddrInfo) (ciptr, serverS_path, serverR_path) == 0) {
- prmsg(1,"SCOOpenServer: failed to fill in addr info\n");
- close(fds);
- close(fdr);
- return -1;
- }
-
- return(fds);
-
-#endif /* !SCORNODENAME */
-}
-
-static int
-TRANS(SCOAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
-{
- char c;
- int fd;
-
- prmsg(2,"SCOAccept(%d)\n", ciptr->fd);
-
- if (read(ciptr->fd, &c, 1) < 0) {
- prmsg(1,"SCOAccept: can't read from client\n");
- *status = TRANS_ACCEPT_MISC_ERROR;
- return(-1);
- }
-
- if( (fd = open(DEV_SPX, O_RDWR)) < 0 ) {
- prmsg(1,"SCOAccept: can't open \"%s\"\n",DEV_SPX);
- *status = TRANS_ACCEPT_MISC_ERROR;
- return(-1);
- }
-
- if (connect_spipe (ciptr->fd, fd) < 0) {
- prmsg(1,"SCOAccept: ioctl(I_FDINSERT) failed\n");
- close (fd);
- *status = TRANS_ACCEPT_MISC_ERROR;
- return -1;
- }
-
- /*
- * Everything looks good: fill in the XtransConnInfo structure.
- */
-
- newciptr->addrlen=ciptr->addrlen;
- if( (newciptr->addr = malloc(newciptr->addrlen)) == NULL ) {
- prmsg(1,
- "SCOAccept: failed to allocate memory for peer addr\n");
- close(fd);
- *status = TRANS_ACCEPT_BAD_MALLOC;
- return -1;
- }
-
- memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen);
-#if defined(__SCO__)
- newciptr->flags |= TRANS_NOUNLINK;
-#endif
-
- newciptr->peeraddrlen=newciptr->addrlen;
- if( (newciptr->peeraddr = malloc(newciptr->peeraddrlen)) == NULL ) {
- prmsg(1,
- "SCOAccept: failed to allocate memory for peer addr\n");
- free(newciptr->addr);
- close(fd);
- *status = TRANS_ACCEPT_BAD_MALLOC;
- return -1;
- }
-
- memcpy(newciptr->peeraddr,newciptr->addr,newciptr->peeraddrlen);
-
- *status = 0;
-
- return(fd);
-}
-
-#endif /* TRANS_SERVER */
-#endif /* LOCAL_TRANS_SCO */
#ifdef TRANS_REOPEN
-#ifdef LOCAL_TRANS_PTS
-
-static int
-TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, const char *port)
-
-{
-#ifdef PTSNODENAME
- char server_path[64];
-#endif
-
- prmsg(2,"PTSReopenServer(%d,%s)\n", fd, port);
-
-#if !defined(PTSNODENAME)
- prmsg(1,"PTSReopenServer: Protocol is not supported by a pts connection\n");
- return 0;
-#else
- if (port && *port ) {
- if( *port == '/' ) { /* A full pathname */
- snprintf(server_path, sizeof(server_path), "%s", port);
- } else {
- snprintf(server_path, sizeof(server_path), "%s%s",
- PTSNODENAME, port);
- }
- } else {
- snprintf(server_path, sizeof(server_path), "%s%ld",
- PTSNODENAME, (long)getpid());
- }
-
- if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
- {
- prmsg(1,"PTSReopenServer: failed to fill in addr info\n");
- return 0;
- }
-
- return 1;
-
-#endif /* !PTSNODENAME */
-}
-
-#endif /* LOCAL_TRANS_PTS */
#ifdef LOCAL_TRANS_NAMED
@@ -1359,41 +555,6 @@ TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd _X_UNUSED, const char *por
#endif /* LOCAL_TRANS_NAMED */
-#ifdef LOCAL_TRANS_SCO
-static int
-TRANS(SCOReopenServer)(XtransConnInfo ciptr, int fd, const char *port)
-
-{
-#ifdef SCORNODENAME
- char serverR_path[64], serverS_path[64];
-#endif
-
- prmsg(2,"SCOReopenServer(%s)\n", port);
- if (!port || !port[0])
- port = "0";
-
-#if !defined(SCORNODENAME)
- prmsg(2,"SCOReopenServer: Protocol is not supported by a SCO connection\n");
- return 0;
-#else
- (void) sprintf(serverR_path, SCORNODENAME, port);
- (void) sprintf(serverS_path, SCOSNODENAME, port);
-
-#if defined(X11_t) && defined(__SCO__)
- ciptr->flags |= TRANS_NOUNLINK;
-#endif
- if (TRANS(FillAddrInfo) (ciptr, serverS_path, serverR_path) == 0)
- {
- prmsg(1, "SCOReopenServer: failed to fill in addr info\n");
- return 0;
- }
-
- return 1;
-
-#endif /* SCORNODENAME */
-}
-
-#endif /* LOCAL_TRANS_SCO */
#endif /* TRANS_REOPEN */
@@ -1470,76 +631,6 @@ typedef struct _LOCALtrans2dev {
} LOCALtrans2dev;
static LOCALtrans2dev LOCALtrans2devtab[] = {
-#ifdef LOCAL_TRANS_PTS
-{"",
-#ifdef TRANS_CLIENT
- TRANS(PTSOpenClient),
-#endif /* TRANS_CLIENT */
-#ifdef TRANS_SERVER
- TRANS(PTSOpenServer),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_CLIENT
- TRANS(OpenFail),
-#endif /* TRANS_CLIENT */
-#ifdef TRANS_SERVER
- TRANS(OpenFail),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_REOPEN
- TRANS(PTSReopenServer),
- TRANS(ReopenFail),
-#endif
-#ifdef TRANS_SERVER
- NULL, /* ResetListener */
- TRANS(PTSAccept)
-#endif /* TRANS_SERVER */
-},
-
-{"local",
-#ifdef TRANS_CLIENT
- TRANS(PTSOpenClient),
-#endif /* TRANS_CLIENT */
-#ifdef TRANS_SERVER
- TRANS(PTSOpenServer),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_CLIENT
- TRANS(OpenFail),
-#endif /* TRANS_CLIENT */
-#ifdef TRANS_SERVER
- TRANS(OpenFail),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_REOPEN
- TRANS(PTSReopenServer),
- TRANS(ReopenFail),
-#endif
-#ifdef TRANS_SERVER
- NULL, /* ResetListener */
- TRANS(PTSAccept)
-#endif /* TRANS_SERVER */
-},
-
-{"pts",
-#ifdef TRANS_CLIENT
- TRANS(PTSOpenClient),
-#endif /* TRANS_CLIENT */
-#ifdef TRANS_SERVER
- TRANS(PTSOpenServer),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_CLIENT
- TRANS(OpenFail),
-#endif /* TRANS_CLIENT */
-#ifdef TRANS_SERVER
- TRANS(OpenFail),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_REOPEN
- TRANS(PTSReopenServer),
- TRANS(ReopenFail),
-#endif
-#ifdef TRANS_SERVER
- NULL, /* ResetListener */
- TRANS(PTSAccept)
-#endif /* TRANS_SERVER */
-},
-#else /* !LOCAL_TRANS_PTS */
{"",
#ifdef TRANS_CLIENT
TRANS(NAMEDOpenClient),
@@ -1585,7 +676,6 @@ static LOCALtrans2dev LOCALtrans2devtab[] = {
TRANS(NAMEDAccept)
#endif /* TRANS_SERVER */
},
-#endif /* !LOCAL_TRANS_PTS */
#ifdef LOCAL_TRANS_NAMED
{"named",
@@ -1611,7 +701,6 @@ static LOCALtrans2dev LOCALtrans2devtab[] = {
#endif /* TRANS_SERVER */
},
-#ifdef __sun /* Alias "pipe" to named, since that's what Solaris called it */
{"pipe",
#ifdef TRANS_CLIENT
TRANS(NAMEDOpenClient),
@@ -1634,34 +723,9 @@ static LOCALtrans2dev LOCALtrans2devtab[] = {
TRANS(NAMEDAccept)
#endif /* TRANS_SERVER */
},
-#endif /* __sun */
#endif /* LOCAL_TRANS_NAMED */
-#ifdef LOCAL_TRANS_SCO
-{"sco",
-#ifdef TRANS_CLIENT
- TRANS(SCOOpenClient),
-#endif /* TRANS_CLIENT */
-#ifdef TRANS_SERVER
- TRANS(SCOOpenServer),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_CLIENT
- TRANS(OpenFail),
-#endif /* TRANS_CLIENT */
-#ifdef TRANS_SERVER
- TRANS(OpenFail),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_REOPEN
- TRANS(SCOReopenServer),
- TRANS(ReopenFail),
-#endif
-#ifdef TRANS_SERVER
- NULL, /* ResetListener */
- TRANS(SCOAccept)
-#endif /* TRANS_SERVER */
-},
-#endif /* LOCAL_TRANS_SCO */
};
#define NUMTRANSPORTS (sizeof(LOCALtrans2devtab)/sizeof(LOCALtrans2dev))
@@ -1670,15 +734,7 @@ static const char *XLOCAL=NULL;
static char *workingXLOCAL=NULL;
static char *freeXLOCAL=NULL;
-#if defined(__SCO__)
-#define DEF_XLOCAL "SCO:UNIX:PTS"
-#elif defined(__UNIXWARE__)
-#define DEF_XLOCAL "UNIX:PTS:NAMED:SCO"
-#elif defined(__sun)
#define DEF_XLOCAL "UNIX:NAMED"
-#else
-#define DEF_XLOCAL "UNIX:PTS:NAMED:SCO"
-#endif
static void
TRANS(LocalInitTransports)(const char *protocol)
@@ -2185,11 +1241,7 @@ TRANS(LocalBytesReadable)(XtransConnInfo ciptr, BytesReadable_t *pend )
{
prmsg(2,"LocalBytesReadable(%p->%d,%p)\n", ciptr, ciptr->fd, pend);
-#if defined(SCO325)
- return ioctl(ciptr->fd, I_NREAD, (char *)pend);
-#else
return ioctl(ciptr->fd, FIONREAD, (char *)pend);
-#endif
}
static int
@@ -2288,16 +1340,8 @@ TRANS(LocalCloseForCloning)(XtransConnInfo ciptr)
#ifdef TRANS_SERVER
static const char * local_aliases[] = {
-# ifdef LOCAL_TRANS_PTS
- "pts",
-# endif
"named",
-# ifdef __sun
"pipe", /* compatibility with Solaris Xlib */
-# endif
-# ifdef LOCAL_TRANS_SCO
- "sco",
-# endif
NULL };
#endif
@@ -2338,46 +1382,6 @@ Xtransport TRANS(LocalFuncs) = {
TRANS(LocalCloseForCloning),
};
-#ifdef LOCAL_TRANS_PTS
-
-Xtransport TRANS(PTSFuncs) = {
- /* Local Interface */
- "pts",
- TRANS_LOCAL,
-#ifdef TRANS_CLIENT
- TRANS(LocalOpenCOTSClient),
-#endif /* TRANS_CLIENT */
-#ifdef TRANS_SERVER
- NULL,
- TRANS(LocalOpenCOTSServer),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_REOPEN
- TRANS(LocalReopenCOTSServer),
-#endif
- TRANS(LocalSetOption),
-#ifdef TRANS_SERVER
- TRANS(LocalCreateListener),
- TRANS(LocalResetListener),
- TRANS(LocalAccept),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_CLIENT
- TRANS(LocalConnect),
-#endif /* TRANS_CLIENT */
- TRANS(LocalBytesReadable),
- TRANS(LocalRead),
- TRANS(LocalWrite),
- TRANS(LocalReadv),
- TRANS(LocalWritev),
-#if XTRANS_SEND_FDS
- TRANS(LocalSendFdInvalid),
- TRANS(LocalRecvFdInvalid),
-#endif
- TRANS(LocalDisconnect),
- TRANS(LocalClose),
- TRANS(LocalCloseForCloning),
-};
-
-#endif /* LOCAL_TRANS_PTS */
#ifdef LOCAL_TRANS_NAMED
@@ -2418,7 +1422,6 @@ Xtransport TRANS(NAMEDFuncs) = {
TRANS(LocalCloseForCloning),
};
-#ifdef __sun
Xtransport TRANS(PIPEFuncs) = {
/* Local Interface */
"pipe",
@@ -2455,45 +1458,6 @@ Xtransport TRANS(PIPEFuncs) = {
TRANS(LocalClose),
TRANS(LocalCloseForCloning),
};
-#endif /* __sun */
#endif /* LOCAL_TRANS_NAMED */
-#ifdef LOCAL_TRANS_SCO
-Xtransport TRANS(SCOFuncs) = {
- /* Local Interface */
- "sco",
- TRANS_LOCAL,
-#ifdef TRANS_CLIENT
- TRANS(LocalOpenCOTSClient),
-#endif /* TRANS_CLIENT */
-#ifdef TRANS_SERVER
- NULL,
- TRANS(LocalOpenCOTSServer),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_REOPEN
- TRANS(LocalReopenCOTSServer),
-#endif
- TRANS(LocalSetOption),
-#ifdef TRANS_SERVER
- TRANS(LocalCreateListener),
- TRANS(LocalResetListener),
- TRANS(LocalAccept),
-#endif /* TRANS_SERVER */
-#ifdef TRANS_CLIENT
- TRANS(LocalConnect),
-#endif /* TRANS_CLIENT */
- TRANS(LocalBytesReadable),
- TRANS(LocalRead),
- TRANS(LocalWrite),
- TRANS(LocalReadv),
- TRANS(LocalWritev),
-#if XTRANS_SEND_FDS
- TRANS(LocalSendFdInvalid),
- TRANS(LocalRecvFdInvalid),
-#endif
- TRANS(LocalDisconnect),
- TRANS(LocalClose),
- TRANS(LocalCloseForCloning),
-};
-#endif /* LOCAL_TRANS_SCO */
diff --git a/Xtranssock.c b/Xtranssock.c
index 42340fe..166a377 100644
--- a/Xtranssock.c
+++ b/Xtranssock.c
@@ -227,7 +227,7 @@ static int TRANS(SocketINETClose) (XtransConnInfo ciptr);
#if defined HAVE_SOCKLEN_T || (defined(IPv6) && defined(AF_INET6))
# define SOCKLEN_T socklen_t
-#elif defined(SVR4) || defined(__SVR4) || defined(__SCO__)
+#elif defined(SVR4) || defined(__SVR4)
# define SOCKLEN_T size_t
#else
# define SOCKLEN_T int
@@ -990,7 +990,7 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, const char *port,
return TRANS_CREATE_LISTENER_FAILED;
}
-#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__))
+#if defined(BSD44SOCKETS)
sockname.sun_len = strlen(sockname.sun_path);
#endif
@@ -1068,7 +1068,7 @@ TRANS(SocketUNIXResetListener) (XtransConnInfo ciptr)
if (!abstract && (
stat (unsock->sun_path, &statb) == -1 ||
((statb.st_mode & S_IFMT) !=
-#if defined(NCR) || defined(SCO325) || !defined(S_IFSOCK)
+#if !defined(S_IFSOCK)
S_IFIFO
#else
S_IFSOCK
@@ -1864,7 +1864,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr,
return TRANS_CONNECT_FAILED;
}
-#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__))
+#if defined(BSD44SOCKETS)
sockname.sun_len = strlen (sockname.sun_path);
#endif
diff --git a/Xtransutil.c b/Xtransutil.c
index f3a280d..e12f37a 100644
--- a/Xtransutil.c
+++ b/Xtransutil.c
@@ -169,13 +169,6 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
}
#endif /* defined(UNIXCONN) || defined(LOCALCONN) */
-#if (defined(__SCO__) || defined(__UNIXWARE__)) && defined(LOCALCONN)
- case 0:
- {
- *familyp=FamilyLocal;
- break;
- }
-#endif
default:
prmsg(1,"ConvertAddress: Unknown family type %d\n",
diff --git a/xtrans.m4 b/xtrans.m4
index 8215e87..0a5c5c1 100644
--- a/xtrans.m4
+++ b/xtrans.m4
@@ -122,7 +122,7 @@ AC_DEFUN([XTRANS_CONNECTION_FLAGS],[
XTRANS_TCP_FLAGS
fi
[case $host_os in
- solaris*|sco*|sysv4*) localdef="yes" ;;
+ solaris*) localdef="yes" ;;
*) localdef="no" ;;
esac]
AC_ARG_ENABLE(local-transport,