Commit Graph

1126 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult
0b3aaa0369 os: drop ResetWellKnownSockets() and XdmcpReset()
Since internal server reset is gone, those aren't needed anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 19:22:44 +01:00
Enrico Weigelt, metux IT consult
416f69eb88 include: misc.h: unexport lowbit() macro
Not used by any drivers.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 19:20:07 +01:00
Enrico Weigelt, metux IT consult
b0ac921156 dix: unexport GrabInProgress
Only internally within OS layer and screen saver logic,
so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 17:42:29 +01:00
Enrico Weigelt, metux IT consult
f161a014f1 os: xdmcp: drop server reset support
Not needed anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 16:36:04 +01:00
Enrico Weigelt, metux IT consult
064e5f2ddf os: drop OsCleanup()
Since we're always terminating now, everbody can call UnlockServer()
directly, so we don't need that extra function anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-20 11:19:02 +01:00
Enrico Weigelt, metux IT consult
f27e12c918 dix: drop DE_RESET and associated cmdline args
Drop the -reset flag, so Xserver now either simply continues (w/o going
through internal reset) when last client disconnected or terminates
when -terminate is given.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-18 18:22:25 +01:00
Chase
2fff53d35d Xtransutil.c: minor formatting fix 2025-11-17 13:16:45 +01:00
Enrico Weigelt, metux IT consult
7a8f12361d os: move OS_COMM_* defines into os/connection.c
They're only used inside os/connection.c, so no need to have them
in some header and expose them to other areas.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-10 11:07:58 +01:00
Enrico Weigelt, metux IT consult
b0b9a624d8 os: replace ETEST macro by ossock_wouldblock()
Move this to a little function (which also has a better name now)
inside the already platform specific ossock.c

Also removing the EMSGSIZE check: we're using TCP or local unix
socket, so EMSGSIZE is never returned.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-08 10:46:03 +01:00
Enrico Weigelt, metux IT consult
cd3b208bde os: osdep: drop unused OsFlushFunc
Not used anymore for over two decades now, so no need to keep it around.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-07 19:12:08 +01:00
Enrico Weigelt, metux IT consult
b3a5b5b61c os: drop unused Xscnprintf() and Xvscnprintf()
Not used anywhere (not even in drivers), so no need to keep them anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-11-07 09:31:48 +01:00
Enrico Weigelt, metux IT consult
7ef8400df5 xfree86: compat: re-add TimeCheck() for proprietary nvidia driver
Yet another very internal function that the proprietary Nvidia driver
is using for unknown reasons.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-10-28 16:26:44 +01:00
Enrico Weigelt, metux IT consult
b306691c2d win32: move definition of sigset_t to os/osdep.h
Not needed by drivers (there aren't any on win32), so no need to
have it in public SDK header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-29 19:13:49 +02:00
Enrico Weigelt, metux IT consult
4a75fb14b7 os: unexport ReplyCallback
It's only used by record extension, not used by any drivers at all
(neither FOSS nor proprietary), so it shouldn't be in the public SDK.

Since it's never been used by any driver, it's effectively no ABI change,
so we can safely do this within ABI-25.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-29 11:05:27 +02:00
Enrico Weigelt, metux IT consult
ca484055c7 dix: unexport screen saver parameters
Not used by any external drivers, so no need to keep them in public
SDK headers. Since they're never used by drivers, it's effectively
not an ABI change, so can safely be done within ABI-25.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-29 11:01:21 +02:00
Enrico Weigelt, metux IT consult
21fb27735a os: unexport XNFreallocarray()
Not used by any drivers, no no need to keep it in public SDK.
Since it's not used by drivers, it's effectively not an ABI change,
so can be done within ABI-25.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-29 10:53:15 +02:00
Enrico Weigelt, metux IT consult
f29fb6bb62 present: unexport symbols not used by drivers
these symbols aren't used by any external drivers (not even proprietary
Nvidia), so no need to keep them exported any longer:

 * present_check_flips
 * present_register_complete_notify
 * present_can_window_flip
 * uint32_t FakeScreenFps

Since it's not any *effective* ABI change, can go into current ABI-25 line.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-26 17:09:43 +02:00
Enrico Weigelt, metux IT consult
74e3f18204 os: unexport inSignalContext
Only used inside OS layer and xfree86 os-support, so no need to keep
it in public SDK.

Since never used by any drivers, it's not an actual ABI change, so
we can safely do it within ABI-25.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-26 15:58:04 +02:00
Enrico Weigelt, metux IT consult
995398ecde os: rename audit.h to audit_priv.h
Our convention is naming private (non-SDK) headers w/ _priv.h suffix.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-26 15:56:47 +02:00
Enrico Weigelt, metux IT consult
da42cb968c os: move LogPrintMarkers() declaration into private header
Not exported, not used by any external modules, so no need to have
that declaration in a public SDK header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-26 11:50:59 +02: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
6168868906 dix: replace XACE_SERVER_ACCESS by direct callback
Move the callbacks directly into DIX, since it's actually core infrastructure.
Also simplifying the whole machinery, by just using a simpel CallbackListPtr.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-25 14:27:41 +02:00
Enrico Weigelt, metux IT consult
5cdfe6e5ab os: move enum ExitCode into private header
Not used by any external drivers, so no need to keep it public.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-25 09:37:05 +02:00
Enrico Weigelt, metux IT consult
9b1fb83d6b os: xtrans: drop unused transport table indices
These aren't used anymore, so no need to keep them any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-24 16:34:33 +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
80e6e7693b os: log: make LogVHdrMessageVerb() static
Only used inside log.c and not exported, so can be made static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-24 11:58:46 +02:00
Enrico Weigelt, metux IT consult
ac0a267f1d xace: drop unused XACE_AUTH_AVAIL
Not used anymore for almost two decades, so no need to keep it.

Fixes: eafaf40fb3
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-23 11:44:14 +02:00
Enrico Weigelt, metux IT consult
9856372932 dix: add callback before ClientRec is being destroyed
Existing client-state hook isn't sufficient for this, and so easy to
be extended cleanly (*1). Adding a new callback is trivial and cheap,
so preferring this way, instead of trying to tweak the existing hook
for something it's never been designed for.

*1) see discussion here: https://github.com/X11Libre/xserver/pull/1077

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-22 12:15:31 +02:00
stefan11111
0cfe43853e os: hw/xfree86/x86emu: Silence warnings on gcc
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-22 12:12:48 +02:00
stefan11111
5943ca5a1d os: Fix builds with -Dxdmcp=false
Fixes: https://github.com/X11Libre/xserver/issues/239
Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-09-22 12:00:14 +02:00
Enrico Weigelt, metux IT consult
4f65d06116 os: replace GenerateRandomData() by custom arc4random_buf() on platforms that missing it
arc4random_buf() is a pretty standard libc function on Unix'oid platforms,
but not all our targets have it, thus we need a fallback there. Currently we
have GenerateRandomData(), which either just wraps arc4random_buf() or provides
some fallback implementation.

For those cases it's easier to just implement missing functions directly
instead of having custom wrapper functions. So, drop GenerateRandomData()
in favor of arc4random_buf() and provide fallback implementation for where
it is missing.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-12 15:37:13 +02:00
Enrico Weigelt, metux IT consult
7193bd9fab os: osdep.h: workaround for win32 define CreateWindow
We need to undef this win32 symbol, otherwise it's conflicting with our
`CreateWindow` fields.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-09-03 14:14:13 +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
449327f68f os: xtrans: drop own struct iovec definition on win32
We don't need our own `struct iovec` definition on win32/mingw anymore.

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
a905a3921b os: xtrans: _XSERVTransWriteV(): call ciptr->transptr->Write() directly
_XSERVTransWrite() is only intended as frontend, for xtrans consumers to
call in here. And upcoming commits will change that function to call the
Writev() method instead of Write(), so we would end up in infinite
recursing if we'd still it it here.

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
e46f51cee9 os: xtrans: drop now obsolete _XSERVTransWritev()
_XSERVTransWritev() isn't used anymore, so no need to keep it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-31 15:51:33 +02:00
Enrico Weigelt, metux IT consult
60b28c2568 os: osdep: small helper for safe strlen()
Adding helper safe_strlen() that's also checking for NULL pointer
and returning 0 in this case.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-18 16:15:41 +02:00
Enrico Weigelt, metux IT consult
34c3a9c7e2 treewide: fix serverGeneration int type mismatch
The global (exported) serverGeneration field is `unsigned long`, while
many other places copy it and compare it two other integer types, eg.
plain `int` (which is signed). Even if it's unlikely ever reaching such
high number of generations that it will ever make trouble, it's still
a good idea to clean this up and use the same type everywhere.

For clearity, introducing a typedef `x_server_generation_t` which is
used everywhere, instead of raw `unsigned long`.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-08-13 11:52:03 +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
Oleh Nykyforchyn
c4077eb298 xserver: os: reexport TimerForce() but do not allow compile drivers with it
This function is called by nvidia390 legacy proprietary driver.

Signed-off-by: Oleh Nykyforchyn <oleh.nyk@gmail.com>
2025-08-07 19:48:35 +02:00
stefan11111
84081451bc os: fix OutputBufferMakeRoom and rename it to OutputBufferMakeRoomAndFlush
This function was badly broken, among other things doing a
use after free, a NULL-pointer dereferrence, and not doing
what it was supposed to do.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-08-07 19:26:12 +02:00
stefan11111
909a5462ac os: fix FlushClient
Flushclient implicitly cast the result from a write-like call
to size_t, which turned it's error return value, -1,
into a large positive value, breaking the surrounding error-checking code.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-08-07 19:26:12 +02:00
stefan11111
fe186eee6f os: use /= 2 instead of >>= 1
Compilers optimize the first one to the second one.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-08-07 19:26:12 +02:00
stefan11111
808fc3a604 os: further simplify FlushClient
Since FlushClient only writes the data in the client's buffer,
with no extra data or padding, we only write at most as many bytes
as there are in the client buffer.

we just have to set oco->count to notWritten, the amount we still
have to write.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
2025-08-07 19:26:12 +02:00