37 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult
857e397c15 os: Xtranssock: fix (signed) char array subscript
>  In file included from /usr/include/ctype.h:100,
>                   from ../include/misc.h:154,
>                   from ../include/os.h:51,
>                   from ../os/Xtransint.h:256,
>                   from ../os/transport.c:57:
> ../os/Xtranssock.c: In function ‘is_numeric’:
> ../os/Xtranssock.c:217:19: error: array subscript has type ‘char’ [-Werror=char-subscripts]
>    217 |  if (!isdigit (str[i]))
>        |                   ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-14 11:27:49 +01:00
Enrico Weigelt, metux IT consult
9a54f4b908 os: enable UNIX sockets on Mingw32
Mingw32 also supports unix sockets, so no need to disable them here.

Since it's now always enabled, follow-up commits can now drop all the
extra #ifdef's on UNIXCONN and so reduce complexity.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-14 11:03:00 +01:00
Enrico Weigelt, metux IT consult
16d4d44551 os: drop symbol TCPCONN
It's been always enabled for aeons, so no practical need to
disable it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-13 15:59:07 +01:00
Enrico Weigelt, metux IT consult
7389686d6d os: xtrans: drop status pointer from *Accept() functions
Nobody's ever looking at this value, so no need to keep it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-12 13:47:15 +01:00
Enrico Weigelt, metux IT consult
c9d9da7cf0 os: xtrans: drop obsolete LOCALCONN code paths
the symbol LOCALCONN is never defined, so these code pathes are dead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-12 13:26:20 +01:00
Enrico Weigelt, metux IT consult
df0f1cc687 os: Xtranssock: fix printf format warning
> ../os/Xtranssock.c: In function '_XSERVTransSocketReopen':
> ../os/Xtranssock.c:449:49: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
>         prmsg (1, "SocketReopen: invalid portlen %d\n", portlen);
>                                                  ~^     ~~~~~~~
>                                                  %ld

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-10 15:11:27 +01:00
Enrico Weigelt, metux IT consult
4ae70b0a09 os: Xtranssock: fix warning on strncpy() call
> ../os/Xtranssock.c:494:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-truncation]
>  494 |     strncpy(addr->sa_data, port, portlen);
>      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../os/Xtranssock.c:446:15: note: length computed here
>  446 |     portlen = strlen(port) + 1; // include space for trailing null
>      |               ^~~~~~~~~~~~

Since we already know the string length, we can just use memcpy()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-25 16:40:43 +02:00
Enrico Weigelt, metux IT consult
e1d372db70 os: xtrans: drop unused _XSERVTransBytesReadable()
Not used anywhere, so no need to keep it around anymore.
Also dropping the BytesReadable vector, which is unused now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-24 15:53:57 +02:00
Enrico Weigelt, metux IT consult
fbc8463e84 os: xtrans: silence printf format warning on prmsg() call
size_t is unsigned, but might have different sizes depending on CPU arch,
so casting it to unsigned long, so we can safely use %ld.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-01 11:43:45 +02:00
Enrico Weigelt, metux IT consult
c9ac063793 os: xtrans: rename Writev() methods to Write()
The Writev() methods essentially became Write() now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-31 15:51:33 +02:00
Enrico Weigelt, metux IT consult
3c5caa1ba0 os: xtrans: drop old Write() methods
Since everything's running via Writev() methods now, the now unused Write()
methods can all be dropped.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-31 15:51:33 +02:00
Enrico Weigelt, metux IT consult
a52ac4fb26 os: xtrans: replace _XSERVTransWriteV()
Now that all WriteV() methods are operating on single buffer instead ofiovec's,
we don't need the complicated _XSERVTransWriteV() anymore, but instead can
write directly to the socket/fd.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-31 15:51:33 +02:00
Enrico Weigelt, metux IT consult
c079ad54fb os: xtrans: let Writev() methods accept just one buffer instead of iovec
Since they're only called with a one-element iovec, we can use a single
buffer pointer straight away, thus making it quite the same as the old
Write() methods.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-31 15:51:33 +02:00
Enrico Weigelt, metux IT consult
b738a28098 os: xtrans: simplify _XSERVTransWriteV()
Refactor _XSERVTransWriteV() to call write() on Unix and instead drop
the WRITEV() macro.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-31 15:51:33 +02:00
Enrico Weigelt, metux IT consult
26c2df04e9 os: use size_t as iov length parameter xtrans writev{,v}
struct msghdr is using size_t as for iov_length, so match up with it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-11 20:14:04 +02:00
stefan11111
81770d7315 os: use ssize_t in xtrans write{,v}
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-08-11 20:14:04 +02:00
Enrico Weigelt, metux IT consult
97f3ff8c7e os: cross platform socket close() wrapper
Reducing the ifdef-zoo a bit by moving the platform specific socket
close calls into separate function. On win32, this also checks the
retval and potentially query for error. On Unix, just calling close().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 12:40:35 +02:00
Enrico Weigelt, metux IT consult
ec20354aec os: cross platform ioctl() wrapper
Reducing the ifdef-zoo a bit by moving the platform specific socket
ioctl calls into separate function. On win32, this also checks the
retval and potentially query for error. On Unix, just calling ioctl().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-07 12:40:35 +02:00
Enrico Weigelt, metux IT consult
0d8e9ee708 os: xtranssock: drop weird check of "out of range" socket
A socket() call either returns a valid socket fd or -1, there's no need for
trying to check whether the returned fd is out of the OS's allowed range
of fd's, because if it would, the kernel would return error anyways.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-05 12:18:19 +02:00
Enrico Weigelt, metux IT consult
d9f82ada19 os: xtranssock: win32: use separate symbol for socket close
Instead of redefining existing standard libc symbols, pick another symbol
that's mapped to the corresponding platform specific function.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 17:32:03 +02:00
Enrico Weigelt, metux IT consult
399c51bb6d os: xtrans: drop _XSERVTransReadv() et al
It's not used anywhere, so no need to keep it around anymore.
We can also dispose the corresponding connection driver's procs here.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 17:09:37 +02:00
Enrico Weigelt, metux IT consult
9fdb2482de os: xtrans: drop define of EINPROGRESS
Never used anywhere and conflicts with system headers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-31 15:24:30 +02:00
Enrico Weigelt, metux IT consult
53691f7174 os: xtranssock: undefine before redefining EADDRINUSE
prevent warning on doubly defined preprocessor symbol.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-30 19:09:44 +02:00
Enrico Weigelt, metux IT consult
4fa6849f43 os: xtrans: drop define of EPROTOTYPE
Never used anywhere and conflicts with system headers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-25 12:44:14 +02:00
Enrico Weigelt, metux IT consult
ee1f0a3ac4 os: xtrans: drop define of ECONNREFUSED
Never used anywhere and conflicts with system headers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-25 12:30:12 +02:00
Enrico Weigelt, metux IT consult
d1bb5dc457 os: xtrans: expand TRANS() macro to _XSERVTrans
Since TRANS() now will always expand the same, it's better for
maintenance, having the function names written explicitly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
03653eb403 os: xtrans: drop TRANS_CLIENT code pathes
Not needed in server-only code base.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
a830e4eff5 os: xtrans: drop XSERV_t and x11_t defines
These are always enablde (x11_t is defined when XSERV_t is defined),
so no need for the #ifdef's anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
499751751d os: xtrans: drop ifdef TRANS_REOPEN
It's always defined, so the guards aren't necessary.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
b17fe4128b os: xtrans: drop ifdef TRANS_SERVER
it's always defined, no extra guards needed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
16053efd50 os: xtrans: replace bzero by memset
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
4ca4c167ff os: xtrans: drop XIM_t
Not defined anywhere.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
882d4d440a os: xtrans: drop FS_t
Not defined anywhere, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
18a459340c os: xtrans: drop FONT_t
Not used anywhere, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
8df9d118a0 os: xtrans: drop ICE_t
Not used anywhere.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
930f2d6f15 os: xtrans: drop X_NO_SYS_UN
Not defined anywhere, so no need to check for it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00
Enrico Weigelt, metux IT consult
cd81370e9d os: incorporate xtrans xtrans-1.6.0
Copy over from xtrans package, tag xtrans-1.6.0

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-18 22:29:38 +02:00