Xtrans 1.2.3. Tested on a full ports build by naddy@.
This commit is contained in:
parent
4f4ae80624
commit
58f9a8fb5c
@ -1,3 +1,127 @@
|
||||
commit 1cf4a1a6716f2c0adf5ee4d0a194a1013be53105
|
||||
Author: Alan Coopersmith <alan.coopersmith@sun.com>
|
||||
Date: Sun Jan 11 10:54:52 2009 -0800
|
||||
|
||||
Version 1.2.3
|
||||
|
||||
commit d0c5592142369afa93dcd58ca6f390dbd127a28a
|
||||
Author: Alan Coopersmith <alan.coopersmith@sun.com>
|
||||
Date: Sun Jan 11 10:51:49 2009 -0800
|
||||
|
||||
Add bugzilla, mailing list & git repo pointers to README
|
||||
|
||||
commit 9f12a154437554938a4fa18b7d3948c7dff8d631
|
||||
Author: Alan Coopersmith <alan.coopersmith@sun.com>
|
||||
Date: Mon Dec 1 13:58:31 2008 -0800
|
||||
|
||||
Switch ChangeLog generation to use XORG_CHANGELOG from xorg-macros 1.2
|
||||
|
||||
commit 8c313881a0c586179c09922a7e00a1f8d669a68a
|
||||
Author: Alan Coopersmith <alan.coopersmith@sun.com>
|
||||
Date: Mon Dec 1 08:37:42 2008 -0800
|
||||
|
||||
18748: xtrans.m4 causes configure --help to list --enable-ipv6 in wrong case.
|
||||
|
||||
X.Org Bug #18748 <http://bugs.freedesktop.org/show_bug.cgi?id=18748>
|
||||
|
||||
commit c626a4298e98f4988701dd587bc8355c62542ec4
|
||||
Author: Alan Hourihane <alanh@tungstengraphics.com>
|
||||
Date: Wed Oct 15 11:19:41 2008 +0100
|
||||
|
||||
add winsock check for windows builds
|
||||
|
||||
commit 005bd80a9eab736aea737869b8a1079c565e1cd6
|
||||
Author: Adam Jackson <ajax@redhat.com>
|
||||
Date: Tue Oct 7 09:56:49 2008 -0400
|
||||
|
||||
xtrans 1.2.2
|
||||
|
||||
commit 1185dd2966521e1a19474dfd4206306cb383fc89
|
||||
Author: Adam Jackson <ajax@redhat.com>
|
||||
Date: Tue Oct 7 09:55:22 2008 -0400
|
||||
|
||||
Finish removing OS/2 support
|
||||
|
||||
commit 51b2e85aeb172f4a058d8ceceec91021ffd0b2a5
|
||||
Author: Adam Jackson <ajax@redhat.com>
|
||||
Date: Tue Oct 7 09:51:27 2008 -0400
|
||||
|
||||
Remove DECNET support.
|
||||
|
||||
This hasn't been consumed in the server or libs since 7.0.
|
||||
|
||||
commit 892ec928da3a0653ae54c321e4c3b1aa06c4e678
|
||||
Author: Adam Jackson <ajax@redhat.com>
|
||||
Date: Thu Aug 7 10:32:11 2008 -0400
|
||||
|
||||
Drastically simplify TRANS_OPEN_MAX.
|
||||
|
||||
If your OS doesn't have sysconf(3), then life is already hard for you.
|
||||
|
||||
commit 339ddc413559d4cb117a72f87b2a70dae6911c32
|
||||
Author: Adam Jackson <ajax@redhat.com>
|
||||
Date: Thu Aug 7 10:23:19 2008 -0400
|
||||
|
||||
Massive ifdef cleanup, dropping a ton of unsupported platform code.
|
||||
|
||||
commit a78b9819cbbbddccb4a6bf364b88ec4f27d25c1f
|
||||
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
|
||||
Date: Tue Aug 5 17:46:37 2008 -0700
|
||||
|
||||
Added a flag to enable "The OS already took care of securing this, please skip checking xauth" for use with Apple launchd sockets.
|
||||
|
||||
commit 3db805979b476d233baa881e83950ef1d2731841
|
||||
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
|
||||
Date: Tue Jul 15 16:56:12 2008 -0700
|
||||
|
||||
Apple: Allow Xquartz to provide an additional fd to xtrans since the dynamic addition code in the server isn't bulletproof yet.
|
||||
|
||||
commit 81d8bdced6b45ab2ab3d3a0bc164ddbf1659fea1
|
||||
Author: Adam Jackson <ajax@redhat.com>
|
||||
Date: Wed Jul 2 15:24:20 2008 -0400
|
||||
|
||||
xtrans 1.2.1
|
||||
|
||||
commit 302af17c4d5f0293a9af4d6c1097ab57a57d3f0f
|
||||
Author: Alan Coopersmith <alan.coopersmith@sun.com>
|
||||
Date: Tue Jun 24 15:45:38 2008 -0700
|
||||
|
||||
Clear some pointer type mismatch warnings
|
||||
|
||||
commit 4d184e41d30a8fe27380e04beb24f775d4a40782
|
||||
Author: Alan Coopersmith <alan.coopersmith@sun.com>
|
||||
Date: Tue Jun 24 15:45:18 2008 -0700
|
||||
|
||||
LocalClose() takes a ConnInfoPtr, not an fd
|
||||
|
||||
commit 177c2fd41727bd0110b493933dcbdbf21878fe09
|
||||
Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
|
||||
Date: Fri May 23 09:48:59 2008 -0700
|
||||
|
||||
Launchd: This functionality has been moved into xorg-server
|
||||
|
||||
commit 02fcb08803dca5bb2df4f8be490a845659bd7ed3
|
||||
Author: Adam Jackson <ajax@redhat.com>
|
||||
Date: Mon May 12 17:49:41 2008 -0400
|
||||
|
||||
Connection failure for abstract socket is ECONNREFUSED, not ENOENT.
|
||||
|
||||
Apropos of bug #15884.
|
||||
|
||||
commit 906294025573d07c739894fa3b2eedc82813a379
|
||||
Author: Bill Nottingham <notting@redhat.com>
|
||||
Date: Mon May 12 17:43:36 2008 -0400
|
||||
|
||||
Ignore mkdir() errors when creating the abstract socket.
|
||||
|
||||
Red Hat bug #445303.
|
||||
|
||||
commit 08134c2ce72bc43c172b6ae134d8a94a40b45c9b
|
||||
Author: James Cloos <cloos@jhcloos.com>
|
||||
Date: Sat May 10 07:02:09 2008 -0400
|
||||
|
||||
Remove extraneous execute bit from .c file
|
||||
|
||||
commit e75b9dad0ae4bc0869af81652d8259675a3c5cac
|
||||
Author: Julien Cristau <jcristau@debian.org>
|
||||
Date: Thu May 8 16:27:29 2008 +0200
|
||||
|
@ -2,10 +2,8 @@ Xtransincludedir = $(includedir)/X11/Xtrans
|
||||
Xtransinclude_HEADERS = \
|
||||
Xtrans.h \
|
||||
Xtrans.c \
|
||||
Xtransdnet.c \
|
||||
Xtransint.h \
|
||||
Xtranslcl.c \
|
||||
Xtransos2.c \
|
||||
Xtranssock.c \
|
||||
Xtranstli.c \
|
||||
Xtransutil.c \
|
||||
@ -24,6 +22,6 @@ CLEANFILES = ChangeLog
|
||||
.PHONY: ChangeLog
|
||||
|
||||
ChangeLog:
|
||||
(GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
|
||||
$(CHANGELOG_CMD)
|
||||
|
||||
dist-hook: ChangeLog
|
||||
|
@ -75,7 +75,6 @@ am__remove_distdir = \
|
||||
DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2
|
||||
GZIP_ENV = --best
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
@ -87,6 +86,7 @@ AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CHANGELOG_CMD = @CHANGELOG_CMD@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
@ -131,6 +131,7 @@ am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
datadir = @datadir@
|
||||
distcleancheck_listfiles = @distcleancheck_listfiles@
|
||||
exec_prefix = @exec_prefix@
|
||||
fchown_define = @fchown_define@
|
||||
host_alias = @host_alias@
|
||||
@ -154,10 +155,8 @@ Xtransincludedir = $(includedir)/X11/Xtrans
|
||||
Xtransinclude_HEADERS = \
|
||||
Xtrans.h \
|
||||
Xtrans.c \
|
||||
Xtransdnet.c \
|
||||
Xtransint.h \
|
||||
Xtranslcl.c \
|
||||
Xtransos2.c \
|
||||
Xtranssock.c \
|
||||
Xtranstli.c \
|
||||
Xtransutil.c \
|
||||
@ -540,7 +539,7 @@ uninstall-am: uninstall-XtransincludeHEADERS uninstall-aclocalDATA \
|
||||
.PHONY: ChangeLog
|
||||
|
||||
ChangeLog:
|
||||
(GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
|
||||
$(CHANGELOG_CMD)
|
||||
|
||||
dist-hook: ChangeLog
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
|
@ -1,14 +1,36 @@
|
||||
xtrans is a library of code that is shared among various X packages to handle
|
||||
network protocol transport in a modular fashion, allowing a single place to
|
||||
add new transport types. It is used by the X server, libX11, libICE, the
|
||||
X font server, and related components.
|
||||
xtrans is a library of code that is shared among various X packages to
|
||||
handle network protocol transport in a modular fashion, allowing a
|
||||
single place to add new transport types. It is used by the X server,
|
||||
libX11, libICE, the X font server, and related components.
|
||||
|
||||
It is however, *NOT* a shared library, but code which each consumer includes and
|
||||
builds it's own copy of with various #ifdef flags to make each copy slightly
|
||||
different. To support this in the modular build system, this package simply
|
||||
installs the C source files into $(prefix)/include/X11/Xtrans and installs a
|
||||
pkg-config file and an autoconf m4 macro file with the flags needed to use it.
|
||||
It is however, *NOT* a shared library, but code which each consumer
|
||||
includes and builds it's own copy of with various #ifdef flags to make
|
||||
each copy slightly different. To support this in the modular build
|
||||
system, this package simply installs the C source files into
|
||||
$(prefix)/include/X11/Xtrans and installs a pkg-config file and an
|
||||
autoconf m4 macro file with the flags needed to use it.
|
||||
|
||||
Documentation of the xtrans API can be found in the xorg-docs package, in
|
||||
PostScript format in xorg-docs/hardcopy/xtrans/Xtrans.PS.gz and in the original
|
||||
troff format in xorg-docs/specs/xtrans/Xtrans.mm .
|
||||
Documentation of the xtrans API can be found in the xorg-docs package,
|
||||
in PostScript format in xorg-docs/hardcopy/xtrans/Xtrans.PS.gz and in
|
||||
the original troff format in xorg-docs/specs/xtrans/Xtrans.mm .
|
||||
|
||||
Please submit bugs & patches to the Xorg bugzilla:
|
||||
|
||||
https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
|
||||
|
||||
under the component "Lib/xtrans".
|
||||
|
||||
All questions regarding this software should be directed at the
|
||||
Xorg mailing list:
|
||||
|
||||
http://lists.freedesktop.org/mailman/listinfo/xorg
|
||||
|
||||
The master development code repository can be found at:
|
||||
|
||||
git://anongit.freedesktop.org/git/xorg/lib/libxtrans
|
||||
|
||||
http://cgit.freedesktop.org/xorg/lib/libxtrans
|
||||
|
||||
For more information on the git code manager, see:
|
||||
|
||||
http://wiki.x.org/wiki/GitPage
|
||||
|
@ -48,9 +48,6 @@ from The Open Group.
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_LAUNCHD
|
||||
#include <launch.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The transport table contains a definition for every transport (protocol)
|
||||
@ -95,18 +92,12 @@ Xtransport_table Xtransports[] = {
|
||||
#endif /* IPv6 */
|
||||
{ &TRANS(SocketINETFuncs), TRANS_SOCKET_INET_INDEX },
|
||||
#endif /* TCPCONN */
|
||||
#if defined(DNETCONN)
|
||||
{ &TRANS(DNETFuncs), TRANS_DNET_INDEX },
|
||||
#endif /* DNETCONN */
|
||||
#if defined(UNIXCONN)
|
||||
#if !defined(LOCALCONN)
|
||||
{ &TRANS(SocketLocalFuncs), TRANS_SOCKET_LOCAL_INDEX },
|
||||
#endif /* !LOCALCONN */
|
||||
{ &TRANS(SocketUNIXFuncs), TRANS_SOCKET_UNIX_INDEX },
|
||||
#endif /* UNIXCONN */
|
||||
#if defined(OS2PIPECONN)
|
||||
{ &TRANS(OS2LocalFuncs), TRANS_LOCAL_LOCAL_INDEX },
|
||||
#endif /* OS2PIPECONN */
|
||||
#if defined(LOCALCONN)
|
||||
{ &TRANS(LocalFuncs), TRANS_LOCAL_LOCAL_INDEX },
|
||||
#ifndef sun
|
||||
@ -437,7 +428,7 @@ TRANS(Open) (int type, char *address)
|
||||
|
||||
PRMSG (2,"Open(%d,%s)\n", type, address, 0);
|
||||
|
||||
#if defined(WIN32) && (defined(TCPCONN) || defined(DNETCONN))
|
||||
#if defined(WIN32) && defined(TCPCONN)
|
||||
if (TRANS(WSAStartup)())
|
||||
{
|
||||
PRMSG (1,"Open: WSAStartup failed\n", 0, 0, 0);
|
||||
@ -730,7 +721,7 @@ TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg)
|
||||
break;
|
||||
case 1: /* Set to non-blocking mode */
|
||||
|
||||
#if defined(O_NONBLOCK) && (!defined(ultrix) && !defined(hpux) && !defined(AIXV3) && !defined(uniosu) && !defined(__UNIXOS2__) && !defined(SCO325)) && !defined(__QNX__)
|
||||
#if defined(O_NONBLOCK) && !defined(SCO325)
|
||||
ret = fcntl (fd, F_GETFL, 0);
|
||||
if (ret != -1)
|
||||
ret = fcntl (fd, F_SETFL, ret | O_NONBLOCK);
|
||||
@ -742,7 +733,7 @@ TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg)
|
||||
ret = ioctl (fd, FIOSNBIO, &arg);
|
||||
}
|
||||
#else
|
||||
#if (defined(AIXV3) || defined(uniosu) || defined(WIN32) || defined(__UNIXOS2__) || defined(__QNX__)) && defined(FIONBIO)
|
||||
#if defined(WIN32)
|
||||
{
|
||||
#ifdef WIN32
|
||||
u_long arg;
|
||||
@ -752,11 +743,7 @@ TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg)
|
||||
arg = 1;
|
||||
/* IBM TCP/IP understands this option too well: it causes TRANS(Read) to fail
|
||||
* eventually with EWOULDBLOCK */
|
||||
#ifndef __UNIXOS2__
|
||||
ret = ioctl (fd, FIONBIO, &arg);
|
||||
#else
|
||||
/* ret = ioctl(fd, FIONBIO, &arg, sizeof(int));*/
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
ret = fcntl (fd, F_GETFL, 0);
|
||||
@ -874,7 +861,7 @@ TRANS(Connect) (XtransConnInfo ciptr, char *address)
|
||||
}
|
||||
|
||||
#ifdef HAVE_LAUNCHD
|
||||
if (!host || !*host) host=strdup("");
|
||||
if (!host) host=strdup("");
|
||||
#endif
|
||||
|
||||
if (!port || !*port)
|
||||
@ -1063,6 +1050,9 @@ complete_network_count (void)
|
||||
}
|
||||
|
||||
|
||||
#ifdef XQUARTZ_EXPORTS_LAUNCHD_FD
|
||||
extern int xquartz_launchd_fd;
|
||||
#endif
|
||||
|
||||
int
|
||||
TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
|
||||
@ -1072,11 +1062,6 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
|
||||
char buffer[256]; /* ??? What size ?? */
|
||||
XtransConnInfo ciptr, temp_ciptrs[NUMTRANS];
|
||||
int status, i, j;
|
||||
#ifdef HAVE_LAUNCHD
|
||||
int launchd_fd;
|
||||
launch_data_t sockets_dict, checkin_request, checkin_response;
|
||||
launch_data_t listening_fd_array, listening_fd;
|
||||
#endif
|
||||
|
||||
#if defined(IPv6) && defined(AF_INET6)
|
||||
int ipv6_succ = 0;
|
||||
@ -1086,57 +1071,15 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
|
||||
|
||||
*count_ret = 0;
|
||||
|
||||
#ifdef HAVE_LAUNCHD
|
||||
/* Get launchd fd */
|
||||
if ((checkin_request = launch_data_new_string(LAUNCH_KEY_CHECKIN)) == NULL) {
|
||||
fprintf(stderr,"launch_data_new_string(\"" LAUNCH_KEY_CHECKIN "\") Unable to create string.\n");
|
||||
goto not_launchd;
|
||||
}
|
||||
|
||||
if ((checkin_response = launch_msg(checkin_request)) == NULL) {
|
||||
fprintf(stderr,"launch_msg(\"" LAUNCH_KEY_CHECKIN "\") IPC failure: %s\n",strerror(errno));
|
||||
goto not_launchd;
|
||||
}
|
||||
|
||||
if (LAUNCH_DATA_ERRNO == launch_data_get_type(checkin_response)) {
|
||||
// ignore EACCES, which is common if we weren't started by launchd
|
||||
if (launch_data_get_errno(checkin_response) != EACCES)
|
||||
fprintf(stderr,"launchd check-in failed: %s\n",strerror(launch_data_get_errno(checkin_response)));
|
||||
goto not_launchd;
|
||||
}
|
||||
|
||||
sockets_dict = launch_data_dict_lookup(checkin_response, LAUNCH_JOBKEY_SOCKETS);
|
||||
if (NULL == sockets_dict) {
|
||||
fprintf(stderr,"launchd check-in: no sockets found to answer requests on!\n");
|
||||
goto not_launchd;
|
||||
}
|
||||
|
||||
if (launch_data_dict_get_count(sockets_dict) > 1) {
|
||||
fprintf(stderr,"launchd check-in: some sockets will be ignored!\n");
|
||||
goto not_launchd;
|
||||
}
|
||||
|
||||
listening_fd_array = launch_data_dict_lookup(sockets_dict, ":0");
|
||||
if (NULL == listening_fd_array) {
|
||||
fprintf(stderr,"launchd check-in: No known sockets found to answer requests on!\n");
|
||||
goto not_launchd;
|
||||
}
|
||||
|
||||
if (launch_data_array_get_count(listening_fd_array)!=1) {
|
||||
fprintf(stderr,"launchd check-in: Expected 1 socket from launchd, got %d)\n",
|
||||
launch_data_array_get_count(listening_fd_array));
|
||||
goto not_launchd;
|
||||
}
|
||||
|
||||
listening_fd=launch_data_array_get_index(listening_fd_array, 0);
|
||||
launchd_fd=launch_data_get_fd(listening_fd);
|
||||
fprintf(stderr,"Xquartz: run by launchd for fd %d\n",launchd_fd);
|
||||
if((ciptr = TRANS(ReopenCOTSServer(TRANS_SOCKET_LOCAL_INDEX,
|
||||
launchd_fd, getenv("DISPLAY"))))==NULL)
|
||||
fprintf(stderr,"Got NULL while trying to Reopen launchd port\n");
|
||||
else temp_ciptrs[(*count_ret)++] = ciptr;
|
||||
|
||||
not_launchd:
|
||||
#ifdef XQUARTZ_EXPORTS_LAUNCHD_FD
|
||||
fprintf(stderr, "Launchd socket fd: %d\n", xquartz_launchd_fd);
|
||||
if(xquartz_launchd_fd != -1) {
|
||||
if((ciptr = TRANS(ReopenCOTSServer(TRANS_SOCKET_LOCAL_INDEX,
|
||||
xquartz_launchd_fd, getenv("DISPLAY"))))==NULL)
|
||||
fprintf(stderr,"Got NULL while trying to Reopen launchd port\n");
|
||||
else
|
||||
temp_ciptrs[(*count_ret)++] = ciptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i < NUMTRANS; i++)
|
||||
@ -1347,45 +1290,8 @@ TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
|
||||
* may be used by it.
|
||||
*/
|
||||
|
||||
#ifdef CRAY
|
||||
|
||||
/*
|
||||
* Cray UniCOS does not have readv and writev so we emulate
|
||||
*/
|
||||
|
||||
static int TRANS(ReadV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt)
|
||||
|
||||
{
|
||||
struct msghdr hdr;
|
||||
|
||||
hdr.msg_iov = iov;
|
||||
hdr.msg_iovlen = iovcnt;
|
||||
hdr.msg_accrights = 0;
|
||||
hdr.msg_accrightslen = 0;
|
||||
hdr.msg_name = 0;
|
||||
hdr.msg_namelen = 0;
|
||||
|
||||
return (recvmsg (ciptr->fd, &hdr, 0));
|
||||
}
|
||||
|
||||
static int TRANS(WriteV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt)
|
||||
|
||||
{
|
||||
struct msghdr hdr;
|
||||
|
||||
hdr.msg_iov = iov;
|
||||
hdr.msg_iovlen = iovcnt;
|
||||
hdr.msg_accrights = 0;
|
||||
hdr.msg_accrightslen = 0;
|
||||
hdr.msg_name = 0;
|
||||
hdr.msg_namelen = 0;
|
||||
|
||||
return (sendmsg (ciptr->fd, &hdr, 0));
|
||||
}
|
||||
|
||||
#endif /* CRAY */
|
||||
|
||||
#if (defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__)
|
||||
#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32)
|
||||
|
||||
/*
|
||||
* emulate readv
|
||||
@ -1417,7 +1323,7 @@ static int TRANS(ReadV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt)
|
||||
|
||||
#endif /* SYSV && __i386__ || WIN32 || __sxg__ */
|
||||
|
||||
#if (defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__)
|
||||
#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32)
|
||||
|
||||
/*
|
||||
* emulate writev
|
||||
@ -1450,7 +1356,7 @@ static int TRANS(WriteV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt)
|
||||
#endif /* SYSV && __i386__ || WIN32 || __sxg__ */
|
||||
|
||||
|
||||
#if (defined(_POSIX_SOURCE) && !defined(AIXV3) && !defined(__QNX__)) || defined(hpux) || defined(USG) || defined(SVR4) || defined(__SCO__)
|
||||
#if defined(_POSIX_SOURCE) || defined(USG) || defined(SVR4) || defined(__SCO__)
|
||||
#ifndef NEED_UTSNAME
|
||||
#define NEED_UTSNAME
|
||||
#endif
|
||||
|
@ -54,11 +54,7 @@ from The Open Group.
|
||||
#include <X11/Xos.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef Lynx
|
||||
#include <sys/socket.h>
|
||||
#else
|
||||
#include <socket.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@ -194,7 +190,7 @@ typedef long BytesReadable_t;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(WIN32) || (defined(USG) && !defined(CRAY) && !defined(umips) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__))
|
||||
#if defined(WIN32) || defined(USG)
|
||||
|
||||
/*
|
||||
* TRANS(Readv) and TRANS(Writev) use struct iovec, normally found
|
||||
@ -208,11 +204,7 @@ struct iovec {
|
||||
};
|
||||
|
||||
#else
|
||||
#ifndef Lynx
|
||||
#include <sys/uio.h>
|
||||
#else
|
||||
#include <uio.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef struct _XtransConnInfo *XtransConnInfo;
|
||||
@ -479,7 +471,7 @@ TRANS(GetHostname) (
|
||||
int /* maxlen */
|
||||
);
|
||||
|
||||
#if defined(WIN32) && (defined(TCPCONN) || defined(DNETCONN))
|
||||
#if defined(WIN32) && defined(TCPCONN)
|
||||
int TRANS(WSAStartup)();
|
||||
#endif
|
||||
|
||||
|
@ -1,664 +0,0 @@
|
||||
/*
|
||||
|
||||
Copyright 1993, 1994, 1998 The Open Group
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
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.
|
||||
|
||||
* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA
|
||||
*
|
||||
* All Rights Reserved
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and its
|
||||
* documentation for any purpose and without fee is hereby granted, provided
|
||||
* that the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name NCR not be used in advertising
|
||||
* or publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. NCR and makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||
* NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef WIN32
|
||||
#include <netdnet/dn.h>
|
||||
#include <netdnet/dnetdb.h>
|
||||
#include <sys/ioctl.h>
|
||||
#endif /* !WIN32 */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#define _WILLWINSOCK_
|
||||
#define BOOL wBOOL
|
||||
#undef Status
|
||||
#define Status wStatus
|
||||
#include <prgpre.h> /* PATHWORKS header normally in %MSTOOLS%\h\pathwork */
|
||||
#undef Status
|
||||
#define Status int
|
||||
#undef BOOL
|
||||
#include <X11/Xw32defs.h>
|
||||
#undef close
|
||||
#define close closesocket
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
#if defined(X11_t)
|
||||
#define DNETOBJ "X$X"
|
||||
#endif
|
||||
#if defined(XIM_t)
|
||||
#define DNETOBJ "IMSERVER$"
|
||||
#endif
|
||||
#if defined(FS_t) || defined(FONT_t)
|
||||
#define DNETOBJ "X$FONT"
|
||||
#endif
|
||||
#if defined(ICE_t)
|
||||
#define DNETOBJ ""
|
||||
#endif
|
||||
#if defined(TEST_t)
|
||||
#define DNETOBJ "X$TEST"
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* This is the DNET implementation of the X Transport service layer
|
||||
*/
|
||||
|
||||
/*
|
||||
* This function gets the local address of the socket and stores it in the
|
||||
* XtransConnInfo structure for the connection.
|
||||
*/
|
||||
|
||||
static int
|
||||
TRANS(DNETGetAddr) (XtransConnInfo ciptr)
|
||||
|
||||
{
|
||||
struct sockaddr_dn sockname;
|
||||
int namelen = sizeof(sockname);
|
||||
|
||||
PRMSG (3,"DNETGetAddr(%x)\n", ciptr, 0, 0);
|
||||
|
||||
if (getsockname (ciptr->fd, (struct sockaddr *) &sockname, &namelen) < 0)
|
||||
{
|
||||
PRMSG (1,"DNETGetAddr: getsockname() failed: %d\n",
|
||||
EGET(), 0, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Everything looks good: fill in the XtransConnInfo structure.
|
||||
*/
|
||||
|
||||
if ((ciptr->addr = (char *) xalloc (namelen)) == NULL)
|
||||
{
|
||||
PRMSG (1, "DNETGetAddr: Can't allocate space for the addr\n",
|
||||
0, 0, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ciptr->family = sockname.sdn_family;
|
||||
ciptr->addrlen = namelen;
|
||||
memcpy (ciptr->addr, &sockname, ciptr->addrlen);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function gets the remote address of the socket and stores it in the
|
||||
* XtransConnInfo structure for the connection.
|
||||
*/
|
||||
|
||||
static int
|
||||
TRANS(DNETGetPeerAddr) (XtransConnInfo ciptr)
|
||||
|
||||
{
|
||||
struct sockaddr_dn sockname;
|
||||
int namelen = sizeof(sockname);
|
||||
|
||||
PRMSG (3,"DNETGetPeerAddr(%x)\n", ciptr, 0, 0);
|
||||
|
||||
if (getpeername (ciptr->fd, (struct sockaddr *) &sockname, &namelen) < 0)
|
||||
{
|
||||
PRMSG (1,"DNETGetPeerAddr: getpeername() failed: %d\n",
|
||||
EGET(), 0, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Everything looks good: fill in the XtransConnInfo structure.
|
||||
*/
|
||||
|
||||
if ((ciptr->peeraddr = (char *) xalloc (namelen)) == NULL)
|
||||
{
|
||||
PRMSG (1,
|
||||
"DNETGetPeerAddr: Can't allocate space for the addr\n",
|
||||
0, 0, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ciptr->peeraddrlen = namelen;
|
||||
memcpy (ciptr->peeraddr, &sockname, ciptr->peeraddrlen);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef TRANS_CLIENT
|
||||
|
||||
static XtransConnInfo
|
||||
TRANS(DNETOpenCOTSClient) (Xtransport *thistrans, char *protocol,
|
||||
char *host, char *port)
|
||||
|
||||
{
|
||||
XtransConnInfo ciptr;
|
||||
|
||||
PRMSG (2,"DNETOpenCOTSClient(%s,%s,%s)\n", protocol, host, port);
|
||||
|
||||
if ((ciptr = (XtransConnInfo) xcalloc (
|
||||
1, sizeof(struct _XtransConnInfo))) == NULL)
|
||||
{
|
||||
PRMSG (1, "DNETOpenCOTSClient: malloc failed\n", 0, 0, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ciptr->index = 0; /* only one form of DECnet */
|
||||
|
||||
/* nothing else to do here */
|
||||
|
||||
return ciptr;
|
||||
}
|
||||
|
||||
#endif /* TRANS_CLIENT */
|
||||
|
||||
|
||||
#ifdef TRANS_SERVER
|
||||
|
||||
static XtransConnInfo
|
||||
TRANS(DNETOpenCOTSServer) (Xtransport *thistrans, char *protocol,
|
||||
char *host, char *port)
|
||||
|
||||
{
|
||||
XtransConnInfo ciptr;
|
||||
|
||||
PRMSG (2,"DNETOpenCOTSServer(%s,%s,%s)\n", protocol, host, port);
|
||||
|
||||
if ((ciptr = (XtransConnInfo) xcalloc (
|
||||
1, sizeof(struct _XtransConnInfo))) == NULL)
|
||||
{
|
||||
PRMSG (1, "DNETOpenCOTSServer: malloc failed\n", 0, 0, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((ciptr->fd = socket (AF_DECnet, SOCK_STREAM, 0)) < 0)
|
||||
{
|
||||
xfree ((char *) ciptr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ciptr->index = 0; /* only one form of DECnet */
|
||||
|
||||
return (ciptr);
|
||||
}
|
||||
|
||||
#endif /* TRANS_SERVER */
|
||||
|
||||
|
||||
#ifdef TRANS_CLIENT
|
||||
|
||||
static XtransConnInfo
|
||||
TRANS(DNETOpenCLTSClient) (Xtransport *thistrans, char *protocol,
|
||||
char *host, char *port)
|
||||
|
||||
{
|
||||
XtransConnInfo ciptr;
|
||||
|
||||
PRMSG (2,"DNETOpenCLTSClient(%s,%s,%s)\n", protocol, host, port);
|
||||
|
||||
if ((ciptr = (XtransConnInfo) xcalloc (
|
||||
1, sizeof (struct _XtransConnInfo))) == NULL)
|
||||
{
|
||||
PRMSG (1, "DNETOpenCLTSClient: malloc failed\n", 0, 0, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ciptr->index = 0; /* only one form of DECnet */
|
||||
|
||||
/* nothing else to do here */
|
||||
|
||||
return ciptr;
|
||||
}
|
||||
|
||||
#endif /* TRANS_CLIENT */
|
||||
|
||||
|
||||
#ifdef TRANS_SERVER
|
||||
|
||||
static XtransConnInfo
|
||||
TRANS(DNETOpenCLTSServer) (Xtransport *thistrans, char *protocol,
|
||||
char *host, char *port)
|
||||
|
||||
{
|
||||
/* NEED TO IMPLEMENT */
|
||||
|
||||
PRMSG (2,"DNETOpenCLTSServer(%s,%s,%s)\n", protocol, host, port);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* TRANS_SERVER */
|
||||
|
||||
|
||||
#ifdef TRANS_REOPEN
|
||||
|
||||
static XtransConnInfo
|
||||
TRANS(DNETReopenCOTSServer) (Xtransport *thistrans, int fd, char *port)
|
||||
|
||||
{
|
||||
XtransConnInfo ciptr;
|
||||
|
||||
PRMSG (2,"DNETReopenCOTSServer(%d,%s)\n", fd, port, 0);
|
||||
|
||||
if ((ciptr = (XtransConnInfo) xcalloc (
|
||||
1, sizeof(struct _XtransConnInfo))) == NULL)
|
||||
{
|
||||
PRMSG (1, "DNETReopenCOTSServer: malloc failed\n", 0, 0, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ciptr->fd = fd;
|
||||
ciptr->index = 0; /* only one form of DECnet */
|
||||
|
||||
return (ciptr);
|
||||
}
|
||||
|
||||
static XtransConnInfo
|
||||
TRANS(DNETReopenCLTSServer) (Xtransport *thistrans, int fd, char *port)
|
||||
|
||||
{
|
||||
XtransConnInfo ciptr;
|
||||
|
||||
PRMSG (2,"DNETReopenCLTSServer(%d,%s)\n", fd, port, 0);
|
||||
|
||||
if ((ciptr = (XtransConnInfo) xcalloc (
|
||||
1, sizeof(struct _XtransConnInfo))) == NULL)
|
||||
{
|
||||
PRMSG (1, "DNETReopenCLTSServer: malloc failed\n", 0, 0, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ciptr->fd = fd;
|
||||
ciptr->index = 0; /* only one form of DECnet */
|
||||
|
||||
return (ciptr);
|
||||
}
|
||||
|
||||
#endif /* TRANS_REOPEN */
|
||||
|
||||
|
||||
static int
|
||||
TRANS(DNETSetOption) (XtransConnInfo ciptr, int option, int arg)
|
||||
|
||||
{
|
||||
PRMSG (2,"DNETSetOption(%d,%d,%d)\n", ciptr->fd, option, arg);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
#ifdef TRANS_SERVER
|
||||
|
||||
static int
|
||||
TRANS(DNETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int flags)
|
||||
|
||||
{
|
||||
struct sockaddr_dn dnsock;
|
||||
int fd = ciptr->fd;
|
||||
|
||||
PRMSG (3, "DNETCreateListener(%x,%d)\n", ciptr, fd, 0);
|
||||
|
||||
bzero ((char *) &dnsock, sizeof (dnsock));
|
||||
dnsock.sdn_family = AF_DECnet;
|
||||
|
||||
if (port && *port )
|
||||
sprintf (dnsock.sdn_objname, "%s%s", DNETOBJ, port);
|
||||
else
|
||||
#ifdef X11_t
|
||||
return -1;
|
||||
#else
|
||||
sprintf (dnsock.sdn_objname, "%s%d", DNETOBJ, getpid ());
|
||||
#endif
|
||||
|
||||
dnsock.sdn_objnamel = strlen (dnsock.sdn_objname);
|
||||
|
||||
if (bind (fd, (struct sockaddr *) &dnsock, sizeof (dnsock)))
|
||||
{
|
||||
close (fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (listen (fd, 5))
|
||||
{
|
||||
close (fd);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
/* Set a flag to indicate that this connection is a listener */
|
||||
|
||||
ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static XtransConnInfo
|
||||
TRANS(DNETAccept) (XtransConnInfo ciptr, int *status)
|
||||
|
||||
{
|
||||
XtransConnInfo newciptr;
|
||||
struct sockaddr_dn sockname;
|
||||
int namelen = sizeof(sockname);
|
||||
|
||||
PRMSG (2, "DNETAccept(%x,%d)\n", ciptr, ciptr->fd, 0);
|
||||
|
||||
if ((newciptr = (XtransConnInfo) xcalloc(
|
||||
1, sizeof (struct _XtransConnInfo))) == NULL)
|
||||
{
|
||||
PRMSG (1, "DNETAccept: malloc failed\n", 0, 0, 0);
|
||||
*status = TRANS_ACCEPT_BAD_MALLOC;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if((newciptr->fd = accept (ciptr->fd,
|
||||
(struct sockaddr *) &sockname, &namelen)) < 0)
|
||||
{
|
||||
PRMSG (1, "DNETAccept: accept() failed\n", 0, 0, 0);
|
||||
|
||||
xfree (newciptr);
|
||||
*status = TRANS_ACCEPT_FAILED;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get this address again because the transport may give a more
|
||||
* specific address now that a connection is established.
|
||||
*/
|
||||
|
||||
if (TRANS(DNETGetAddr) (newciptr) < 0)
|
||||
{
|
||||
PRMSG(1,
|
||||
"DNETAccept: ...DNETGetAddr() failed:\n", 0, 0, 0);
|
||||
close (newciptr->fd);
|
||||
xfree (newciptr);
|
||||
*status = TRANS_ACCEPT_MISC_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (TRANS(DNETGetPeerAddr) (newciptr) < 0)
|
||||
{
|
||||
PRMSG(1,
|
||||
"DNETAccept: ...DNETGetPeerAddr() failed:\n", 0, 0, 0);
|
||||
|
||||
close (newciptr->fd);
|
||||
if (newciptr->addr) xfree (newciptr->addr);
|
||||
xfree (newciptr);
|
||||
*status = TRANS_ACCEPT_MISC_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*status = 0;
|
||||
|
||||
return newciptr;
|
||||
}
|
||||
|
||||
#endif /* TRANS_SERVER */
|
||||
|
||||
|
||||
#ifdef TRANS_CLIENT
|
||||
|
||||
#define OBJBUFSIZE 64
|
||||
|
||||
static int
|
||||
TRANS(DNETConnect) (XtransConnInfo ciptr, char *host, char *port)
|
||||
|
||||
{
|
||||
char objname[OBJBUFSIZE];
|
||||
|
||||
extern int dnet_conn();
|
||||
|
||||
PRMSG (2,"DNETConnect(%d,%s,%s)\n", ciptr->fd, host, port);
|
||||
|
||||
#ifdef X11_t
|
||||
/*
|
||||
* X has a well known port, that is transport dependent. It is easier
|
||||
* to handle it here, than try and come up with a transport independent
|
||||
* representation that can be passed in and resolved the usual way.
|
||||
*
|
||||
* The port that is passed here is really a string containing the idisplay
|
||||
* from ConnectDisplay().
|
||||
*/
|
||||
|
||||
if (is_numeric (port))
|
||||
{
|
||||
short tmpport = (short) atoi (port);
|
||||
|
||||
sprintf (objname, "X$X%d", tmpport);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
strncpy(objname, port, OBJBUFSIZE);
|
||||
|
||||
|
||||
/*
|
||||
* Do the connect
|
||||
*/
|
||||
|
||||
if (!host) host = "0";
|
||||
|
||||
if ((ciptr->fd = dnet_conn (host, objname, SOCK_STREAM, 0, 0, 0, 0)) < 0)
|
||||
{
|
||||
return TRANS_CONNECT_FAILED;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sync up the address fields of ciptr.
|
||||
*/
|
||||
|
||||
if (TRANS(DNETGetAddr) (ciptr) < 0)
|
||||
{
|
||||
PRMSG (1,
|
||||
"DNETConnect: ...DNETGetAddr() failed:\n", 0, 0, 0);
|
||||
return TRANS_CONNECT_FAILED;
|
||||
}
|
||||
|
||||
if (TRANS(DNETGetPeerAddr) (ciptr) < 0)
|
||||
{
|
||||
PRMSG (1,
|
||||
"DNETConnect: ...DNETGetPeerAddr() failed:\n",
|
||||
0, 0, 0);
|
||||
return TRANS_CONNECT_FAILED;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* TRANS_CLIENT */
|
||||
|
||||
|
||||
static int
|
||||
TRANS(DNETBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend)
|
||||
|
||||
{
|
||||
PRMSG (2,"DNETBytesReadable(%x,%d,%x)\n", ciptr, ciptr->fd, pend);
|
||||
|
||||
#ifdef WIN32
|
||||
{
|
||||
int ret = ioctlsocket ((SOCKET) ciptr->fd, FIONREAD, (u_long *) pend);
|
||||
errno = WSAGetLastError();
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
return ioctl(ciptr->fd, FIONREAD, (char *)pend);
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
TRANS(DNETRead) (XtransConnInfo ciptr, char *buf, int size)
|
||||
|
||||
{
|
||||
PRMSG (2,"DNETRead(%d,%x,%d)\n", ciptr->fd, buf, size);
|
||||
|
||||
#ifdef WIN32
|
||||
{
|
||||
int ret = recv ((SOCKET)ciptr->fd, buf, size, 0);
|
||||
errno = WSAGetLastError();
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
return read (ciptr->fd, buf, size);
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
TRANS(DNETWrite) (XtransConnInfo ciptr, char *buf, int size)
|
||||
|
||||
{
|
||||
PRMSG (2,"DNETWrite(%d,%x,%d)\n", ciptr->fd, buf, size);
|
||||
|
||||
#ifdef WIN32
|
||||
{
|
||||
int ret = send ((SOCKET)ciptr->fd, buf, size, 0);
|
||||
errno = WSAGetLastError();
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
return write (ciptr->fd, buf, size);
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
TRANS(DNETReadv) (XtransConnInfo ciptr, struct iovec *buf, int size)
|
||||
|
||||
{
|
||||
PRMSG (2,"DNETReadv(%d,%x,%d)\n", ciptr->fd, buf, size);
|
||||
|
||||
return READV (ciptr, buf, size);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
TRANS(DNETWritev) (XtransConnInfo ciptr, struct iovec *buf, int size)
|
||||
|
||||
{
|
||||
PRMSG (2,"DNETWritev(%d,%x,%d)\n", ciptr->fd, buf, size);
|
||||
|
||||
return WRITEV (ciptr, buf, size);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
TRANS(DNETDisconnect) (XtransConnInfo ciptr)
|
||||
|
||||
{
|
||||
PRMSG (2,"DNETDisconnect(%x,%d)\n", ciptr, ciptr->fd, 0);
|
||||
|
||||
#ifdef WIN32
|
||||
{
|
||||
int ret = shutdown (ciptr->fd, 2);
|
||||
errno = WSAGetLastError();
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
return shutdown (ciptr->fd, 2); /* disallow further sends and receives */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
TRANS(DNETClose) (XtransConnInfo ciptr)
|
||||
|
||||
{
|
||||
PRMSG (2,"DNETClose(%x,%d)\n", ciptr, ciptr->fd, 0);
|
||||
|
||||
#ifdef WIN32
|
||||
{
|
||||
int ret = close (ciptr->fd);
|
||||
errno = WSAGetLastError();
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
return close (ciptr->fd);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Xtransport TRANS(DNETFuncs) = {
|
||||
/* DNET Interface */
|
||||
"dnet",
|
||||
0,
|
||||
#ifdef TRANS_CLIENT
|
||||
TRANS(DNETOpenCOTSClient),
|
||||
#endif /* TRANS_CLIENT */
|
||||
#ifdef TRANS_SERVER
|
||||
TRANS(DNETOpenCOTSServer),
|
||||
#endif /* TRANS_SERVER */
|
||||
#ifdef TRANS_CLIENT
|
||||
TRANS(DNETOpenCLTSClient),
|
||||
#endif /* TRANS_CLIENT */
|
||||
#ifdef TRANS_SERVER
|
||||
TRANS(DNETOpenCLTSServer),
|
||||
#endif /* TRANS_SERVER */
|
||||
#ifdef TRANS_REOPEN
|
||||
TRANS(DNETReopenCOTSServer),
|
||||
TRANS(DNETReopenCLTSServer),
|
||||
#endif /* TRANS_REOPEN */
|
||||
TRANS(DNETSetOption),
|
||||
#ifdef TRANS_SERVER
|
||||
TRANS(DNETCreateListener),
|
||||
NULL, /* ResetListener */
|
||||
TRANS(DNETAccept),
|
||||
#endif /* TRANS_SERVER */
|
||||
#ifdef TRANS_CLIENT
|
||||
TRANS(DNETConnect),
|
||||
#endif /* TRANS_CLIENT */
|
||||
TRANS(DNETBytesReadable),
|
||||
TRANS(DNETRead),
|
||||
TRANS(DNETWrite),
|
||||
TRANS(DNETReadv),
|
||||
TRANS(DNETWritev),
|
||||
TRANS(DNETDisconnect),
|
||||
TRANS(DNETClose),
|
||||
TRANS(DNETClose),
|
||||
};
|
@ -69,11 +69,7 @@ from The Open Group.
|
||||
*/
|
||||
|
||||
#ifndef XTRANSDEBUG
|
||||
# ifndef __UNIXOS2__
|
||||
# define XTRANSDEBUG 1
|
||||
# else
|
||||
# define XTRANSDEBUG 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
@ -89,87 +85,23 @@ from The Open Group.
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef WIN32
|
||||
# ifndef Lynx
|
||||
# include <sys/socket.h>
|
||||
# else
|
||||
# include <socket.h>
|
||||
# endif
|
||||
# include <netinet/in.h>
|
||||
# include <arpa/inet.h>
|
||||
# ifdef __UNIXOS2__
|
||||
# include <sys/ioctl.h>
|
||||
# endif
|
||||
|
||||
/*
|
||||
* Moved the setting of NEED_UTSNAME to this header file from Xtrans.c,
|
||||
* 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(USG) || defined(SVR4) || defined(__SCO__)
|
||||
# ifndef NEED_UTSNAME
|
||||
# define NEED_UTSNAME
|
||||
# endif
|
||||
# include <sys/utsname.h>
|
||||
# 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 <limits.h>
|
||||
# else
|
||||
# define _POSIX_SOURCE
|
||||
# include <limits.h>
|
||||
# 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 <sys/param.h>
|
||||
# ifndef OPEN_MAX
|
||||
# ifdef __OSF1__
|
||||
# define OPEN_MAX 256
|
||||
# else
|
||||
# ifdef NOFILE
|
||||
# define OPEN_MAX NOFILE
|
||||
# else
|
||||
# if !defined(__UNIXOS2__) && !defined(__QNX__)
|
||||
# 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 */
|
||||
|
||||
# ifdef __UNIXOS2__
|
||||
# define ESET(val)
|
||||
# else
|
||||
# define ESET(val) errno = val
|
||||
# endif
|
||||
# define EGET() errno
|
||||
|
||||
#else /* WIN32 */
|
||||
@ -370,6 +302,7 @@ typedef struct _Xtransport_table {
|
||||
#define TRANS_NOLISTEN (1<<3) /* Don't listen on this one */
|
||||
#define TRANS_NOUNLINK (1<<4) /* Dont 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) */
|
||||
|
||||
/* Flags to preserve when setting others */
|
||||
#define TRANS_KEEPFLAGS (TRANS_NOUNLINK|TRANS_ABSTRACT)
|
||||
@ -379,7 +312,7 @@ typedef struct _Xtransport_table {
|
||||
* systems, so they may be emulated.
|
||||
*/
|
||||
|
||||
#if defined(CRAY) || (defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__)
|
||||
#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32)
|
||||
|
||||
#define READV(ciptr, iov, iovcnt) TRANS(ReadV)(ciptr, iov, iovcnt)
|
||||
|
||||
@ -396,7 +329,7 @@ static int TRANS(ReadV)(
|
||||
#endif /* CRAY || (SYSV && __i386__) || WIN32 || __sxg__ || */
|
||||
|
||||
|
||||
#if defined(CRAY) || (defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__)
|
||||
#if defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun) || defined(WIN32)
|
||||
|
||||
#define WRITEV(ciptr, iov, iovcnt) TRANS(WriteV)(ciptr, iov, iovcnt)
|
||||
|
||||
|
@ -76,12 +76,7 @@ from The Open Group.
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#if defined(SVR4)
|
||||
#if !defined(DGUX)
|
||||
#include <sys/filio.h>
|
||||
#else /* DGUX */
|
||||
#include <sys/stream.h>
|
||||
#include <sys/ptms.h>
|
||||
#endif
|
||||
#endif
|
||||
#ifdef sun
|
||||
# include <stropts.h>
|
||||
@ -103,10 +98,6 @@ from The Open Group.
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
|
||||
#if defined(ISC) && !defined(_POSIX_SOURCE)
|
||||
typedef unsigned short mode_t;
|
||||
/* POSIX needed for mode_t define in sys/types.h */
|
||||
#endif
|
||||
|
||||
/* Types of local connections supported:
|
||||
* - PTS
|
||||
@ -120,10 +111,6 @@ typedef unsigned short mode_t;
|
||||
#if defined(SVR4) || defined(__SVR4)
|
||||
# define LOCAL_TRANS_NAMED
|
||||
#endif
|
||||
#if !defined(sun) && !defined(__SCO__) && !defined(__UNIXWARE__)
|
||||
/* SCO doesnt use the ISC transport type - it causes problems */
|
||||
# define LOCAL_TRANS_ISC
|
||||
#endif
|
||||
#if defined(__SCO__) || defined(__UNIXWARE__)
|
||||
# define LOCAL_TRANS_SCO
|
||||
#endif
|
||||
@ -179,7 +166,7 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path)
|
||||
return 0;
|
||||
}
|
||||
strcpy (sunaddr->sun_path, sun_path);
|
||||
#if defined(BSD44SOCKETS) && !defined(Lynx)
|
||||
#if defined(BSD44SOCKETS)
|
||||
sunaddr->sun_len = strlen (sunaddr->sun_path);
|
||||
#endif
|
||||
|
||||
@ -206,7 +193,7 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path)
|
||||
return 0;
|
||||
}
|
||||
strcpy (p_sunaddr->sun_path, peer_sun_path);
|
||||
#if defined(BSD44SOCKETS) && !defined(Lynx)
|
||||
#if defined(BSD44SOCKETS)
|
||||
p_sunaddr->sun_len = strlen (p_sunaddr->sun_path);
|
||||
#endif
|
||||
|
||||
@ -220,7 +207,7 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path)
|
||||
#ifdef LOCAL_TRANS_PTS
|
||||
/* PTS */
|
||||
|
||||
#if defined(SYSV) && !defined(__SCO__) && !defined(ISC)
|
||||
#if defined(SYSV) && !defined(__SCO__)
|
||||
#define SIGNAL_T int
|
||||
#else
|
||||
#define SIGNAL_T void
|
||||
@ -251,11 +238,7 @@ static void _dummy(int sig)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _AIX
|
||||
#define DEV_PTMX "/dev/ptc"
|
||||
#else
|
||||
#define DEV_PTMX "/dev/ptmx"
|
||||
#endif
|
||||
|
||||
#if defined(X11_t)
|
||||
|
||||
@ -270,9 +253,6 @@ static void _dummy(int sig)
|
||||
* backwards binary compatability only.
|
||||
*/
|
||||
|
||||
#define X_ISC_DIR "/dev/X/ISCCONN"
|
||||
#define ISCDEVNODENAME "/dev/X/ISCCONN/X%s"
|
||||
#define ISCTMPNODENAME "/tmp/.X11-unix/X%s"
|
||||
#define SCORNODENAME "/dev/X%1sR"
|
||||
#define SCOSNODENAME "/dev/X%1sS"
|
||||
#endif /* !sun */
|
||||
@ -657,7 +637,7 @@ TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
|
||||
|
||||
sunaddr->sun_family=AF_UNIX;
|
||||
strcpy(sunaddr->sun_path,buf);
|
||||
#if defined(BSD44SOCKETS) && !defined(Lynx)
|
||||
#if defined(BSD44SOCKETS)
|
||||
sunaddr->sun_len=strlen(sunaddr->sun_path);
|
||||
#endif
|
||||
|
||||
@ -858,7 +838,7 @@ TRANS(NAMEDOpenServer)(XtransConnInfo ciptr, char *port)
|
||||
if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
|
||||
{
|
||||
PRMSG(1,"NAMEDOpenServer: failed to fill in addr info\n", 0,0,0);
|
||||
TRANS(LocalClose)(fd);
|
||||
TRANS(LocalClose)(ciptr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -950,7 +930,7 @@ TRANS(NAMEDAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
|
||||
|
||||
|
||||
|
||||
#if defined(LOCAL_TRANS_ISC) || defined(LOCAL_TRANS_SCO)
|
||||
#if defined(LOCAL_TRANS_SCO)
|
||||
|
||||
/*
|
||||
* connect_spipe is used by the SCO and ISC connection types.
|
||||
@ -1004,294 +984,9 @@ named_spipe(int fd, char *path)
|
||||
return(ret);
|
||||
}
|
||||
|
||||
#endif /* defined(LOCAL_TRANS_ISC) || defined(LOCAL_TRANS_SCO) */
|
||||
#endif /* defined(LOCAL_TRANS_SCO) */
|
||||
|
||||
|
||||
#if defined(LOCAL_TRANS_ISC)
|
||||
|
||||
|
||||
/* ISC */
|
||||
|
||||
#ifdef TRANS_CLIENT
|
||||
|
||||
static int
|
||||
TRANS(ISCOpenClient)(XtransConnInfo ciptr, char *port)
|
||||
|
||||
{
|
||||
#ifdef ISCDEVNODENAME
|
||||
int fd,fds,server;
|
||||
char server_path[64];
|
||||
char server_dev_path[64];
|
||||
struct strfdinsert buf;
|
||||
long temp;
|
||||
mode_t spmode;
|
||||
struct stat filestat;
|
||||
#endif
|
||||
|
||||
PRMSG(2,"ISCOpenClient(%s)\n", port, 0,0 );
|
||||
|
||||
#if !defined(ISCDEVNODENAME)
|
||||
PRMSG(1,"ISCOpenClient: Protocol is not supported by a ISC connection\n", 0,0,0);
|
||||
return -1;
|
||||
#else
|
||||
(void) sprintf(server_path, ISCTMPNODENAME, port);
|
||||
(void) sprintf(server_dev_path, ISCDEVNODENAME, port);
|
||||
|
||||
fd = fds = server = -1;
|
||||
|
||||
if (stat(DEV_SPX, &filestat) == -1) {
|
||||
PRMSG(1, "ISCOpenClient: stat(%s) failed, errno=%d\n", DEV_SPX, errno, 0 );
|
||||
return(-1);
|
||||
}
|
||||
|
||||
spmode = (filestat.st_mode & S_IFMT);
|
||||
|
||||
if (stat(server_path, &filestat) != -1) {
|
||||
if ((filestat.st_mode & S_IFMT) == spmode) {
|
||||
if ((server = open(server_path, O_RDWR)) < 0) {
|
||||
PRMSG(1,"ISCOpenClient: failed to open %s\n",
|
||||
server_path, 0,0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (server < 0) {
|
||||
/* try the alternate path */
|
||||
if (stat(server_dev_path, &filestat) != -1) {
|
||||
if ((filestat.st_mode & S_IFMT) == spmode) {
|
||||
if ((server = open(server_dev_path, O_RDWR)) < 0) {
|
||||
PRMSG(1,"ISCOpenClient: failed to open %s\n",
|
||||
server_dev_path, 0,0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (server < 0) {
|
||||
PRMSG(1,"ISCOpenClient: can't open either device %s or %s\n",
|
||||
server_path, server_dev_path, 0 );
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((fds = open(DEV_SPX, O_RDWR)) < 0 ||
|
||||
(fd = open(DEV_SPX, O_RDWR)) < 0) {
|
||||
/* Failed to open all of the devices */
|
||||
PRMSG(1,"ISCOpenClient: can't open %s\n", DEV_SPX, 0,0 );
|
||||
(void) close(server);
|
||||
if (fds != -1)
|
||||
(void) close(fds);
|
||||
if (fd != -1)
|
||||
(void) close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* make a STREAMS-pipe */
|
||||
|
||||
buf.databuf.maxlen = -1;
|
||||
buf.databuf.len = -1;
|
||||
buf.databuf.buf = NULL;
|
||||
buf.ctlbuf.maxlen = sizeof(long);
|
||||
buf.ctlbuf.len = sizeof(long);
|
||||
buf.ctlbuf.buf = (caddr_t)&temp;
|
||||
buf.offset = 0;
|
||||
buf.fildes = fd;
|
||||
buf.flags = 0;
|
||||
|
||||
if (ioctl(fds, I_FDINSERT, &buf) < 0 ||
|
||||
ioctl(server, I_SENDFD, fds) < 0) {
|
||||
PRMSG(1,"ISCOpenClient: ioctl(I_FDINSERT or I_SENDFD) failed\n",
|
||||
0,0,0 );
|
||||
(void) close(server);
|
||||
(void) close(fds);
|
||||
(void) close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Everything looks good: fill in the XtransConnInfo structure.
|
||||
*/
|
||||
|
||||
if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
|
||||
{
|
||||
PRMSG(1,"ISCOpenClient: failed to fill in addr info\n", 0, 0, 0);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return (fd);
|
||||
|
||||
#endif /* !ISCDEVNODENAME */
|
||||
}
|
||||
|
||||
#endif /* TRANS_CLIENT */
|
||||
|
||||
|
||||
#ifdef TRANS_SERVER
|
||||
|
||||
static int
|
||||
TRANS(ISCOpenServer)(XtransConnInfo ciptr, char *port)
|
||||
|
||||
{
|
||||
#ifdef ISCDEVNODENAME
|
||||
int fd = -1,fds = -1;
|
||||
char server_path[64],server_unix_path[64];
|
||||
unsigned int mode = 0;
|
||||
#endif
|
||||
|
||||
PRMSG(2,"ISCOpenServer(%s)\n", port, 0,0 );
|
||||
|
||||
#if !defined(ISCDEVNODENAME)
|
||||
PRMSG(1,"ISCOpenServer: Protocol is not supported by a ISC connection\n", 0,0,0);
|
||||
return -1;
|
||||
#else
|
||||
(void) sprintf(server_path, ISCDEVNODENAME, port);
|
||||
(void) sprintf(server_unix_path, ISCTMPNODENAME, port);
|
||||
|
||||
#ifdef HAS_STICKY_DIR_BIT
|
||||
mode = 01777;
|
||||
#else
|
||||
mode = 0777;
|
||||
#endif
|
||||
|
||||
/* "/dev/X" */
|
||||
if (trans_mkdir(X_STREAMS_DIR, mode) == -1) {
|
||||
PRMSG (1, "ISCOpenServer: mkdir(%s) failed, errno = %d\n",
|
||||
X_STREAMS_DIR, errno, 0);
|
||||
return(-1);
|
||||
}
|
||||
/* "/dev/X/ISCCONN" */
|
||||
if (trans_mkdir(X_ISC_DIR, mode) == -1) {
|
||||
PRMSG (1, "ISCOpenServer: mkdir(%s) failed, errno = %d\n",
|
||||
X_ISC_DIR, errno, 0);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
unlink(server_path);
|
||||
|
||||
if( ((fds=open(DEV_SPX, O_RDWR)) < 0) ||
|
||||
((fd =open(DEV_SPX, O_RDWR)) < 0)) {
|
||||
PRMSG(1,"ISCOpenServer: failed to open %s\n", DEV_SPX, 0,0 );
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( (connect_spipe(fds, fd) < 0) ||
|
||||
(named_spipe(fds, server_path) < 0)) {
|
||||
PRMSG(1,"ISCOpenServer: failed connect pipes\n", 0,0,0 );
|
||||
close(fd);
|
||||
close(fds);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if !defined(UNIXCONN)
|
||||
/*
|
||||
* If the UNIX Domain socket transport is not being used, then link this
|
||||
* device to the path /tmp/.X11-unix/X path.
|
||||
*/
|
||||
#define X_UNIX_DIR "/tmp/.X11-unix"
|
||||
|
||||
if (trans_mkdir(X_UNIX_DIR, mode) == -1) {
|
||||
PRMSG (1, "ISCOpenServer: mkdir(%s) failed, errno = %d\n",
|
||||
X_UNIX_DIR, errno, 0);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
unlink(server_unix_path);
|
||||
|
||||
#ifdef SVR4
|
||||
/* we prefer symbolic links because hard links can't cross file systems */
|
||||
if( symlink(server_path, server_unix_path) < 0 )
|
||||
PRMSG(1,"ISCOpenServer: failed to link %s to %s\n",
|
||||
server_path, server_unix_path, 0 );
|
||||
/*
|
||||
* Don't make this failure fatal since the listener
|
||||
* is already established, and this just for compatability
|
||||
*/
|
||||
#else
|
||||
#ifdef ISC40
|
||||
/* catch SIGSYS on symlink for ISC40 compiled binaries running on ISC30 */
|
||||
signal(SIGSYS,_dummy);
|
||||
#endif
|
||||
if( link(server_path, server_unix_path) < 0 )
|
||||
#ifdef ISC40
|
||||
if( symlink(server_path, server_unix_path) < 0 )
|
||||
#endif
|
||||
PRMSG(1,"ISCOpenServer: failed to link %s to %s\n",
|
||||
server_path, server_unix_path, 0 );
|
||||
/*
|
||||
* Don't make this failure fatal since the listener
|
||||
* is already established, and this just for compatability
|
||||
*/
|
||||
#endif /* SVR4 */
|
||||
#endif /* !UNIXCONN */
|
||||
|
||||
/*
|
||||
* Everything looks good: fill in the XtransConnInfo structure.
|
||||
*/
|
||||
|
||||
if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
|
||||
{
|
||||
PRMSG(1,"ISCOpenServer: failed to fill in addr info\n", 0, 0, 0);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return fd;
|
||||
|
||||
#endif /* !ISCDEVNODENAME */
|
||||
}
|
||||
|
||||
static int
|
||||
TRANS(ISCAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status)
|
||||
|
||||
{
|
||||
struct strrecvfd str;
|
||||
|
||||
PRMSG(2,"ISCAccept(%d)\n", ciptr->fd, 0,0 );
|
||||
|
||||
while (ioctl(ciptr->fd, I_RECVFD, &str) < 0) {
|
||||
if (errno != EAGAIN) {
|
||||
PRMSG(1,"ISCAccept: Can't read fildes", 0,0,0 );
|
||||
*status = TRANS_ACCEPT_MISC_ERROR;
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Everything looks good: fill in the XtransConnInfo structure.
|
||||
*/
|
||||
|
||||
newciptr->addrlen=ciptr->addrlen;
|
||||
if( (newciptr->addr=(char *)xalloc(newciptr->addrlen)) == NULL ) {
|
||||
PRMSG(1,
|
||||
"ISCAccept: failed to allocate memory for peer addr\n",
|
||||
0,0,0);
|
||||
close(str.fd);
|
||||
*status = TRANS_ACCEPT_BAD_MALLOC;
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen);
|
||||
|
||||
newciptr->peeraddrlen=newciptr->addrlen;
|
||||
if( (newciptr->peeraddr=(char *)xalloc(newciptr->peeraddrlen)) == NULL ) {
|
||||
PRMSG(1,
|
||||
"ISCAccept: failed to allocate memory for peer addr\n",
|
||||
0,0,0);
|
||||
xfree(newciptr->addr);
|
||||
close(str.fd);
|
||||
*status = TRANS_ACCEPT_BAD_MALLOC;
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(newciptr->peeraddr,newciptr->addr,newciptr->peeraddrlen);
|
||||
|
||||
*status = 0;
|
||||
|
||||
return(str.fd);
|
||||
}
|
||||
|
||||
#endif /* TRANS_SERVER */
|
||||
#endif /* LOCAL_TRANS_ISC */
|
||||
|
||||
|
||||
#ifdef LOCAL_TRANS_SCO
|
||||
@ -1654,35 +1349,6 @@ TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd, char *port)
|
||||
|
||||
#endif /* LOCAL_TRANS_NAMED */
|
||||
|
||||
#ifdef LOCAL_TRANS_ISC
|
||||
static int
|
||||
TRANS(ISCReopenServer)(XtransConnInfo ciptr, int fd, char *port)
|
||||
|
||||
{
|
||||
#ifdef ISCDEVNODENAME
|
||||
char server_path[64], server_unix_path[64];
|
||||
#endif
|
||||
|
||||
PRMSG(2,"ISCReopenServer(%s)\n", port, 0,0 );
|
||||
|
||||
#if !defined(ISCDEVNODENAME)
|
||||
PRMSG(1,"ISCReopenServer: Protocol is not supported by a ISC connection\n", 0,0,0);
|
||||
return 0;
|
||||
#else
|
||||
(void) sprintf(server_path, ISCDEVNODENAME, port);
|
||||
(void) sprintf(server_unix_path, ISCTMPNODENAME, port);
|
||||
|
||||
if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0)
|
||||
{
|
||||
PRMSG(1, "ISCReopenServer: failed to fill in addr info\n", 0,0,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
#endif /* !ISCDEVNODENAME */
|
||||
}
|
||||
#endif /* LOCAL_TRANS_ISC */
|
||||
|
||||
#ifdef LOCAL_TRANS_SCO
|
||||
static int
|
||||
@ -1962,30 +1628,6 @@ static LOCALtrans2dev LOCALtrans2devtab[] = {
|
||||
#endif /* sun */
|
||||
#endif /* LOCAL_TRANS_NAMED */
|
||||
|
||||
#ifdef LOCAL_TRANS_ISC
|
||||
{"isc",
|
||||
#ifdef TRANS_CLIENT
|
||||
TRANS(ISCOpenClient),
|
||||
#endif /* TRANS_CLIENT */
|
||||
#ifdef TRANS_SERVER
|
||||
TRANS(ISCOpenServer),
|
||||
#endif /* TRANS_SERVER */
|
||||
#ifdef TRANS_CLIENT
|
||||
TRANS(OpenFail),
|
||||
#endif /* TRANS_CLIENT */
|
||||
#ifdef TRANS_SERVER
|
||||
TRANS(OpenFail),
|
||||
#endif /* TRANS_SERVER */
|
||||
#ifdef TRANS_REOPEN
|
||||
TRANS(ISCReopenServer),
|
||||
TRANS(ReopenFail),
|
||||
#endif
|
||||
#ifdef TRANS_SERVER
|
||||
NULL, /* ResetListener */
|
||||
TRANS(ISCAccept)
|
||||
#endif /* TRANS_SERVER */
|
||||
},
|
||||
#endif /* LOCAL_TRANS_ISC */
|
||||
|
||||
#ifdef LOCAL_TRANS_SCO
|
||||
{"sco",
|
||||
@ -2590,7 +2232,7 @@ TRANS(LocalBytesReadable)(XtransConnInfo ciptr, BytesReadable_t *pend )
|
||||
{
|
||||
PRMSG(2,"LocalBytesReadable(%x->%d,%x)\n", ciptr, ciptr->fd, pend);
|
||||
|
||||
#if defined(ISC) || defined(SCO325)
|
||||
#if defined(SCO325)
|
||||
return ioctl(ciptr->fd, I_NREAD, (char *)pend);
|
||||
#else
|
||||
return ioctl(ciptr->fd, FIONREAD, (char *)pend);
|
||||
@ -2700,9 +2342,6 @@ static char * local_aliases[] = {
|
||||
# ifdef sun
|
||||
"pipe", /* compatibility with Solaris Xlib */
|
||||
# endif
|
||||
# ifdef LOCAL_TRANS_ISC
|
||||
"isc",
|
||||
# endif
|
||||
# ifdef LOCAL_TRANS_SCO
|
||||
"sco",
|
||||
# endif
|
||||
@ -2878,47 +2517,6 @@ Xtransport TRANS(PIPEFuncs) = {
|
||||
#endif /* sun */
|
||||
#endif /* LOCAL_TRANS_NAMED */
|
||||
|
||||
#ifdef LOCAL_TRANS_ISC
|
||||
Xtransport TRANS(ISCFuncs) = {
|
||||
/* Local Interface */
|
||||
"isc",
|
||||
TRANS_LOCAL,
|
||||
#ifdef TRANS_CLIENT
|
||||
TRANS(LocalOpenCOTSClient),
|
||||
#endif /* TRANS_CLIENT */
|
||||
#ifdef TRANS_SERVER
|
||||
NULL,
|
||||
TRANS(LocalOpenCOTSServer),
|
||||
#endif /* TRANS_SERVER */
|
||||
#ifdef TRANS_CLIENT
|
||||
TRANS(LocalOpenCLTSClient),
|
||||
#endif /* TRANS_CLIENT */
|
||||
#ifdef TRANS_SERVER
|
||||
TRANS(LocalOpenCLTSServer),
|
||||
#endif /* TRANS_SERVER */
|
||||
#ifdef TRANS_REOPEN
|
||||
TRANS(LocalReopenCOTSServer),
|
||||
TRANS(LocalReopenCLTSServer),
|
||||
#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),
|
||||
TRANS(LocalDisconnect),
|
||||
TRANS(LocalClose),
|
||||
TRANS(LocalCloseForCloning),
|
||||
};
|
||||
#endif /* LOCAL_TRANS_ISC */
|
||||
|
||||
#ifdef LOCAL_TRANS_SCO
|
||||
Xtransport TRANS(SCOFuncs) = {
|
||||
|
@ -1,887 +0,0 @@
|
||||
/* $XFree86: xc/lib/xtrans/Xtransos2.c,v 3.9tsi Exp $ */
|
||||
|
||||
/*
|
||||
* (c) Copyright 1996 by Sebastien Marineau and Holger Veit
|
||||
* <marineau@genie.uottawa.ca>
|
||||
* <Holger.Veit@gmd.de>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* HOLGER VEIT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of Sebastien Marineau or Holger Veit shall not be
|
||||
* used in advertising or otherwise to promote the sale, use or other dealings
|
||||
* in this Software without prior written authorization from Holger Veit or Sebastien Marineau.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Implementation of the OS/2 local pipe transport layer */
|
||||
|
||||
#define INCL_DOSNMPIPES
|
||||
#define INCL_DOSPROCESS
|
||||
#define INCL_DOSERRORS
|
||||
#define INCL_DOSFILEMGR
|
||||
#undef BYTE
|
||||
#undef BOOL
|
||||
#include <os2.h>
|
||||
|
||||
#ifdef XSERV_t
|
||||
extern HEV hPipeSem;
|
||||
BOOL init_server_pipes();
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* Independent Layer
|
||||
*************************************************************************/
|
||||
#ifdef TRANS_CLIENT
|
||||
|
||||
static XtransConnInfo
|
||||
TRANS(Os2OpenClient)(Xtransport *thistrans, char *protocol,
|
||||
char *host, char *port)
|
||||
{
|
||||
APIRET rc;
|
||||
HFILE hfd,hServer;
|
||||
ULONG action,byteWritten,State;
|
||||
char pipename[256],clientname[256];
|
||||
char server_string[256];
|
||||
struct sockaddr *addr_name;
|
||||
unsigned char pipe_len;
|
||||
XtransConnInfo ciptr;
|
||||
static int unique_id=0;
|
||||
int i,namelen,try;
|
||||
|
||||
PRMSG(2,"Os2OpenClient(%s,%s,%s)\n",protocol,host,port);
|
||||
|
||||
/* test, whether the host is really local, i.e. either
|
||||
* "os2" or "local"
|
||||
*/
|
||||
if (strcmp(protocol,"os2") && strcmp(protocol,"local")) {
|
||||
PRMSG (1,
|
||||
"Os2OpenClient: Cannot connect to non-local host %s\n",
|
||||
host, 0, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* make the pipename */
|
||||
|
||||
if (port && *port ) {
|
||||
if( *port == '/' ) { /* A full pathname */
|
||||
(void) sprintf(pipename, "\\PIPE\\X\\%s,", port);
|
||||
} else {
|
||||
(void) sprintf(pipename, "%s%s", "\\PIPE\\X\\xf86.", port);
|
||||
}
|
||||
} else {
|
||||
(void) sprintf(pipename, "\\PIPE\\X\\xfree86"); }
|
||||
|
||||
PRMSG(5, "Os2OpenClient: Creating pipe %s\n",pipename, 0,0 );
|
||||
|
||||
/* make a connection entry */
|
||||
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL ) {
|
||||
PRMSG(1,"Os2OpenClient: calloc(1,%d) failed\n",
|
||||
sizeof(struct _XtransConnInfo),0,0 );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* open the pipe. Try ten times before giving up at 500ms intervals*/
|
||||
try = 0;
|
||||
do {
|
||||
rc = DosOpen(pipename,&hServer, &action, 0,
|
||||
FILE_NORMAL, FILE_OPEN,
|
||||
OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYWRITE,
|
||||
(PEAOP2)NULL);
|
||||
if(rc == 0) break;
|
||||
if (try >=10) {
|
||||
PRMSG(1,"Os2OpenClient: Open server pipe %s failed, rc=%d\n",
|
||||
pipename,rc,0 );
|
||||
PRMSG(1,"\tProbable causes: either the XServer is not running, or has not started properly,\n",
|
||||
0,0,0 );
|
||||
PRMSG(1,"\tor the DISPLAY variable is set incorrectly.\n",
|
||||
0,0,0 );
|
||||
xfree(ciptr);
|
||||
return NULL;
|
||||
}
|
||||
try ++;
|
||||
DosSleep(500);
|
||||
} while (rc != 0);
|
||||
|
||||
/* OK, now we are talking to the server. Generate a unique pipe name and pass it to
|
||||
* the server. Make the pipe and wait for server to connect */
|
||||
|
||||
sprintf(clientname,"\\PIPE\\X\\%d.%d",getpid(),unique_id++);
|
||||
|
||||
rc = DosCreateNPipe (clientname, &hfd,
|
||||
NP_NOINHERIT | NP_ACCESS_DUPLEX,
|
||||
1 | NP_NOWAIT | NP_TYPE_BYTE | NP_READMODE_BYTE,
|
||||
16384, 16384, 0);
|
||||
if (rc != 0){
|
||||
PRMSG(1, "Os2OpenClient: Unable to create pipe %s\n", pipename,0,0 );
|
||||
DosClose(hfd);
|
||||
pipe_len=0;
|
||||
DosWrite(hServer,&pipe_len,1,&byteWritten);
|
||||
DosClose(hServer);
|
||||
xfree(ciptr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* Connect to the pipe. */
|
||||
|
||||
rc = DosConnectNPipe (hfd);
|
||||
if (rc != 0 && rc != ERROR_PIPE_NOT_CONNECTED)
|
||||
{
|
||||
PRMSG(1, "Os2OpenClient: Unable to connect to pipe %s\n", pipename,0,0 );
|
||||
DosClose (hfd);
|
||||
DosClose(hServer);
|
||||
xfree(ciptr);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Now write name to server on hServer */
|
||||
server_string[0]=(char) strlen(clientname)+1;
|
||||
strcpy(&server_string[1],clientname);
|
||||
rc = DosWrite(hServer,server_string,(ULONG)server_string[0]+1,&byteWritten);
|
||||
if(rc != 0){ /* Could not write to server pipe? */
|
||||
PRMSG(1, "Os2OpenClient: Error writing to server pipe, handle=%d, rc=%d, w=%d\n",
|
||||
hServer,rc,byteWritten );
|
||||
DosClose(hServer);
|
||||
DosClose(hfd);
|
||||
xfree(ciptr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
PRMSG (5, "Os2OpenCLient: Wrote pipename %s to server; len %d written %d \n",
|
||||
&server_string[1],server_string[0]+1,byteWritten);
|
||||
|
||||
|
||||
/* The server will respond by opening the pipe. Wait for that for 30 secs */
|
||||
|
||||
i=0;
|
||||
DosSleep(50); /* Give it time to catch up but minimize race condition*/
|
||||
rc = DosConnectNPipe(hfd);
|
||||
while((rc == ERROR_PIPE_NOT_CONNECTED)&&(i++<60)) {
|
||||
DosSleep(500);
|
||||
rc = DosConnectNPipe(hfd);
|
||||
}
|
||||
|
||||
if(rc != 0){ /* Server has not responded! */
|
||||
PRMSG(1, "Os2OpenClient: Timeout on wait for server response, handle=%d, rc=%d\n",hServer,rc,0 );
|
||||
PRMSG(1, "\tProbable cause: the XServer has exited or crashed while the connection was being established\n",0,0,0 );
|
||||
PRMSG(1, "\tor the XServer is too busy to respond.\n",0,0,0 );
|
||||
DosClose(hServer);
|
||||
DosClose(hfd);
|
||||
xfree(ciptr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* OK, the server has connected! Fill-in the info and return */
|
||||
|
||||
DosClose(hServer);
|
||||
|
||||
/* Last check: make sure client is connected! */
|
||||
|
||||
rc = DosQueryNPHState(hfd,&State);
|
||||
if(rc != 0){ /* Client is not connected! */
|
||||
PRMSG(1, "Os2OpenClient: Client pipe does not appear connected. rc=%d, h=%d\n",rc,hfd,0 );
|
||||
PRMSG(1, "\tProbable cause: the XServer has just exited.\n",0,0,0 );
|
||||
DosClose(hfd);
|
||||
xfree(ciptr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
namelen=sizeof(struct sockaddr);
|
||||
if ((ciptr->addr = (char *) xalloc (namelen)) == NULL)
|
||||
{
|
||||
PRMSG (1, "Os2OpenClient: Can't allocate space for the addr\n",
|
||||
0, 0, 0);
|
||||
DosClose(hfd);
|
||||
xfree(ciptr);
|
||||
return(NULL);
|
||||
}
|
||||
ciptr->addrlen = namelen;
|
||||
((struct sockaddr *)ciptr->addr)->sa_family = AF_UNIX;
|
||||
strcpy(((struct sockaddr *)ciptr->addr)->sa_data, "local");
|
||||
|
||||
if ((ciptr->peeraddr = (char *) xalloc (namelen)) == NULL)
|
||||
{
|
||||
PRMSG (1, "Os2OpenCLient: Can't allocate space for the addr\n",
|
||||
0, 0, 0);
|
||||
DosClose(hfd);
|
||||
xfree(ciptr->addr);
|
||||
xfree(ciptr);
|
||||
return(NULL);
|
||||
}
|
||||
ciptr->peeraddrlen = namelen;
|
||||
((struct sockaddr *)ciptr->peeraddr)->sa_family = AF_UNIX;
|
||||
strcpy (((struct sockaddr *)ciptr->peeraddr)->sa_data,"local");
|
||||
|
||||
PRMSG (5, "Os2OpenCLient: Filled in struct: len %d %d name %s\n",
|
||||
ciptr->addrlen,ciptr->peeraddrlen,((struct sockaddr *)ciptr->peeraddr)->sa_data);
|
||||
|
||||
|
||||
ciptr->index=hfd;
|
||||
ciptr->family=AF_UNIX;
|
||||
if((ciptr->fd=_imphandle(hfd))<0){
|
||||
PRMSG(1, "Os2OpenClient: Could not import the pipe handle into EMX\n",0,0,0 );
|
||||
PRMSG(1, "\tProbable cause: EMX has run out of free file handles.\n",0,0,0 );
|
||||
DosClose(hfd);
|
||||
xfree(ciptr->addr);
|
||||
xfree(ciptr->peeraddr);
|
||||
xfree(ciptr);
|
||||
return(NULL);
|
||||
}
|
||||
PRMSG(5, "Os2OpenClient: pipe handle %d EMX handle %d\n",ciptr->index,ciptr->fd,0 );
|
||||
fcntl(ciptr->fd,F_SETFL,O_NDELAY);
|
||||
fcntl(ciptr->fd,F_SETFD,FD_CLOEXEC);
|
||||
return ciptr;
|
||||
}
|
||||
#endif /* TRANS_CLIENT */
|
||||
|
||||
#ifdef TRANS_SERVER
|
||||
static XtransConnInfo
|
||||
TRANS(Os2OpenServer)(Xtransport *thistrans, char *protocol,
|
||||
char *host, char *port)
|
||||
{
|
||||
APIRET rc;
|
||||
HFILE hfd;
|
||||
ULONG action;
|
||||
char pipename[256];
|
||||
struct sockaddr *addr_name;
|
||||
XtransConnInfo ciptr;
|
||||
int namelen;
|
||||
|
||||
#ifdef XSERV_t
|
||||
if (! init_server_pipes()) return(NULL);
|
||||
#endif
|
||||
|
||||
PRMSG(2,"Os2OpenServer(%s,%s,%s)\n",protocol,host,port);
|
||||
|
||||
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
|
||||
{
|
||||
PRMSG(1,"Os2OpenServer: xcalloc(1,%d) failed\n",
|
||||
sizeof(struct _XtransConnInfo),0,0 );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
if (port && *port ) {
|
||||
if( *port == '/' ) { /* A full pathname */
|
||||
(void) sprintf(pipename, "\\PIPE\\X\\%s", port);
|
||||
} else {
|
||||
(void) sprintf(pipename, "%s%s", "\\PIPE\\X\\xf86.", port);
|
||||
}
|
||||
} else {
|
||||
(void) sprintf(pipename, "\\PIPE\\X\\xfree86");
|
||||
}
|
||||
|
||||
PRMSG(5, "Os2OpenServer: Creating pipe %s\n",pipename, 0,0 );
|
||||
|
||||
rc = DosCreateNPipe (pipename, &hfd,
|
||||
NP_NOINHERIT | NP_ACCESS_INBOUND,
|
||||
1 | NP_NOWAIT | NP_TYPE_BYTE | NP_READMODE_BYTE,
|
||||
0, 8192, 0);
|
||||
if (rc != 0){
|
||||
PRMSG(1, "Os2OpenServer: Unable to create pipe %s, rc=%d\n", pipename,rc,0 );
|
||||
PRMSG(1, "\tProbable cause: there is already another XServer running on display :%s\n",port,0,0 );
|
||||
DosClose(hfd);
|
||||
xfree(ciptr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* Connect to the pipe. */
|
||||
|
||||
rc = DosConnectNPipe (hfd);
|
||||
if (rc != 0 && rc != ERROR_PIPE_NOT_CONNECTED)
|
||||
{
|
||||
PRMSG(1, "Os2OpenServer: Unable to connect to pipe %s\n", pipename,0,0 );
|
||||
DosClose (hfd);
|
||||
xfree(ciptr);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Pipe is now connected and waiting for client connect */
|
||||
|
||||
/*** Put in info ***/
|
||||
|
||||
namelen=sizeof(struct sockaddr);
|
||||
if ((ciptr->addr = (char *) xalloc (namelen)) == NULL)
|
||||
{
|
||||
PRMSG (1, "Os2OpenServer: Can't allocate space for the addr\n",
|
||||
0, 0, 0);
|
||||
DosClose(hfd);
|
||||
xfree(ciptr);
|
||||
return(NULL);
|
||||
}
|
||||
ciptr->addrlen = namelen;
|
||||
((struct sockaddr *)ciptr->addr)->sa_family = AF_UNIX;
|
||||
strcpy (((struct sockaddr *)ciptr->addr)->sa_data, "local");
|
||||
|
||||
if ((ciptr->peeraddr = (char *) xalloc (namelen)) == NULL)
|
||||
{
|
||||
PRMSG (1, "Os2OpenServer: Can't allocate space for the addr\n",
|
||||
0, 0, 0);
|
||||
DosClose(hfd);
|
||||
xfree(ciptr->addr);
|
||||
xfree(ciptr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
ciptr->peeraddrlen = namelen;
|
||||
((struct sockaddr *)ciptr->peeraddr)->sa_family = AF_UNIX;
|
||||
strcpy(((struct sockaddr *)ciptr->peeraddr)->sa_data,"local");
|
||||
|
||||
PRMSG (5, "Os2OpenServer: Filled in struct: len %d %d name %s\n",
|
||||
ciptr->addrlen,ciptr->peeraddrlen,((struct sockaddr *)ciptr->peeraddr)->sa_data);
|
||||
|
||||
ciptr->index=hfd; /* Save this for later use in this unused member of struct */
|
||||
ciptr->flags=1; /* Listener */
|
||||
ciptr->family=AF_UNIX;
|
||||
|
||||
if((ciptr->fd=_imphandle(hfd))<0){
|
||||
DosClose(hfd);
|
||||
xfree(ciptr->addr);
|
||||
xfree(ciptr->peeraddr);
|
||||
xfree(ciptr);
|
||||
return(NULL);
|
||||
}
|
||||
PRMSG(5, "Os2OpenServer: Pipe handle %d EMX handle %d",ciptr->index,ciptr->fd,0 );
|
||||
|
||||
#ifdef XSERV_t
|
||||
/* Attach the pipe sem to the pipe. Use handle index as key */
|
||||
rc = DosSetNPipeSem(ciptr->fd, (HSEM)hPipeSem, ciptr->fd);
|
||||
if (rc){
|
||||
PRMSG(1, "Os2OpenCOTSServer: Could not attach sem %d to pipe %d, rc=%d\n",
|
||||
hPipeSem,ciptr->fd,rc);
|
||||
DosClose(ciptr->fd);
|
||||
xfree(ciptr->addr);
|
||||
xfree(ciptr->peeraddr);
|
||||
xfree(ciptr);
|
||||
return(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
fcntl(ciptr->fd,F_SETFL,O_NDELAY);
|
||||
fcntl(ciptr->fd,F_SETFD,FD_CLOEXEC);
|
||||
return(ciptr);
|
||||
}
|
||||
#endif /* TRANS_SERVER */
|
||||
|
||||
#ifdef TRANS_CLIENT
|
||||
static XtransConnInfo
|
||||
TRANS(Os2OpenCLTSClient)(Xtransport *thistrans, char *protocol,
|
||||
char *host, char *port)
|
||||
{
|
||||
PRMSG(2,"Os2OpenCLTSClient(%s,%s,%s)\n",protocol,host,port);
|
||||
return TRANS(Os2OpenClient)(thistrans, protocol, host, port);
|
||||
}
|
||||
#endif /* TRANS_CLIENT */
|
||||
|
||||
#ifdef TRANS_CLIENT
|
||||
static XtransConnInfo
|
||||
TRANS(Os2OpenCOTSClient)(Xtransport *thistrans, char *protocol,
|
||||
char *host, char *port)
|
||||
{
|
||||
PRMSG(2,"Os2OpenCOTSClient(%s,%s,%s)\n",protocol,host,port);
|
||||
return TRANS(Os2OpenClient)(thistrans, protocol, host, port);
|
||||
}
|
||||
#endif /* TRANS_CLIENT */
|
||||
|
||||
|
||||
#ifdef TRANS_SERVER
|
||||
static XtransConnInfo
|
||||
TRANS(Os2OpenCLTSServer)(Xtransport *thistrans, char *protocol,
|
||||
char *host, char *port)
|
||||
{
|
||||
PRMSG(2,"Os2OpenCLTSServer(%s,%s,%s)\n",protocol,host,port);
|
||||
return TRANS(Os2OpenServer)(thistrans, protocol, host, port);
|
||||
}
|
||||
#endif /* TRANS_SERVER */
|
||||
|
||||
|
||||
#ifdef TRANS_SERVER
|
||||
static XtransConnInfo
|
||||
TRANS(Os2OpenCOTSServer)(Xtransport *thistrans, char *protocol,
|
||||
char *host, char *port)
|
||||
{
|
||||
PRMSG(2,"Os2OpenCOTSServer(%s,%s,%s)\n",protocol,host,port);
|
||||
return TRANS(Os2OpenServer)(thistrans, protocol, host, port);
|
||||
}
|
||||
#endif /* TRANS_SERVER */
|
||||
|
||||
|
||||
#ifdef TRANS_REOPEN
|
||||
static XtransConnInfo
|
||||
TRANS(Os2ReopenCOTSServer)(Xtransport *thistrans, int fd, char *port)
|
||||
{
|
||||
|
||||
XtransConnInfo ciptr;
|
||||
char addr_name[256];
|
||||
int namelen;
|
||||
|
||||
PRMSG(2,"Os2ReopenCOTSServer(%d,%s)\n", fd, port, 0);
|
||||
|
||||
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
|
||||
{
|
||||
PRMSG(1,"Os2ReopenCOTSServer: xcalloc(1,%d) failed\n",
|
||||
sizeof(struct _XtransConnInfo),0,0 );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strcpy(addr_name,"local");
|
||||
namelen=sizeof(addr_name);
|
||||
if ((ciptr->addr = (char *) xalloc (namelen)) == NULL)
|
||||
{
|
||||
PRMSG (1, "Os2ReopenCOTSServer: Can't allocate space for the addr\n",
|
||||
0, 0, 0);
|
||||
xfree(ciptr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
ciptr->addrlen = namelen;
|
||||
memcpy (ciptr->addr, addr_name, ciptr->addrlen);
|
||||
if ((ciptr->peeraddr = (char *) xalloc (namelen)) == NULL)
|
||||
{
|
||||
PRMSG (1, "Os2ReopenCOTSServer: Can't allocate space for the addr\n",
|
||||
0, 0, 0);
|
||||
xfree(ciptr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
ciptr->peeraddrlen = namelen;
|
||||
memcpy (ciptr->peeraddr,addr_name, ciptr->addrlen);
|
||||
|
||||
ciptr->fd = fd;
|
||||
ciptr->family=AF_UNIX;
|
||||
ciptr->flags=1;
|
||||
PRMSG(1,"Os2ReopenCOTSServer: Filled-in info for handle %d on port %s.\n", fd, port, 0);
|
||||
|
||||
return(ciptr);
|
||||
}
|
||||
|
||||
static XtransConnInfo
|
||||
TRANS(Os2ReopenCLTSServer)(Xtransport *thistrans, int fd, char *port)
|
||||
{
|
||||
PRMSG(2,"Os2ReopenCLTSServer(%d,%s)\n", fd, port, 0);
|
||||
return TRANS(Os2ReopenCOTSServer)(thistrans, fd, port);
|
||||
}
|
||||
#endif
|
||||
|
||||
static
|
||||
TRANS(Os2SetOption)(XtransConnInfo ciptr, int option, int arg)
|
||||
{
|
||||
PRMSG(2,"Os2SetOption(%d,%d,%d)\n",ciptr->fd,option,arg);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef TRANS_SERVER
|
||||
|
||||
static
|
||||
TRANS(Os2CreateListener)(XtransConnInfo ciptr, char *port, unsigned int flags)
|
||||
{
|
||||
PRMSG(2,"Os2CreateListener(%x->%d,%s)\n",ciptr,ciptr->fd,port);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static XtransConnInfo
|
||||
TRANS(Os2Accept)(XtransConnInfo ciptr, int *status)
|
||||
{
|
||||
XtransConnInfo newciptr;
|
||||
HFILE hClient;
|
||||
unsigned char length;
|
||||
ULONG action;
|
||||
char clientname[256];
|
||||
struct sockaddr *addr_name;
|
||||
int in,namelen;
|
||||
APIRET rc;
|
||||
|
||||
|
||||
PRMSG(2,"Os2Accept(%x->%d)\n", ciptr, ciptr->fd,0);
|
||||
if( (newciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo)))==NULL )
|
||||
{
|
||||
PRMSG(1,"Os2Accept: xcalloc(1,%d) failed\n",
|
||||
sizeof(struct _XtransConnInfo),0,0 );
|
||||
*status = TRANS_ACCEPT_BAD_MALLOC;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Read in length of client pipe name. If fails, then reset server pipe */
|
||||
if((in=read(ciptr->fd,&length,1))<=0){
|
||||
PRMSG(2,"Os2Accept: Error reading incoming connection, in=%d, error=%d\n",
|
||||
in,errno,0 );
|
||||
*status = TRANS_ACCEPT_MISC_ERROR;
|
||||
xfree(newciptr);
|
||||
rc = DosDisConnectNPipe(ciptr->fd);
|
||||
rc = DosConnectNPipe (ciptr->fd);
|
||||
if (rc != 0 && rc != ERROR_PIPE_NOT_CONNECTED)
|
||||
{
|
||||
PRMSG(1, "Os2Accept: Unable to reconnect server pipe %d\n", ciptr->fd,0,0 );
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
PRMSG(5, "Os2Accept: Bytes to read for name: %d\n",length,0,0 );
|
||||
|
||||
|
||||
/* Check length for valid length ?? */
|
||||
|
||||
/* Now read in length bytes from pipe for client pipe name */
|
||||
if((in=read(ciptr->fd,clientname,length))<=0){
|
||||
PRMSG(2,"Os2Accept: Error reading incoming connection, in=%d, error=%d\n",
|
||||
in,errno,0 );
|
||||
*status = TRANS_ACCEPT_MISC_ERROR;
|
||||
xfree(newciptr);
|
||||
rc = DosDisConnectNPipe(ciptr->fd);
|
||||
rc = DosConnectNPipe (ciptr->fd);
|
||||
if (rc != 0 && rc != ERROR_PIPE_NOT_CONNECTED)
|
||||
{
|
||||
PRMSG(1, "Os2Accept: Unable to reconnect server pipe %d\n", ciptr->fd,0,0 );
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
clientname[length]='\0';
|
||||
PRMSG(5, "Os2Accept: Server name %s length %d\n",clientname,length,0 );
|
||||
|
||||
|
||||
/* Now we have the client pipe name. Open it with DosOpen */
|
||||
|
||||
rc = DosOpen(clientname,&hClient, &action, 0,
|
||||
FILE_NORMAL, FILE_OPEN,
|
||||
OPEN_FLAGS_NOINHERIT | OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYREADWRITE,
|
||||
(PEAOP2)NULL);
|
||||
|
||||
PRMSG(5, "Os2Accept: Open pipe %s, handle = %d, rc=%d\n",clientname,hClient,rc );
|
||||
|
||||
if (rc) {
|
||||
PRMSG(1,"Os2Accept: Open pipe %s to client failed, rc=%d\n",
|
||||
clientname,rc,0 );
|
||||
PRMSG(1, "\tProbable cause: the client has exited or timed-out.\n",0,0,0 );
|
||||
xfree(newciptr);
|
||||
rc = DosDisConnectNPipe(ciptr->fd);
|
||||
rc = DosConnectNPipe (ciptr->fd);
|
||||
if (rc != 0 && rc != ERROR_PIPE_NOT_CONNECTED)
|
||||
{
|
||||
PRMSG(1, "Os2Accept: Unable to reconnect server pipe %d\n", ciptr->fd,0,0 );
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc = DosSetNPHState (hClient, NP_NOWAIT | NP_READMODE_BYTE);
|
||||
if (rc != 0)
|
||||
{
|
||||
PRMSG(1,"Os2Accept: Could not set pipe %s to non-blocking mode, rc=%d\n",
|
||||
hClient,rc,0 );
|
||||
xfree(newciptr);
|
||||
rc = DosDisConnectNPipe(ciptr->fd);
|
||||
rc = DosConnectNPipe (ciptr->fd);
|
||||
if (rc != 0 && rc != ERROR_PIPE_NOT_CONNECTED)
|
||||
{
|
||||
PRMSG(1, "Os2Accept: Unable to reconnect server pipe %d\n", ciptr->fd,0,0 );
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* OK, we seem to be well connected to client. Now disconnect server pipe and put again in listen */
|
||||
|
||||
rc = DosDisConnectNPipe(ciptr->fd);
|
||||
rc = DosConnectNPipe (ciptr->fd);
|
||||
PRMSG(5, "Os2Accept: Reconnecting server pipe %d, rc = %d\n",ciptr->fd,rc,0 );
|
||||
|
||||
if (rc != 0 && rc != ERROR_PIPE_NOT_CONNECTED)
|
||||
{
|
||||
PRMSG(1, "Os2Accept: Unable to reconnect server pipe %d\n", ciptr->fd,0,0 );
|
||||
} /* Consider this non-fatal for present connection */
|
||||
|
||||
/* And finally fill-in info in newciptr */
|
||||
|
||||
namelen=sizeof(struct sockaddr);
|
||||
if ((newciptr->addr = (char *) xalloc (namelen)) == NULL)
|
||||
{
|
||||
PRMSG (1, "Os2Accept: Can't allocate space for the addr\n",
|
||||
0, 0, 0);
|
||||
DosClose(hClient);
|
||||
xfree(newciptr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
newciptr->addrlen = namelen;
|
||||
((struct sockaddr *)newciptr->addr)->sa_family = AF_UNIX;
|
||||
strcpy (((struct sockaddr *)newciptr->addr)->sa_data, "local");
|
||||
|
||||
if ((newciptr->peeraddr = (char *) xalloc (namelen)) == NULL)
|
||||
{
|
||||
PRMSG (1, "Os2Accept: Can't allocate space for the addr\n",
|
||||
0, 0, 0);
|
||||
DosClose(hClient);
|
||||
xfree(ciptr->addr);
|
||||
xfree(newciptr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
newciptr->peeraddrlen = namelen;
|
||||
((struct sockaddr *)newciptr->peeraddr)->sa_family = AF_UNIX;
|
||||
strcpy (((struct sockaddr *)newciptr->peeraddr)->sa_data, "local");
|
||||
|
||||
PRMSG (5, "Os2Accept: Filled in struct: len %d %d name %s\n",
|
||||
newciptr->addrlen,newciptr->peeraddrlen,newciptr->peeraddr);
|
||||
|
||||
|
||||
newciptr->index=hClient;
|
||||
newciptr->family=AF_UNIX;
|
||||
if((newciptr->fd=_imphandle(hClient))<0){
|
||||
PRMSG(1,"Os2Accept: Could not import pipe %d into EMX, errno=%d\n",
|
||||
hClient,errno,0 );
|
||||
PRMSG(1, "\tProbable cause: EMX has run out of file handles.\n",0,0,0 );
|
||||
DosClose(hClient);
|
||||
xfree(newciptr->addr);
|
||||
xfree(newciptr->peeraddr);
|
||||
xfree(newciptr);
|
||||
return(NULL);
|
||||
}
|
||||
PRMSG(5, "Os2Accept: Pipe handle %d EMX handle %d",newciptr->index,newciptr->fd,0 );
|
||||
|
||||
#ifdef XSERV_t
|
||||
/* Attach the pipe sem to the pipe. Use handle index as key */
|
||||
rc = DosSetNPipeSem(newciptr->fd, (HSEM)hPipeSem, newciptr->fd);
|
||||
if (rc){
|
||||
PRMSG(1, "Os2OpenCOTSServer: Could not attach sem %d to pipe %d, rc=%d\n",
|
||||
hPipeSem,newciptr->fd,rc);
|
||||
DosClose(newciptr->fd);
|
||||
xfree(newciptr->addr);
|
||||
xfree(newciptr->peeraddr);
|
||||
xfree(newciptr);
|
||||
return(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
fcntl(ciptr->fd,F_SETFL,O_NDELAY);
|
||||
fcntl(ciptr->fd,F_SETFD,FD_CLOEXEC);
|
||||
*status=0;
|
||||
return newciptr;
|
||||
}
|
||||
|
||||
#endif /* TRANS_SERVER */
|
||||
|
||||
#ifdef TRANS_CLIENT
|
||||
|
||||
static
|
||||
TRANS(Os2Connect)(XtransConnInfo ciptr, char *host, char *port)
|
||||
{
|
||||
PRMSG(2,"Os2Connect(%x->%d,%s)\n", ciptr, ciptr->fd, port);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* TRANS_CLIENT */
|
||||
|
||||
static int
|
||||
TRANS(Os2BytesReadable)(XtransConnInfo ciptr, BytesReadable_t *pend )
|
||||
{
|
||||
ULONG rc, state, nread;
|
||||
AVAILDATA avail;
|
||||
char buffer;
|
||||
|
||||
PRMSG(2,"Os2BytesReadable(%x->%d,%x)\n", ciptr, ciptr->fd, pend);
|
||||
|
||||
rc = DosPeekNPipe (ciptr->fd, &buffer, 0, &nread, &avail, &state);
|
||||
if (rc != 0)
|
||||
{
|
||||
errno = EPIPE;
|
||||
*pend = 0;
|
||||
return -1;
|
||||
}
|
||||
if (state == NP_STATE_CLOSING)
|
||||
{
|
||||
errno = EPIPE;
|
||||
*pend = 0;
|
||||
return -1;
|
||||
}
|
||||
errno = 0;
|
||||
*pend = avail.cbpipe;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
TRANS(Os2Read)(XtransConnInfo ciptr, char *buf, int size)
|
||||
{
|
||||
int ret;
|
||||
APIRET rc;
|
||||
ULONG ulRead;
|
||||
PRMSG(2,"Os2Read(%d,%x,%d)\n", ciptr->fd, buf, size );
|
||||
errno = 0;
|
||||
rc = DosRead(ciptr->fd, buf, size, &ulRead);
|
||||
if (rc == 0){
|
||||
ret = ulRead;
|
||||
}
|
||||
else if ((rc == 232) || (rc == 231)){
|
||||
errno = EAGAIN;
|
||||
ret = -1;
|
||||
}
|
||||
else if (rc == 6){
|
||||
errno = EBADF;
|
||||
ret = -1;
|
||||
}
|
||||
else if ((rc == 109) || (rc == 230) || (rc == 233)){
|
||||
errno = EPIPE;
|
||||
ret = -1;
|
||||
}
|
||||
else {
|
||||
PRMSG(2,"Os2Read: Unknown return code from DosRead, fd %d rc=%d\n", ciptr->fd,rc,0 );
|
||||
errno = EINVAL;
|
||||
ret = -1;
|
||||
}
|
||||
return (ret);
|
||||
}
|
||||
|
||||
static int
|
||||
TRANS(Os2Write)(XtransConnInfo ciptr, char *buf, int size)
|
||||
{
|
||||
int ret;
|
||||
APIRET rc;
|
||||
ULONG nWritten;
|
||||
PRMSG(2,"Os2Write(%d,%x,%d)\n", ciptr->fd, buf, size );
|
||||
rc = DosWrite(ciptr->fd, buf, size, &nWritten);
|
||||
if (rc == 0){
|
||||
ret = nWritten;
|
||||
if(nWritten == 0) {
|
||||
errno=EAGAIN;
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
else if ((rc == 39) || (rc == 112)){
|
||||
errno = EAGAIN;
|
||||
ret = -1;
|
||||
}
|
||||
else if ((rc == 109) || (rc == 230) || (rc == 233)){
|
||||
errno = EPIPE;
|
||||
ret = -1;
|
||||
}
|
||||
else if (rc == 6){
|
||||
errno=EBADF;
|
||||
ret = -1;
|
||||
}
|
||||
else {
|
||||
PRMSG(2,"(Os2Write)Unknown return code from DosWrite, fd %d rc=%d\n", ciptr->fd,rc,0 );
|
||||
errno = EINVAL;
|
||||
ret = -1;
|
||||
}
|
||||
return (ret);
|
||||
}
|
||||
|
||||
static int
|
||||
TRANS(Os2Readv)(XtransConnInfo ciptr, struct iovec *buf, int size)
|
||||
{
|
||||
int ret;
|
||||
PRMSG(2,"Os2Readv(%d,%x,%d)\n", ciptr->fd, buf, size );
|
||||
ret = READV(ciptr,buf,size);
|
||||
if ((ret <0) && (errno == EINVAL)) errno = EPIPE;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
static int
|
||||
TRANS(Os2Writev)(XtransConnInfo ciptr, struct iovec *buf, int size)
|
||||
{
|
||||
int ret;
|
||||
PRMSG(2,"Os2Writev(%d,%x,%d)\n", ciptr->fd, buf, size );
|
||||
ret = WRITEV(ciptr,buf,size);
|
||||
if ((ret <0) && (errno == EINVAL)) errno = EPIPE;
|
||||
if ((ret <0) && (errno == ENOSPC)) errno = EAGAIN;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
static int
|
||||
TRANS(Os2Disconnect)(XtransConnInfo ciptr)
|
||||
{
|
||||
PRMSG(2,"Os2Disconnect(%x->%d)\n", ciptr, ciptr->fd, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
TRANS(Os2Close)(XtransConnInfo ciptr)
|
||||
{
|
||||
int ret;
|
||||
PRMSG(2,"Os2Close(%x->%d)\n", ciptr, ciptr->fd ,0);
|
||||
ret=close(ciptr->fd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
TRANS(Os2CloseForCloning)(XtransConnInfo ciptr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
PRMSG(2,"Os2CloseForCloning(%x->%d)\n", ciptr, ciptr->fd ,0);
|
||||
ret=close(ciptr->fd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Xtransport TRANS(OS2LocalFuncs) = {
|
||||
/* Local Interface */
|
||||
"local",
|
||||
TRANS_LOCAL,
|
||||
#ifdef TRANS_CLIENT
|
||||
TRANS(Os2OpenCOTSClient),
|
||||
#endif /* TRANS_CLIENT */
|
||||
#ifdef TRANS_SERVER
|
||||
NULL,
|
||||
TRANS(Os2OpenCOTSServer),
|
||||
#endif /* TRANS_SERVER */
|
||||
#ifdef TRANS_CLIENT
|
||||
TRANS(Os2OpenCLTSClient),
|
||||
#endif /* TRANS_CLIENT */
|
||||
#ifdef TRANS_SERVER
|
||||
TRANS(Os2OpenCLTSServer),
|
||||
#endif /* TRANS_SERVER */
|
||||
#ifdef TRANS_REOPEN
|
||||
TRANS(Os2ReopenCOTSServer),
|
||||
TRANS(Os2ReopenCLTSServer),
|
||||
#endif
|
||||
TRANS(Os2SetOption),
|
||||
#ifdef TRANS_SERVER
|
||||
TRANS(Os2CreateListener),
|
||||
NULL, /* ResetListener */
|
||||
TRANS(Os2Accept),
|
||||
#endif /* TRANS_SERVER */
|
||||
#ifdef TRANS_CLIENT
|
||||
TRANS(Os2Connect),
|
||||
#endif /* TRANS_CLIENT */
|
||||
TRANS(Os2BytesReadable),
|
||||
TRANS(Os2Read),
|
||||
TRANS(Os2Write),
|
||||
TRANS(Os2Readv),
|
||||
TRANS(Os2Writev),
|
||||
TRANS(Os2Disconnect),
|
||||
TRANS(Os2Close),
|
||||
TRANS(Os2CloseForCloning),
|
||||
};
|
||||
|
||||
#ifdef XSERV_t
|
||||
/* This function is used in the server to initialize the semaphore used with pipes */
|
||||
|
||||
BOOL init_server_pipes()
|
||||
{
|
||||
static BOOL first_time=TRUE;
|
||||
ULONG rc;
|
||||
|
||||
if(first_time){
|
||||
rc = DosCreateEventSem(NULL, &hPipeSem,DC_SEM_SHARED,FALSE);
|
||||
if (rc){
|
||||
PRMSG(1,"Os2OpenListener (init_server_pipes): Could not create pipe semaphore, rc=%d\n",
|
||||
rc,0,0);
|
||||
return(FALSE);
|
||||
}
|
||||
first_time=FALSE;
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
#endif /* XSERV_t */
|
@ -69,21 +69,14 @@ from the copyright holders.
|
||||
|
||||
#ifdef UNIXCONN
|
||||
#ifndef X_NO_SYS_UN
|
||||
#ifndef Lynx
|
||||
#include <sys/un.h>
|
||||
#else
|
||||
#include <un.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#if defined(hpux) || (defined(MOTOROLA) && defined(SYSV))
|
||||
#define NO_TCP_H
|
||||
#endif
|
||||
|
||||
#ifndef NO_TCP_H
|
||||
#if defined(__osf__) || defined(linux) || defined(__GLIBC__) || defined(AIXV5)
|
||||
#if defined(linux) || defined(__GLIBC__)
|
||||
#include <sys/param.h>
|
||||
#endif /* osf */
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
@ -94,7 +87,7 @@ from the copyright holders.
|
||||
#endif /* !NO_TCP_H */
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#if defined(SVR4) && !defined(DGUX) && !defined(_SEQUENT_)
|
||||
#if defined(SVR4)
|
||||
#include <sys/filio.h>
|
||||
#endif
|
||||
|
||||
@ -102,10 +95,12 @@ from the copyright holders.
|
||||
#include <net/errno.h>
|
||||
#endif
|
||||
|
||||
#if (defined(__i386__) && defined(SYSV)) && (!defined(ISC) || !defined(I_NREAD) || defined(SCO325)) || defined(_SEQUENT_)
|
||||
#if defined(__i386__) && defined(SYSV)
|
||||
#include <sys/stropts.h>
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#else /* !WIN32 */
|
||||
|
||||
#include <X11/Xwinsock.h>
|
||||
@ -130,33 +125,8 @@ from the copyright holders.
|
||||
#undef SO_DONTLINGER
|
||||
#endif
|
||||
|
||||
#if defined(__UNIXOS2__)
|
||||
#if defined(NOT_EMX09A)
|
||||
static int IBMsockInit = 0;
|
||||
#define SocketInitOnce()\
|
||||
if (!IBMsockInit) {\
|
||||
sock_init();\
|
||||
IBMsockInit = 1;\
|
||||
}
|
||||
#undef EINTR
|
||||
#define EINTR SOCEINTR
|
||||
#undef EINVAL
|
||||
#define EINVAL SOCEINVAL
|
||||
#undef errno
|
||||
#define errno sock_errno()
|
||||
#undef close
|
||||
#define close soclose
|
||||
#undef ioctl
|
||||
#define ioctl sockioctl
|
||||
#else
|
||||
#define SocketInitOnce() /**/
|
||||
#endif
|
||||
/* this is still not there */
|
||||
#define SOCKET int
|
||||
#else
|
||||
/* others don't need this */
|
||||
#define SocketInitOnce() /**/
|
||||
#endif
|
||||
|
||||
#ifdef linux
|
||||
#define HAVE_ABSTRACT_SOCKETS
|
||||
@ -215,36 +185,6 @@ static int TRANS(SocketINETClose) (XtransConnInfo ciptr);
|
||||
|
||||
#ifdef UNIXCONN
|
||||
|
||||
#ifdef hpux
|
||||
|
||||
#if defined(X11_t)
|
||||
#define UNIX_PATH "/usr/spool/sockets/X11/"
|
||||
#define UNIX_DIR "/usr/spool/sockets/X11"
|
||||
#define OLD_UNIX_PATH "/tmp/.X11-unix/X"
|
||||
#endif /* X11_t */
|
||||
#if defined(XIM_t)
|
||||
#define UNIX_PATH "/usr/spool/sockets/XIM/"
|
||||
#define UNIX_DIR "/usr/spool/sockets/XIM"
|
||||
#define OLD_UNIX_PATH "/tmp/.XIM-unix/XIM"
|
||||
#endif /* XIM_t */
|
||||
#if defined(FS_t) || defined(FONT_t)
|
||||
#define UNIX_PATH "/usr/spool/sockets/fontserv/"
|
||||
#define UNIX_DIR "/usr/spool/sockets/fontserv"
|
||||
#endif /* FS_t || FONT_t */
|
||||
#if defined(ICE_t)
|
||||
#define UNIX_PATH "/usr/spool/sockets/ICE/"
|
||||
#define UNIX_DIR "/usr/spool/sockets/ICE"
|
||||
#endif /* ICE_t */
|
||||
#if defined(TEST_t)
|
||||
#define UNIX_PATH "/usr/spool/sockets/xtrans_test/"
|
||||
#define UNIX_DIR "/usr/spool/sockets/xtrans_test"
|
||||
#endif
|
||||
#if defined(LBXPROXY_t)
|
||||
#define UNIX_PATH "/usr/spool/sockets/X11/"
|
||||
#define UNIX_DIR "/usr/spool/sockets/X11"
|
||||
#endif
|
||||
|
||||
#else /* !hpux */
|
||||
|
||||
#if defined(X11_t)
|
||||
#define UNIX_PATH "/tmp/.X11-unix/X"
|
||||
@ -271,7 +211,6 @@ static int TRANS(SocketINETClose) (XtransConnInfo ciptr);
|
||||
#define UNIX_DIR "/tmp/.X11-unix"
|
||||
#endif
|
||||
|
||||
#endif /* hpux */
|
||||
|
||||
#endif /* UNIXCONN */
|
||||
|
||||
@ -481,7 +420,7 @@ TRANS(SocketOpen) (int i, int type)
|
||||
Sockettrans2devtab[i].protocol)) < 0
|
||||
#ifndef WIN32
|
||||
#if (defined(X11_t) && !defined(USE_POLL)) || defined(FS_t) || defined(FONT_t)
|
||||
|| ciptr->fd >= TRANS_OPEN_MAX
|
||||
|| ciptr->fd >= sysconf(_SC_OPEN_MAX)
|
||||
#endif
|
||||
#endif
|
||||
) {
|
||||
@ -560,10 +499,10 @@ TRANS(SocketReopen) (int i, int type, int fd, char *port)
|
||||
PRMSG (1, "SocketReopen: malloc(addr) failed\n", 0, 0, 0);
|
||||
return NULL;
|
||||
}
|
||||
ciptr->addr = addr;
|
||||
ciptr->addr = (char *) addr;
|
||||
ciptr->addrlen = portlen + 2;
|
||||
|
||||
if ((ciptr->peeraddr = (struct sockaddr *) xcalloc (1, portlen + 2)) == NULL) {
|
||||
if ((ciptr->peeraddr = (char *) xcalloc (1, portlen + 2)) == NULL) {
|
||||
PRMSG (1, "SocketReopen: malloc(portaddr) failed\n", 0, 0, 0);
|
||||
return NULL;
|
||||
}
|
||||
@ -1142,7 +1081,7 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
|
||||
#else
|
||||
mode = 0777;
|
||||
#endif
|
||||
if (trans_mkdir(UNIX_DIR, mode) == -1) {
|
||||
if (!abstract && trans_mkdir(UNIX_DIR, mode) == -1) {
|
||||
PRMSG (1, "SocketUNIXCreateListener: mkdir(%s) failed, errno = %d\n",
|
||||
UNIX_DIR, errno, 0);
|
||||
(void) umask (oldUmask);
|
||||
@ -1162,7 +1101,7 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
|
||||
return TRANS_CREATE_LISTENER_FAILED;
|
||||
}
|
||||
|
||||
#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__)) && !defined(Lynx)
|
||||
#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__))
|
||||
sockname.sun_len = strlen(sockname.sun_path);
|
||||
#endif
|
||||
|
||||
@ -1716,25 +1655,11 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
|
||||
return TRANS_CONNECT_FAILED;
|
||||
}
|
||||
|
||||
#if defined(CRAY) && defined(OLDTCP)
|
||||
/* Only Cray UNICOS3 and UNICOS4 will define this */
|
||||
{
|
||||
long t;
|
||||
memcpy ((char *)&t, (char *) hostp->h_addr, sizeof (t));
|
||||
sockname.sin_addr = t;
|
||||
}
|
||||
#else
|
||||
memcpy ((char *) &sockname.sin_addr, (char *) hostp->h_addr,
|
||||
sizeof (sockname.sin_addr));
|
||||
#endif /* CRAY and OLDTCP */
|
||||
|
||||
} else {
|
||||
#if defined(CRAY) && defined(OLDTCP)
|
||||
/* Only Cray UNICOS3 and UNICOS4 will define this */
|
||||
sockname.sin_addr = tmpaddr;
|
||||
#else
|
||||
sockname.sin_addr.s_addr = tmpaddr;
|
||||
#endif /* CRAY and OLDTCP */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2018,10 +1943,6 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
|
||||
struct sockaddr_un sockname;
|
||||
SOCKLEN_T namelen;
|
||||
|
||||
#if defined(hpux) && defined(X11_t)
|
||||
struct sockaddr_un old_sockname;
|
||||
SOCKLEN_T old_namelen;
|
||||
#endif
|
||||
|
||||
int abstract = 0;
|
||||
#ifdef HAVE_ABSTRACT_SOCKETS
|
||||
@ -2069,7 +1990,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
|
||||
return TRANS_CONNECT_FAILED;
|
||||
}
|
||||
|
||||
#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__)) && !defined(Lynx)
|
||||
#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__))
|
||||
sockname.sun_len = strlen (sockname.sun_path);
|
||||
#endif
|
||||
|
||||
@ -2080,18 +2001,6 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(hpux) && defined(X11_t)
|
||||
/*
|
||||
* This is gross, but it was in Xlib
|
||||
*/
|
||||
old_sockname.sun_family = AF_UNIX;
|
||||
if (set_sun_path(port, OLD_UNIX_PATH, old_sockname.sun_path, abstract) != 0) {
|
||||
PRMSG (1, "SocketUNIXConnect: path too long\n", 0, 0, 0);
|
||||
return TRANS_CONNECT_FAILED;
|
||||
}
|
||||
old_namelen = strlen (old_sockname.sun_path) +
|
||||
offsetof(struct sockaddr_un, sun_path);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Adjust the socket path if using abstract sockets.
|
||||
@ -2100,9 +2009,6 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
|
||||
|
||||
if (abstract) {
|
||||
sockname.sun_path[0] = '\0';
|
||||
#if defined(hpux) && defined(X11_t)
|
||||
old_sockname.sun_path[0] = '\0';
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2114,18 +2020,6 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
|
||||
int olderrno = errno;
|
||||
int connected = 0;
|
||||
|
||||
#if defined(hpux) && defined(X11_t)
|
||||
if (olderrno == ENOENT)
|
||||
{
|
||||
if (connect (ciptr->fd,
|
||||
(struct sockaddr *) &old_sockname, old_namelen) >= 0)
|
||||
{
|
||||
connected = 1;
|
||||
}
|
||||
else
|
||||
olderrno = errno;
|
||||
}
|
||||
#endif
|
||||
if (!connected)
|
||||
{
|
||||
errno = olderrno;
|
||||
@ -2150,7 +2044,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
|
||||
return TRANS_IN_PROGRESS;
|
||||
else if (olderrno == EINTR)
|
||||
return TRANS_TRY_CONNECT_AGAIN;
|
||||
else if (olderrno == ENOENT) {
|
||||
else if (olderrno == ENOENT || olderrno == ECONNREFUSED) {
|
||||
/* If opening as abstract socket failed, try again normally */
|
||||
if (abstract) {
|
||||
ciptr->transptr->flags &= ~(TRANS_ABSTRACT);
|
||||
@ -2204,9 +2098,6 @@ TRANS(SocketBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend)
|
||||
{
|
||||
PRMSG (2,"SocketBytesReadable(%p,%d,%p)\n",
|
||||
ciptr, ciptr->fd, pend);
|
||||
#if defined(QNX4)
|
||||
*pend = 0L; /* FIONREAD only returns a short. Zero out upper bits */
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
{
|
||||
int ret = ioctlsocket ((SOCKET) ciptr->fd, FIONREAD, (u_long *) pend);
|
||||
@ -2214,14 +2105,10 @@ TRANS(SocketBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend)
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
#if (defined(__i386__) && defined(SYSV) && !defined(SCO325)) || (defined(_SEQUENT_) && _SOCKET_VERSION == 1)
|
||||
#if defined(__i386__) && defined(SYSV) && !defined(SCO325)
|
||||
return ioctl (ciptr->fd, I_NREAD, (char *) pend);
|
||||
#else
|
||||
#if defined(__UNIXOS2__)
|
||||
return ioctl (ciptr->fd, FIONREAD, (char*) pend, sizeof(int));
|
||||
#else
|
||||
return ioctl (ciptr->fd, FIONREAD, (char *) pend);
|
||||
#endif /* __UNIXOS2__ */
|
||||
#endif /* __i386__ && SYSV || _SEQUENT_ && _SOCKET_VERSION == 1 */
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
@ -2233,7 +2120,7 @@ TRANS(SocketRead) (XtransConnInfo ciptr, char *buf, int size)
|
||||
{
|
||||
PRMSG (2,"SocketRead(%d,%p,%d)\n", ciptr->fd, buf, size);
|
||||
|
||||
#if defined(WIN32) || defined(__UNIXOS2__)
|
||||
#if defined(WIN32)
|
||||
{
|
||||
int ret = recv ((SOCKET)ciptr->fd, buf, size, 0);
|
||||
#ifdef WIN32
|
||||
@ -2253,7 +2140,7 @@ TRANS(SocketWrite) (XtransConnInfo ciptr, char *buf, int size)
|
||||
{
|
||||
PRMSG (2,"SocketWrite(%d,%p,%d)\n", ciptr->fd, buf, size);
|
||||
|
||||
#if defined(WIN32) || defined(__UNIXOS2__)
|
||||
#if defined(WIN32)
|
||||
{
|
||||
int ret = send ((SOCKET)ciptr->fd, buf, size, 0);
|
||||
#ifdef WIN32
|
||||
|
@ -104,17 +104,8 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
|
||||
*/
|
||||
|
||||
struct sockaddr_in saddr;
|
||||
#ifdef CRAY
|
||||
#ifdef OLDTCP
|
||||
int len = sizeof(saddr.sin_addr);
|
||||
#else
|
||||
int len = SIZEOF_in_addr;
|
||||
#endif /* OLDTCP */
|
||||
char *cp = (char *) &saddr.sin_addr;
|
||||
#else /* else not CRAY */
|
||||
int len = sizeof(saddr.sin_addr.s_addr);
|
||||
char *cp = (char *) &saddr.sin_addr.s_addr;
|
||||
#endif /* CRAY */
|
||||
|
||||
memcpy (&saddr, *addrp, sizeof (struct sockaddr_in));
|
||||
|
||||
@ -169,28 +160,14 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
|
||||
#endif /* IPv6 */
|
||||
#endif /* defined(TCPCONN) || defined(STREAMSCONN) */
|
||||
|
||||
#if defined(DNETCONN)
|
||||
case AF_DECnet:
|
||||
{
|
||||
struct sockaddr_dn saddr;
|
||||
|
||||
memcpy (&saddr, *addrp, sizeof (struct sockaddr_dn));
|
||||
|
||||
*familyp=FamilyDECnet;
|
||||
*addrlenp=sizeof(struct dn_naddr);
|
||||
memcpy(*addrp,&saddr.sdn_add,*addrlenp);
|
||||
|
||||
break;
|
||||
}
|
||||
#endif /* defined(DNETCONN) */
|
||||
|
||||
#if defined(UNIXCONN) || defined(LOCALCONN) || defined(OS2PIPECONN)
|
||||
#if defined(UNIXCONN) || defined(LOCALCONN)
|
||||
case AF_UNIX:
|
||||
{
|
||||
*familyp=FamilyLocal;
|
||||
break;
|
||||
}
|
||||
#endif /* defined(UNIXCONN) || defined(LOCALCONN) || defined(OS2PIPECONN)*/
|
||||
#endif /* defined(UNIXCONN) || defined(LOCALCONN) */
|
||||
|
||||
#if (defined(__SCO__) || defined(__UNIXWARE__)) && defined(LOCALCONN)
|
||||
case 0:
|
||||
@ -268,7 +245,7 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr)
|
||||
|
||||
switch (family)
|
||||
{
|
||||
#if defined(UNIXCONN) || defined(STREAMSCONN) || defined(LOCALCONN) || defined(OS2PIPECONN)
|
||||
#if defined(UNIXCONN) || defined(STREAMSCONN) || defined(LOCALCONN)
|
||||
case AF_UNIX:
|
||||
{
|
||||
struct sockaddr_un *saddr = (struct sockaddr_un *) addr;
|
||||
@ -279,7 +256,7 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr)
|
||||
hostnamebuf, saddr->sun_path);
|
||||
break;
|
||||
}
|
||||
#endif /* defined(UNIXCONN) || defined(STREAMSCONN) || defined(LOCALCONN) || defined(OS2PIPECONN) */
|
||||
#endif /* defined(UNIXCONN) || defined(STREAMSCONN) || defined(LOCALCONN) */
|
||||
|
||||
#if defined(TCPCONN) || defined(STREAMSCONN)
|
||||
case AF_INET:
|
||||
@ -312,18 +289,6 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr)
|
||||
}
|
||||
#endif /* defined(TCPCONN) || defined(STREAMSCONN) */
|
||||
|
||||
#if defined(DNETCONN)
|
||||
case AF_DECnet:
|
||||
{
|
||||
struct sockaddr_dn *saddr = (struct sockaddr_dn *) addr;
|
||||
len = 13 + strlen (hostnamebuf) + saddr->sdn_objnamel;
|
||||
networkId = (char *) xalloc (len);
|
||||
snprintf (networkId, len, "dnet/%s::%s",
|
||||
hostnamebuf, saddr->sdn_objname);
|
||||
break;
|
||||
}
|
||||
#endif /* defined(DNETCONN) */
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -373,14 +338,14 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr)
|
||||
switch (family)
|
||||
{
|
||||
case AF_UNSPEC:
|
||||
#if defined(UNIXCONN) || defined(STREAMSCONN) || defined(LOCALCONN) || defined(OS2PIPECONN)
|
||||
#if defined(UNIXCONN) || defined(STREAMSCONN) || defined(LOCALCONN)
|
||||
case AF_UNIX:
|
||||
{
|
||||
if (gethostname (addrbuf, sizeof (addrbuf)) == 0)
|
||||
addr = addrbuf;
|
||||
break;
|
||||
}
|
||||
#endif /* defined(UNIXCONN) || defined(STREAMSCONN) || defined(LOCALCONN) || defined(OS2PIPECONN) */
|
||||
#endif /* defined(UNIXCONN) || defined(STREAMSCONN) || defined(LOCALCONN) */
|
||||
|
||||
#if defined(TCPCONN) || defined(STREAMSCONN)
|
||||
case AF_INET:
|
||||
@ -444,24 +409,6 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr)
|
||||
|
||||
#endif /* defined(TCPCONN) || defined(STREAMSCONN) */
|
||||
|
||||
#if defined(DNETCONN)
|
||||
case AF_DECnet:
|
||||
{
|
||||
struct sockaddr_dn *saddr = (struct sockaddr_dn *) peer_addr;
|
||||
struct nodeent *np;
|
||||
|
||||
if (np = getnodebyaddr(saddr->sdn_add.a_addr,
|
||||
saddr->sdn_add.a_len, AF_DECnet)) {
|
||||
snprintf(addrbuf, sizeof(addrbuf), "%s:", np->n_name);
|
||||
} else {
|
||||
snprintf(addrbuf, sizeof(addrbuf), "%s:",
|
||||
dnet_htoa(&saddr->sdn_add));
|
||||
}
|
||||
addr = addrbuf;
|
||||
break;
|
||||
}
|
||||
#endif /* defined(DNETCONN) */
|
||||
|
||||
default:
|
||||
return (NULL);
|
||||
}
|
||||
@ -479,7 +426,7 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr)
|
||||
#endif /* ICE_t */
|
||||
|
||||
|
||||
#if defined(WIN32) && (defined(TCPCONN) || defined(DNETCONN))
|
||||
#if defined(WIN32) && defined(TCPCONN)
|
||||
int
|
||||
TRANS(WSAStartup) (void)
|
||||
{
|
||||
|
477
lib/libxtrans/aclocal.m4
vendored
477
lib/libxtrans/aclocal.m4
vendored
@ -825,6 +825,466 @@ AC_SUBST([am__tar])
|
||||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
||||
dnl xorg-macros.m4. Generated from xorg-macros.m4.in:xorgversion.m4 by configure.
|
||||
dnl
|
||||
dnl Copyright 2005-2006 Sun Microsystems, Inc. All rights reserved.
|
||||
dnl
|
||||
dnl Permission is hereby granted, free of charge, to any person obtaining a
|
||||
dnl copy of this software and associated documentation files (the
|
||||
dnl "Software"), to deal in the Software without restriction, including
|
||||
dnl without limitation the rights to use, copy, modify, merge, publish,
|
||||
dnl distribute, and/or sell copies of the Software, and to permit persons
|
||||
dnl to whom the Software is furnished to do so, provided that the above
|
||||
dnl copyright notice(s) and this permission notice appear in all copies of
|
||||
dnl the Software and that both the above copyright notice(s) and this
|
||||
dnl permission notice appear in supporting documentation.
|
||||
dnl
|
||||
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
dnl OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
dnl HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
|
||||
dnl INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
|
||||
dnl FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
dnl NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||
dnl WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
dnl
|
||||
dnl Except as contained in this notice, the name of a copyright holder
|
||||
dnl shall not be used in advertising or otherwise to promote the sale, use
|
||||
dnl or other dealings in this Software without prior written authorization
|
||||
dnl of the copyright holder.
|
||||
|
||||
# XORG_MACROS_VERSION(required-version)
|
||||
# -------------------------------------
|
||||
# Minimum version: 1.1.0
|
||||
#
|
||||
# If you're using a macro added in Version 1.1 or newer, include this in
|
||||
# your configure.ac with the minimum required version, such as:
|
||||
# XORG_MACROS_VERSION(1.1)
|
||||
#
|
||||
# To force at least a version with this macro defined, also add:
|
||||
# m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.1 or later before running autoconf/autogen])])
|
||||
#
|
||||
#
|
||||
# See the "minimum version" comment for each macro you use to see what
|
||||
# version you require.
|
||||
AC_DEFUN([XORG_MACROS_VERSION],[
|
||||
[XORG_MACROS_needed_version=$1
|
||||
XORG_MACROS_needed_major=`echo $XORG_MACROS_needed_version | sed 's/\..*$//'`
|
||||
XORG_MACROS_needed_minor=`echo $XORG_MACROS_needed_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`]
|
||||
AC_MSG_CHECKING([if xorg-macros used to generate configure is at least ${XORG_MACROS_needed_major}.${XORG_MACROS_needed_minor}])
|
||||
[XORG_MACROS_version=1.2.1
|
||||
XORG_MACROS_major=`echo $XORG_MACROS_version | sed 's/\..*$//'`
|
||||
XORG_MACROS_minor=`echo $XORG_MACROS_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`]
|
||||
if test $XORG_MACROS_major -ne $XORG_MACROS_needed_major ; then
|
||||
AC_MSG_ERROR([configure built with incompatible version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.x])
|
||||
fi
|
||||
if test $XORG_MACROS_minor -lt $XORG_MACROS_needed_minor ; then
|
||||
AC_MSG_ERROR([configure built with too old of a version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.${XORG_MACROS_minor}.0 or newer])
|
||||
fi
|
||||
AC_MSG_RESULT([yes, $XORG_MACROS_version])
|
||||
]) # XORG_MACROS_VERSION
|
||||
|
||||
# XORG_PROG_RAWCPP()
|
||||
# ------------------
|
||||
# Minimum version: 1.0.0
|
||||
#
|
||||
# Find cpp program and necessary flags for use in pre-processing text files
|
||||
# such as man pages and config files
|
||||
AC_DEFUN([XORG_PROG_RAWCPP],[
|
||||
AC_REQUIRE([AC_PROG_CPP])
|
||||
AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
|
||||
[$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
|
||||
|
||||
# Check for flag to avoid builtin definitions - assumes unix is predefined,
|
||||
# which is not the best choice for supporting other OS'es, but covers most
|
||||
# of the ones we need for now.
|
||||
AC_MSG_CHECKING([if $RAWCPP requires -undef])
|
||||
AC_LANG_CONFTEST([Does cpp redefine unix ?])
|
||||
if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
|
||||
AC_MSG_RESULT([no])
|
||||
else
|
||||
if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
|
||||
RAWCPPFLAGS=-undef
|
||||
AC_MSG_RESULT([yes])
|
||||
# under Cygwin unix is still defined even with -undef
|
||||
elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then
|
||||
RAWCPPFLAGS="-undef -ansi"
|
||||
AC_MSG_RESULT([yes, with -ansi])
|
||||
else
|
||||
AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef. I don't know what to do.])
|
||||
fi
|
||||
fi
|
||||
rm -f conftest.$ac_ext
|
||||
|
||||
AC_MSG_CHECKING([if $RAWCPP requires -traditional])
|
||||
AC_LANG_CONFTEST([Does cpp preserve "whitespace"?])
|
||||
if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
|
||||
AC_MSG_RESULT([no])
|
||||
else
|
||||
if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
|
||||
RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional. I don't know what to do.])
|
||||
fi
|
||||
fi
|
||||
rm -f conftest.$ac_ext
|
||||
AC_SUBST(RAWCPPFLAGS)
|
||||
]) # XORG_PROG_RAWCPP
|
||||
|
||||
# XORG_MANPAGE_SECTIONS()
|
||||
# -----------------------
|
||||
# Minimum version: 1.0.0
|
||||
#
|
||||
# Determine which sections man pages go in for the different man page types
|
||||
# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files.
|
||||
# Not sure if there's any better way than just hardcoding by OS name.
|
||||
# Override default settings by setting environment variables
|
||||
|
||||
AC_DEFUN([XORG_MANPAGE_SECTIONS],[
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
|
||||
if test x$APP_MAN_SUFFIX = x ; then
|
||||
APP_MAN_SUFFIX=1
|
||||
fi
|
||||
if test x$APP_MAN_DIR = x ; then
|
||||
APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)'
|
||||
fi
|
||||
|
||||
if test x$LIB_MAN_SUFFIX = x ; then
|
||||
LIB_MAN_SUFFIX=3
|
||||
fi
|
||||
if test x$LIB_MAN_DIR = x ; then
|
||||
LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)'
|
||||
fi
|
||||
|
||||
if test x$FILE_MAN_SUFFIX = x ; then
|
||||
case $host_os in
|
||||
solaris*) FILE_MAN_SUFFIX=4 ;;
|
||||
*) FILE_MAN_SUFFIX=5 ;;
|
||||
esac
|
||||
fi
|
||||
if test x$FILE_MAN_DIR = x ; then
|
||||
FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)'
|
||||
fi
|
||||
|
||||
if test x$MISC_MAN_SUFFIX = x ; then
|
||||
case $host_os in
|
||||
solaris*) MISC_MAN_SUFFIX=5 ;;
|
||||
*) MISC_MAN_SUFFIX=7 ;;
|
||||
esac
|
||||
fi
|
||||
if test x$MISC_MAN_DIR = x ; then
|
||||
MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)'
|
||||
fi
|
||||
|
||||
if test x$DRIVER_MAN_SUFFIX = x ; then
|
||||
case $host_os in
|
||||
solaris*) DRIVER_MAN_SUFFIX=7 ;;
|
||||
*) DRIVER_MAN_SUFFIX=4 ;;
|
||||
esac
|
||||
fi
|
||||
if test x$DRIVER_MAN_DIR = x ; then
|
||||
DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)'
|
||||
fi
|
||||
|
||||
if test x$ADMIN_MAN_SUFFIX = x ; then
|
||||
case $host_os in
|
||||
solaris*) ADMIN_MAN_SUFFIX=1m ;;
|
||||
*) ADMIN_MAN_SUFFIX=8 ;;
|
||||
esac
|
||||
fi
|
||||
if test x$ADMIN_MAN_DIR = x ; then
|
||||
ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)'
|
||||
fi
|
||||
|
||||
|
||||
AC_SUBST([APP_MAN_SUFFIX])
|
||||
AC_SUBST([LIB_MAN_SUFFIX])
|
||||
AC_SUBST([FILE_MAN_SUFFIX])
|
||||
AC_SUBST([MISC_MAN_SUFFIX])
|
||||
AC_SUBST([DRIVER_MAN_SUFFIX])
|
||||
AC_SUBST([ADMIN_MAN_SUFFIX])
|
||||
AC_SUBST([APP_MAN_DIR])
|
||||
AC_SUBST([LIB_MAN_DIR])
|
||||
AC_SUBST([FILE_MAN_DIR])
|
||||
AC_SUBST([MISC_MAN_DIR])
|
||||
AC_SUBST([DRIVER_MAN_DIR])
|
||||
AC_SUBST([ADMIN_MAN_DIR])
|
||||
]) # XORG_MANPAGE_SECTIONS
|
||||
|
||||
# XORG_CHECK_LINUXDOC
|
||||
# -------------------
|
||||
# Minimum version: 1.0.0
|
||||
#
|
||||
# Defines the variable MAKE_TEXT if the necessary tools and
|
||||
# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt.
|
||||
# Whether or not the necessary tools and files are found can be checked
|
||||
# with the AM_CONDITIONAL "BUILD_LINUXDOC"
|
||||
AC_DEFUN([XORG_CHECK_LINUXDOC],[
|
||||
if test x$XORG_SGML_PATH = x ; then
|
||||
XORG_SGML_PATH=$prefix/share/sgml
|
||||
fi
|
||||
HAVE_DEFS_ENT=
|
||||
|
||||
if test x"$cross_compiling" = x"yes" ; then
|
||||
HAVE_DEFS_ENT=no
|
||||
else
|
||||
AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
|
||||
fi
|
||||
|
||||
AC_PATH_PROG(LINUXDOC, linuxdoc)
|
||||
AC_PATH_PROG(PS2PDF, ps2pdf)
|
||||
|
||||
AC_MSG_CHECKING([Whether to build documentation])
|
||||
|
||||
if test x$HAVE_DEFS_ENT != x && test x$LINUXDOC != x ; then
|
||||
BUILDDOC=yes
|
||||
else
|
||||
BUILDDOC=no
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
|
||||
|
||||
AC_MSG_RESULT([$BUILDDOC])
|
||||
|
||||
AC_MSG_CHECKING([Whether to build pdf documentation])
|
||||
|
||||
if test x$PS2PDF != x && test x$BUILD_PDFDOC != xno; then
|
||||
BUILDPDFDOC=yes
|
||||
else
|
||||
BUILDPDFDOC=no
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
|
||||
|
||||
AC_MSG_RESULT([$BUILDPDFDOC])
|
||||
|
||||
MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt"
|
||||
MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps"
|
||||
MAKE_PDF="$PS2PDF"
|
||||
MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B html --split=0"
|
||||
|
||||
AC_SUBST(MAKE_TEXT)
|
||||
AC_SUBST(MAKE_PS)
|
||||
AC_SUBST(MAKE_PDF)
|
||||
AC_SUBST(MAKE_HTML)
|
||||
]) # XORG_CHECK_LINUXDOC
|
||||
|
||||
# XORG_CHECK_DOCBOOK
|
||||
# -------------------
|
||||
# Minimum version: 1.0.0
|
||||
#
|
||||
# Checks for the ability to build output formats from SGML DocBook source.
|
||||
# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC"
|
||||
# indicates whether the necessary tools and files are found and, if set,
|
||||
# $(MAKE_XXX) blah.sgml will produce blah.xxx.
|
||||
AC_DEFUN([XORG_CHECK_DOCBOOK],[
|
||||
if test x$XORG_SGML_PATH = x ; then
|
||||
XORG_SGML_PATH=$prefix/share/sgml
|
||||
fi
|
||||
HAVE_DEFS_ENT=
|
||||
BUILDTXTDOC=no
|
||||
BUILDPDFDOC=no
|
||||
BUILDPSDOC=no
|
||||
BUILDHTMLDOC=no
|
||||
|
||||
AC_CHECK_FILE([$XORG_SGML_PATH/X11/defs.ent], [HAVE_DEFS_ENT=yes])
|
||||
|
||||
AC_PATH_PROG(DOCBOOKPS, docbook2ps)
|
||||
AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
|
||||
AC_PATH_PROG(DOCBOOKHTML, docbook2html)
|
||||
AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
|
||||
|
||||
AC_MSG_CHECKING([Whether to build text documentation])
|
||||
if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKTXT != x &&
|
||||
test x$BUILD_TXTDOC != xno; then
|
||||
BUILDTXTDOC=yes
|
||||
fi
|
||||
AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
|
||||
AC_MSG_RESULT([$BUILDTXTDOC])
|
||||
|
||||
AC_MSG_CHECKING([Whether to build PDF documentation])
|
||||
if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPDF != x &&
|
||||
test x$BUILD_PDFDOC != xno; then
|
||||
BUILDPDFDOC=yes
|
||||
fi
|
||||
AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
|
||||
AC_MSG_RESULT([$BUILDPDFDOC])
|
||||
|
||||
AC_MSG_CHECKING([Whether to build PostScript documentation])
|
||||
if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPS != x &&
|
||||
test x$BUILD_PSDOC != xno; then
|
||||
BUILDPSDOC=yes
|
||||
fi
|
||||
AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
|
||||
AC_MSG_RESULT([$BUILDPSDOC])
|
||||
|
||||
AC_MSG_CHECKING([Whether to build HTML documentation])
|
||||
if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKHTML != x &&
|
||||
test x$BUILD_HTMLDOC != xno; then
|
||||
BUILDHTMLDOC=yes
|
||||
fi
|
||||
AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes])
|
||||
AC_MSG_RESULT([$BUILDHTMLDOC])
|
||||
|
||||
MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT"
|
||||
MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS"
|
||||
MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF"
|
||||
MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML"
|
||||
|
||||
AC_SUBST(MAKE_TEXT)
|
||||
AC_SUBST(MAKE_PS)
|
||||
AC_SUBST(MAKE_PDF)
|
||||
AC_SUBST(MAKE_HTML)
|
||||
]) # XORG_CHECK_DOCBOOK
|
||||
|
||||
# XORG_CHECK_MALLOC_ZERO
|
||||
# ----------------------
|
||||
# Minimum version: 1.0.0
|
||||
#
|
||||
# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if
|
||||
# malloc(0) returns NULL. Packages should add one of these cflags to
|
||||
# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them.
|
||||
AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[
|
||||
AC_ARG_ENABLE(malloc0returnsnull,
|
||||
AC_HELP_STRING([--enable-malloc0returnsnull],
|
||||
[malloc(0) returns NULL (default: auto)]),
|
||||
[MALLOC_ZERO_RETURNS_NULL=$enableval],
|
||||
[MALLOC_ZERO_RETURNS_NULL=auto])
|
||||
|
||||
AC_MSG_CHECKING([whether malloc(0) returns NULL])
|
||||
if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
|
||||
AC_RUN_IFELSE([
|
||||
char *malloc();
|
||||
char *realloc();
|
||||
char *calloc();
|
||||
main() {
|
||||
char *m0, *r0, *c0, *p;
|
||||
m0 = malloc(0);
|
||||
p = malloc(10);
|
||||
r0 = realloc(p,0);
|
||||
c0 = calloc(0);
|
||||
exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1);
|
||||
}],
|
||||
[MALLOC_ZERO_RETURNS_NULL=yes],
|
||||
[MALLOC_ZERO_RETURNS_NULL=no])
|
||||
fi
|
||||
AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
|
||||
|
||||
if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then
|
||||
MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL"
|
||||
XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS
|
||||
XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
|
||||
else
|
||||
MALLOC_ZERO_CFLAGS=""
|
||||
XMALLOC_ZERO_CFLAGS=""
|
||||
XTMALLOC_ZERO_CFLAGS=""
|
||||
fi
|
||||
|
||||
AC_SUBST([MALLOC_ZERO_CFLAGS])
|
||||
AC_SUBST([XMALLOC_ZERO_CFLAGS])
|
||||
AC_SUBST([XTMALLOC_ZERO_CFLAGS])
|
||||
]) # XORG_CHECK_MALLOC_ZERO
|
||||
|
||||
# XORG_WITH_LINT()
|
||||
# ----------------
|
||||
# Minimum version: 1.1.0
|
||||
#
|
||||
# Sets up flags for source checkers such as lint and sparse if --with-lint
|
||||
# is specified. (Use --with-lint=sparse for sparse.)
|
||||
# Sets $LINT to name of source checker passed with --with-lint (default: lint)
|
||||
# Sets $LINT_FLAGS to flags to pass to source checker
|
||||
# Sets LINT automake conditional if enabled (default: disabled)
|
||||
#
|
||||
AC_DEFUN([XORG_WITH_LINT],[
|
||||
|
||||
# Allow checking code with lint, sparse, etc.
|
||||
AC_ARG_WITH(lint, [AC_HELP_STRING([--with-lint],
|
||||
[Use a lint-style source code checker (default: disabled)])],
|
||||
[use_lint=$withval], [use_lint=no])
|
||||
if test "x$use_lint" = "xyes" ; then
|
||||
LINT="lint"
|
||||
else
|
||||
LINT="$use_lint"
|
||||
fi
|
||||
if test "x$LINT_FLAGS" = "x" -a "x$LINT" != "xno" ; then
|
||||
case $LINT in
|
||||
lint|*/lint)
|
||||
case $host_os in
|
||||
solaris*)
|
||||
LINT_FLAGS="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
AC_SUBST(LINT)
|
||||
AC_SUBST(LINT_FLAGS)
|
||||
AM_CONDITIONAL(LINT, [test x$LINT != xno])
|
||||
|
||||
]) # XORG_WITH_LINT
|
||||
|
||||
# XORG_LINT_LIBRARY(LIBNAME)
|
||||
# --------------------------
|
||||
# Minimum version: 1.1.0
|
||||
#
|
||||
# Sets up flags for building lint libraries for checking programs that call
|
||||
# functions in the library.
|
||||
# Disabled by default, enable with --enable-lint-library
|
||||
# Sets:
|
||||
# @LINTLIB@ - name of lint library file to make
|
||||
# MAKE_LINT_LIB - automake conditional
|
||||
#
|
||||
|
||||
AC_DEFUN([XORG_LINT_LIBRARY],[
|
||||
AC_REQUIRE([XORG_WITH_LINT])
|
||||
# Build lint "library" for more indepth checks of programs calling this library
|
||||
AC_ARG_ENABLE(lint-library, [AC_HELP_STRING([--enable-lint-library],
|
||||
[Create lint library (default: disabled)])],
|
||||
[make_lint_lib=$enableval], [make_lint_lib=no])
|
||||
if test "x$make_lint_lib" != "xno" ; then
|
||||
if test "x$LINT" = "xno" ; then
|
||||
AC_MSG_ERROR([Cannot make lint library without --with-lint])
|
||||
fi
|
||||
if test "x$make_lint_lib" = "xyes" ; then
|
||||
LINTLIB=llib-l$1.ln
|
||||
else
|
||||
LINTLIB=$make_lint_lib
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(LINTLIB)
|
||||
AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
|
||||
|
||||
]) # XORG_LINT_LIBRARY
|
||||
|
||||
# XORG_CWARNFLAGS
|
||||
# ---------------
|
||||
# Minimum version: 1.2.0
|
||||
#
|
||||
# Defines CWARNFLAGS to enable C compiler warnings.
|
||||
#
|
||||
AC_DEFUN([XORG_CWARNFLAGS], [
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
if test "x$GCC" = xyes ; then
|
||||
CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
|
||||
-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
|
||||
-Wbad-function-cast"
|
||||
case `gcc -dumpversion` in
|
||||
3.4.* | 4.*)
|
||||
CWARNFLAGS+=" -Wold-style-definition -Wdeclaration-after-statement"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
|
||||
if test "x$SUNCC" = "xyes"; then
|
||||
CWARNFLAGS="-v"
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(CWARNFLAGS)
|
||||
]) # XORG_CWARNFLAGS
|
||||
dnl Copyright 2005 Red Hat, Inc
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this software and its
|
||||
@ -887,3 +1347,20 @@ AC_DEFUN([XORG_RELEASE_VERSION],[
|
||||
[Patch version of this package])
|
||||
])
|
||||
|
||||
# XORG_CHANGELOG()
|
||||
# ----------------
|
||||
# Minimum version: 1.2.0
|
||||
#
|
||||
# Defines the variable CHANGELOG_CMD as the command to generate
|
||||
# ChangeLog from git.
|
||||
#
|
||||
# Arrange that distcleancheck ignores ChangeLog left over by distclean.
|
||||
#
|
||||
AC_DEFUN([XORG_CHANGELOG], [
|
||||
CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > .changelog.tmp && \
|
||||
mv .changelog.tmp ChangeLog) || (rm -f .changelog.tmp; touch ChangeLog; \
|
||||
echo 'git directory not found: installing possibly empty changelog.' >&2)"
|
||||
AC_SUBST([CHANGELOG_CMD])
|
||||
AC_SUBST([distcleancheck_listfiles], ['find . -type f ! -name ChangeLog -print'])
|
||||
]) # XORG_CHANGELOG
|
||||
|
||||
|
57
lib/libxtrans/configure
vendored
57
lib/libxtrans/configure
vendored
@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.59 for xtrans 1.2.
|
||||
# Generated by GNU Autoconf 2.59 for xtrans 1.2.3.
|
||||
#
|
||||
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>.
|
||||
#
|
||||
@ -269,11 +269,11 @@ SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='xtrans'
|
||||
PACKAGE_TARNAME='xtrans'
|
||||
PACKAGE_VERSION='1.2'
|
||||
PACKAGE_STRING='xtrans 1.2'
|
||||
PACKAGE_VERSION='1.2.3'
|
||||
PACKAGE_STRING='xtrans 1.2.3'
|
||||
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg'
|
||||
|
||||
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE fchown_define sticky_bit_define LIBOBJS LTLIBOBJS'
|
||||
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE fchown_define sticky_bit_define CHANGELOG_CMD distcleancheck_listfiles LIBOBJS LTLIBOBJS'
|
||||
ac_subst_files=''
|
||||
|
||||
# Initialize some variables set by options.
|
||||
@ -738,7 +738,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures xtrans 1.2 to adapt to many kinds of systems.
|
||||
\`configure' configures xtrans 1.2.3 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@ -800,7 +800,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of xtrans 1.2:";;
|
||||
short | recursive ) echo "Configuration of xtrans 1.2.3:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@ -925,7 +925,7 @@ fi
|
||||
test -n "$ac_init_help" && exit 0
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
xtrans configure 1.2
|
||||
xtrans configure 1.2.3
|
||||
generated by GNU Autoconf 2.59
|
||||
|
||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
@ -939,7 +939,7 @@ cat >&5 <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by xtrans $as_me 1.2, which was
|
||||
It was created by xtrans $as_me 1.2.3, which was
|
||||
generated by GNU Autoconf 2.59. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@ -1537,7 +1537,7 @@ fi
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='xtrans'
|
||||
VERSION='1.2'
|
||||
VERSION='1.2.3'
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@ -1692,6 +1692,31 @@ fi
|
||||
|
||||
|
||||
|
||||
# Require xorg-macros version 1.2.0 or newer for XORG_CHANGELOG macro
|
||||
|
||||
|
||||
XORG_MACROS_needed_version=1.2
|
||||
XORG_MACROS_needed_major=`echo $XORG_MACROS_needed_version | sed 's/\..*$//'`
|
||||
XORG_MACROS_needed_minor=`echo $XORG_MACROS_needed_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`
|
||||
echo "$as_me:$LINENO: checking if xorg-macros used to generate configure is at least ${XORG_MACROS_needed_major}.${XORG_MACROS_needed_minor}" >&5
|
||||
echo $ECHO_N "checking if xorg-macros used to generate configure is at least ${XORG_MACROS_needed_major}.${XORG_MACROS_needed_minor}... $ECHO_C" >&6
|
||||
XORG_MACROS_version=1.2.1
|
||||
XORG_MACROS_major=`echo $XORG_MACROS_version | sed 's/\..*$//'`
|
||||
XORG_MACROS_minor=`echo $XORG_MACROS_version | sed -e 's/^[0-9]*\.//' -e 's/\..*$//'`
|
||||
if test $XORG_MACROS_major -ne $XORG_MACROS_needed_major ; then
|
||||
{ { echo "$as_me:$LINENO: error: configure built with incompatible version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.x" >&5
|
||||
echo "$as_me: error: configure built with incompatible version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.x" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
if test $XORG_MACROS_minor -lt $XORG_MACROS_needed_minor ; then
|
||||
{ { echo "$as_me:$LINENO: error: configure built with too old of a version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.${XORG_MACROS_minor}.0 or newer" >&5
|
||||
echo "$as_me: error: configure built with too old of a version of xorg-macros.m4 - requires version ${XORG_MACROS_major}.${XORG_MACROS_minor}.0 or newer" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: yes, $XORG_MACROS_version" >&5
|
||||
echo "${ECHO_T}yes, $XORG_MACROS_version" >&6
|
||||
|
||||
|
||||
# Because xtrans is included into other modules rather than being linked
|
||||
# with, these defines have to be added to the cflags line
|
||||
|
||||
@ -2950,6 +2975,14 @@ _ACEOF
|
||||
|
||||
|
||||
|
||||
CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > .changelog.tmp && \
|
||||
mv .changelog.tmp ChangeLog) || (rm -f .changelog.tmp; touch ChangeLog; \
|
||||
echo 'git directory not found: installing possibly empty changelog.' >&2)"
|
||||
|
||||
distcleancheck_listfiles='find . -type f ! -name ChangeLog -print'
|
||||
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files Makefile xtrans.pc"
|
||||
cat >confcache <<\_ACEOF
|
||||
# This file is a shell script that caches the results of configure
|
||||
@ -3365,7 +3398,7 @@ _ASBOX
|
||||
} >&5
|
||||
cat >&5 <<_CSEOF
|
||||
|
||||
This file was extended by xtrans $as_me 1.2, which was
|
||||
This file was extended by xtrans $as_me 1.2.3, which was
|
||||
generated by GNU Autoconf 2.59. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@ -3423,7 +3456,7 @@ _ACEOF
|
||||
|
||||
cat >>$CONFIG_STATUS <<_ACEOF
|
||||
ac_cs_version="\\
|
||||
xtrans config.status 1.2
|
||||
xtrans config.status 1.2.3
|
||||
configured by $0, generated by GNU Autoconf 2.59,
|
||||
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
|
||||
|
||||
@ -3663,6 +3696,8 @@ s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
|
||||
s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
|
||||
s,@fchown_define@,$fchown_define,;t t
|
||||
s,@sticky_bit_define@,$sticky_bit_define,;t t
|
||||
s,@CHANGELOG_CMD@,$CHANGELOG_CMD,;t t
|
||||
s,@distcleancheck_listfiles@,$distcleancheck_listfiles,;t t
|
||||
s,@LIBOBJS@,$LIBOBJS,;t t
|
||||
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
|
||||
CEOF
|
||||
|
@ -21,10 +21,14 @@ dnl
|
||||
dnl Process this file with autoconf to create configure.
|
||||
|
||||
AC_PREREQ([2.57])
|
||||
AC_INIT(xtrans, 1.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xtrans)
|
||||
AC_INIT(xtrans, 1.2.3, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xtrans)
|
||||
AM_INIT_AUTOMAKE([dist-bzip2])
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
# Require xorg-macros version 1.2.0 or newer for XORG_CHANGELOG macro
|
||||
m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])])
|
||||
XORG_MACROS_VERSION(1.2)
|
||||
|
||||
# Because xtrans is included into other modules rather than being linked
|
||||
# with, these defines have to be added to the cflags line
|
||||
|
||||
@ -44,6 +48,7 @@ sticky_bit_define="-DHAS_STICKY_DIR_BIT"
|
||||
AC_SUBST(sticky_bit_define)
|
||||
|
||||
XORG_RELEASE_VERSION
|
||||
XORG_CHANGELOG
|
||||
|
||||
AC_OUTPUT([Makefile
|
||||
xtrans.pc])
|
||||
|
@ -47,9 +47,6 @@ from The Open Group.
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef __UNIXOS2__
|
||||
#define I_NEED_OS2_H
|
||||
#endif
|
||||
|
||||
#ifdef XSERV_t
|
||||
#include "os.h"
|
||||
@ -63,15 +60,9 @@ from The Open Group.
|
||||
|
||||
#include "Xtransint.h"
|
||||
|
||||
#ifdef DNETCONN
|
||||
#include "Xtransdnet.c"
|
||||
#endif
|
||||
#ifdef LOCALCONN
|
||||
#include "Xtranslcl.c"
|
||||
#endif
|
||||
#ifdef OS2PIPECONN
|
||||
#include "Xtransos2.c"
|
||||
#endif
|
||||
#if defined(TCPCONN) || defined(UNIXCONN)
|
||||
#include "Xtranssock.c"
|
||||
#endif
|
||||
|
@ -32,10 +32,11 @@ AC_DEFUN([XTRANS_TCP_FLAGS],[
|
||||
# SVR4 hides these in libraries other than libc
|
||||
AC_SEARCH_LIBS(socket, [socket])
|
||||
AC_SEARCH_LIBS(gethostbyname, [nsl])
|
||||
AC_HAVE_LIBRARY([ws2_32])
|
||||
|
||||
# Needs to come after above checks for libsocket & libnsl for SVR4 systems
|
||||
AC_ARG_ENABLE(ipv6,
|
||||
AC_HELP_STRING([--enable-IPv6],[Enable IPv6 support]),
|
||||
AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),
|
||||
[IPV6CONN=$enableval],
|
||||
[AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])])
|
||||
AC_MSG_CHECKING([if IPv6 support should be built])
|
||||
|
Loading…
Reference in New Issue
Block a user