Update to xtrans 1.2.7

This commit is contained in:
matthieu 2012-04-08 14:50:52 +00:00
parent a577557f31
commit 0e15740580
14 changed files with 1771 additions and 1333 deletions

View File

@ -1,3 +1,463 @@
commit 8ce5ecd33b05becc054dbd07f87e385165b6c979
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Thu Mar 22 20:04:07 2012 -0700
xtrans 1.2.7
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit f8eea0bf256de59602790b6a7c7877b31520440f
Author: Matt Dew <marcoz@osource.org>
Date: Wed Jan 11 22:23:32 2012 -0700
informaltable cleanup
On certain tables, add top and bottom borders to table
header and a bottom border to the table. This matches
what those tables in the old pdfs looked like.
the <?dbfo keep-together='always'> prevents tables from
splitting across pages. Useful for tiny tables.
Converting the colwidth to a floating point,
IE, 1* -> 1.0* cleans up these build errors:
WARNING: table-layout="fixed" and column-width unspecified
=> falling back to proportional-column-width(1)
Signed-off-by: Matt Dew <marcoz@osource.org>
commit 6086f6c1d0e0a1c9e590879acb2319dea0eb6e96
Author: Robert Bragg <robert@linux.intel.com>
Date: Mon Dec 12 00:30:43 2011 +0000
Xtranssock.c: avoid buffer overrun in SocketReopen
This function was constructing an address from a port string allocating
a buffer according to the size of the string but then later copying
the address according to sizeof(struct sockaddr).
This patch ensures that we allocate a struct sockaddr buffer with enough
space for the port string to be copied into sa_data[] and uses that
combined length to determine how much should be copied at the end of the
function.
This fixes a crash when using xwayland which uses ListenOnOpenFD() that
will call _XSERVTransReopenCOTSServer() with a short port string like
":1".
Signed-off-by: Robert Bragg <robert@linux.intel.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit a04a45cb94f7f569e6dd77df93258fa167d0a4ea
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Wed Nov 30 18:40:46 2011 -0800
Remove unnecessary casts on malloc, calloc & free calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
commit a0bfb4fefd20b396e3d88eff0c60602fc436dad5
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Wed Nov 30 18:11:15 2011 -0800
Replace malloc(strlen)+strcpy with strdup
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
commit b89e1b45198c48996750b5da3d715c10f974243f
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Wed Nov 30 18:05:05 2011 -0800
Finish conversion to standard C allocation functions
Commit 4ac40cd5451 started this, by no longer special casing the
xserver to include it's former custom allocation functions, this
just takes the remaining #defines and pre-substitutes them into
the code.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit ff992be7b05483f9a0586a27ee0edb6d99580b84
Author: Alan Hourihane <alanh@fairlite.co.uk>
Date: Thu Dec 1 12:04:22 2011 +0000
Fix some resource & memory leaks in libxtrans.
Signed-off-by: Alan Hourihane <alanh@vmware.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 29c9e101f7ad72556aa6b3dbc17d66a1ace9b2b1
Author: Matt Dew <marcoz@osource.org>
Date: Tue Oct 4 21:59:50 2011 -0600
Cleanup IDs and links in doc
1 - fix the capitalization of the ID attributes to match either the
<title> or <funcdef> string it goes with.
2 - fix any <linkend>'s that were affected by 1.
3 - any <function> in the docs that has an actual funcdef,
will become an olink.
Signed-off-by: Matt Dew <marcoz@osource.org>
commit 0f942e5f015cb3270e6f2e17c308bee894cb5fe3
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Sep 25 11:39:13 2011 -0700
Convert a bunch of sprintf calls to snprintf
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
commit eb9a8904fbef61a57ff01c90627ead57055ed62b
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Sep 25 11:18:26 2011 -0700
Add const attributes to fix gcc -Wwrite-strings warnings
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 4e610d4bbcf29cca9dc5dbad29ca820996aaa8c7
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Sep 25 10:59:45 2011 -0700
Fix warning: unused variable 'tmpport' with various configurations
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
commit a74c5d915c3095059356f83d1b845192e5c472c2
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Sep 25 10:57:00 2011 -0700
Add _X_UNUSED attributes to silence unused parameter warnings
Not all the transport variants use all the arguments to every function,
but as long as one transport type needs it, they all get the args passed.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 64f765de138cb9b757df315469b3136d32222ea2
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat Sep 24 00:04:40 2011 -0700
Mark __xtransname strings for debug messages as const char *
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
commit ea921932dae7049b231bead7f8f3f088d7beaf9e
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Sep 23 23:03:09 2011 -0700
Fix unused variable warnings
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
commit c1968d10f97d62ac05d698822c2688151f70a9eb
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Sep 23 22:59:11 2011 -0700
Fix warning: ISO C90 forbids mixed declarations and code
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 225c45b3accab56fab361104a3d14b80f6cec954
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Sep 23 22:57:56 2011 -0700
Fix printf format string warnings
Now that prmsg lets arguments types actually be checked, fix
the warnings found.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
commit b1b69ce8e8e4fe0f190c8bd85b537309e71055c8
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Sep 23 22:35:03 2011 -0700
Convert PRMSG macro to prmsg inline function
Allows using varargs to have the correct number of arguments passed to
get rid of the many gcc warnings about variable printf format strings,
and to reduce the duplication from having 5 implementations of the
PRMSG macro depending on the debug options defined & output method used.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
commit cbdb434033da1725a69014cc6e4d89c691a6fd95
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat Sep 24 07:43:07 2011 -0700
Fix warnings about static functions declared but never defined
Add #define XTRANS_TRANSPORT_C to transport.c and check for it
before making static function declarations and other bits needed
only when compiling the Xtrans code itself, not from other sources
that include the Xtransint.h header for the struct definitions.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
commit cf39d738086b0a7c668fb3720d64de8d711a1a97
Author: Arvind Umrao <arvind.umrao@oracle.com>
Date: Tue Sep 20 22:56:52 2011 +0530
Removing SUN specific code, let solaris create .X11-pipe with sticky bit on
Alan told me, named pipe support was added around Solaris 2.6 when that was a much better performing transport than Unix sockets on the Solaris kernels of the time. By Solaris 10, Unix sockets had been reimplemented in the kernel to be faster, so they became the default again. In Solaris 11, we don't even have named pipe support in the libxcb library that implements X client connection code now, so the named pipes would only be accessed by code with a different libX11 or a statically linked libX11 from Solaris 2.6-9
Signed-off-by: Arvind Umrao <arvind.umrao@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit a477713b89686480cf59a9c75c0aaeeba2386d0a
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Tue Sep 20 18:56:47 2011 -0400
specs: regroup <author> <editor> <othercredit> under authorgroup
Some elements are not displayed when outside authorgroup
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
commit 1ad48fb9bc18d0c7a8fbec1d2cd232877e945047
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Tue Sep 20 15:47:09 2011 -0400
specs: refactor copyright legal text for multi licensing
we can use <copyright> markup for the first holder
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
commit bd93bf86fd914a9cc54e2bedec5b063e5a38b732
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Mon Sep 19 10:58:40 2011 -0400
doc: support multi licensed copyright notice and license text
For documentation having multiple licenses, the copyright and legalnotice
elements sequence cannot instantiated multiple times.
The copyright notice and license text are therefore coded inside a
legalnotice element. The role attribute on the paragraph is used to allow
styling of the copyright notice text which should not be italicized.
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
commit eb9ec458b7fb5332f7ae7b8faf59443a9075ec60
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Sep 16 22:54:41 2011 -0700
Strip trailing whitespace
Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}'
git diff -w & git diff -b show no diffs from this change
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 36174eb06e805fa51c9c2e9e914fdfad4a99f50f
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Wed Sep 14 15:29:19 2011 -0400
docs: fix authors affiliation
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
commit 9b6c2473be2848ce0a4986ddaa59e5f5ef028bfc
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Mon Sep 12 16:37:24 2011 -0400
docs: use the &fullrelvers; entity to set X11 release information
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
commit b5754cdf64f3396a5853413eda1943cf75ff3cbd
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Sun Sep 11 19:49:54 2011 -0400
docs: remove <productnumber> which is not used by default
This element is not rendered by default on the title. A template
customization is required to display it.
X Window System does not have a product number.
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
commit 20f338c548e5fcb16650a4e2c25c2008c1fdac36
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Thu Sep 8 20:00:00 2011 -0400
docbook.am: embed css styles inside the HTML HEAD element
Rather than referring to the external xorg.css stylesheet, embed the content
of the file in the html output produced. This is accomplished by using
version 1.10 of xorg-xhtml.xsl.
This makes the whole html docs tree much more relocatable.
In addition, it eliminates xorg.css as a runtime file which makes
xorg-sgml-doctools a build time only package.
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
commit 8eb827af1b57ec52be183cddaf32257968c02878
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Wed Sep 7 10:31:04 2011 -0400
docbook.am: global maintenance update - entities, images and olinking
Adding support in libX11 for html chunking caused a reorg of docbook.am
as well as the xorg-sgml-doctools masterdb for olinking.
The parameter img.src.path is added for pdf images.
A searchpath to the root builddir is added for local entities, if present.
The docbook.am makefile hides all the details and is identical for
all 22 modules having DocBook documentation. It is included by a thin
Makefile.am which requires no docbook knowledge.
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
commit b710cdadc92fc212af361bee48f5af6333ec3e6d
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Sun Jun 12 18:39:46 2011 -0400
Install xml versions of specs even if HAVE_XMLTO is false
DocBook/XML input source is also a usefull output format that can be viewed
with an XML viewer or editor and by some O/S help system.
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
commit 78d1f7d29145567e11b985042e917a435bef95f9
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Sun Jun 5 16:27:37 2011 -0400
Install target dbs alongside generated documents
This matches a change in xorg-sgml-docs whereby the masterdb will look for
the target dbs into the same location as the generated documents.
The target dbs are now installed alongside the generated documents.
Previously they are installed in $prefix/sgml/X11/dbs alongside masterdb which
has the potential of installing outside the package prefix and cause
distcheck to fail when user does not have write permission in this package.
Requires XORG_CHECK_SGML_DOCTOOLS(1.8) which was released 2011-06-11
commit e05d7abbcf880099058b699ac52f65edcac95582
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Sun Apr 24 19:39:26 2011 -0700
Silence warnings when building with clang
/usr/X11/include/X11/Xtrans/Xtransint.h:349:12: error: unused function 'is_numeric' [-Werror,-Wunused-function]
static int is_numeric (
^
/usr/X11/include/X11/Xtrans/Xtransint.h:354:12: error: unused function 'trans_mkdir' [-Werror,-Wunused-function]
static int trans_mkdir (
^
In file included from /usr/X11/include/X11/Xtrans/transport.c:67:
...
fatal error: too many errors emitted, stopping now [-ferror-limit=]
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 27ae0ad1406a33919ea9f76034495bca7cccf051
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Sun Feb 27 15:06:18 2011 -0500
Documentation: add Docbook external references support
When writing technical documentation, it is often necessary to cross
reference to other information. When that other information is not in the
current document, additional support is needed, namely <olink>.
A new feature with version 1.7 of xorg-sgml-doctools adds references to
other documents within or outside this package.
This patch adds technical support for this feature but does not change
the content of the documentation as seen by the end user.
Each book or article must generate a database containing the href
of sections that can be referred to from another document. This database
is installed in DATAROOTDIR/sgml/X11/dbs. There is a requirement that
the value of DATAROOTDIR for xorg-sgml-doctools and for the package
documentation is the same. This forms a virtual document tree.
This database is consulted by other documents while they are being generated
in order to fulfill the missing information for linking.
Refer to the xorg-sgml-doctools for further technical information.
Co-authored-by: Matt Dew <marcoz@osource.org>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
commit cc199c31465b258032bdb9083879699202db7ee9
Author: Adam Jackson <ajax@redhat.com>
Date: Mon Feb 21 12:44:06 2011 -0500
Remove a decnet leftover
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
commit 91620213d2bd75fe322df06c5b6f55b85a10e55a
Author: Adam Jackson <ajax@redhat.com>
Date: Tue Mar 15 15:47:08 2011 -0400
Remove K&R token pasting macros
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
commit 4ac40cd5451983e6f62527700cdf9e2f8a29c013
Author: Adam Jackson <ajax@redhat.com>
Date: Tue Mar 15 15:45:56 2011 -0400
Don't special-case allocation for the X server
xserver uses malloc/free directly now, don't route through the Xalloc
wrappers.
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Adam Jackson <ajax@redhat.com>
commit 638caa2053330038c5ba5a5682ff02be6aa0faa6
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Wed Feb 2 11:43:46 2011 -0500
config: comment, minor upgrade, quote and layout configure.ac
Group statements per section as per Autoconf standard layout
Quote statements where appropriate.
Autoconf recommends not using dnl instead of # for comments
Use AC_CONFIG_FILES to replace the deprecated AC_OUTPUT with parameters.
Add AC_CONFIG_SRCDIR([Makefile.am])
This helps automated maintenance and release activities.
Details can be found in http://wiki.x.org/wiki/NewModuleGuidelines
commit a26753b7b20cd5cadc1e7fa007cec063f39a49e8
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Thu Dec 16 23:59:20 2010 -0800
doc: Correct column count in transport configuration table
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 59f57d1a19d4091fef115b9eafa139bf620332cb
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Mon Nov 8 16:33:45 2010 -0800

View File

@ -132,31 +132,31 @@ void
TRANS(FreeConnInfo) (XtransConnInfo ciptr)
{
PRMSG (3,"FreeConnInfo(%p)\n", ciptr, 0, 0);
prmsg (3,"FreeConnInfo(%p)\n", ciptr);
if (ciptr->addr)
xfree (ciptr->addr);
free (ciptr->addr);
if (ciptr->peeraddr)
xfree (ciptr->peeraddr);
free (ciptr->peeraddr);
if (ciptr->port)
xfree (ciptr->port);
free (ciptr->port);
xfree ((char *) ciptr);
free (ciptr);
}
#define PROTOBUFSIZE 20
static Xtransport *
TRANS(SelectTransport) (char *protocol)
TRANS(SelectTransport) (const char *protocol)
{
char protobuf[PROTOBUFSIZE];
int i;
PRMSG (3,"SelectTransport(%s)\n", protocol, 0, 0);
prmsg (3,"SelectTransport(%s)\n", protocol);
/*
* Force Protocol to be lowercase as a way of doing
@ -203,18 +203,16 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
*/
char *mybuf, *tmpptr;
char *_protocol, *_host, *_port;
const char *_protocol;
char *_host, *_port;
char hostnamebuf[256];
int _host_len;
size_t len;
PRMSG (3,"ParseAddress(%s)\n", address, 0, 0);
prmsg (3,"ParseAddress(%s)\n", address);
/* Copy the string so it can be changed */
len = strlen (address) + 1;
tmpptr = mybuf = (char *) xalloc (len);
strlcpy (mybuf, address, len);
tmpptr = mybuf = strdup (address);
/* Parse the string to get each component */
@ -230,7 +228,7 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
*protocol = NULL;
*host = NULL;
*port = NULL;
xfree (tmpptr);
free (tmpptr);
return 0;
}
@ -280,26 +278,10 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
*protocol = NULL;
*host = NULL;
*port = NULL;
xfree (tmpptr);
free (tmpptr);
return 0;
}
/* Check for DECnet */
if ((mybuf != _host) && (*(mybuf - 1) == ':')
#if defined(IPv6) && defined(AF_INET6)
/* An IPv6 address can end in :: so three : in a row is assumed to be
an IPv6 host and not a DECnet node with a : in it's name, unless
DECnet is specifically requested */
&& ( ((mybuf - 1) == _host) || (*(mybuf - 2) != ':') ||
((_protocol != NULL) && (strcmp(_protocol, "dnet") == 0)) )
#endif
)
{
_protocol = "dnet";
*(mybuf - 1) = '\0';
}
*mybuf ++= '\0';
_host_len = strlen(_host);
@ -362,49 +344,41 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port)
* Now that we have all of the components, allocate new
* string space for them.
*/
len = strlen (_protocol) + 1;
if ((*protocol = (char *) xalloc(len)) == NULL)
if ((*protocol = strdup (_protocol)) == NULL)
{
/* Malloc failed */
*port = NULL;
*host = NULL;
*protocol = NULL;
xfree (tmpptr);
free (tmpptr);
return 0;
}
else
strlcpy (*protocol, _protocol, len);
len = strlen (_host) + 1;
if ((*host = (char *) xalloc (len)) == NULL)
if ((*host = strdup (_host)) == NULL)
{
/* Malloc failed */
*port = NULL;
*host = NULL;
xfree (*protocol);
free (*protocol);
*protocol = NULL;
xfree (tmpptr);
free (tmpptr);
return 0;
}
else
strlcpy (*host, _host, len);
len = strlen (_port) + 1;
if ((*port = (char *) xalloc (len)) == NULL)
if ((*port = strdup (_port)) == NULL)
{
/* Malloc failed */
*port = NULL;
xfree (*host);
free (*host);
*host = NULL;
xfree (*protocol);
free (*protocol);
*protocol = NULL;
xfree (tmpptr);
free (tmpptr);
return 0;
}
else
strlcpy (*port, _port, len);
xfree (tmpptr);
free (tmpptr);
return 1;
}
@ -424,12 +398,12 @@ TRANS(Open) (int type, char *address)
XtransConnInfo ciptr = NULL;
Xtransport *thistrans;
PRMSG (2,"Open(%d,%s)\n", type, address, 0);
prmsg (2,"Open(%d,%s)\n", type, address);
#if defined(WIN32) && defined(TCPCONN)
if (TRANS(WSAStartup)())
{
PRMSG (1,"Open: WSAStartup failed\n", 0, 0, 0);
prmsg (1,"Open: WSAStartup failed\n");
return NULL;
}
#endif
@ -438,7 +412,7 @@ TRANS(Open) (int type, char *address)
if (TRANS(ParseAddress) (address, &protocol, &host, &port) == 0)
{
PRMSG (1,"Open: Unable to Parse address %s\n", address, 0, 0);
prmsg (1,"Open: Unable to Parse address %s\n", address);
return NULL;
}
@ -446,12 +420,12 @@ TRANS(Open) (int type, char *address)
if ((thistrans = TRANS(SelectTransport) (protocol)) == NULL)
{
PRMSG (1,"Open: Unable to find transport for %s\n",
protocol, 0, 0);
prmsg (1,"Open: Unable to find transport for %s\n",
protocol);
xfree (protocol);
xfree (host);
xfree (port);
free (protocol);
free (host);
free (port);
return NULL;
}
@ -480,27 +454,27 @@ TRANS(Open) (int type, char *address)
#endif /* TRANS_SERVER */
break;
default:
PRMSG (1,"Open: Unknown Open type %d\n", type, 0, 0);
prmsg (1,"Open: Unknown Open type %d\n", type);
}
if (ciptr == NULL)
{
if (!(thistrans->flags & TRANS_DISABLED))
{
PRMSG (1,"Open: transport open failed for %s/%s:%s\n",
prmsg (1,"Open: transport open failed for %s/%s:%s\n",
protocol, host, port);
}
xfree (protocol);
xfree (host);
xfree (port);
free (protocol);
free (host);
free (port);
return NULL;
}
ciptr->transptr = thistrans;
ciptr->port = port; /* We need this for TRANS(Reopen) */
xfree (protocol);
xfree (host);
free (protocol);
free (host);
return ciptr;
}
@ -522,9 +496,8 @@ TRANS(Reopen) (int type, int trans_id, int fd, char *port)
Xtransport *thistrans = NULL;
char *save_port;
int i;
size_t len;
PRMSG (2,"Reopen(%d,%d,%s)\n", trans_id, fd, port);
prmsg (2,"Reopen(%d,%d,%s)\n", trans_id, fd, port);
/* Determine the transport type */
@ -537,22 +510,19 @@ TRANS(Reopen) (int type, int trans_id, int fd, char *port)
if (thistrans == NULL)
{
PRMSG (1,"Reopen: Unable to find transport id %d\n",
trans_id, 0, 0);
prmsg (1,"Reopen: Unable to find transport id %d\n",
trans_id);
return NULL;
}
len = strlen (port) + 1;
if ((save_port = (char *) xalloc (len)) == NULL)
if ((save_port = strdup (port)) == NULL)
{
PRMSG (1,"Reopen: Unable to malloc port string\n", 0, 0, 0);
prmsg (1,"Reopen: Unable to malloc port string\n");
return NULL;
}
strlcpy (save_port, port, len);
/* Get a new XtransConnInfo object */
switch (type)
@ -564,12 +534,13 @@ TRANS(Reopen) (int type, int trans_id, int fd, char *port)
ciptr = thistrans->ReopenCLTSServer(thistrans, fd, port);
break;
default:
PRMSG (1,"Reopen: Bad Open type %d\n", type, 0, 0);
prmsg (1,"Reopen: Bad Open type %d\n", type);
}
if (ciptr == NULL)
{
PRMSG (1,"Reopen: transport open failed\n", 0, 0, 0);
prmsg (1,"Reopen: transport open failed\n");
free (save_port);
return NULL;
}
@ -595,7 +566,7 @@ XtransConnInfo
TRANS(OpenCOTSClient) (char *address)
{
PRMSG (2,"OpenCOTSClient(%s)\n", address, 0, 0);
prmsg (2,"OpenCOTSClient(%s)\n", address);
return TRANS(Open) (XTRANS_OPEN_COTS_CLIENT, address);
}
@ -608,7 +579,7 @@ XtransConnInfo
TRANS(OpenCOTSServer) (char *address)
{
PRMSG (2,"OpenCOTSServer(%s)\n", address, 0, 0);
prmsg (2,"OpenCOTSServer(%s)\n", address);
return TRANS(Open) (XTRANS_OPEN_COTS_SERVER, address);
}
@ -621,7 +592,7 @@ XtransConnInfo
TRANS(OpenCLTSClient) (char *address)
{
PRMSG (2,"OpenCLTSClient(%s)\n", address, 0, 0);
prmsg (2,"OpenCLTSClient(%s)\n", address);
return TRANS(Open) (XTRANS_OPEN_CLTS_CLIENT, address);
}
@ -634,7 +605,7 @@ XtransConnInfo
TRANS(OpenCLTSServer) (char *address)
{
PRMSG (2,"OpenCLTSServer(%s)\n", address, 0, 0);
prmsg (2,"OpenCLTSServer(%s)\n", address);
return TRANS(Open) (XTRANS_OPEN_CLTS_SERVER, address);
}
@ -647,7 +618,7 @@ XtransConnInfo
TRANS(ReopenCOTSServer) (int trans_id, int fd, char *port)
{
PRMSG (2,"ReopenCOTSServer(%d, %d, %s)\n", trans_id, fd, port);
prmsg (2,"ReopenCOTSServer(%d, %d, %s)\n", trans_id, fd, port);
return TRANS(Reopen) (XTRANS_OPEN_COTS_SERVER, trans_id, fd, port);
}
@ -655,7 +626,7 @@ XtransConnInfo
TRANS(ReopenCLTSServer) (int trans_id, int fd, char *port)
{
PRMSG (2,"ReopenCLTSServer(%d, %d, %s)\n", trans_id, fd, port);
prmsg (2,"ReopenCLTSServer(%d, %d, %s)\n", trans_id, fd, port);
return TRANS(Reopen) (XTRANS_OPEN_CLTS_SERVER, trans_id, fd, port);
}
@ -666,7 +637,6 @@ TRANS(GetReopenInfo) (XtransConnInfo ciptr,
{
int i;
size_t len;
for (i = 0; i < NUMTRANS; i++)
if (Xtransports[i].transport == ciptr->transptr)
@ -674,15 +644,11 @@ TRANS(GetReopenInfo) (XtransConnInfo ciptr,
*trans_id = Xtransports[i].transport_id;
*fd = ciptr->fd;
len = strlen (ciptr->port) + 1;
if ((*port = (char *) xalloc (len)) == NULL)
if ((*port = strdup (ciptr->port)) == NULL)
return 0;
else
{
strlcpy (*port, ciptr->port, len);
return 1;
}
}
return 0;
}
@ -697,7 +663,7 @@ TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg)
int fd = ciptr->fd;
int ret = 0;
PRMSG (2,"SetOption(%d,%d,%d)\n", fd, option, arg);
prmsg (2,"SetOption(%d,%d,%d)\n", fd, option, arg);
/*
* For now, all transport type use the same stuff for setting options.
@ -783,7 +749,7 @@ TRANS(CreateListener) (XtransConnInfo ciptr, char *port, unsigned int flags)
}
int
TRANS(NoListen) (char * protocol)
TRANS(NoListen) (const char * protocol)
{
Xtransport *trans;
@ -791,8 +757,8 @@ TRANS(NoListen) (char * protocol)
if ((trans = TRANS(SelectTransport)(protocol)) == NULL)
{
PRMSG (1,"TransNoListen: unable to find transport: %s\n",
protocol, 0, 0);
prmsg (1,"TransNoListen: unable to find transport: %s\n",
protocol);
return -1;
}
@ -825,7 +791,7 @@ TRANS(Accept) (XtransConnInfo ciptr, int *status)
{
XtransConnInfo newciptr;
PRMSG (2,"Accept(%d)\n", ciptr->fd, 0, 0);
prmsg (2,"Accept(%d)\n", ciptr->fd);
newciptr = ciptr->transptr->Accept (ciptr, status);
@ -849,12 +815,12 @@ TRANS(Connect) (XtransConnInfo ciptr, char *address)
char *port;
int ret;
PRMSG (2,"Connect(%d,%s)\n", ciptr->fd, address, 0);
prmsg (2,"Connect(%d,%s)\n", ciptr->fd, address);
if (TRANS(ParseAddress) (address, &protocol, &host, &port) == 0)
{
PRMSG (1,"Connect: Unable to Parse address %s\n",
address, 0, 0);
prmsg (1,"Connect: Unable to Parse address %s\n",
address);
return -1;
}
@ -864,18 +830,18 @@ TRANS(Connect) (XtransConnInfo ciptr, char *address)
if (!port || !*port)
{
PRMSG (1,"Connect: Missing port specification in %s\n",
address, 0, 0);
if (protocol) xfree (protocol);
if (host) xfree (host);
prmsg (1,"Connect: Missing port specification in %s\n",
address);
if (protocol) free (protocol);
if (host) free (host);
return -1;
}
ret = ciptr->transptr->Connect (ciptr, host, port);
if (protocol) xfree (protocol);
if (host) xfree (host);
if (port) xfree (port);
if (protocol) free (protocol);
if (host) free (host);
if (port) free (port);
return ret;
}
@ -931,7 +897,7 @@ TRANS(Close) (XtransConnInfo ciptr)
{
int ret;
PRMSG (2,"Close(%d)\n", ciptr->fd, 0, 0);
prmsg (2,"Close(%d)\n", ciptr->fd);
ret = ciptr->transptr->Close (ciptr);
@ -946,7 +912,7 @@ TRANS(CloseForCloning) (XtransConnInfo ciptr)
{
int ret;
PRMSG (2,"CloseForCloning(%d)\n", ciptr->fd, 0, 0);
prmsg (2,"CloseForCloning(%d)\n", ciptr->fd);
ret = ciptr->transptr->CloseForCloning (ciptr);
@ -968,14 +934,14 @@ TRANS(GetMyAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp,
Xtransaddr **addrp)
{
PRMSG (2,"GetMyAddr(%d)\n", ciptr->fd, 0, 0);
prmsg (2,"GetMyAddr(%d)\n", ciptr->fd);
*familyp = ciptr->family;
*addrlenp = ciptr->addrlen;
if ((*addrp = (Xtransaddr *) xalloc (ciptr->addrlen)) == NULL)
if ((*addrp = malloc (ciptr->addrlen)) == NULL)
{
PRMSG (1,"GetMyAddr: malloc failed\n", 0, 0, 0);
prmsg (1,"GetMyAddr: malloc failed\n");
return -1;
}
memcpy(*addrp, ciptr->addr, ciptr->addrlen);
@ -988,14 +954,14 @@ TRANS(GetPeerAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp,
Xtransaddr **addrp)
{
PRMSG (2,"GetPeerAddr(%d)\n", ciptr->fd, 0, 0);
prmsg (2,"GetPeerAddr(%d)\n", ciptr->fd);
*familyp = ciptr->family;
*addrlenp = ciptr->peeraddrlen;
if ((*addrp = (Xtransaddr *) xalloc (ciptr->peeraddrlen)) == NULL)
if ((*addrp = malloc (ciptr->peeraddrlen)) == NULL)
{
PRMSG (1,"GetPeerAddr: malloc failed\n", 0, 0, 0);
prmsg (1,"GetPeerAddr: malloc failed\n");
return -1;
}
memcpy(*addrp, ciptr->peeraddr, ciptr->peeraddrlen);
@ -1064,8 +1030,8 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
#if defined(IPv6) && defined(AF_INET6)
int ipv6_succ = 0;
#endif
PRMSG (2,"MakeAllCOTSServerListeners(%s,%p)\n",
port ? port : "NULL", ciptrs_ret, 0);
prmsg (2,"MakeAllCOTSServerListeners(%s,%p)\n",
port ? port : "NULL", ciptrs_ret);
*count_ret = 0;
@ -1091,17 +1057,17 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
snprintf(buffer, sizeof(buffer), "%s/:%s",
trans->TransName, port ? port : "");
PRMSG (5,"MakeAllCOTSServerListeners: opening %s\n",
buffer, 0, 0);
prmsg (5,"MakeAllCOTSServerListeners: opening %s\n",
buffer);
if ((ciptr = TRANS(OpenCOTSServer(buffer))) == NULL)
{
if (trans->flags & TRANS_DISABLED)
continue;
PRMSG (1,
prmsg (1,
"MakeAllCOTSServerListeners: failed to open listener for %s\n",
trans->TransName, 0, 0);
trans->TransName);
continue;
}
#if defined(IPv6) && defined(AF_INET6)
@ -1120,9 +1086,8 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
* running at this address, and this function should fail.
*/
PRMSG (1,
"MakeAllCOTSServerListeners: server already running\n",
0, 0, 0);
prmsg (1,
"MakeAllCOTSServerListeners: server already running\n");
for (j = 0; j < *count_ret; j++)
TRANS(Close) (temp_ciptrs[j]);
@ -1134,9 +1099,9 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
}
else
{
PRMSG (1,
prmsg (1,
"MakeAllCOTSServerListeners: failed to create listener for %s\n",
trans->TransName, 0, 0);
trans->TransName);
continue;
}
@ -1147,9 +1112,9 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
ipv6_succ = 1;
#endif
PRMSG (5,
prmsg (5,
"MakeAllCOTSServerListeners: opened listener for %s, %d\n",
trans->TransName, ciptr->fd, 0);
trans->TransName, ciptr->fd);
temp_ciptrs[*count_ret] = ciptr;
(*count_ret)++;
@ -1157,13 +1122,13 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret,
*partial = (*count_ret < complete_network_count());
PRMSG (5,
prmsg (5,
"MakeAllCOTSServerListeners: partial=%d, actual=%d, complete=%d \n",
*partial, *count_ret, complete_network_count());
if (*count_ret > 0)
{
if ((*ciptrs_ret = (XtransConnInfo *) xalloc (
if ((*ciptrs_ret = malloc (
*count_ret * sizeof (XtransConnInfo))) == NULL)
{
return -1;
@ -1189,8 +1154,8 @@ TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
XtransConnInfo ciptr, temp_ciptrs[NUMTRANS];
int status, i, j;
PRMSG (2,"MakeAllCLTSServerListeners(%s,%p)\n",
port ? port : "NULL", ciptrs_ret, 0);
prmsg (2,"MakeAllCLTSServerListeners(%s,%p)\n",
port ? port : "NULL", ciptrs_ret);
*count_ret = 0;
@ -1204,14 +1169,14 @@ TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
snprintf(buffer, sizeof(buffer), "%s/:%s",
trans->TransName, port ? port : "");
PRMSG (5,"MakeAllCLTSServerListeners: opening %s\n",
buffer, 0, 0);
prmsg (5,"MakeAllCLTSServerListeners: opening %s\n",
buffer);
if ((ciptr = TRANS(OpenCLTSServer (buffer))) == NULL)
{
PRMSG (1,
prmsg (1,
"MakeAllCLTSServerListeners: failed to open listener for %s\n",
trans->TransName, 0, 0);
trans->TransName);
continue;
}
@ -1225,9 +1190,8 @@ TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
* running at this address, and this function should fail.
*/
PRMSG (1,
"MakeAllCLTSServerListeners: server already running\n",
0, 0, 0);
prmsg (1,
"MakeAllCLTSServerListeners: server already running\n");
for (j = 0; j < *count_ret; j++)
TRANS(Close) (temp_ciptrs[j]);
@ -1239,30 +1203,30 @@ TRANS(MakeAllCLTSServerListeners) (char *port, int *partial, int *count_ret,
}
else
{
PRMSG (1,
prmsg (1,
"MakeAllCLTSServerListeners: failed to create listener for %s\n",
trans->TransName, 0, 0);
trans->TransName);
continue;
}
}
PRMSG (5,
prmsg (5,
"MakeAllCLTSServerListeners: opened listener for %s, %d\n",
trans->TransName, ciptr->fd, 0);
trans->TransName, ciptr->fd);
temp_ciptrs[*count_ret] = ciptr;
(*count_ret)++;
}
*partial = (*count_ret < complete_network_count());
PRMSG (5,
prmsg (5,
"MakeAllCLTSServerListeners: partial=%d, actual=%d, complete=%d \n",
*partial, *count_ret, complete_network_count());
if (*count_ret > 0)
{
if ((*ciptrs_ret = (XtransConnInfo *) xalloc (
if ((*ciptrs_ret = malloc (
*count_ret * sizeof (XtransConnInfo))) == NULL)
{
return -1;

View File

@ -57,112 +57,84 @@ from The Open Group.
#include <sys/socket.h>
#endif
#ifdef __clang__
/* Not all clients make use of all provided statics */
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-function"
#endif
/*
* Set the functions names according to where this code is being compiled.
*/
#ifdef X11_t
#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _X11Trans##func
#else
#define TRANS(func) _X11Trans/**/func
#endif
#ifdef XTRANSDEBUG
static char* __xtransname = "_X11Trans";
static const char *__xtransname = "_X11Trans";
#endif
#endif /* X11_t */
#ifdef XSERV_t
#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _XSERVTrans##func
#else
#define TRANS(func) _XSERVTrans/**/func
#endif
#ifdef XTRANSDEBUG
static char* __xtransname = "_XSERVTrans";
static const char *__xtransname = "_XSERVTrans";
#endif
#define X11_t
#endif /* XSERV_t */
#ifdef XIM_t
#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _XimXTrans##func
#else
#define TRANS(func) _XimXTrans/**/func
#endif
#ifdef XTRANSDEBUG
static char* __xtransname = "_XimTrans";
static const char *__xtransname = "_XimTrans";
#endif
#endif /* XIM_t */
#ifdef FS_t
#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _FSTrans##func
#else
#define TRANS(func) _FSTrans/**/func
#endif
#ifdef XTRANSDEBUG
static char* __xtransname = "_FSTrans";
static const char *__xtransname = "_FSTrans";
#endif
#endif /* FS_t */
#ifdef FONT_t
#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _FontTrans##func
#else
#define TRANS(func) _FontTrans/**/func
#endif
#ifdef XTRANSDEBUG
static char* __xtransname = "_FontTrans";
static const char *__xtransname = "_FontTrans";
#endif
#endif /* FONT_t */
#ifdef ICE_t
#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _IceTrans##func
#else
#define TRANS(func) _IceTrans/**/func
#endif
#ifdef XTRANSDEBUG
static char* __xtransname = "_IceTrans";
static const char *__xtransname = "_IceTrans";
#endif
#endif /* ICE_t */
#ifdef TEST_t
#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _TESTTrans##func
#else
#define TRANS(func) _TESTTrans/**/func
#endif
#ifdef XTRANSDEBUG
static char* __xtransname = "_TESTTrans";
static const char *__xtransname = "_TESTTrans";
#endif
#endif /* TEST_t */
#ifdef LBXPROXY_t
#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _LBXPROXYTrans##func
#else
#define TRANS(func) _LBXPROXYTrans/**/func
#endif
#define X11_t /* The server defines this - so should the LBX proxy */
#ifdef XTRANSDEBUG
static char* __xtransname = "_LBXPROXYTrans";
static const char *__xtransname = "_LBXPROXYTrans";
#endif
#endif /* LBXPROXY_t */
#if !defined(TRANS)
#if !defined(UNIXCPP) || defined(ANSICPP)
#define TRANS(func) _XTrans##func
#else
#define TRANS(func) _XTrans/**/func
#endif
#ifdef XTRANSDEBUG
static char* __xtransname = "_XTrans";
static const char *__xtransname = "_XTrans";
#endif
#endif /* !TRANS */
#ifdef __clang__
#pragma clang diagnostic pop
#endif
/*
* Create a single address structure that can be used wherever
@ -332,7 +304,7 @@ int TRANS(CreateListener)(
);
int TRANS(NoListen) (
char* /* protocol*/
const char* /* protocol*/
);
int TRANS(ResetListener)(

View File

@ -68,7 +68,7 @@ from The Open Group.
* message.
*/
#ifndef XTRANSDEBUG
#if !defined(XTRANSDEBUG) && defined(XTRANS_TRANSPORT_C)
# define XTRANSDEBUG 1
#endif
@ -78,6 +78,10 @@ from The Open Group.
#include "Xtrans.h"
#ifndef _X_UNUSED /* Defined in Xfuncproto.h in xproto >= 7.0.22 */
# define _X_UNUSED /* */
#endif
#ifdef XTRANSDEBUG
# include <stdio.h>
#endif /* XTRANSDEBUG */
@ -140,7 +144,7 @@ struct _XtransConnInfo {
typedef struct _Xtransport {
char *TransName;
const char *TransName;
int flags;
#ifdef TRANS_CLIENT
@ -155,7 +159,7 @@ typedef struct _Xtransport {
#endif /* TRANS_CLIENT */
#ifdef TRANS_SERVER
char ** nolisten;
const char ** nolisten;
XtransConnInfo (*OpenCOTSServer)(
struct _Xtransport *, /* transport */
char *, /* protocol */
@ -307,6 +311,15 @@ typedef struct _Xtransport_table {
/* Flags to preserve when setting others */
#define TRANS_KEEPFLAGS (TRANS_NOUNLINK|TRANS_ABSTRACT)
#ifdef XTRANS_TRANSPORT_C /* only provide static function prototypes when
building the transport.c file that has them in */
#ifdef __clang__
/* Not all clients make use of all provided statics */
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-function"
#endif
/*
* readv() and writev() don't exist or don't work correctly on some
* systems, so they may be emulated.
@ -357,58 +370,70 @@ static int trans_mkdir (
);
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
/*
* Some XTRANSDEBUG stuff
*/
#if defined(XTRANSDEBUG)
/* add hack to the format string to avoid warnings about extra arguments
* to fprintf.
#ifdef XTRANSDEBUG
#include <stdarg.h>
/*
* The X server provides ErrorF() & VErrorF(), for other software that uses
* xtrans, we provide our own simple versions.
*/
#ifdef XTRANSDEBUGTIMESTAMP
#if defined(XSERV_t) && defined(TRANS_SERVER)
/* Use ErrorF() for the X server */
#define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \
int hack= 0, saveerrno=errno; \
struct timeval tp;\
gettimeofday(&tp,0); \
ErrorF("%s",__xtransname); \
ErrorF(x+hack,a,b,c); \
ErrorF("timestamp (ms): %d\n",tp.tv_sec*1000+tp.tv_usec/1000); \
errno=saveerrno; \
} else ((void)0)
#else
#define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \
int hack= 0, saveerrno=errno; \
struct timeval tp;\
gettimeofday(&tp,0); \
fprintf(stderr, "%s", __xtransname); fflush(stderr); \
fprintf(stderr, x+hack,a,b,c); fflush(stderr); \
fprintf(stderr, "timestamp (ms): %d\n",tp.tv_sec*1000+tp.tv_usec/1000); \
fflush(stderr); \
errno=saveerrno; \
} else ((void)0)
#endif /* XSERV_t && TRANS_SERVER */
#else /* XTRANSDEBUGTIMESTAMP */
#if defined(XSERV_t) && defined(TRANS_SERVER)
/* Use ErrorF() for the X server */
#define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \
int hack= 0, saveerrno=errno; \
ErrorF("%s",__xtransname); \
ErrorF(x+hack,a,b,c); \
errno=saveerrno; \
} else ((void)0)
#else
#define PRMSG(lvl,x,a,b,c) if (lvl <= XTRANSDEBUG){ \
int hack= 0, saveerrno=errno; \
fprintf(stderr, "%s", __xtransname); fflush(stderr); \
fprintf(stderr, x+hack,a,b,c); fflush(stderr); \
errno=saveerrno; \
} else ((void)0)
#endif /* XSERV_t && TRANS_SERVER */
#endif /* XTRANSDEBUGTIMESTAMP */
#else
#define PRMSG(lvl,x,a,b,c) ((void)0)
# if defined(XSERV_t) && defined(TRANS_SERVER)
# include "os.h"
# else
static inline void _X_ATTRIBUTE_PRINTF(1, 0)
VErrorF(const char *f, va_list args)
{
vfprintf(stderr, f, args);
fflush(stderr);
}
static inline void _X_ATTRIBUTE_PRINTF(1, 2)
ErrorF(const char *f, ...)
{
va_list args;
va_start(args, f);
VErrorF(f, args);
va_end(args);
}
# endif /* xserver */
#endif /* XTRANSDEBUG */
static inline void _X_ATTRIBUTE_PRINTF(2, 3)
prmsg(int lvl, const char *f, ...)
{
#ifdef XTRANSDEBUG
va_list args;
va_start(args, f);
if (lvl <= XTRANSDEBUG) {
int saveerrno = errno;
ErrorF("%s", __xtransname);
VErrorF(f, args);
# ifdef XTRANSDEBUGTIMESTAMP
{
struct timeval tp;
gettimeofday(&tp, 0);
ErrorF("timestamp (ms): %d\n",
tp.tv_sec * 1000 + tp.tv_usec / 1000);
}
# endif
errno = saveerrno;
}
va_end(args);
#endif /* XTRANSDEBUG */
}
#endif /* XTRANS_TRANSPORT_C */
#endif /* _XTRANSINT_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -172,7 +172,7 @@ from the copyright holders.
*/
typedef struct _Sockettrans2dev {
char *transname;
const char *transname;
int family;
int devcotsname;
int devcltsname;
@ -254,12 +254,12 @@ static int TRANS(SocketINETClose) (XtransConnInfo ciptr);
*/
static int
TRANS(SocketSelectFamily) (int first, char *family)
TRANS(SocketSelectFamily) (int first, const char *family)
{
int i;
PRMSG (3,"SocketSelectFamily(%s)\n", family, 0, 0);
prmsg (3,"SocketSelectFamily(%s)\n", family);
for (i = first + 1; i < NUMSOCKETFAMILIES;i++)
{
@ -288,7 +288,7 @@ TRANS(SocketINETGetAddr) (XtransConnInfo ciptr)
void *socknamePtr;
SOCKLEN_T namelen;
PRMSG (3,"SocketINETGetAddr(%p)\n", ciptr, 0, 0);
prmsg (3,"SocketINETGetAddr(%p)\n", ciptr);
#if defined(IPv6) && defined(AF_INET6)
namelen = sizeof(socknamev6);
@ -306,8 +306,8 @@ TRANS(SocketINETGetAddr) (XtransConnInfo ciptr)
#ifdef WIN32
errno = WSAGetLastError();
#endif
PRMSG (1,"SocketINETGetAddr: getsockname() failed: %d\n",
EGET(),0, 0);
prmsg (1,"SocketINETGetAddr: getsockname() failed: %d\n",
EGET());
return -1;
}
@ -315,11 +315,10 @@ TRANS(SocketINETGetAddr) (XtransConnInfo ciptr)
* Everything looks good: fill in the XtransConnInfo structure.
*/
if ((ciptr->addr = (char *) xalloc (namelen)) == NULL)
if ((ciptr->addr = malloc (namelen)) == NULL)
{
PRMSG (1,
"SocketINETGetAddr: Can't allocate space for the addr\n",
0, 0, 0);
prmsg (1,
"SocketINETGetAddr: Can't allocate space for the addr\n");
return -1;
}
@ -366,7 +365,7 @@ TRANS(SocketINETGetPeerAddr) (XtransConnInfo ciptr)
bzero(socknamePtr, namelen);
PRMSG (3,"SocketINETGetPeerAddr(%p)\n", ciptr, 0, 0);
prmsg (3,"SocketINETGetPeerAddr(%p)\n", ciptr);
if (getpeername (ciptr->fd, (struct sockaddr *) socknamePtr,
(void *)&namelen) < 0)
@ -374,8 +373,8 @@ TRANS(SocketINETGetPeerAddr) (XtransConnInfo ciptr)
#ifdef WIN32
errno = WSAGetLastError();
#endif
PRMSG (1,"SocketINETGetPeerAddr: getpeername() failed: %d\n",
EGET(), 0, 0);
prmsg (1,"SocketINETGetPeerAddr: getpeername() failed: %d\n",
EGET());
return -1;
}
@ -383,11 +382,10 @@ TRANS(SocketINETGetPeerAddr) (XtransConnInfo ciptr)
* Everything looks good: fill in the XtransConnInfo structure.
*/
if ((ciptr->peeraddr = (char *) xalloc (namelen)) == NULL)
if ((ciptr->peeraddr = malloc (namelen)) == NULL)
{
PRMSG (1,
"SocketINETGetPeerAddr: Can't allocate space for the addr\n",
0, 0, 0);
prmsg (1,
"SocketINETGetPeerAddr: Can't allocate space for the addr\n");
return -1;
}
@ -404,12 +402,11 @@ TRANS(SocketOpen) (int i, int type)
{
XtransConnInfo ciptr;
PRMSG (3,"SocketOpen(%d,%d)\n", i, type, 0);
prmsg (3,"SocketOpen(%d,%d)\n", i, type);
if ((ciptr = (XtransConnInfo) xcalloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
if ((ciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL)
{
PRMSG (1, "SocketOpen: malloc failed\n", 0, 0, 0);
prmsg (1, "SocketOpen: malloc failed\n");
return NULL;
}
@ -424,10 +421,10 @@ TRANS(SocketOpen) (int i, int type)
#ifdef WIN32
errno = WSAGetLastError();
#endif
PRMSG (2, "SocketOpen: socket() failed for %s\n",
Sockettrans2devtab[i].transname, 0, 0);
prmsg (2, "SocketOpen: socket() failed for %s\n",
Sockettrans2devtab[i].transname);
xfree ((char *) ciptr);
free (ciptr);
return NULL;
}
@ -455,60 +452,64 @@ TRANS(SocketOpen) (int i, int type)
#ifdef TRANS_REOPEN
static XtransConnInfo
TRANS(SocketReopen) (int i, int type, int fd, char *port)
TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, char *port)
{
XtransConnInfo ciptr;
int portlen;
struct sockaddr *addr;
size_t addrlen;
PRMSG (3,"SocketReopen(%d,%d,%s)\n", type, fd, port);
prmsg (3,"SocketReopen(%d,%d,%s)\n", type, fd, port);
if (port == NULL) {
PRMSG (1, "SocketReopen: port was null!\n", 0, 0, 0);
prmsg (1, "SocketReopen: port was null!\n");
return NULL;
}
portlen = strlen(port) + 1; // include space for trailing null
#ifdef SOCK_MAXADDRLEN
if (portlen < 0 || portlen > (SOCK_MAXADDRLEN + 2)) {
PRMSG (1, "SocketReopen: invalid portlen %d\n", portlen, 0, 0);
prmsg (1, "SocketReopen: invalid portlen %d\n", portlen);
return NULL;
}
if (portlen < 14) portlen = 14;
#else
if (portlen < 0 || portlen > 14) {
PRMSG (1, "SocketReopen: invalid portlen %d\n", portlen, 0, 0);
prmsg (1, "SocketReopen: invalid portlen %d\n", portlen);
return NULL;
}
#endif /*SOCK_MAXADDRLEN*/
if ((ciptr = (XtransConnInfo) xcalloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
if ((ciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL)
{
PRMSG (1, "SocketReopen: malloc(ciptr) failed\n", 0, 0, 0);
prmsg (1, "SocketReopen: malloc(ciptr) failed\n");
return NULL;
}
ciptr->fd = fd;
if ((addr = (struct sockaddr *) xcalloc (1, portlen + 2)) == NULL) {
PRMSG (1, "SocketReopen: malloc(addr) failed\n", 0, 0, 0);
addrlen = portlen + offsetof(struct sockaddr, sa_data);
if ((addr = calloc (1, addrlen)) == NULL) {
prmsg (1, "SocketReopen: malloc(addr) failed\n");
free (ciptr);
return NULL;
}
ciptr->addr = (char *) addr;
ciptr->addrlen = portlen + 2;
ciptr->addrlen = addrlen;
if ((ciptr->peeraddr = (char *) xcalloc (1, portlen + 2)) == NULL) {
PRMSG (1, "SocketReopen: malloc(portaddr) failed\n", 0, 0, 0);
if ((ciptr->peeraddr = calloc (1, addrlen)) == NULL) {
prmsg (1, "SocketReopen: malloc(portaddr) failed\n");
free (addr);
free (ciptr);
return NULL;
}
ciptr->peeraddrlen = portlen + 2;
ciptr->peeraddrlen = addrlen;
/* Initialize ciptr structure as if it were a normally-opened unix socket */
ciptr->flags = TRANS_LOCAL | TRANS_NOUNLINK;
#ifdef BSD44SOCKETS
addr->sa_len = portlen + 1;
addr->sa_len = addrlen;
#endif
addr->sa_family = AF_UNIX;
#ifdef HAS_STRLCPY
@ -517,7 +518,7 @@ TRANS(SocketReopen) (int i, int type, int fd, char *port)
strncpy(addr->sa_data, port, portlen);
#endif
ciptr->family = AF_UNIX;
memcpy(ciptr->peeraddr, ciptr->addr, sizeof(struct sockaddr));
memcpy(ciptr->peeraddr, ciptr->addr, addrlen);
ciptr->port = rindex(addr->sa_data, ':');
if (ciptr->port == NULL) {
if (is_numeric(addr->sa_data)) {
@ -540,13 +541,13 @@ TRANS(SocketReopen) (int i, int type, int fd, char *port)
#ifdef TRANS_CLIENT
static XtransConnInfo
TRANS(SocketOpenCOTSClientBase) (char *transname, char *protocol,
char *host, char *port, int previndex)
TRANS(SocketOpenCOTSClientBase) (const char *transname, const char *protocol,
const char *host, const char *port, int previndex)
{
XtransConnInfo ciptr;
int i = previndex;
PRMSG (2, "SocketOpenCOTSClient(%s,%s,%s)\n",
prmsg (2, "SocketOpenCOTSClient(%s,%s,%s)\n",
protocol, host, port);
SocketInitOnce();
@ -562,11 +563,11 @@ TRANS(SocketOpenCOTSClientBase) (char *transname, char *protocol,
}
if (i < 0) {
if (i == -1)
PRMSG (1,"SocketOpenCOTSClient: Unable to open socket for %s\n",
transname, 0, 0);
prmsg (1,"SocketOpenCOTSClient: Unable to open socket for %s\n",
transname);
else
PRMSG (1,"SocketOpenCOTSClient: Unable to determine socket type for %s\n",
transname, 0, 0);
prmsg (1,"SocketOpenCOTSClient: Unable to determine socket type for %s\n",
transname);
return NULL;
}
@ -595,7 +596,7 @@ TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, char *protocol,
XtransConnInfo ciptr;
int i = -1;
PRMSG (2,"SocketOpenCOTSServer(%s,%s,%s)\n", protocol, host, port);
prmsg (2,"SocketOpenCOTSServer(%s,%s,%s)\n", protocol, host, port);
SocketInitOnce();
@ -606,11 +607,11 @@ TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, char *protocol,
}
if (i < 0) {
if (i == -1)
PRMSG (1,"SocketOpenCOTSServer: Unable to open socket for %s\n",
thistrans->TransName, 0, 0);
prmsg (1,"SocketOpenCOTSServer: Unable to open socket for %s\n",
thistrans->TransName);
else
PRMSG (1,"SocketOpenCOTSServer: Unable to determine socket type for %s\n",
thistrans->TransName, 0, 0);
prmsg (1,"SocketOpenCOTSServer: Unable to determine socket type for %s\n",
thistrans->TransName);
return NULL;
}
@ -662,7 +663,7 @@ TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, char *protocol,
XtransConnInfo ciptr;
int i = -1;
PRMSG (2,"SocketOpenCLTSClient(%s,%s,%s)\n", protocol, host, port);
prmsg (2,"SocketOpenCLTSClient(%s,%s,%s)\n", protocol, host, port);
SocketInitOnce();
@ -673,11 +674,11 @@ TRANS(SocketOpenCLTSClient) (Xtransport *thistrans, char *protocol,
}
if (i < 0) {
if (i == -1)
PRMSG (1,"SocketOpenCLTSClient: Unable to open socket for %s\n",
thistrans->TransName, 0, 0);
prmsg (1,"SocketOpenCLTSClient: Unable to open socket for %s\n",
thistrans->TransName);
else
PRMSG (1,"SocketOpenCLTSClient: Unable to determine socket type for %s\n",
thistrans->TransName, 0, 0);
prmsg (1,"SocketOpenCLTSClient: Unable to determine socket type for %s\n",
thistrans->TransName);
return NULL;
}
@ -701,7 +702,7 @@ TRANS(SocketOpenCLTSServer) (Xtransport *thistrans, char *protocol,
XtransConnInfo ciptr;
int i = -1;
PRMSG (2,"SocketOpenCLTSServer(%s,%s,%s)\n", protocol, host, port);
prmsg (2,"SocketOpenCLTSServer(%s,%s,%s)\n", protocol, host, port);
SocketInitOnce();
@ -712,11 +713,11 @@ TRANS(SocketOpenCLTSServer) (Xtransport *thistrans, char *protocol,
}
if (i < 0) {
if (i == -1)
PRMSG (1,"SocketOpenCLTSServer: Unable to open socket for %s\n",
thistrans->TransName, 0, 0);
prmsg (1,"SocketOpenCLTSServer: Unable to open socket for %s\n",
thistrans->TransName);
else
PRMSG (1,"SocketOpenCLTSServer: Unable to determine socket type for %s\n",
thistrans->TransName, 0, 0);
prmsg (1,"SocketOpenCLTSServer: Unable to determine socket type for %s\n",
thistrans->TransName);
return NULL;
}
@ -746,8 +747,8 @@ TRANS(SocketReopenCOTSServer) (Xtransport *thistrans, int fd, char *port)
XtransConnInfo ciptr;
int i = -1;
PRMSG (2,
"SocketReopenCOTSServer(%d, %s)\n", fd, port, 0);
prmsg (2,
"SocketReopenCOTSServer(%d, %s)\n", fd, port);
SocketInitOnce();
@ -758,11 +759,11 @@ TRANS(SocketReopenCOTSServer) (Xtransport *thistrans, int fd, char *port)
}
if (i < 0) {
if (i == -1)
PRMSG (1,"SocketReopenCOTSServer: Unable to open socket for %s\n",
thistrans->TransName, 0, 0);
prmsg (1,"SocketReopenCOTSServer: Unable to open socket for %s\n",
thistrans->TransName);
else
PRMSG (1,"SocketReopenCOTSServer: Unable to determine socket type for %s\n",
thistrans->TransName, 0, 0);
prmsg (1,"SocketReopenCOTSServer: Unable to determine socket type for %s\n",
thistrans->TransName);
return NULL;
}
@ -780,8 +781,8 @@ TRANS(SocketReopenCLTSServer) (Xtransport *thistrans, int fd, char *port)
XtransConnInfo ciptr;
int i = -1;
PRMSG (2,
"SocketReopenCLTSServer(%d, %s)\n", fd, port, 0);
prmsg (2,
"SocketReopenCLTSServer(%d, %s)\n", fd, port);
SocketInitOnce();
@ -792,11 +793,11 @@ TRANS(SocketReopenCLTSServer) (Xtransport *thistrans, int fd, char *port)
}
if (i < 0) {
if (i == -1)
PRMSG (1,"SocketReopenCLTSServer: Unable to open socket for %s\n",
thistrans->TransName, 0, 0);
prmsg (1,"SocketReopenCLTSServer: Unable to open socket for %s\n",
thistrans->TransName);
else
PRMSG (1,"SocketReopenCLTSServer: Unable to determine socket type for %s\n",
thistrans->TransName, 0, 0);
prmsg (1,"SocketReopenCLTSServer: Unable to determine socket type for %s\n",
thistrans->TransName);
return NULL;
}
@ -814,7 +815,7 @@ static int
TRANS(SocketSetOption) (XtransConnInfo ciptr, int option, int arg)
{
PRMSG (2,"SocketSetOption(%d,%d,%d)\n", ciptr->fd, option, arg);
prmsg (2,"SocketSetOption(%d,%d,%d)\n", ciptr->fd, option, arg);
return -1;
}
@ -842,7 +843,7 @@ set_sun_path(const char *port, const char *upath, char *path, int abstract)
if (strlen(port) + strlen(upath) > maxlen)
return -1;
snprintf(path, maxlen+1, "%s%s%s", at, upath, port);
snprintf(path, sizeof(s.sun_path), "%s%s%s", at, upath, port);
return 0;
}
#endif
@ -859,7 +860,7 @@ TRANS(SocketCreateListener) (XtransConnInfo ciptr,
int fd = ciptr->fd;
int retry;
PRMSG (3, "SocketCreateListener(%x,%p)\n", ciptr, fd, 0);
prmsg (3, "SocketCreateListener(%p,%d)\n", ciptr, fd);
if (Sockettrans2devtab[ciptr->index].family == AF_INET
#if defined(IPv6) && defined(AF_INET6)
@ -880,8 +881,7 @@ TRANS(SocketCreateListener) (XtransConnInfo ciptr,
}
if (retry-- == 0) {
PRMSG (1, "SocketCreateListener: failed to bind listener\n",
0, 0, 0);
prmsg (1, "SocketCreateListener: failed to bind listener\n");
close (fd);
return TRANS_CREATE_LISTENER_FAILED;
}
@ -912,7 +912,7 @@ TRANS(SocketCreateListener) (XtransConnInfo ciptr,
if (listen (fd, BACKLOG) < 0)
{
PRMSG (1, "SocketCreateListener: listen() failed\n", 0, 0, 0);
prmsg (1, "SocketCreateListener: listen() failed\n");
close (fd);
return TRANS_CREATE_LISTENER_FAILED;
}
@ -947,7 +947,7 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int
char portbuf[PORTBUFSIZE];
#endif
PRMSG (2, "SocketINETCreateListener(%s)\n", port, 0, 0);
prmsg (2, "SocketINETCreateListener(%s)\n", port);
#ifdef X11_t
/*
@ -976,9 +976,9 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int
{
if ((servp = _XGetservbyname (port,"tcp",sparams)) == NULL)
{
PRMSG (1,
prmsg (1,
"SocketINETCreateListener: Unable to get service for %s\n",
port, 0, 0);
port);
return TRANS_CREATE_LISTENER_FAILED;
}
/* we trust getservbyname to return a valid number */
@ -1033,17 +1033,15 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int
if ((status = TRANS(SocketCreateListener) (ciptr,
(struct sockaddr *) &sockname, namelen, flags)) < 0)
{
PRMSG (1,
"SocketINETCreateListener: ...SocketCreateListener() failed\n",
0, 0, 0);
prmsg (1,
"SocketINETCreateListener: ...SocketCreateListener() failed\n");
return status;
}
if (TRANS(SocketINETGetAddr) (ciptr) < 0)
{
PRMSG (1,
"SocketINETCreateListener: ...SocketINETGetAddr() failed\n",
0, 0, 0);
prmsg (1,
"SocketINETCreateListener: ...SocketINETGetAddr() failed\n");
return TRANS_CREATE_LISTENER_FAILED;
}
@ -1072,8 +1070,8 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
abstract = ciptr->transptr->flags & TRANS_ABSTRACT;
#endif
PRMSG (2, "SocketUNIXCreateListener(%s)\n",
port ? port : "NULL", 0, 0);
prmsg (2, "SocketUNIXCreateListener(%s)\n",
port ? port : "NULL");
/* Make sure the directory is created */
@ -1086,8 +1084,8 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
mode = 0777;
#endif
if (!abstract && trans_mkdir(UNIX_DIR, mode) == -1) {
PRMSG (1, "SocketUNIXCreateListener: mkdir(%s) failed, errno = %d\n",
UNIX_DIR, errno, 0);
prmsg (1, "SocketUNIXCreateListener: mkdir(%s) failed, errno = %d\n",
UNIX_DIR, errno);
(void) umask (oldUmask);
return TRANS_CREATE_LISTENER_FAILED;
}
@ -1101,7 +1099,7 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
port = tmpport;
}
if (set_sun_path(port, UNIX_PATH, sockname.sun_path, abstract) != 0) {
PRMSG (1, "SocketUNIXCreateListener: path too long\n", 0, 0, 0);
prmsg (1, "SocketUNIXCreateListener: path too long\n");
return TRANS_CREATE_LISTENER_FAILED;
}
@ -1125,9 +1123,8 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
if ((status = TRANS(SocketCreateListener) (ciptr,
(struct sockaddr *) &sockname, namelen, flags)) < 0)
{
PRMSG (1,
"SocketUNIXCreateListener: ...SocketCreateListener() failed\n",
0, 0, 0);
prmsg (1,
"SocketUNIXCreateListener: ...SocketCreateListener() failed\n");
(void) umask (oldUmask);
return status;
}
@ -1141,11 +1138,10 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
namelen = sizeof (sockname); /* this will always make it the same size */
if ((ciptr->addr = (char *) xalloc (namelen)) == NULL)
if ((ciptr->addr = malloc (namelen)) == NULL)
{
PRMSG (1,
"SocketUNIXCreateListener: Can't allocate space for the addr\n",
0, 0, 0);
prmsg (1,
"SocketUNIXCreateListener: Can't allocate space for the addr\n");
(void) umask (oldUmask);
return TRANS_CREATE_LISTENER_FAILED;
}
@ -1180,7 +1176,7 @@ TRANS(SocketUNIXResetListener) (XtransConnInfo ciptr)
abstract = ciptr->transptr->flags & TRANS_ABSTRACT;
#endif
PRMSG (3, "SocketUNIXResetListener(%p,%d)\n", ciptr, ciptr->fd, 0);
prmsg (3, "SocketUNIXResetListener(%p,%d)\n", ciptr, ciptr->fd);
if (!abstract && (
stat (unsock->sun_path, &statb) == -1 ||
@ -1201,8 +1197,8 @@ TRANS(SocketUNIXResetListener) (XtransConnInfo ciptr)
mode = 0777;
#endif
if (trans_mkdir(UNIX_DIR, mode) == -1) {
PRMSG (1, "SocketUNIXResetListener: mkdir(%s) failed, errno = %d\n",
UNIX_DIR, errno, 0);
prmsg (1, "SocketUNIXResetListener: mkdir(%s) failed, errno = %d\n",
UNIX_DIR, errno);
(void) umask (oldUmask);
return TRANS_RESET_FAILURE;
}
@ -1254,12 +1250,11 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status)
struct sockaddr_in sockname;
SOCKLEN_T namelen = sizeof(sockname);
PRMSG (2, "SocketINETAccept(%p,%d)\n", ciptr, ciptr->fd, 0);
prmsg (2, "SocketINETAccept(%p,%d)\n", ciptr, ciptr->fd);
if ((newciptr = (XtransConnInfo) xcalloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
if ((newciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL)
{
PRMSG (1, "SocketINETAccept: malloc failed\n", 0, 0, 0);
prmsg (1, "SocketINETAccept: malloc failed\n");
*status = TRANS_ACCEPT_BAD_MALLOC;
return NULL;
}
@ -1270,8 +1265,8 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status)
#ifdef WIN32
errno = WSAGetLastError();
#endif
PRMSG (1, "SocketINETAccept: accept() failed\n", 0, 0, 0);
xfree (newciptr);
prmsg (1, "SocketINETAccept: accept() failed\n");
free (newciptr);
*status = TRANS_ACCEPT_FAILED;
return NULL;
}
@ -1295,23 +1290,21 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status)
if (TRANS(SocketINETGetAddr) (newciptr) < 0)
{
PRMSG (1,
"SocketINETAccept: ...SocketINETGetAddr() failed:\n",
0, 0, 0);
prmsg (1,
"SocketINETAccept: ...SocketINETGetAddr() failed:\n");
close (newciptr->fd);
xfree (newciptr);
free (newciptr);
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
}
if (TRANS(SocketINETGetPeerAddr) (newciptr) < 0)
{
PRMSG (1,
"SocketINETAccept: ...SocketINETGetPeerAddr() failed:\n",
0, 0, 0);
prmsg (1,
"SocketINETAccept: ...SocketINETGetPeerAddr() failed:\n");
close (newciptr->fd);
if (newciptr->addr) xfree (newciptr->addr);
xfree (newciptr);
if (newciptr->addr) free (newciptr->addr);
free (newciptr);
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
}
@ -1333,12 +1326,11 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
struct sockaddr_un sockname;
SOCKLEN_T namelen = sizeof sockname;
PRMSG (2, "SocketUNIXAccept(%p,%d)\n", ciptr, ciptr->fd, 0);
prmsg (2, "SocketUNIXAccept(%p,%d)\n", ciptr, ciptr->fd);
if ((newciptr = (XtransConnInfo) xcalloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
if ((newciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL)
{
PRMSG (1, "SocketUNIXAccept: malloc() failed\n", 0, 0, 0);
prmsg (1, "SocketUNIXAccept: malloc() failed\n");
*status = TRANS_ACCEPT_BAD_MALLOC;
return NULL;
}
@ -1346,8 +1338,8 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
if ((newciptr->fd = accept (ciptr->fd,
(struct sockaddr *) &sockname, (void *)&namelen)) < 0)
{
PRMSG (1, "SocketUNIXAccept: accept() failed\n", 0, 0, 0);
xfree (newciptr);
prmsg (1, "SocketUNIXAccept: accept() failed\n");
free (newciptr);
*status = TRANS_ACCEPT_FAILED;
return NULL;
}
@ -1358,13 +1350,12 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
* since this is unix domain.
*/
if ((newciptr->addr = (char *) xalloc (ciptr->addrlen)) == NULL)
if ((newciptr->addr = malloc (ciptr->addrlen)) == NULL)
{
PRMSG (1,
"SocketUNIXAccept: Can't allocate space for the addr\n",
0, 0, 0);
prmsg (1,
"SocketUNIXAccept: Can't allocate space for the addr\n");
close (newciptr->fd);
xfree (newciptr);
free (newciptr);
*status = TRANS_ACCEPT_BAD_MALLOC;
return NULL;
}
@ -1377,14 +1368,13 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
newciptr->addrlen = ciptr->addrlen;
memcpy (newciptr->addr, ciptr->addr, newciptr->addrlen);
if ((newciptr->peeraddr = (char *) xalloc (ciptr->addrlen)) == NULL)
if ((newciptr->peeraddr = malloc (ciptr->addrlen)) == NULL)
{
PRMSG (1,
"SocketUNIXAccept: Can't allocate space for the addr\n",
0, 0, 0);
prmsg (1,
"SocketUNIXAccept: Can't allocate space for the addr\n");
close (newciptr->fd);
if (newciptr->addr) xfree (newciptr->addr);
xfree (newciptr);
if (newciptr->addr) free (newciptr->addr);
free (newciptr);
*status = TRANS_ACCEPT_BAD_MALLOC;
return NULL;
}
@ -1430,23 +1420,23 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
struct addrinfo hints;
char ntopbuf[INET6_ADDRSTRLEN];
int resetonce = 0;
#endif
#else
struct sockaddr_in sockname;
struct hostent *hostp;
struct servent *servp;
unsigned long tmpaddr;
#endif
#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
_Xgethostbynameparams hparams;
_Xgetservbynameparams sparams;
#endif
struct hostent *hostp;
struct servent *servp;
unsigned long tmpaddr;
#ifdef X11_t
char portbuf[PORTBUFSIZE];
#endif
long tmpport;
char hostnamebuf[256]; /* tmp space */
PRMSG (2,"SocketINETConnect(%d,%s,%s)\n", ciptr->fd, host, port);
prmsg (2,"SocketINETConnect(%d,%s,%s)\n", ciptr->fd, host, port);
if (!host)
{
@ -1467,7 +1457,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
if (is_numeric (port))
{
tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10);
long tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10);
snprintf (portbuf, sizeof(portbuf), "%lu", tmpport);
port = portbuf;
}
@ -1497,7 +1487,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
res = getaddrinfo(host,port,&hints,&addrlist->firstaddr);
if (res != 0) {
PRMSG (1, "SocketINETConnect() can't get address "
prmsg (1, "SocketINETConnect() can't get address "
"for %s:%s: %s\n", host, port, gai_strerror(res));
ESET(EINVAL);
return TRANS_CONNECT_FAILED;
@ -1506,7 +1496,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
addrlist->addr ; res++) {
addrlist->addr = addrlist->addr->ai_next;
}
PRMSG(4,"Got New Address list with %d addresses\n", res, 0, 0);
prmsg(4,"Got New Address list with %d addresses\n", res);
res = 0;
addrlist->addr = NULL;
}
@ -1515,8 +1505,8 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
if (addrlist->addr == NULL) {
if (resetonce) {
/* Already checked entire list - no usable addresses */
PRMSG (1, "SocketINETConnect() no usable address "
"for %s:%s\n", host, port, 0);
prmsg (1, "SocketINETConnect() no usable address "
"for %s:%s\n", host, port);
return TRANS_CONNECT_FAILED;
} else {
/* Go back to beginning of list */
@ -1531,12 +1521,12 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
if (addrlist->addr->ai_family == AF_INET) {
struct sockaddr_in *sin = (struct sockaddr_in *) socketaddr;
PRMSG (4,"SocketINETConnect() sockname.sin_addr = %s\n",
prmsg (4,"SocketINETConnect() sockname.sin_addr = %s\n",
inet_ntop(addrlist->addr->ai_family,&sin->sin_addr,
ntopbuf,sizeof(ntopbuf)), 0, 0);
ntopbuf,sizeof(ntopbuf)));
PRMSG (4,"SocketINETConnect() sockname.sin_port = %d\n",
ntohs(sin->sin_port), 0, 0);
prmsg (4,"SocketINETConnect() sockname.sin_port = %d\n",
ntohs(sin->sin_port));
if (Sockettrans2devtab[ciptr->index].family == AF_INET6) {
if (strcmp(Sockettrans2devtab[ciptr->index].transname,
@ -1558,26 +1548,24 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
Sockettrans2devtab[newciptr->index].family !=
AF_INET) {
socketaddr = NULL;
PRMSG (4,"SocketINETConnect() Cannot get IPv4 "
" socketfor IPv4 address\n", 0,0,0);
prmsg (4,"SocketINETConnect() Cannot get IPv4 "
" socketfor IPv4 address\n");
}
if (newciptr)
xfree(newciptr);
free(newciptr);
} else {
socketaddr = NULL;
PRMSG (4,"SocketINETConnect Skipping IPv4 address\n",
0,0,0);
prmsg (4,"SocketINETConnect Skipping IPv4 address\n");
}
}
} else if (addrlist->addr->ai_family == AF_INET6) {
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) socketaddr;
PRMSG (4,"SocketINETConnect() sockname.sin6_addr = %s\n",
prmsg (4,"SocketINETConnect() sockname.sin6_addr = %s\n",
inet_ntop(addrlist->addr->ai_family,
&sin6->sin6_addr,ntopbuf,sizeof(ntopbuf)),
0, 0);
PRMSG (4,"SocketINETConnect() sockname.sin6_port = %d\n",
ntohs(sin6->sin6_port), 0, 0);
&sin6->sin6_addr,ntopbuf,sizeof(ntopbuf)));
prmsg (4,"SocketINETConnect() sockname.sin6_port = %d\n",
ntohs(sin6->sin6_port));
if (Sockettrans2devtab[ciptr->index].family == AF_INET) {
if (strcmp(Sockettrans2devtab[ciptr->index].transname,
@ -1596,17 +1584,16 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
Sockettrans2devtab[newciptr->index].family !=
AF_INET6) {
socketaddr = NULL;
PRMSG (4,"SocketINETConnect() Cannot get IPv6 "
"socket for IPv6 address\n", 0,0,0);
prmsg (4,"SocketINETConnect() Cannot get IPv6 "
"socket for IPv6 address\n");
}
if (newciptr)
xfree(newciptr);
free(newciptr);
}
else
{
socketaddr = NULL;
PRMSG (4,"SocketINETConnect() Skipping IPv6 address\n",
0,0,0);
prmsg (4,"SocketINETConnect() Skipping IPv6 address\n");
}
}
} else {
@ -1644,17 +1631,17 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
tmpaddr = INADDR_NONE;
}
PRMSG (4,"SocketINETConnect() inet_addr(%s) = %x\n", host, tmpaddr, 0);
prmsg (4,"SocketINETConnect() inet_addr(%s) = %x\n", host, tmpaddr);
if (tmpaddr == INADDR_NONE) {
if ((hostp = _XGethostbyname(host,hparams)) == NULL) {
PRMSG (1,"SocketINETConnect: Can't get address for %s\n",
host, 0, 0);
prmsg (1,"SocketINETConnect: Can't get address for %s\n",
host);
ESET(EINVAL);
return TRANS_CONNECT_FAILED;
}
if (hostp->h_addrtype != AF_INET) { /* is IP host? */
PRMSG (1,"SocketINETConnect: not INET host%s\n", host, 0, 0);
prmsg (1,"SocketINETConnect: not INET host%s\n", host);
ESET(EPROTOTYPE);
return TRANS_CONNECT_FAILED;
}
@ -1674,20 +1661,20 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
if (!is_numeric (port)) {
if ((servp = _XGetservbyname (port,"tcp",sparams)) == NULL) {
PRMSG (1,"SocketINETConnect: can't get service for %s\n",
port, 0, 0);
prmsg (1,"SocketINETConnect: can't get service for %s\n",
port);
return TRANS_CONNECT_FAILED;
}
sockname.sin_port = htons (servp->s_port);
} else {
tmpport = strtol (port, (char**)NULL, 10);
long tmpport = strtol (port, (char**)NULL, 10);
if (tmpport < 1024 || tmpport > USHRT_MAX)
return TRANS_CONNECT_FAILED;
sockname.sin_port = htons (((unsigned short) tmpport));
}
PRMSG (4,"SocketINETConnect: sockname.sin_port = %d\n",
ntohs(sockname.sin_port), 0, 0);
prmsg (4,"SocketINETConnect: sockname.sin_port = %d\n",
ntohs(sockname.sin_port));
socketaddr = (struct sockaddr *) &sockname;
socketaddrlen = sizeof(sockname);
}
@ -1757,8 +1744,8 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
res = TRANS_IN_PROGRESS;
else
{
PRMSG (2,"SocketINETConnect: Can't connect: errno = %d\n",
olderrno,0, 0);
prmsg (2,"SocketINETConnect: Can't connect: errno = %d\n",
olderrno);
res = TRANS_CONNECT_FAILED;
}
@ -1772,17 +1759,15 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
if (TRANS(SocketINETGetAddr) (ciptr) < 0)
{
PRMSG (1,
"SocketINETConnect: ...SocketINETGetAddr() failed:\n",
0, 0, 0);
prmsg (1,
"SocketINETConnect: ...SocketINETGetAddr() failed:\n");
res = TRANS_CONNECT_FAILED;
}
else if (TRANS(SocketINETGetPeerAddr) (ciptr) < 0)
{
PRMSG (1,
"SocketINETConnect: ...SocketINETGetPeerAddr() failed:\n",
0, 0, 0);
prmsg (1,
"SocketINETConnect: ...SocketINETGetPeerAddr() failed:\n");
res = TRANS_CONNECT_FAILED;
}
}
@ -1950,7 +1935,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
abstract = ciptr->transptr->flags & TRANS_ABSTRACT;
#endif
PRMSG (2,"SocketUNIXConnect(%d,%s,%s)\n", ciptr->fd, host, port);
prmsg (2,"SocketUNIXConnect(%d,%s,%s)\n", ciptr->fd, host, port);
/*
* Make sure 'host' is really local. If not, we return failure.
@ -1962,9 +1947,9 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
if (host && *host && host[0]!='/' && strcmp (host, "unix") != 0 && !UnixHostReallyLocal (host))
{
PRMSG (1,
prmsg (1,
"SocketUNIXConnect: Cannot connect to non-local host %s\n",
host, 0, 0);
host);
return TRANS_CONNECT_FAILED;
}
@ -1975,8 +1960,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
if (!port || !*port)
{
PRMSG (1,"SocketUNIXConnect: Missing port specification\n",
0, 0, 0);
prmsg (1,"SocketUNIXConnect: Missing port specification\n");
return TRANS_CONNECT_FAILED;
}
@ -1987,7 +1971,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
sockname.sun_family = AF_UNIX;
if (set_sun_path(port, UNIX_PATH, sockname.sun_path, abstract) != 0) {
PRMSG (1, "SocketUNIXConnect: path too long\n", 0, 0, 0);
prmsg (1, "SocketUNIXConnect: path too long\n");
return TRANS_CONNECT_FAILED;
}
@ -2054,8 +2038,8 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
return TRANS_CONNECT_FAILED;
}
} else {
PRMSG (2,"SocketUNIXConnect: Can't connect: errno = %d\n",
EGET(),0, 0);
prmsg (2,"SocketUNIXConnect: Can't connect: errno = %d\n",
EGET());
return TRANS_CONNECT_FAILED;
}
@ -2067,12 +2051,11 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
* since this is unix domain.
*/
if ((ciptr->addr = (char *) xalloc(namelen)) == NULL ||
(ciptr->peeraddr = (char *) xalloc(namelen)) == NULL)
if ((ciptr->addr = malloc(namelen)) == NULL ||
(ciptr->peeraddr = malloc(namelen)) == NULL)
{
PRMSG (1,
"SocketUNIXCreateListener: Can't allocate space for the addr\n",
0, 0, 0);
prmsg (1,
"SocketUNIXCreateListener: Can't allocate space for the addr\n");
return TRANS_CONNECT_FAILED;
}
@ -2097,7 +2080,7 @@ static int
TRANS(SocketBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend)
{
PRMSG (2,"SocketBytesReadable(%p,%d,%p)\n",
prmsg (2,"SocketBytesReadable(%p,%d,%p)\n",
ciptr, ciptr->fd, pend);
#ifdef WIN32
{
@ -2119,7 +2102,7 @@ static int
TRANS(SocketRead) (XtransConnInfo ciptr, char *buf, int size)
{
PRMSG (2,"SocketRead(%d,%p,%d)\n", ciptr->fd, buf, size);
prmsg (2,"SocketRead(%d,%p,%d)\n", ciptr->fd, buf, size);
#if defined(WIN32)
{
@ -2139,7 +2122,7 @@ static int
TRANS(SocketWrite) (XtransConnInfo ciptr, char *buf, int size)
{
PRMSG (2,"SocketWrite(%d,%p,%d)\n", ciptr->fd, buf, size);
prmsg (2,"SocketWrite(%d,%p,%d)\n", ciptr->fd, buf, size);
#if defined(WIN32)
{
@ -2159,7 +2142,7 @@ static int
TRANS(SocketReadv) (XtransConnInfo ciptr, struct iovec *buf, int size)
{
PRMSG (2,"SocketReadv(%d,%p,%d)\n", ciptr->fd, buf, size);
prmsg (2,"SocketReadv(%d,%p,%d)\n", ciptr->fd, buf, size);
return READV (ciptr, buf, size);
}
@ -2169,7 +2152,7 @@ static int
TRANS(SocketWritev) (XtransConnInfo ciptr, struct iovec *buf, int size)
{
PRMSG (2,"SocketWritev(%d,%p,%d)\n", ciptr->fd, buf, size);
prmsg (2,"SocketWritev(%d,%p,%d)\n", ciptr->fd, buf, size);
return WRITEV (ciptr, buf, size);
}
@ -2179,7 +2162,7 @@ static int
TRANS(SocketDisconnect) (XtransConnInfo ciptr)
{
PRMSG (2,"SocketDisconnect(%p,%d)\n", ciptr, ciptr->fd, 0);
prmsg (2,"SocketDisconnect(%p,%d)\n", ciptr, ciptr->fd);
#ifdef WIN32
{
@ -2198,7 +2181,7 @@ static int
TRANS(SocketINETClose) (XtransConnInfo ciptr)
{
PRMSG (2,"SocketINETClose(%p,%d)\n", ciptr, ciptr->fd, 0);
prmsg (2,"SocketINETClose(%p,%d)\n", ciptr, ciptr->fd);
#ifdef WIN32
{
@ -2226,7 +2209,7 @@ TRANS(SocketUNIXClose) (XtransConnInfo ciptr)
struct sockaddr_un *sockname = (struct sockaddr_un *) ciptr->addr;
int ret;
PRMSG (2,"SocketUNIXClose(%p,%d)\n", ciptr, ciptr->fd, 0);
prmsg (2,"SocketUNIXClose(%p,%d)\n", ciptr, ciptr->fd);
ret = close(ciptr->fd);
@ -2253,8 +2236,8 @@ TRANS(SocketUNIXCloseForCloning) (XtransConnInfo ciptr)
int ret;
PRMSG (2,"SocketUNIXCloseForCloning(%p,%d)\n",
ciptr, ciptr->fd, 0);
prmsg (2,"SocketUNIXCloseForCloning(%p,%d)\n",
ciptr, ciptr->fd);
ret = close(ciptr->fd);
@ -2266,7 +2249,7 @@ TRANS(SocketUNIXCloseForCloning) (XtransConnInfo ciptr)
#ifdef TCPCONN
# ifdef TRANS_SERVER
static char* tcp_nolisten[] = {
static const char* tcp_nolisten[] = {
"inet",
#if defined(IPv6) && defined(AF_INET6)
"inet6",

View File

@ -123,7 +123,7 @@ TRANS(TLISelectFamily)(char *family)
{
int i;
PRMSG(3,"TLISelectFamily(%s)\n", family, 0,0 );
prmsg(3,"TLISelectFamily(%s)\n", family);
for(i=0;i<NUMTLIFAMILIES;i++)
{
@ -146,7 +146,7 @@ TRANS(TLIGetAddr)(XtransConnInfo ciptr)
Xtransaddr sockname;
struct netbuf netbuf;
PRMSG(3,"TLIGetAddr(%x)\n", ciptr, 0,0 );
prmsg(3,"TLIGetAddr(%x)\n", ciptr);
netbuf.buf=(char *)&sockname;
netbuf.len=sizeof(sockname);
@ -154,25 +154,24 @@ TRANS(TLIGetAddr)(XtransConnInfo ciptr)
if( t_getname(ciptr->fd,&netbuf,LOCALNAME) < 0 )
{
PRMSG(1,"TLIGetAddr: t_getname(LOCALNAME) failed: %d\n",
errno, 0,0 );
prmsg(1,"TLIGetAddr: t_getname(LOCALNAME) failed: %d\n",
errno);
return -1;
}
PRMSG(4,"TLIGetAddr: got family %d len %d\n",
((struct sockaddr *) &sockname)->sa_family ,netbuf.len, 0 );
prmsg(4,"TLIGetAddr: got family %d len %d\n",
((struct sockaddr *) &sockname)->sa_family ,netbuf.len);
/*
* Everything looks good: fill in the XtransConnInfo structure.
*/
if( ciptr->addr )
xfree(ciptr->addr);
free(ciptr->addr);
if( (ciptr->addr=(char *)xalloc(netbuf.len)) == NULL )
if( (ciptr->addr = malloc(netbuf.len)) == NULL )
{
PRMSG(1, "TLIGetAddr: Can't allocate space for the addr\n",
0,0,0);
prmsg(1, "TLIGetAddr: Can't allocate space for the addr\n");
return -1;
}
@ -196,7 +195,7 @@ TRANS(TLIGetPeerAddr)(XtransConnInfo ciptr)
Xtransaddr sockname;
struct netbuf netbuf;
PRMSG(3,"TLIGetPeerAddr(%x)\n", ciptr, 0,0 );
prmsg(3,"TLIGetPeerAddr(%x)\n", ciptr);
netbuf.buf=(char *)&sockname;
netbuf.len=sizeof(sockname);
@ -204,26 +203,25 @@ TRANS(TLIGetPeerAddr)(XtransConnInfo ciptr)
if( t_getname(ciptr->fd,&netbuf,REMOTENAME) < 0 )
{
PRMSG(1,"TLIGetPeerAddr: t_getname(REMOTENAME) failed: %d\n",
errno, 0,0 );
prmsg(1,"TLIGetPeerAddr: t_getname(REMOTENAME) failed: %d\n",
errno);
return -1;
}
PRMSG(4,"TLIGetPeerAddr: got family %d len %d\n",
((struct sockaddr *) &sockname)->sa_family ,netbuf.len, 0 );
prmsg(4,"TLIGetPeerAddr: got family %d len %d\n",
((struct sockaddr *) &sockname)->sa_family ,netbuf.len);
/*
* Everything looks good: fill in the XtransConnInfo structure.
*/
if( ciptr->peeraddr )
xfree(ciptr->peeraddr);
free(ciptr->peeraddr);
if( (ciptr->peeraddr=(char *)xalloc(netbuf.len)) == NULL )
if( (ciptr->peeraddr = malloc(netbuf.len)) == NULL )
{
PRMSG(1,
"TLIGetPeerAddr: Can't allocate space for the addr\n",
0,0,0);
prmsg(1,
"TLIGetPeerAddr: Can't allocate space for the addr\n");
return -1;
}
@ -251,24 +249,22 @@ TRANS(TLITLIBindLocal)(int fd, int family, char *port)
struct sockaddr_un *sunaddr=NULL;
struct t_bind *req=NULL;
PRMSG(2, "TLITLIBindLocal(%d,%d,%s)\n", fd, family, port);
prmsg(2, "TLITLIBindLocal(%d,%d,%s)\n", fd, family, port);
if( family == AF_UNIX )
{
if( (req=(struct t_bind *)t_alloc(fd,T_BIND,0)) == NULL )
{
PRMSG(1,
"TLITLIBindLocal() failed to allocate a t_bind\n",
0,0,0 );
prmsg(1,
"TLITLIBindLocal() failed to allocate a t_bind\n");
return -1;
}
if( (sunaddr=(struct sockaddr_un *)
malloc(sizeof(struct sockaddr_un))) == NULL )
{
PRMSG(1,
"TLITLIBindLocal: failed to allocate a sockaddr_un\n",
0,0,0 );
prmsg(1,
"TLITLIBindLocal: failed to allocate a sockaddr_un\n");
t_free((char *)req,T_BIND);
return -1;
}
@ -286,8 +282,8 @@ TRANS(TLITLIBindLocal)(int fd, int family, char *port)
(void) sprintf(sunaddr->sun_path,"%s%d",
TLINODENAME, getpid()^time(NULL) );
PRMSG(4, "TLITLIBindLocal: binding to %s\n",
sunaddr->sun_path, 0,0);
prmsg(4, "TLITLIBindLocal: binding to %s\n",
sunaddr->sun_path);
req->addr.buf=(char *)sunaddr;
req->addr.len=sizeof(*sunaddr);
@ -296,9 +292,9 @@ TRANS(TLITLIBindLocal)(int fd, int family, char *port)
if( t_bind(fd, req, NULL) < 0 )
{
PRMSG(1,
prmsg(1,
"TLIBindLocal: Unable to bind TLI device to %s\n",
port, 0,0 );
port);
if (sunaddr)
free((char *) sunaddr);
if (req)
@ -314,17 +310,17 @@ TRANS(TLIOpen)(char *device)
{
XtransConnInfo ciptr;
PRMSG(3,"TLIOpen(%s)\n", device, 0,0 );
prmsg(3,"TLIOpen(%s)\n", device);
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
if( (ciptr = calloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
PRMSG(1, "TLIOpen: calloc failed\n", 0,0,0 );
prmsg(1, "TLIOpen: calloc failed\n");
return NULL;
}
if( (ciptr->fd=t_open( device, O_RDWR, NULL )) < 0 )
{
PRMSG(1, "TLIOpen: t_open failed for %s\n", device, 0,0 );
prmsg(1, "TLIOpen: t_open failed for %s\n", device);
free(ciptr);
return NULL;
}
@ -341,17 +337,17 @@ TRANS(TLIReopen)(char *device, int fd, char *port)
{
XtransConnInfo ciptr;
PRMSG(3,"TLIReopen(%s,%d, %s)\n", device, fd, port );
prmsg(3,"TLIReopen(%s,%d, %s)\n", device, fd, port );
if (t_sync (fd) < 0)
{
PRMSG(1, "TLIReopen: t_sync failed\n", 0,0,0 );
prmsg(1, "TLIReopen: t_sync failed\n");
return NULL;
}
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
if( (ciptr = calloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
PRMSG(1, "TLIReopen: calloc failed\n", 0,0,0 );
prmsg(1, "TLIReopen: calloc failed\n");
return NULL;
}
@ -374,7 +370,7 @@ TRANS(TLIAddrToNetbuf)(int tlifamily, char *host, char *port,
void *handlep;
long lport;
PRMSG(3,"TLIAddrToNetbuf(%d,%s,%s)\n", tlifamily, host, port );
prmsg(3,"TLIAddrToNetbuf(%d,%s,%s)\n", tlifamily, host, port );
if( (handlep=setnetconfig()) == NULL )
return -1;
@ -395,15 +391,14 @@ TRANS(TLIAddrToNetbuf)(int tlifamily, char *host, char *port,
if( strcmp(netconfigp->nc_protofmly,
TLItrans2devtab[tlifamily].protofamily) != 0 )
continue;
PRMSG(5,"TLIAddrToNetbuf: Trying to resolve %s.%s for %s\n",
prmsg(5,"TLIAddrToNetbuf: Trying to resolve %s.%s for %s\n",
host, port, TLItrans2devtab[tlifamily].protofamily );
if( netdir_getbyname(netconfigp,&nd_hostserv, &nd_addrlistp) == 0 )
{
/* we have at least one address to use */
PRMSG(5, "TLIAddrToNetbuf: found address for %s.%s\n", host, port, 0 );
PRMSG(5, "TLIAddrToNetbuf: %s\n",taddr2uaddr(netconfigp,nd_addrlistp->n_addrs),
0,0 );
prmsg(5, "TLIAddrToNetbuf: found address for %s.%s\n", host, port);
prmsg(5, "TLIAddrToNetbuf: %s\n",taddr2uaddr(netconfigp,nd_addrlistp->n_addrs));
memcpy(netbufp->buf,nd_addrlistp->n_addrs->buf,
nd_addrlistp->n_addrs->len);
@ -431,39 +426,39 @@ TRANS(TLIOpenCOTSClient)(Xtransport *thistrans, char *protocol,
XtransConnInfo ciptr;
int i;
PRMSG(2,"TLIOpenCOTSClient(%s,%s,%s)\n", protocol, host, port );
prmsg(2,"TLIOpenCOTSClient(%s,%s,%s)\n", protocol, host, port );
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
PRMSG(1,"TLIOpenCOTSClient: Unable to determine device for %s\n",
thistrans->TransName, 0,0 );
prmsg(1,"TLIOpenCOTSClient: Unable to determine device for %s\n",
thistrans->TransName);
return NULL;
}
if( (ciptr=TRANS(TLIOpen)(TLItrans2devtab[i].devcotsname)) == NULL )
{
PRMSG(1,"TLIOpenCOTSClient: Unable to open device for %s\n",
thistrans->TransName, 0,0 );
prmsg(1,"TLIOpenCOTSClient: Unable to open device for %s\n",
thistrans->TransName);
return NULL;
}
if( TRANS(TLITLIBindLocal)(ciptr->fd,TLItrans2devtab[i].family,port) < 0 )
{
PRMSG(1,
prmsg(1,
"TLIOpenCOTSClient: ...TLITLIBindLocal() failed: %d\n",
errno, 0,0 );
errno);
t_close(ciptr->fd);
xfree(ciptr);
free(ciptr);
return NULL;
}
if( TRANS(TLIGetAddr)(ciptr) < 0 )
{
PRMSG(1,
prmsg(1,
"TLIOpenCOTSClient: ...TLIGetAddr() failed: %d\n",
errno, 0,0 );
errno);
t_close(ciptr->fd);
xfree(ciptr);
free(ciptr);
return NULL;
}
@ -486,21 +481,21 @@ TRANS(TLIOpenCOTSServer)(Xtransport *thistrans, char *protocol,
XtransConnInfo ciptr;
int i;
PRMSG(2,"TLIOpenCOTSServer(%s,%s,%s)\n", protocol, host, port );
prmsg(2,"TLIOpenCOTSServer(%s,%s,%s)\n", protocol, host, port );
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
PRMSG(1,
prmsg(1,
"TLIOpenCOTSServer: Unable to determine device for %s\n",
thistrans->TransName, 0,0 );
thistrans->TransName);
return NULL;
}
if( (ciptr=TRANS(TLIOpen)(TLItrans2devtab[i].devcotsname)) == NULL )
{
PRMSG(1,
prmsg(1,
"TLIOpenCOTSServer: Unable to open device for %s\n",
thistrans->TransName, 0,0 );
thistrans->TransName);
return NULL;
}
@ -529,41 +524,41 @@ TRANS(TLIOpenCLTSClient)(Xtransport *thistrans, char *protocol,
XtransConnInfo ciptr;
int i;
PRMSG(2,"TLIOpenCLTSClient(%s,%s,%s)\n", protocol, host, port );
prmsg(2,"TLIOpenCLTSClient(%s,%s,%s)\n", protocol, host, port );
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
PRMSG(1,
prmsg(1,
"TLIOpenCLTSClient: Unable to determine device for %s\n",
thistrans->TransName, 0,0 );
thistrans->TransName);
return NULL;
}
if( (ciptr=TRANS(TLIOpen)(TLItrans2devtab[i].devcltsname)) == NULL )
{
PRMSG(1,
prmsg(1,
"TLIOpenCLTSClient: Unable to open device for %s\n",
thistrans->TransName, 0,0 );
thistrans->TransName);
return NULL;
}
if( TRANS(TLITLIBindLocal)(ciptr->fd,TLItrans2devtab[i].family,port) < 0 )
{
PRMSG(1,
prmsg(1,
"TLIOpenCLTSClient: ...TLITLIBindLocal() failed: %d\n",
errno, 0,0 );
errno);
t_close(ciptr->fd);
xfree(ciptr);
free(ciptr);
return NULL;
}
if( TRANS(TLIGetAddr)(ciptr) < 0 )
{
PRMSG(1,
prmsg(1,
"TLIOpenCLTSClient: ...TLIGetPeerAddr() failed: %d\n",
errno, 0,0 );
errno);
t_close(ciptr->fd);
xfree(ciptr);
free(ciptr);
return NULL;
}
@ -583,21 +578,21 @@ TRANS(TLIOpenCLTSServer)(Xtransport *thistrans, char *protocol,
XtransConnInfo ciptr;
int i;
PRMSG(2,"TLIOpenCLTSServer(%s,%s,%s)\n", protocol, host, port );
prmsg(2,"TLIOpenCLTSServer(%s,%s,%s)\n", protocol, host, port );
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
PRMSG(1,
prmsg(1,
"TLIOpenCLTSServer: Unable to determine device for %s\n",
thistrans->TransName, 0,0 );
thistrans->TransName);
return NULL;
}
if( (ciptr=TRANS(TLIOpen)(TLItrans2devtab[i].devcltsname)) == NULL )
{
PRMSG(1,
prmsg(1,
"TLIOpenCLTSServer: Unable to open device for %s\n",
thistrans->TransName, 0,0 );
thistrans->TransName);
return NULL;
}
@ -616,22 +611,22 @@ TRANS(TLIReopenCOTSServer)(Xtransport *thistrans, int fd, char *port)
XtransConnInfo ciptr;
int i;
PRMSG(2,"TLIReopenCOTSServer(%d, %s)\n", fd, port, 0 );
prmsg(2,"TLIReopenCOTSServer(%d, %s)\n", fd, port);
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
PRMSG(1,
prmsg(1,
"TLIReopenCOTSServer: Unable to determine device for %s\n",
thistrans->TransName, 0,0 );
thistrans->TransName);
return NULL;
}
if( (ciptr=TRANS(TLIReopen)(
TLItrans2devtab[i].devcotsname, fd, port)) == NULL )
{
PRMSG(1,
prmsg(1,
"TLIReopenCOTSServer: Unable to open device for %s\n",
thistrans->TransName, 0,0 );
thistrans->TransName);
return NULL;
}
@ -650,22 +645,22 @@ TRANS(TLIReopenCLTSServer)(Xtransport *thistrans, int fd, char *port)
XtransConnInfo ciptr;
int i;
PRMSG(2,"TLIReopenCLTSServer(%d, %s)\n", fd, port, 0 );
prmsg(2,"TLIReopenCLTSServer(%d, %s)\n", fd, port);
if( (i=TRANS(TLISelectFamily)(thistrans->TransName)) < 0 )
{
PRMSG(1,
prmsg(1,
"TLIReopenCLTSServer: Unable to determine device for %s\n",
thistrans->TransName, 0,0 );
thistrans->TransName);
return NULL;
}
if( (ciptr=TRANS(TLIReopen)(
TLItrans2devtab[i].devcltsname, fd, port)) == NULL )
{
PRMSG(1,
prmsg(1,
"TLIReopenCLTSServer: Unable to open device for %s\n",
thistrans->TransName, 0,0 );
thistrans->TransName);
return NULL;
}
@ -681,7 +676,7 @@ static int
TRANS(TLISetOption)(XtransConnInfo ciptr, int option, int arg)
{
PRMSG(2,"TLISetOption(%d,%d,%d)\n", ciptr->fd, option, arg );
prmsg(2,"TLISetOption(%d,%d,%d)\n", ciptr->fd, option, arg );
return -1;
}
@ -695,19 +690,18 @@ TRANS(TLICreateListener)(XtransConnInfo ciptr, struct t_bind *req)
{
struct t_bind *ret;
PRMSG(2,"TLICreateListener(%x->%d,%x)\n", ciptr, ciptr->fd, req );
prmsg(2,"TLICreateListener(%x->%d,%x)\n", ciptr, ciptr->fd, req );
if( (ret=(struct t_bind *)t_alloc(ciptr->fd,T_BIND,T_ALL)) == NULL )
{
PRMSG(1, "TLICreateListener: failed to allocate a t_bind\n",
0,0,0 );
prmsg(1, "TLICreateListener: failed to allocate a t_bind\n");
t_free((char *)req,T_BIND);
return TRANS_CREATE_LISTENER_FAILED;
}
if( t_bind(ciptr->fd, req, ret) < 0 )
{
PRMSG(1, "TLICreateListener: t_bind failed\n", 0,0,0 );
prmsg(1, "TLICreateListener: t_bind failed\n");
t_free((char *)req,T_BIND);
t_free((char *)ret,T_BIND);
return TRANS_CREATE_LISTENER_FAILED;
@ -715,8 +709,8 @@ TRANS(TLICreateListener)(XtransConnInfo ciptr, struct t_bind *req)
if( memcmp(req->addr.buf,ret->addr.buf,req->addr.len) != 0 )
{
PRMSG(1, "TLICreateListener: unable to bind to %x\n",
req, 0,0 );
prmsg(1, "TLICreateListener: unable to bind to %x\n",
req);
t_free((char *)req,T_BIND);
t_free((char *)ret,T_BIND);
return TRANS_ADDR_IN_USE;
@ -726,11 +720,10 @@ TRANS(TLICreateListener)(XtransConnInfo ciptr, struct t_bind *req)
* Everything looks good: fill in the XtransConnInfo structure.
*/
if( (ciptr->addr=(char *)xalloc(ret->addr.len)) == NULL )
if( (ciptr->addr = malloc(ret->addr.len)) == NULL )
{
PRMSG(1,
"TLICreateListener: Unable to allocate space for the address\n",
0,0,0 );
prmsg(1,
"TLICreateListener: Unable to allocate space for the address\n");
t_free((char *)req,T_BIND);
t_free((char *)ret, T_BIND);
return TRANS_CREATE_LISTENER_FAILED;
@ -755,7 +748,7 @@ TRANS(TLIINETCreateListener)(XtransConnInfo ciptr, char *port, unsigned int flag
struct sockaddr_in *sinaddr;
long tmpport;
PRMSG(2,"TLIINETCreateListener(%x->%d,%s)\n", ciptr,
prmsg(2,"TLIINETCreateListener(%x->%d,%s)\n", ciptr,
ciptr->fd, port ? port : "NULL" );
#ifdef X11_t
@ -778,18 +771,17 @@ TRANS(TLIINETCreateListener)(XtransConnInfo ciptr, char *port, unsigned int flag
if( (req=(struct t_bind *)t_alloc(ciptr->fd,T_BIND,T_ALL)) == NULL )
{
PRMSG(1,
"TLIINETCreateListener: failed to allocate a t_bind\n",
0,0,0 );
prmsg(1,
"TLIINETCreateListener: failed to allocate a t_bind\n");
return TRANS_CREATE_LISTENER_FAILED;
}
if( port && *port ) {
if(TRANS(TLIAddrToNetbuf)(ciptr->index,HOST_SELF,port,&(req->addr)) < 0)
{
PRMSG(1,
prmsg(1,
"TLIINETCreateListener: can't resolve name:HOST_SELF.%s\n",
port, 0,0 );
port);
t_free((char *)req,T_BIND);
return TRANS_CREATE_LISTENER_FAILED;
}
@ -816,23 +808,21 @@ TRANS(TLITLICreateListener)(XtransConnInfo ciptr, char *port, unsigned int flags
struct sockaddr_un *sunaddr;
int ret_value;
PRMSG(2,"TLITLICreateListener(%x->%d,%s)\n", ciptr, ciptr->fd,
prmsg(2,"TLITLICreateListener(%x->%d,%s)\n", ciptr, ciptr->fd,
port ? port : "NULL");
if( (req=(struct t_bind *)t_alloc(ciptr->fd,T_BIND,0)) == NULL )
{
PRMSG(1,
"TLITLICreateListener: failed to allocate a t_bind\n",
0,0,0 );
prmsg(1,
"TLITLICreateListener: failed to allocate a t_bind\n");
return TRANS_CREATE_LISTENER_FAILED;
}
if( (sunaddr=(struct sockaddr_un *)
malloc(sizeof(struct sockaddr_un))) == NULL )
{
PRMSG(1,
"TLITLICreateListener: failed to allocate a sockaddr_un\n",
0,0,0 );
prmsg(1,
"TLITLICreateListener: failed to allocate a sockaddr_un\n");
t_free((char *)req,T_BIND);
return TRANS_CREATE_LISTENER_FAILED;
}
@ -872,11 +862,11 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
XtransConnInfo newciptr;
int i;
PRMSG(2,"TLIAccept(%x->%d)\n", ciptr, ciptr->fd, 0 );
prmsg(2,"TLIAccept(%x->%d)\n", ciptr, ciptr->fd);
if( (call=(struct t_call *)t_alloc(ciptr->fd,T_CALL,T_ALL)) == NULL )
{
PRMSG(1, "TLIAccept() failed to allocate a t_call\n", 0,0,0 );
prmsg(1, "TLIAccept() failed to allocate a t_call\n");
*status = TRANS_ACCEPT_BAD_MALLOC;
return NULL;
}
@ -885,8 +875,8 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
{
extern char *t_errlist[];
extern int t_errno;
PRMSG(1, "TLIAccept() t_listen() failed\n", 0,0,0 );
PRMSG(1, "TLIAccept: %s\n", t_errlist[t_errno], 0,0 );
prmsg(1, "TLIAccept() t_listen() failed\n");
prmsg(1, "TLIAccept: %s\n", t_errlist[t_errno]);
t_free((char *)call,T_CALL);
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
@ -900,7 +890,7 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
if( (newciptr=TRANS(TLIOpen)(TLItrans2devtab[i].devcotsname)) == NULL )
{
PRMSG(1, "TLIAccept() failed to open a new endpoint\n", 0,0,0 );
prmsg(1, "TLIAccept() failed to open a new endpoint\n");
t_free((char *)call,T_CALL);
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
@ -908,12 +898,12 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
if( TRANS(TLITLIBindLocal)(newciptr->fd,TLItrans2devtab[i].family,"") < 0 )
{
PRMSG(1,
prmsg(1,
"TLIAccept: TRANS(TLITLIBindLocal)() failed: %d\n",
errno, 0,0 );
errno);
t_free((char *)call,T_CALL);
t_close(newciptr->fd);
xfree(newciptr);
free(newciptr);
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
}
@ -923,19 +913,19 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
{
extern char *t_errlist[];
extern int t_errno;
PRMSG(1, "TLIAccept() t_accept() failed\n", 0,0,0 );
PRMSG(1, "TLIAccept: %s\n", t_errlist[t_errno], 0,0 );
prmsg(1, "TLIAccept() t_accept() failed\n");
prmsg(1, "TLIAccept: %s\n", t_errlist[t_errno]);
if( t_errno == TLOOK )
{
int evtype = t_look(ciptr->fd);
PRMSG(1, "TLIAccept() t_look() returned %d\n", evtype,0,0 );
prmsg(1, "TLIAccept() t_look() returned %d\n", evtype);
switch( evtype )
{
case T_DISCONNECT:
if( t_rcvdis(ciptr->fd, NULL) < 0 )
{
PRMSG(1, "TLIAccept() t_rcvdis() failed\n", 0,0,0 );
PRMSG(1, "TLIAccept: %s\n", t_errlist[t_errno], 0,0 );
prmsg(1, "TLIAccept() t_rcvdis() failed\n");
prmsg(1, "TLIAccept: %s\n", t_errlist[t_errno]);
}
break;
default:
@ -953,45 +943,45 @@ TRANS(TLIAccept)(XtransConnInfo ciptr, int *status)
if( TRANS(TLIGetAddr)(newciptr) < 0 )
{
PRMSG(1,
prmsg(1,
"TLIAccept: TRANS(TLIGetPeerAddr)() failed: %d\n",
errno, 0,0 );
errno);
t_close(newciptr->fd);
xfree(newciptr);
free(newciptr);
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
}
if( TRANS(TLIGetPeerAddr)(newciptr) < 0 )
{
PRMSG(1,
prmsg(1,
"TLIAccept: TRANS(TLIGetPeerAddr)() failed: %d\n",
errno, 0,0 );
errno);
t_close(newciptr->fd);
xfree(newciptr->addr);
xfree(newciptr);
free(newciptr->addr);
free(newciptr);
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
}
if( ioctl(newciptr->fd, I_POP,"timod") < 0 )
{
PRMSG(1, "TLIAccept() ioctl(I_POP, \"timod\") failed %d\n",
errno,0,0 );
prmsg(1, "TLIAccept() ioctl(I_POP, \"timod\") failed %d\n",
errno);
t_close(newciptr->fd);
xfree(newciptr->addr);
xfree(newciptr);
free(newciptr->addr);
free(newciptr);
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
}
if( ioctl(newciptr->fd, I_PUSH,"tirdwr") < 0 )
{
PRMSG(1, "TLIAccept() ioctl(I_PUSH,\"tirdwr\") failed %d\n",
errno,0,0 );
prmsg(1, "TLIAccept() ioctl(I_PUSH,\"tirdwr\") failed %d\n",
errno);
t_close(newciptr->fd);
xfree(newciptr->addr);
xfree(newciptr);
free(newciptr->addr);
free(newciptr);
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
}
@ -1010,14 +1000,14 @@ static int
TRANS(TLIConnect)(XtransConnInfo ciptr, struct t_call *sndcall )
{
PRMSG(2, "TLIConnect(%x->%d,%x)\n", ciptr, ciptr->fd, sndcall);
prmsg(2, "TLIConnect(%x->%d,%x)\n", ciptr, ciptr->fd, sndcall);
if( t_connect(ciptr->fd,sndcall,NULL) < 0 )
{
extern char *t_errlist[];
extern int t_errno;
PRMSG(1, "TLIConnect() t_connect() failed\n", 0,0,0 );
PRMSG(1, "TLIConnect: %s\n", t_errlist[t_errno], 0,0 );
prmsg(1, "TLIConnect() t_connect() failed\n");
prmsg(1, "TLIConnect: %s\n", t_errlist[t_errno]);
t_free((char *)sndcall,T_CALL);
if (t_errno == TLOOK && t_look(ciptr->fd) == T_DISCONNECT)
{
@ -1036,31 +1026,31 @@ TRANS(TLIConnect)(XtransConnInfo ciptr, struct t_call *sndcall )
if( TRANS(TLIGetAddr)(ciptr) < 0 )
{
PRMSG(1,
prmsg(1,
"TLIConnect: ...TLIGetAddr() failed: %d\n",
errno, 0,0 );
errno);
return TRANS_CONNECT_FAILED;
}
if( TRANS(TLIGetPeerAddr)(ciptr) < 0 )
{
PRMSG(1,
prmsg(1,
"TLIConnect: ...TLIGetPeerAddr() failed: %d\n",
errno, 0,0 );
errno);
return TRANS_CONNECT_FAILED;
}
if( ioctl(ciptr->fd, I_POP,"timod") < 0 )
{
PRMSG(1, "TLIConnect() ioctl(I_POP,\"timod\") failed %d\n",
errno,0,0 );
prmsg(1, "TLIConnect() ioctl(I_POP,\"timod\") failed %d\n",
errno);
return TRANS_CONNECT_FAILED;
}
if( ioctl(ciptr->fd, I_PUSH,"tirdwr") < 0 )
{
PRMSG(1, "TLIConnect() ioctl(I_PUSH,\"tirdwr\") failed %d\n",
errno,0,0 );
prmsg(1, "TLIConnect() ioctl(I_PUSH,\"tirdwr\") failed %d\n",
errno);
return TRANS_CONNECT_FAILED;
}
@ -1076,7 +1066,7 @@ TRANS(TLIINETConnect)(XtransConnInfo ciptr, char *host, char *port)
struct t_call *sndcall;
long tmpport;
PRMSG(2, "TLIINETConnect(%s,%s)\n", host, port, 0);
prmsg(2, "TLIINETConnect(%s,%s)\n", host, port);
#ifdef X11_t
/*
@ -1098,14 +1088,14 @@ TRANS(TLIINETConnect)(XtransConnInfo ciptr, char *host, char *port)
if( (sndcall=(struct t_call *)t_alloc(ciptr->fd,T_CALL,T_ALL)) == NULL )
{
PRMSG(1, "TLIINETConnect() failed to allocate a t_call\n", 0,0,0 );
prmsg(1, "TLIINETConnect() failed to allocate a t_call\n");
return TRANS_CONNECT_FAILED;
}
if( TRANS(TLIAddrToNetbuf)(ciptr->index, host, port, &(sndcall->addr) ) < 0 )
{
PRMSG(1, "TLIINETConnect() unable to resolve name:%s.%s\n",
host, port, 0 );
prmsg(1, "TLIINETConnect() unable to resolve name:%s.%s\n",
host, port);
t_free((char *)sndcall,T_CALL);
return TRANS_CONNECT_FAILED;
}
@ -1122,20 +1112,19 @@ TRANS(TLITLIConnect)(XtransConnInfo ciptr, char *host, char *port)
struct sockaddr_un *sunaddr;
int ret_value;
PRMSG(2, "TLITLIConnect(%s,%s)\n", host, port, 0);
prmsg(2, "TLITLIConnect(%s,%s)\n", host, port);
if( (sndcall=(struct t_call *)t_alloc(ciptr->fd,T_CALL,T_OPT|T_UDATA)) == NULL )
{
PRMSG(1, "TLITLIConnect() failed to allocate a t_call\n", 0,0,0 );
prmsg(1, "TLITLIConnect() failed to allocate a t_call\n");
return TRANS_CONNECT_FAILED;
}
if( (sunaddr=(struct sockaddr_un *)
malloc(sizeof(struct sockaddr_un))) == NULL )
{
PRMSG(1,
"TLITLIConnect: failed to allocate a sockaddr_un\n",
0,0,0 );
prmsg(1,
"TLITLIConnect: failed to allocate a sockaddr_un\n");
t_free((char *)sndcall,T_CALL);
return TRANS_CONNECT_FAILED;
}
@ -1170,7 +1159,7 @@ TRANS(TLIBytesReadable)(XtransConnInfo ciptr, BytesReadable_t *pend)
int ret;
struct pollfd filedes;
PRMSG(2, "TLIByteReadable(%x->%d,%x)\n", ciptr, ciptr->fd, pend );
prmsg(2, "TLIByteReadable(%x->%d,%x)\n", ciptr, ciptr->fd, pend );
/*
* This function should detect hangup conditions. Use poll to check
@ -1212,7 +1201,7 @@ static int
TRANS(TLIRead)(XtransConnInfo ciptr, char *buf, int size)
{
PRMSG(2, "TLIRead(%d,%x,%d)\n", ciptr->fd, buf, size );
prmsg(2, "TLIRead(%d,%x,%d)\n", ciptr->fd, buf, size );
return read(ciptr->fd,buf,size);
}
@ -1222,7 +1211,7 @@ static int
TRANS(TLIWrite)(XtransConnInfo ciptr, char *buf, int size)
{
PRMSG(2, "TLIWrite(%d,%x,%d)\n", ciptr->fd, buf, size );
prmsg(2, "TLIWrite(%d,%x,%d)\n", ciptr->fd, buf, size );
return write(ciptr->fd,buf,size);
}
@ -1232,7 +1221,7 @@ static int
TRANS(TLIReadv)(XtransConnInfo ciptr, struct iovec *buf, int size)
{
PRMSG(2, "TLIReadv(%d,%x,%d)\n", ciptr->fd, buf, size );
prmsg(2, "TLIReadv(%d,%x,%d)\n", ciptr->fd, buf, size );
return READV(ciptr,buf,size);
}
@ -1242,7 +1231,7 @@ static int
TRANS(TLIWritev)(XtransConnInfo ciptr, struct iovec *buf, int size)
{
PRMSG(2, "TLIWritev(%d,%x,%d)\n", ciptr->fd, buf, size );
prmsg(2, "TLIWritev(%d,%x,%d)\n", ciptr->fd, buf, size );
return WRITEV(ciptr,buf,size);
}
@ -1252,7 +1241,7 @@ static int
TRANS(TLIDisconnect)(XtransConnInfo ciptr)
{
PRMSG(2, "TLIDisconnect(%x->%d)\n", ciptr, ciptr->fd, 0 );
prmsg(2, "TLIDisconnect(%x->%d)\n", ciptr, ciptr->fd);
/*
* Restore the TLI modules so that the connection can be properly shutdown.
@ -1272,7 +1261,7 @@ static int
TRANS(TLIClose)(XtransConnInfo ciptr)
{
PRMSG(2, "TLIClose(%x->%d)\n", ciptr, ciptr->fd, 0 );
prmsg(2, "TLIClose(%x->%d)\n", ciptr, ciptr->fd);
t_unbind(ciptr->fd);
@ -1288,7 +1277,7 @@ TRANS(TLICloseForCloning)(XtransConnInfo ciptr)
* Don't unbind.
*/
PRMSG(2, "TLICloseForCloning(%x->%d)\n", ciptr, ciptr->fd, 0 );
prmsg(2, "TLICloseForCloning(%x->%d)\n", ciptr, ciptr->fd);
return (t_close(ciptr->fd));
}

View File

@ -91,7 +91,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
{
PRMSG(2,"ConvertAddress(%d,%d,%x)\n",*familyp,*addrlenp,*addrp);
prmsg(2,"ConvertAddress(%d,%d,%p)\n",*familyp,*addrlenp,*addrp);
switch( *familyp )
{
@ -178,8 +178,8 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
#endif
default:
PRMSG(1,"ConvertAddress: Unknown family type %d\n",
*familyp, 0,0 );
prmsg(1,"ConvertAddress: Unknown family type %d\n",
*familyp);
return -1;
}
@ -197,11 +197,11 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
if (len > 0) {
if (*addrp && *addrlenp < (len + 1))
{
xfree ((char *) *addrp);
free (*addrp);
*addrp = NULL;
}
if (!*addrp)
*addrp = (Xtransaddr *) xalloc (len + 1);
*addrp = malloc (len + 1);
if (*addrp) {
strlcpy ((char *) *addrp, hostnamebuf, len + 1);
*addrlenp = len;
@ -212,7 +212,7 @@ TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp)
else
{
if (*addrp)
xfree ((char *) *addrp);
free (*addrp);
*addrp = NULL;
*addrlenp = 0;
}
@ -242,7 +242,7 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr)
char *addr = ciptr->addr;
char hostnamebuf[256];
char *networkId = NULL;
char *transName = ciptr->transptr->TransName;
const char *transName = ciptr->transptr->TransName;
size_t len;
if (gethostname (hostnamebuf, sizeof (hostnamebuf)) < 0)
@ -258,7 +258,7 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr)
struct sockaddr_un *saddr = (struct sockaddr_un *) addr;
len = 3 + strlen (transName) +
strlen (hostnamebuf) + strlen (saddr->sun_path);
networkId = (char *) xalloc (len);
networkId = (char *) malloc (len);
snprintf (networkId, len, "%s/%s:%s", transName,
hostnamebuf, saddr->sun_path);
break;
@ -289,7 +289,7 @@ TRANS(GetMyNetworkId) (XtransConnInfo ciptr)
snprintf (portnumbuf, sizeof(portnumbuf), "%d", portnum);
len = 3 + strlen (transName) +
strlen (hostnamebuf) + strlen (portnumbuf);
networkId = (char *) xalloc (len);
networkId = (char *) malloc (len);
snprintf (networkId, len, "%s/%s:%s", transName, hostnamebuf,
portnumbuf);
break;
@ -319,7 +319,7 @@ int
void
#endif
#endif
nameserver_lost(int sig)
nameserver_lost(int sig _X_UNUSED)
{
nameserver_timedout = 1;
longjmp (env, -1);
@ -421,7 +421,7 @@ TRANS(GetPeerNetworkId) (XtransConnInfo ciptr)
}
len = strlen (ciptr->transptr->TransName) + strlen (addr) + 2;
hostname = (char *) xalloc (len);
hostname = (char *) malloc (len);
strlcpy (hostname, ciptr->transptr->TransName, len);
strlcat (hostname, "/", len);
if (addr)
@ -439,7 +439,7 @@ TRANS(WSAStartup) (void)
{
static WSADATA wsadata;
PRMSG (2,"WSAStartup()\n", 0, 0, 0);
prmsg (2,"WSAStartup()\n");
if (!wsadata.wVersion && WSAStartup(MAKEWORD(2,2), &wsadata))
return 1;
@ -487,8 +487,8 @@ trans_mkdir(const char *path, int mode)
if (lstat(path, &buf) != 0) {
if (errno != ENOENT) {
PRMSG(1, "mkdir: ERROR: (l)stat failed for %s (%d)\n",
path, errno, 0);
prmsg(1, "mkdir: ERROR: (l)stat failed for %s (%d)\n",
path, errno);
return -1;
}
/* Dir doesn't exist. Try to create it */
@ -501,15 +501,15 @@ trans_mkdir(const char *path, int mode)
*/
if (geteuid() != 0) {
if (mode & 01000) {
PRMSG(1, "mkdir: ERROR: euid != 0,"
prmsg(1, "mkdir: ERROR: euid != 0,"
"directory %s will not be created.\n",
path, 0, 0);
path);
#ifdef FAIL_HARD
return -1;
#endif
} else {
PRMSG(1, "mkdir: Cannot create %s with root ownership\n",
path, 0, 0);
prmsg(1, "mkdir: Cannot create %s with root ownership\n",
path);
}
}
#endif
@ -517,8 +517,8 @@ trans_mkdir(const char *path, int mode)
#ifndef WIN32
if (mkdir(path, mode) == 0) {
if (chmod(path, mode)) {
PRMSG(1, "mkdir: ERROR: Mode of %s should be set to %04o\n",
path, mode, 0);
prmsg(1, "mkdir: ERROR: Mode of %s should be set to %04o\n",
path, mode);
#ifdef FAIL_HARD
return -1;
#endif
@ -527,8 +527,8 @@ trans_mkdir(const char *path, int mode)
if (mkdir(path) == 0) {
#endif
} else {
PRMSG(1, "mkdir: ERROR: Cannot create %s\n",
path, 0, 0);
prmsg(1, "mkdir: ERROR: Cannot create %s\n",
path);
return -1;
}
@ -586,8 +586,9 @@ trans_mkdir(const char *path, int mode)
struct stat fbuf;
if ((fd = open(path, O_RDONLY)) != -1) {
if (fstat(fd, &fbuf) == -1) {
PRMSG(1, "mkdir: ERROR: fstat failed for %s (%d)\n",
path, errno, 0);
prmsg(1, "mkdir: ERROR: fstat failed for %s (%d)\n",
path, errno);
close(fd);
return -1;
}
/*
@ -597,8 +598,9 @@ trans_mkdir(const char *path, int mode)
if (!S_ISDIR(fbuf.st_mode) ||
buf.st_dev != fbuf.st_dev ||
buf.st_ino != fbuf.st_ino) {
PRMSG(1, "mkdir: ERROR: inode for %s changed\n",
path, 0, 0);
prmsg(1, "mkdir: ERROR: inode for %s changed\n",
path);
close(fd);
return -1;
}
if (updateOwner && fchown(fd, 0, 0) == 0)
@ -613,30 +615,29 @@ trans_mkdir(const char *path, int mode)
if (updateOwner && !updatedOwner) {
#ifdef FAIL_HARD
if (status & FAIL_IF_NOT_ROOT) {
PRMSG(1, "mkdir: ERROR: Owner of %s must be set to root\n",
path, 0, 0);
prmsg(1, "mkdir: ERROR: Owner of %s must be set to root\n",
path);
return -1;
}
#endif
#if !defined(__APPLE_CC__) && !defined(__CYGWIN__)
PRMSG(1, "mkdir: Owner of %s should be set to root\n",
path, 0, 0);
prmsg(1, "mkdir: Owner of %s should be set to root\n",
path);
#endif
}
if (updateMode && !updatedMode) {
#ifdef FAIL_HARD
if (status & FAIL_IF_NOMODE) {
PRMSG(1, "mkdir: ERROR: Mode of %s must be set to %04o\n",
path, mode, 0);
prmsg(1, "mkdir: ERROR: Mode of %s must be set to %04o\n",
path, mode);
return -1;
}
#endif
PRMSG(1, "mkdir: Mode of %s should be set to %04o\n",
path, mode, 0);
prmsg(1, "mkdir: Mode of %s should be set to %04o\n",
path, mode);
if (status & WARN_NO_ACCESS) {
PRMSG(1, "mkdir: this may cause subsequent errors\n",
0, 0, 0);
prmsg(1, "mkdir: this may cause subsequent errors\n");
}
}
return 0;

View File

@ -1,40 +1,44 @@
dnl Copyright © 2003 Keith Packard, Noah Levitt
dnl
dnl Permission to use, copy, modify, distribute, and sell this software and its
dnl documentation for any purpose is hereby granted without fee, provided that
dnl the above copyright notice appear in all copies and that both that
dnl copyright notice and this permission notice appear in supporting
dnl documentation, and that the name of Keith Packard not be used in
dnl advertising or publicity pertaining to distribution of the software without
dnl specific, written prior permission. Keith Packard makes no
dnl representations about the suitability of this software for any purpose. It
dnl is provided "as is" without express or implied warranty.
dnl
dnl KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
dnl EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
dnl PERFORMANCE OF THIS SOFTWARE.
dnl
dnl Process this file with autoconf to create configure.
# Copyright © 2003 Keith Packard, Noah Levitt
#
# 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, and that the name of Keith Packard not be used in
# advertising or publicity pertaining to distribution of the software without
# specific, written prior permission. Keith Packard makes no
# representations about the suitability of this software for any purpose. It
# is provided "as is" without express or implied warranty.
#
# KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
# EVENT SHALL KEITH PACKARD 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.
#
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xtrans], [1.2.6],
AC_INIT([xtrans], [1.2.7],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xtrans])
AC_CONFIG_SRCDIR([Makefile.am])
# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
# Require xorg-macros minimum of 1.10 for DocBook XML documentation
# Require xorg-macros minimum of 1.12 for DocBook external references
m4_ifndef([XORG_MACROS_VERSION],
[m4_fatal([must install xorg-macros 1.10 or later before running autoconf/autogen])])
XORG_MACROS_VERSION(1.10)
[m4_fatal([must install xorg-macros 1.12 or later before running autoconf/autogen])])
XORG_MACROS_VERSION(1.12)
XORG_DEFAULT_OPTIONS
XORG_ENABLE_DOCS
XORG_WITH_XMLTO(0.0.20)
XORG_WITH_XMLTO(0.0.22)
XORG_WITH_FOP
XORG_CHECK_SGML_DOCTOOLS(1.5)
XORG_WITH_XSLTPROC
XORG_CHECK_SGML_DOCTOOLS(1.8)
# Because xtrans is included into other modules rather than being linked
# with, these defines have to be added to the cflags line
@ -54,6 +58,7 @@ sticky_bit_define="-DHAS_STICKY_DIR_BIT"
AC_SUBST(sticky_bit_define)
AC_OUTPUT([Makefile
AC_CONFIG_FILES([Makefile
doc/Makefile
xtrans.pc])
AC_OUTPUT

View File

@ -1,62 +1,13 @@
#
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
#
# 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 (including the next
# paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
#
if ENABLE_DOCS
doc_sources = xtrans.xml
dist_doc_DATA = $(doc_sources)
if HAVE_XMLTO
doc_DATA = $(doc_sources:.xml=.html)
# Main DocBook/XML files (DOCTYPE book)
docbook = xtrans.xml
if HAVE_FOP
doc_DATA += $(doc_sources:.xml=.ps) $(doc_sources:.xml=.pdf)
endif
# The location where the DocBook/XML files and their generated formats are installed
shelfdir = $(docdir)
if HAVE_XMLTO_TEXT
doc_DATA += $(doc_sources:.xml=.txt)
endif
# Generate DocBook/XML output formats with or without stylesheets
include $(top_srcdir)/docbook.am
if HAVE_STYLESHEETS
XMLTO_FLAGS = \
-m $(XSL_STYLESHEET) \
--stringparam html.stylesheet="$(STYLESHEET_SRCDIR)/xorg.css"
endif
CLEANFILES = $(doc_DATA)
SUFFIXES = .xml .ps .pdf .txt .html
.xml.txt:
$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) txt $<
.xml.html:
$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) xhtml-nochunks $<
.xml.pdf:
$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop pdf $<
.xml.ps:
$(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop ps $<
endif HAVE_XMLTO
endif ENABLE_DOCS

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
<!ENTITY % defs SYSTEM "defs.ent"> %defs;
]>
<!-- lifted from troff+ms+XMan by doclifter -->
<book id="xtrans">
@ -8,28 +11,28 @@
<bookinfo>
<title>X Transport Interface</title>
<subtitle>X Consortium Standard</subtitle>
<releaseinfo>X Version 11, Release 7.X</releaseinfo>
<authorgroup>
<author>
<firstname>Stuart</firstname><surname>Anderson</surname>
<affiliation><orgname>NCR Corporation</orgname></affiliation>
</author>
<othercredit><firstname>Ralph</firstname><surname>Mor</surname>
<affiliation><orgname>X Consortium</orgname></affiliation>
</othercredit>
<othercredit><firstname>Alan</firstname><surname>Coopersmith</surname>
<affiliation><orgname>Oracle Corp.</orgname></affiliation>
</othercredit>
</authorgroup>
<othercredit><firstname>Ralph</firstname><surname>Mor</surname></othercredit>
<othercredit><firstname>Alan</firstname><surname>Coopersmith</surname></othercredit>
<corpname>NCR Corporation</corpname>
<releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
<releaseinfo>Version 0.7</releaseinfo>
<affiliation><orgname>The Open Group</orgname></affiliation>
<productnumber>X Version 11, Release 7.x</productnumber>
<copyright><year>1993</year><year>1994</year>
<holder>NCR Corporation - Dayton, Ohio, USA</holder>
</copyright>
<legalnotice>
<para>
Copyright &copy; 1993, 1994 NCR Corporation - Dayton, Ohio, USA
</para>
<para>
All Rights Reserved
</para>
<para>
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, provided
@ -41,7 +44,6 @@ written prior permission. NCR makes no representations about the
suitability of this software for any purpose. It is provided "as is"
without express or implied warranty.
</para>
<para>
NCR DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
@ -51,14 +53,12 @@ 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.
</para>
</legalnotice>
<legalnotice>
<para>
<para role="multiLicensing">
Copyright &copy; 1993, 1994, 2002 The Open Group
</para>
<para>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the &ldquo;Software&rdquo;), to deal
@ -67,12 +67,10 @@ 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:
</para>
<para>
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
</para>
<para>
THE SOFTWARE IS PROVIDED &ldquo;AS IS&rdquo;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
@ -81,19 +79,15 @@ 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.
</para>
<para>
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.
</para>
<para>
X Window System is a trademark of The Open Group, Inc.
</para>
</legalnotice>
</bookinfo>
<preface><title>The X Transport Interface</title>
@ -109,7 +103,7 @@ for client vs. server code.
</para></note>
</preface>
<chapter id='purposes_and_goals'>
<chapter id='Purposes_and_Goals'>
<title>Purposes and Goals</title>
<para>The X Transport Interface is intended to combine all system and
@ -127,7 +121,7 @@ FS, and connection-less oriented protocols such as XDMCP.</para>
</chapter>
<chapter id='overview_of_the_interface'>
<chapter id='Overview_of_the_Interface'>
<title>Overview of the Interface</title>
<para>
@ -148,7 +142,7 @@ an interface would affect performance.
</para>
</chapter>
<chapter id='definition_of_address_specification_format'>
<chapter id='Definition_of_Address_Specification_Format'>
<title>Definition of Address Specification Format</title>
<para>
@ -175,14 +169,14 @@ part of an address.
</para>
</chapter>
<chapter id='internal_data_structures'>
<chapter id='Internal_Data_Structures'>
<title>Internal Data Structures</title>
<para>
There are two major data structures associated with the transport
independent portion of this interface. Additional data structures
may be used internally by each transport.
</para>
<sect1 id="xtransport">
<sect1 id='Xtransport'>
<title>Xtransport</title>
<para>
Each transport supported has an entry in the transport table. The transport
@ -343,7 +337,7 @@ should not be unlinked.
</para>
</sect1>
<sect1 id="xtransconninfo">
<sect1 id='XtransConnInfo'>
<title>XtransConnInfo</title>
<para>
Each connection will have an opaque <structname>XtransConnInfo</structname>
@ -370,7 +364,7 @@ struct _XtransConnInfo {
</sect1>
</chapter>
<chapter id='exposed_transport_independent_api'>
<chapter id='Exposed_Transport_Independent_API'>
<title>Exposed Transport Independent API</title>
<para>
@ -391,7 +385,7 @@ All failures are considered fatal, and the connection should be closed
and re-established if desired. In most cases, however, the value of
errno will be available for debugging purposes.
</para>
<sect1 id="core_interface_api">
<sect1 id='Core_Interface_API'>
<title>Core Interface API</title>
<itemizedlist mark='bullet'>
<listitem>
@ -665,7 +659,7 @@ is the list of transports.
</itemizedlist>
</sect1>
<sect1 id="utility_api">
<sect1 id='Utility_API'>
<title>Utility API</title>
<para>
This section describes a few useful functions that have been implemented on
@ -687,7 +681,7 @@ FamilyLocal)).
</sect1>
</chapter>
<chapter id="transport_option_definition">
<chapter id='Transport_Option_Definition'>
<title>Transport Option Definition</title>
<para>
The following options are defined for the
@ -721,7 +715,7 @@ connection will not be closed when an exec occurs.
</itemizedlist>
</chapter>
<chapter id="hidden_transport_dependent_api">
<chapter id='Hidden_Transport_Dependent_API'>
<title>Hidden Transport Dependent API</title>
<para>
The hidden transport dependent functions are placed in the Xtransport record.
@ -941,7 +935,7 @@ This function will break the connection, and close the endpoint.
</listitem>
</itemizedlist>
</chapter>
<chapter id="configuration">
<chapter id='Configuration'>
<title>Configuration</title>
<para>
@ -962,13 +956,14 @@ In X11R7 modular releases, these flags are set when running
<function>XTRANS_CONNECTION_FLAGS</function> macro from
<filename>xtrans.m4</filename>.
</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='4' align='left'>
<colspec colname='define' align='center'/>
<colspec colname='enable'/>
<colspec colname='desc'/>
<informaltable frame='topbot'>
<tgroup cols='3' align='left' colsep='0' rowsep='0'>
<colspec colname='define' colwidth='1.0*' />
<colspec colname='enable' colwidth='2.0*' />
<colspec colname='desc' colwidth='2.0*'/>
<thead>
<row>
<row rowsep='1'>
<entry><code>#define</code></entry>
<entry>configure flag</entry>
<entry>Description</entry>
@ -1024,18 +1019,18 @@ In X11R7 modular releases, these flags are set when running
</chapter>
<chapter id="transport_specific_definitions">
<chapter id='Transport_Specific_Definitions'>
<title>Transport Specific Definitions</title>
<informaltable pgwide='0' frame='none'>
<informaltable frame='all' colsep='1' rowsep='1'>
<tgroup cols='4' align='center'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<colspec colname='c3'/>
<colspec colname='c4'/>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='1.0*'/>
<colspec colname='c3' colwidth='3.0*'/>
<colspec colname='c4' colwidth='2.0*'/>
<thead>
<row>
<entry morerows="1" align='center'>Protocol Family</entry>
<entry morerows="1">Protocol Family</entry>
<entry namest="c2" nameend="c4" align='center'>Address Component</entry>
</row>
<row>
@ -1046,34 +1041,34 @@ In X11R7 modular releases, these flags are set when running
</thead>
<tbody>
<row>
<entry align='center'>Internet</entry>
<entry align='center'>inet inet6 tcp udp</entry>
<entry align='center'>name of an internet addressable host</entry>
<entry align='center'>string containing the name of a service or a valid port number. Example: "xserver0", "7100"</entry>
<entry>Internet</entry>
<entry>inet inet6 tcp udp</entry>
<entry>name of an internet addressable host</entry>
<entry>string containing the name of a service or a valid port number. Example: "xserver0", "7100"</entry>
</row>
<row>
<entry align='center'>DECnet</entry>
<entry align='center'>decnet</entry>
<entry align='center'>name of a DECnet addressable host</entry>
<entry align='center'>string containing the complete name of the object. Example: "X$X0"</entry>
<entry>DECnet</entry>
<entry>decnet</entry>
<entry>name of a DECnet addressable host</entry>
<entry>string containing the complete name of the object. Example: "X$X0"</entry>
</row>
<row>
<entry align='center'>NETware</entry>
<entry align='center'>ipx</entry>
<entry align='center'>name of a NETware addressable host</entry>
<entry align='center'>Not sure of the specifics yet.</entry>
<entry>NETware</entry>
<entry>ipx</entry>
<entry>name of a NETware addressable host</entry>
<entry>Not sure of the specifics yet.</entry>
</row>
<row>
<entry align='center'>OSI</entry>
<entry align='center'>osi</entry>
<entry align='center'>name of an OSI adressable host.</entry>
<entry align='center'>Not sure of the specifics yet.</entry>
<entry>OSI</entry>
<entry>osi</entry>
<entry>name of an OSI adressable host.</entry>
<entry>Not sure of the specifics yet.</entry>
</row>
<row>
<entry align='center'>Local</entry>
<entry align='center'>local pts named sco isc</entry>
<entry align='center'>(ignored)</entry>
<entry align='center'>String containing the port name, ie "xserver0", "fontserver0".</entry>
<entry>Local</entry>
<entry>local pts named sco isc</entry>
<entry>(ignored)</entry>
<entry>String containing the port name, ie "xserver0", "fontserver0".</entry>
</row>
</tbody>
</tgroup>
@ -1081,7 +1076,7 @@ In X11R7 modular releases, these flags are set when running
</chapter>
<chapter id="implementation_notes">
<chapter id='Implementation_Notes'>
<title>Implementation Notes</title>
<para>
This section refers to the prototype implementation that is being developed

105
lib/libxtrans/docbook.am Normal file
View File

@ -0,0 +1,105 @@
#
# Generate output formats for a single DocBook/XML with/without chapters
#
# Variables set by the calling Makefile:
# shelfdir: the location where the docs/specs are installed. Typically $(docdir)
# docbook: the main DocBook/XML file, no chapters, appendix or image files
# chapters: all files pulled in by an XInclude statement and images.
#
#
# This makefile is intended for Users Documentation and Functional Specifications.
# Do not use for Developer Documentation which is not installed and does not require olink.
# Refer to http://www.x.org/releases/X11R7.6/doc/xorg-docs/ReleaseNotes.html#id2584393
# for an explanation on documents classification.
#
# DocBook/XML generated output formats to be installed
shelf_DATA =
# DocBook/XML file with chapters, appendix and images it includes
dist_shelf_DATA = $(docbook) $(chapters)
if HAVE_XMLTO
if HAVE_STYLESHEETS
XMLTO_SEARCHPATH_FLAGS = \
--searchpath "$(XORG_SGML_PATH)/X11" \
--searchpath "$(abs_top_builddir)"
XMLTO_HTML_OLINK_FLAGS = \
--stringparam target.database.document=$(XORG_SGML_PATH)/X11/dbs/masterdb.html.xml \
--stringparam current.docid="$(<:.xml=)"
XMLTO_HTML_STYLESHEET_FLAGS = -x $(STYLESHEET_SRCDIR)/xorg-xhtml.xsl
XMLTO_HTML_FLAGS = \
$(XMLTO_SEARCHPATH_FLAGS) \
$(XMLTO_HTML_STYLESHEET_FLAGS) \
$(XMLTO_HTML_OLINK_FLAGS)
shelf_DATA += $(docbook:.xml=.html)
%.html: %.xml $(chapters)
$(AM_V_GEN)$(XMLTO) $(XMLTO_HTML_FLAGS) xhtml-nochunks $<
if HAVE_XMLTO_TEXT
shelf_DATA += $(docbook:.xml=.txt)
%.txt: %.xml $(chapters)
$(AM_V_GEN)$(XMLTO) $(XMLTO_HTML_FLAGS) txt $<
endif HAVE_XMLTO_TEXT
if HAVE_FOP
XMLTO_FO_IMAGEPATH_FLAGS = --stringparam img.src.path=$(abs_builddir)/
XMLTO_PDF_OLINK_FLAGS = \
--stringparam target.database.document=$(XORG_SGML_PATH)/X11/dbs/masterdb.pdf.xml \
--stringparam current.docid="$(<:.xml=)"
XMLTO_FO_STYLESHEET_FLAGS = -x $(STYLESHEET_SRCDIR)/xorg-fo.xsl
XMLTO_FO_FLAGS = \
$(XMLTO_SEARCHPATH_FLAGS) \
$(XMLTO_FO_STYLESHEET_FLAGS) \
$(XMLTO_FO_IMAGEPATH_FLAGS) \
$(XMLTO_PDF_OLINK_FLAGS)
shelf_DATA += $(docbook:.xml=.pdf)
%.pdf: %.xml $(chapters)
$(AM_V_GEN)$(XMLTO) $(XMLTO_FO_FLAGS) --with-fop pdf $<
shelf_DATA += $(docbook:.xml=.ps)
%.ps: %.xml $(chapters)
$(AM_V_GEN)$(XMLTO) $(XMLTO_FO_FLAGS) --with-fop ps $<
endif HAVE_FOP
# Generate documents cross-reference target databases
if HAVE_XSLTPROC
XSLT_SEARCHPATH_FLAGS = \
--path "$(XORG_SGML_PATH)/X11" \
--path "$(abs_top_builddir)"
XSLT_OLINK_FLAGS = \
--stringparam targets.filename "$@" \
--stringparam collect.xref.targets "only" \
--stringparam olink.base.uri "$(@:.db=)"
XSLT_HTML_FLAGS = \
$(XSLT_SEARCHPATH_FLAGS) \
$(XSLT_OLINK_FLAGS) \
--nonet --xinclude \
$(STYLESHEET_SRCDIR)/xorg-xhtml.xsl
XSLT_PDF_FLAGS = \
$(XSLT_SEARCHPATH_FLAGS) \
$(XSLT_OLINK_FLAGS) \
--nonet --xinclude \
$(STYLESHEET_SRCDIR)/xorg-fo.xsl
shelf_DATA += $(docbook:.xml=.html.db)
%.html.db: %.xml $(chapters)
$(AM_V_GEN)$(XSLTPROC) $(XSLT_HTML_FLAGS) $<
shelf_DATA += $(docbook:.xml=.pdf.db)
%.pdf.db: %.xml $(chapters)
$(AM_V_GEN)$(XSLTPROC) $(XSLT_PDF_FLAGS) $<
endif HAVE_XSLTPROC
endif HAVE_STYLESHEETS
endif HAVE_XMLTO
CLEANFILES = $(shelf_DATA)

View File

@ -47,19 +47,19 @@ from The Open Group.
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef XSERV_t
#include "os.h"
#else
#include <stdlib.h>
#define xalloc(_size) malloc(_size)
#define xcalloc(_num,_size) calloc(_num,_size)
#define xrealloc(_ptr,_size) realloc(_ptr,_size)
#define xfree(_ptr) free(_ptr)
#endif
#define XTRANS_TRANSPORT_C /* used to flag Xtransint.h that it's being used
here, not just #included in another file */
#include "Xtransint.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-nonliteral"
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
#ifdef LOCALCONN
#include "Xtranslcl.c"
#endif
@ -71,3 +71,7 @@ from The Open Group.
#endif
#include "Xtrans.c"
#include "Xtransutil.c"
#ifdef __clang__
#pragma clang diagnostic pop
#endif