Commit Graph

276 Commits

Author SHA1 Message Date
Alan Coopersmith 2ffe0f8a35 os: if getaddrinfo() is available, use it, even if IPv6 support is disabled
Support for using getaddrinfo() was originally added to support IPv6,
and only used if IPv6 support was enabled.  Two decades later, support
for getaddrinfo() is ubiquitous and OS'es have marked gethostbyname()
as deprecated, so use the modern interface whenever we can now.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1760>
2025-01-27 22:34:51 +00:00
Enrico Weigelt, metux IT consult bb9953db3f os: utils: fix char signess mismatch
On NetBSD gives warning:

In file included from /usr/include/ctype.h:100,
                 from ../include/misc.h:174,
                 from ../os/utils.c:75:
../os/utils.c: In function ‘VerifyDisplayName’:
../os/utils.c:624:23: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  624 |         if (!isdigit(d[i])) {
      |                       ^
../os/utils.c: In function ‘ProcessCommandLine’:
../os/utils.c:942:44: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  942 |             if ((i + 1 < argc) && (isdigit(*argv[i + 1])))
      |                                            ^

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1455>
2024-10-10 13:56:05 +00:00
Enrico Weigelt, metux IT consult a917f6a8a8 drop obsolete HAVE_DIX_CONFIG_H
The symbol controls whether to include dix-config.h, and it's always set,
thus we don't need it (and dozens of ifdef's) anymore.

This commit only removes them from our own source files, where we can
guarantee that dix-config.h is present - leaving the (potentially exported)
headers untouched.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-10-10 13:38:31 +00:00
Enrico Weigelt, metux IT consult aef17edd92 os: utils: drop obsolete REMOVE_ENV_LD conditional
This always had been set since it's incarnation back two decades
ago, on XFree86 4.3.0.1. Probably no need to keep that around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1518>
2024-09-01 20:08:30 +00:00
Enrico Weigelt, metux IT consult 4b94e4fa08 os: utils: drop unused USE_ISPRINT
This always had been disabled since it's incarnation XFree86 4.3.0.1,
back two decades ago, so there's likely no need for it.

Fixes: d568221710
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1518>
2024-09-01 20:08:30 +00:00
Enrico Weigelt, metux IT consult b5d897d126 os: utils: drop REMOVE_LONG_ENV conditional
This always had been enabled since it's incarnation back two decades ago,
so it doesn't seem to be necessary keeping that conditional any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1518>
2024-09-01 20:08:30 +00:00
Enrico Weigelt, metux IT consult 6c6944be14 os: utils: drop unused VENDORSUPPORT
This doesn't seem to be used anymore for two decades now,
so there's probably no need to keep it any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1518>
2024-09-01 20:08:30 +00:00
Enrico Weigelt, metux IT consult 69905a0a28 os: utils: drop unused NO_OUTPUT_PIPES
This hasn't been used/enabled for over 20 years, so there's probably
no reason for keeping it even longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1518>
2024-09-01 20:08:30 +00:00
Enrico Weigelt, metux IT consult 6153b89d19 os: utils: minor code formatting cleanup
Just correcting some small indention issues, no actual change.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1518>
2024-09-01 20:08:30 +00:00
Enrico Weigelt, metux IT consult 2cec3cfbf1 include: move private definitions out of input.h
It's not good having the public server api headers clobbered with private
definitions, so cleaning them up.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1354>
2024-09-01 17:59:23 +00:00
Alan Coopersmith f35951d83e Remove remnants of support for SysV versions before SVR4
Most of the support for such OS'es was removed in 2010 for
xorg-server-1.10.0, but a few bits lingered on, and a few
comments were left out-of-date.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1667>
2024-09-01 02:14:10 +00:00
Enrico Weigelt, metux IT consult 8e32cec204 xv: move noXvExtension to xvmain.c
It's more appropriate having those kind of flags in the corresponding
extension.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1512>
2024-07-26 23:51:13 +00:00
Enrico Weigelt, metux IT consult 96c99b8318 os: move -nolock help message printing to serverlock.h
Reduce #ifdef cluttering in os/utils.c a little bit my moving the (built-time-)
conditional printing of the help message into serverlock.c

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1320>
2024-07-26 22:26:07 +00:00
Enrico Weigelt, metux IT consult 749046e5e9 os: move out LockServer logic from util.c to serverlock.c
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1320>
2024-07-26 22:26:07 +00:00
Enrico Weigelt, metux IT consult 4773182c72 os: unexport LockServer() and UnlockServer() from public module API
These functions work on server process level, and shouldn't be touched
by drivers at all, thus shouldn't be exported to them.

(couldn't find any driver/module using these symbols)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1320>
2024-07-26 22:26:07 +00:00
Enrico Weigelt, metux IT consult 69b57fd01f os: move defining LOCK_SERVER into meson
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1320>
2024-07-26 22:26:07 +00:00
Enrico Weigelt, metux IT consult f8057261fe os: drop extra ifdefs for AF_INET6
Since IPv6 is now only defined if IPv6 is really supported, we don't
need to ifdef on AF_INET6 anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1539>
2024-06-18 01:59:33 +00:00
Enrico Weigelt, metux IT consult e5c8b664d3 os: unexport ddx callbacks
The DDX callbacks (where core/DIX calls into DDX) aren't supposed to be
called by drivers directly, so unexport them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1332>
2024-05-08 09:37:35 +02:00
Enrico Weigelt, metux IT consult bae6cbc8ca include: move private defs to dixstruct_priv.h
Public server module API shouldn't be clobbered with private definitions,
thus move them out to dixstruct_priv.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1289>
2024-04-30 00:47:38 +00:00
Enrico Weigelt, metux IT consult be4c8444eb os: unexport Os*() functions
These aren't called (and suited for being called) by drivers,
thus drop them from the public module API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1381>
2024-04-16 14:20:30 +02:00
Enrico Weigelt, metux IT consult cbc9f557e5 os: unexport set_font_authorizations()
This function is only used by DIX, so no need to export it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1344>
2024-04-15 14:42:45 -07:00
Enrico Weigelt, metux IT consult 389b528203 os: unexport command line args handling functions
These functions shouldn't be called by drivers or extensions, thus
shouldn't be exported. Also moving it to separate header, so the
already huge ones aren't cluttered with even more things.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1334>
2024-04-15 21:21:40 +00:00
Enrico Weigelt, metux IT consult 3843a643e0 os: unexport audit functions
These aren't used by any drivers, so no need to keep them around in the
public driver API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1326>
2024-04-15 19:54:34 +00:00
Enrico Weigelt, metux IT consult 537293ff4e os: move SELinux enforcement state to the extension
Those fields are better off in the extension instead of the OS layer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1328>
2024-03-25 19:40:04 +00:00
Enrico Weigelt, metux IT consult 02ba47f09d os: move out Format*() functions
Move out the Format*() functions to separate source and header.

These aren't exported, thus no module API change.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1312>
2024-03-09 17:34:51 +00:00
Enrico Weigelt, metux IT consult 040e41c7e9 dix: unexport global variables
Those aren't used by drivers, so no need to export them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1375>
2024-03-09 17:23:43 +00:00
Enrico Weigelt, metux IT consult 7bd19a9580 xwin: replace ZeroMemory()
replace Windows specific ZeroMemory (macro just calling memset())
by static initialization, calloc() and memset().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1295>
2024-03-03 23:02:54 +00:00
Enrico Weigelt, metux IT consult 5d2f675ca8 os: utils: drop obsolete System() on non-win32 targets
This function is only used on WIN32 targets, so we can drop the *nix
implementation.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1295>
2024-03-03 23:02:54 +00:00
Enrico Weigelt, metux IT consult 22a67f7818 os: move string functions to separate source file
Unclutter the huge utils.c a bit, by moving out string functions to
their own source file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1336>
2024-02-29 10:09:37 +00:00
Enrico Weigelt, metux IT consult 3e9ac852bc os: move alloc functions to separate source file
Reduce the massive os/utils.c a little bit by moving out the alloc
functions to their own source file.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1336>
2024-02-29 10:09:37 +00:00
Enrico Weigelt, metux IT consult fe1e2b7b3d dix: unexport and move maxBigRequestSize
* this symbol is a server configuration flag (can be passed via cmdline)
  for limiting the max size of big-requests. there shouldn't be any need
  to use it outside the core X server (in server modules like drivers
  or external extension) - therefore unexport it
* in order to reduce namespace pollution of public (server module API)
  headers, create a new internal header for those tings (more to come)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1275>
2024-02-23 23:19:32 +00:00
Peter Hutterer eaa92ea422 Revert "include: move BUG_*() macros to separate header"
This breaks the xf86-input-synaptics driver:

  synaptics.c: In function 'clickpad_guess_clickfingers':
  synaptics.c:2638:5: error: implicit declaration of function 'BUG_RETURN_VAL' [-Werror=implicit-function-declaration]
   2638 |     BUG_RETURN_VAL(hw->num_mt_mask > sizeof(close_point) * 8, 0);

This reverts commit 442aec2219.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1316>
2024-02-23 23:11:01 +00:00
Enrico Weigelt, metux IT consult 194a7c2032 os: move xdmcp prototypes to separate header
The xdmcp handling isn't really OS specific, and only few sites actually need
to call it, so at least it's prototypes are better off in some separate header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1311>
2024-02-22 23:42:52 +00:00
Enrico Weigelt 442aec2219 include: move BUG_*() macros to separate header
Yet another step of uncluttering includes: move out the BUG_* macros
into a separate header, which then is included as-needed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-02-15 23:33:46 +00:00
Alan Coopersmith a8bb924af1 os: Assume all supported non-WIN32 platforms have seteuid & saved_ids
Removes fallback code to fork and exec a "cat" command to read files.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2024-02-10 00:05:54 +00:00
Simon Ser 21b3dad238 Allow disabling the SHAPE extension at runtime
To correctly render a window making use of SHAPE, a compositor
must query the shape rectangles. This may not be a desirable
feature for a Wayland compositor. Allow SHAPE to be turned off at
runtime, so that the compositor can opt-out.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-03-03 18:28:40 +00:00
Peter Hutterer 412777664a Disallow byte-swapped clients by default
The X server swapping code is a huge attack surface, much of this code
is untested and prone to security issues. The use-case of byte-swapped
clients is very niche, so let's disable this by default and allow it
only when the respective config option or commandline flag is given.

For Xorg, this adds the ServerFlag "AllowByteSwappedClients" "on".
For all DDX, this adds the commandline options +byteswappedclients and
-byteswappedclients to enable or disable, respectively.

Fixes #1201

https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1029

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-06 11:59:37 +10:00
Alan Coopersmith f8cbe96d14 os: Use memcpy() instead of memmove() when buffers are known not to overlap
Most of these came from a mass bcopy() -> memmove() substitution in 1993
with a commit comment of "Ansification (changed bfuncs -> mfuncs)"

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-08-29 21:10:51 +00:00
nerdopolis ca1dfdc9aa os: Try to discover the current seat with the XDG_SEAT var first 2021-10-14 10:35:43 +00:00
Boris-Barboris 16571b8926 Don't hardcode fps for fake screen
Currently, when main hardware screen is powered-off,
X server initializes fake screen's timer with
1 second update interval.

Streaming software like Nomachine or Vnc, as well as
desktop input automation suffers from it, since it
will forever be stuck on 1 fps until the display is
turned back on.

This commit adds command line option -fakescreenfps <int>
that allows the user to change the default fake screen
timer.

Signed-off-by: Baranin Alexander <ismailsiege@gmail.com>
2021-07-29 08:09:00 +00:00
Olivier Certner d4b38e1119 os: Properly report failure to link lock file
Stop assuming that a failure to link always means that the file indeed
exists. In case of other failure (e.g., permissions), the user would get an
inconsistent "Can't read lock file" message.

Signed-off-by: Olivier Certner <olce.freedesktop@certner.fr>
2021-06-25 10:18:18 +00:00
Olivier Fourdan 6b47321bc6 dix: Add optional terminate delay
When the command line option "-terminate" is used, it could be
interesting to give it an optional grace period to let the Xserver
running for a little longer in case a new connection occurs.

This adds an optional parameter to the "-terminate" command line option
for this purpose.

v2: Use a delay in seconds instead of milliseconds
    (Martin Peres <martin.peres@mupuf.org>)
v3: Clarify man page entry, ensure terminateDelay is always >= 0,
    simplify TimerFree(). (Peter Hutterer <peter.hutterer@who-t.net>)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-06-07 17:28:05 +02:00
Olivier Fourdan 3cdac5ba07 mi: List extensions in usage message
Not all extensions can be enabled or disabled at runtime, list the
extensions which can from the help message rather than on error only.

v2:
 * Print the header message in the ListStaticExtensions() (Peter
   Hutterer)
 * Do not export ListStaticExtensions() as Xserver API

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2021-01-29 12:52:09 +00:00
Adam Jackson 2d1ed64d2a dix: Remove -to option to set the default connection timeout
One minute is admittedly arbitrary, but again, pretty sure this never
gets set on the command line in practice.
2019-10-30 16:17:04 +00:00
Adam Jackson 56ea4c769c dix: Remove -fn and -fc options to set default text/cursor fonts
I strongly suspect these never get used in the wild, and it's not an
especially useful thing to do in any case.
2019-10-30 16:17:04 +00:00
Jon Turney 7b4b030df8 configure: Check for sigprocmask
MinGW defines SIG_BLOCK, but doesn't have signal masks, so rather than
checking for SIG_BLOCK, add a configure check for sigprocmask.

v2:
Also add check to meson.build
2019-05-18 14:59:38 +00:00
Peter Harris 937a5b78a2 os: Fix GetTimeInMicros resolution
GetTimeInMillis is called first, which sets clockid to
CLOCK_MONOTONIC_COARSE, which is typically much lower resolution than
the callers of GetTimeInMicros want.

Prior to a779fda224, GetTimeInMillis and
GetTimeInMicros did not share a clockid.

Restore the clockid split to fix the granularity of GetTimeInMicros.

Signed-off-by: Peter Harris <pharris@opentext.com>
2019-01-30 14:56:46 -05:00
Adam Jackson 53d32c94f3 dix: Remove the magic WhenMapped backing store hack
Automatic compositing exists, if that's what you want then use it.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-10-23 18:37:46 +00:00
Nicolai Hähnle 1b6910af12 os: use PrivsElevated instead of a manual check
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Ben Crocker <bcrocker@redhat.com>
Reviewed-by: Antoine Martin <antoine@nagafix.co.uk>
Tested-by: Ben Crocker <bcrocker@redhat.com>
2018-03-21 10:58:40 -04:00
Nicolai Hähnle 9ef602de46 os: move xf86PrivsElevated here
Having different types of code all trying to check for elevated privileges
is a bad idea. This implementation is the most thorough one.

Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Ben Crocker <bcrocker@redhat.com>
Reviewed-by: Antoine Martin <antoine@nagafix.co.uk>
Tested-by: Ben Crocker <bcrocker@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-03-21 10:58:39 -04:00