summaryrefslogtreecommitdiff
path: root/os
AgeCommit message (Collapse)AuthorFilesLines
2020-11-02os: Fix instruction pointer written in xorg_backtraceBernhard Übelacker1-2/+5
The address retrieved in "pip.start_ip" is not necessarily the same address as unw_get_proc_name finds as nearest symbol and returns in "off". Therefore using "pip.start_ip + off" is not reliable, at least visible in the binaries from the Debian repository. Bug-Debian: https://bugs.debian.org/971088 Signed-off-by: Bernhard Übelacker <bernhardu@mailbox.org> (cherry picked from commit c15dd0ba4893f79f7181e783cb1ba404edca917a)
2020-02-06os: Ignore dying client in ResetCurrentRequestDaniel Llewellyn1-0/+5
You might as well, it's harmless. Better, some cleanup code (like DRI2 swap wait) needs to run both normally and at client exit, so it simplifies the callers to not need to check first. See 4308f5d3 for a similar example. Props: @ajax (Adam Jackson) Fixes: xorg/xserver#211 Signed-off-by: Daniel Llewellyn <diddledan@ubuntu.com> (cherry picked from commit 578371616e09364318c9fb2371a693d438b31b29)
2020-01-13ospoll: Fix Solaris ports implementation to build on Solaris 11.4Alan Coopersmith1-9/+15
Wrong version got committed, but wasn't noticed since it only builds with meson, not autoconf. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> (cherry picked from commit 0e8c0d2f238e5d50daaf4672bd80ad519673b5e3)
2020-01-13Add ddxInputThread call from os layer into ddx layerAlan Coopersmith1-0/+2
Allows ddx's to run additional code as necessary to set up the input thread. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> (cherry picked from commit 4ad21c3247d98ac6c5ad71fa36be60ed04f7c92c)
2019-11-20os: Don't crash in AttendClient if the client is goneAaron Plattner1-0/+8
If a client is in the process of being closed down, then its client->osPrivate pointer will be set to NULL by CloseDownConnection. This can cause a crash if freeing the client's resources results in a call to AttendClient. For example, if the client has a pending sync fence: Thread 1 "X" received signal SIGSEGV, Segmentation fault. AttendClient (client=0x5571c4aed9a0) at ../os/connection.c:942 (gdb) bt #0 AttendClient (client=0x5571c4aed9a0) at ../os/connection.c:942 #1 0x00005571c3dbb865 in SyncAwaitTriggerFired (pTrigger=<optimized out>) at ../Xext/sync.c:694 #2 0x00005571c3dd5749 in miSyncDestroyFence (pFence=0x5571c5063980) at ../miext/sync/misync.c:120 #3 0x00005571c3dbbc69 in FreeFence (obj=<optimized out>, id=<optimized out>) at ../Xext/sync.c:1909 #4 0x00005571c3d7a01d in doFreeResource (res=0x5571c506e3d0, skip=skip@entry=0) at ../dix/resource.c:880 #5 0x00005571c3d7b1dc in FreeClientResources (client=0x5571c4aed9a0) at ../dix/resource.c:1146 #6 FreeClientResources (client=0x5571c4aed9a0) at ../dix/resource.c:1109 #7 0x00005571c3d5525f in CloseDownClient (client=0x5571c4aed9a0) at ../dix/dispatch.c:3473 #8 0x00005571c3d55eeb in Dispatch () at ../dix/dispatch.c:492 #9 0x00005571c3d59e96 in dix_main (argc=3, argv=0x7ffe7854bc28, envp=<optimized out>) at ../dix/main.c:276 #10 0x00007fea4837cb6b in __libc_start_main (main=0x5571c3d1d060 <main>, argc=3, argv=0x7ffe7854bc28, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffe7854bc18) at ../csu/libc-start.c:308 #11 0x00005571c3d1d09a in _start () at ../Xext/sync.c:2378 (gdb) print client->osPrivate $1 = (void *) 0x0 Since the client is about to be freed, its ignore count doesn't matter and AttendClient can simply be a no-op. Check for client->clientGone in AttendClient and remove similar checks from two callers that had them. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> (cherry picked from commit 4308f5d3d1fbd0f5dce81e22c0c3f08c65a7c9d8)
2019-02-20os: Fix GetTimeInMicros resolutionPeter Harris1-4/+5
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 a779fda224bee0c4d27636503367e55ae93b33c2, 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> (cherry picked from commit 937a5b78a2f6ea771132ff0f9ece708a23c1bdad)
2019-02-20os: Report errors opening authorization file (#469)Alan Coopersmith1-1/+8
Fixes: xorg/xserver#469 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> (cherry picked from commit 7fb6338c68e158053295cb448faa5c559aa9990c)
2018-10-25LogFilePrep: add a comment to the unsafe format string.Matthieu Herrb1-0/+2
CVE-2018-14665 also made it possible to exploit this to access memory. With -logfile forbidden when running with elevated privileges this is no longer an issue. Signed-off-by: Matthieu Herrb <matthieu@herrb.eu> Reviewed-by: Adam Jackson <ajax@redhat.com> (cherry picked from commit 248d164eae27f1f310266d78e52f13f64362f81e)
2018-10-05os/xdmcp: Don't create a new socket in XdmcpReset()Alexander Volkov1-3/+9
xdmcpSocket survives during the reset, there is no need to create a new one. This commit restores logic that was broken by 49c0f2413d32fdfe36e45861fcb32aaeab633094 in Xorg 1.19. Signed-off-by: Alexander Volkov <a.volkov@rusbitech.ru> (cherry picked from commit 32677ce03d793a1f2aa8871112eb3d19b3cb762f)
2018-08-01meson: ensure the libc has RPC functions when secure-rpc is enabledLyude Paul1-1/+5
Currently our meson.build just makes the assumption that the libc is going to provide RPC functions. This doesn't actually seem to be the case on Fedora, which causes compilation to fail unexpectedly: ../../Projects/xserver/os/rpcauth.c:47:10: fatal error: rpc/rpc.h: No such file or directory #include <rpc/rpc.h> ^~~~~~~~~~~ compilation terminated. So, in the event that we can't use libtirpc ensure that we actually check whether or not the libc provides rpc/rpc.h. If it doesn't, raise an error. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Lyude Paul <lyude@redhat.com> (cherry picked from commit d95a1310ef8e08a93a28f9766d1b4093f7891404)
2018-08-01os: Recompute whether any clients are ready after check_timers()Damien Leone1-1/+2
If a driver calls AttendClient() from within a timer callback we need to re-compute the local 'are_ready' to prevent the attended client from waiting until WaitForSomething() times out. This is a fix similar to commit 9ed5b263. Signed-off-by: Damien Leone <dleone@nvidia.com> Reviewed-by: Keith Packard <keithp@keithp.com> (cherry picked from commit f33cb4264387ed14a586ba080885b4d21e4aa48b)
2018-04-17os/WaitFor: Check timers on every iterationChris Wilson1-2/+1
Currently we only check timer expiry if there are no client fd (or other input) waiting to be serviced. This makes it very easy to starve the timers with long request queues, and so miss critical timestamps. The timer subsystem is just another input waiting to be serviced, so evaluate it on every loop like all the others, at the cost of calling GetTimeInMillis() slightly more frequently. (A more invasive and likely OS specific alternative would be to move the timer wheel to the local equivalent of timerfd, and treat it as an input fd to the event loop exactly equivalent to all the others, and so also serviced on every pass. The trade-off being that the kernel timer wheel is likely more efficiently integrated with epoll, but individual updates to each timer would then require syscalls.) Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-04-02meson: Remove usage of pkg-config --variable=includedirThierry Reding1-0/+3
Querying a pkg-config variable using the --variable option produces the value of the given variable as stored in the pkg-config file and should not be used to add directories to the include search path. The reason for this is that it breaks cross-compilation, because header files are installed relative to the host sysroot. pkg-config supports a PKG_CONFIG_SYSROOT_DIR environment variable that points to this sysroot and will prepend that to the path of directories in -I or -L options in pkg-config's Cflags, Libs or Libs.private keywords. However, because no context can be inferred from variable names, as opposed to the keywords with fixed meaning, the sysroot path will not be prepended to them. The build system is responsible for doing so if necessary since it is aware of the context in which the variable is used. Adding the include directory returned by pkg-config to the include path leaks build system information into the cross-build and break with very confusing errors such as this: In file included from include/misc.h:82:0, from dix/atom.c:55: /usr/include/pthread.h:682:6: warning: '__regparm__' attribute directive ignored [-Wattributes] __cleanup_fct_attribute; ^~~~~~~~~~~~~~~~~~~~~~~ or this: In file included from include/misc.h:139:0, from dix/atom.c:55: /usr/include/stdlib.h:133:8: error: '_Float128' is not supported on this target extern _Float128 strtof128 (const char *__restrict __nptr, ^~~~~~~~~ Fix this by replacing the include directory with the appropriate xproto dependency required to add the correct include directory to the compile command for subdirectories that are missing the dependency. As detailed above, this gives pkg-config the opportunity to prepend the sysroot for all paths in -I compiler options. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
2018-03-28os: Fix -logfile when used with -displayfdAntoine Martin1-1/+1
Trivial way to reproduce the bug: $ Xorg -logfile /tmp/mylog -config /etc/xpra/xorg.conf -displayfd 2 The server then moans: Failed to rename log file "/tmp/mylog" to "/tmp/mylog": No such file or directory And the log file is created but immediately renamed to "/tmp/mylog.old". This is caused by the changes to the log file handling introduced by this commit: https://cgit.freedesktop.org/xorg/xserver/commit/?id=edcb6426f20c3be5dd5f50b76a686754aef2f64e To fix this, only rename the logfile if the log filename contains the magic substitution string "%s". Signed-off-by: Antoine Martin <antoine@nagafix.co.uk> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-03-21os: use PrivsElevated instead of a manual checkNicolai Hähnle1-1/+1
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-21os: move xf86PrivsElevated hereNicolai Hähnle1-0/+63
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-08os: Define {ReadFdFrom,WriteFdTo}Client unconditionallyAdam Jackson1-2/+7
Otherwise this is broken on cygwin: rrlease.c: In function ‘ProcRRCreateLease’: rrlease.c:305:9: error: implicit declaration of function ‘WriteFdToClient’ [-Werror=implicit-function-declaration] if (WriteFdToClient(client, fd, TRUE) < 0) { Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-02-19os: avoid uninitialized offsets in backtraceJeffrey Smith1-0/+1
When xorg_backtrace calls unw_get_proc_name and an error occurs, offset might not be set for the current frame. Initialize offset for each frame so that the offset from another frame cannot be used inadvertently. Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-01-31os: Always return microseconds from GetTimeInMicros()Jeff Smith1-1/+1
When a monotonic clock is not available, GetTimeInMicros() returns the time in nanoseconds. Instead, return the time in microseconds, as the name indicates. Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-01-24os/inputthread: Force unlock when stopping thread.Michal Srb1-0/+1
The inputthread is kept locked all the time while X server's VT is not active. If the X server is terminated while not active, it will be stuck forever in InputThreadFini waiting for the thread to join, but it wouldn't because it is locked. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=103782 Signed-off-by: Michal Srb <msrb@suse.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-01-22meson: Use and prefer tirpc for Secure RPC authenticationJon Turney1-0/+5
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-01-16meson: Enable SUN-DES-1 auth codeAdam Jackson1-0/+4
Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2018-01-08os: Fix a type error in the IPv6 XDMCP codeAdam Jackson1-1/+1
Building with strict-aliasing rightly chirps here: ../os/xdmcp.c: In function ‘XdmcpRegisterConnection’: ../os/xdmcp.c:489:31: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] &((struct sockaddr_in6 *) &address)->sin6_addr.s6_addr[12]; ^~~~~~~~~~~~ We have "const char *address", so &address here is a char ** (i.e., it points to the slot on the stack containing the pointer to the character array passed in as an argument). Casting that to a struct sockaddr_in6 * is wrong, because it means that area of the stack will be reinterpreted as a struct sockaddr_in6. Instead, cast address, not &address. Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-12-13os: Add epoll-like port implementation for SolarisPeter Harris1-7/+121
x11perf -noop with 200 xlogos connected is slightly faster with ports: before after Operation ---------- ----------------- -------------------- 18400000.0 19200000.0 (1.04) X protocol NoOperation Acked-by: Keith Packard <keithp@keithp.com> Signed-off-by: Peter Harris <pharris@opentext.com>
2017-12-13os: Add epoll-like pollset implementation for AIXPeter Harris1-1/+145
AIX's poll only allows FD_SETSIZE entries in the fd list, which is insufficient for expanded MaxClients. As a bonus, x11perf -noop with ~250 xlogos connected is slightly faster with pollset: before after Operation --------- ---------------- -------------------- 5750000.0 5990000.0 (1.04) X protocol NoOperation Signed-off-by: Peter Harris <pharris@opentext.com> Acked-by: Keith Packard <keithp@keithp.com>
2017-12-13os: Make OsSignalHandler ask for core dumps for signo != SIGQUITAdam Jackson1-2/+4
SIGQUIT is a normal termination request, but any other signal we handle here wants a core. This has the effect of making FatalError's call to AbortServer trigger the if (CoreDump) OsAbort(); path. This will allow us to remove some DDX code that has the same net effect. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
2017-12-13os: Fix strtok/free crash in ComputeLocalClientTomasz Śniatowski1-3/+3
Don't reuse cmd for strtok output to ensure the proper pointer is freed afterwards. The code incorrectly assumed the pointer returned by strtok(cmd, ":") would always point to cmd. However, strtok(str, sep) != str if str begins with sep. This caused an invalid-free crash when running a program under X with a name beginning with a colon. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=104123 Signed-off-by: Tomasz Śniatowski <kailoran@gmail.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2017-11-29os/xdmcp: Honour -once when session is deadDaniel Martin1-1/+1
Terminate a dead session when -once was passed. Don't restart it. Signed-off-by: Daniel Martin <consume.noise@gmail.com> Reviewed-by: Walter Harms <wharms@bfs.de>
2017-11-06os: Remove mffs()Adam Jackson2-25/+0
This was always wide enough to work on an fd_mask ("mask" ffs presumably). We don't operate on fd_masks anymore, so this can go. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2017-10-30Use ARRAY_SIZE all over the treeDaniel Martin2-5/+3
Roundhouse kick replacing the various (sizeof(foo)/sizeof(foo[0])) with the ARRAY_SIZE macro from dix.h when possible. A semantic patch for coccinelle has been used first. Additionally, a few macros have been inlined as they had only one or two users. Signed-off-by: Daniel Martin <consume.noise@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-10-09os: Make sure big requests have sufficient length.Michal Srb1-0/+5
A client can send a big request where the 32B "length" field has value 0. When the big request header is removed and the length corrected, the value will underflow to 0xFFFFFFFF. Functions processing the request later will think that the client sent much more data and may touch memory beyond the receive buffer. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-30os: Fix warning in LockServerAdam Jackson1-1/+1
The meson build gives me: ../os/utils.c: In function ‘LockServer’: ../os/utils.c:310:40: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=] snprintf(pid_str, sizeof(pid_str), "%10ld\n", (long) getpid()); ^~~~~~~~~ ../os/utils.c:310:5: note: ‘snprintf’ output between 12 and 13 bytes into a destination of size 12 snprintf(pid_str, sizeof(pid_str), "%10ld\n", (long) getpid()); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Which seems to be due to the %d part meaning that a negative number's - sign would be one wider than we're expecting. Fine, just coerce it to unsigned. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2017-08-22os: make MitGenerateCookie() independent of XCSECURITYEmil Velikov1-4/+0
Analogous to previous commit. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk>
2017-08-22os: make GenerateRandomData() independent of XCSECURITYEmil Velikov1-2/+2
The function itself does not depend on the macro. Move it outside of the ifdef guard and remove the identical copy in XWIN. This is step 1 towards removing the duplication in winauth.c and moving the OS specifics to os/ Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk>
2017-08-14meson: Fix epoll detectionPeter Harris1-1/+1
The epoll code depends on epoll_create1, not epoll_create. Signed-off-by: Peter Harris <pharris@opentext.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net>
2017-06-13os: Set oc->fd to -1 when connection is closedKeith Packard1-0/+1
This ensures that we don't use the now-closed file descriptor in the future. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2017-06-13os: Check oc->trans_conn before using oc->fd in YieldControlNoInputKeith Packard1-10/+9
oc->trans_conn is set to NULL when the connection is closed. At this point, oc->fd is no longer valid and shouldn't be used. Move dereference of oc->fd up into YieldControlNoInput where the state of oc->trans_conn can be checked in a single place. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2017-06-13os: Don't call ospoll_listen/ospoll_mute after connection is closedKeith Packard1-4/+6
In set_poll_client, check oc->trans_conn to make sure the connection is still running before changing the ospoll configuration of the file descriptor in case some other bit of the server is now using this file descriptor. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2017-06-13os: Use CloseDownFileDescriptor from AbortClient, including ospoll_removeKeith Packard3-11/+12
AbortClient performs most of the same operations as CloseDownFileDescriptor except that it doesn't call ospoll_remove, leaving that unaware that the file descriptor has been closed. If the file descriptor is re-used before the server comes back around to clean up, and that new file descriptor is passed to SetNotifyFd, then that function will mistakenly re-interpret the stale ClientPtr returned by ospoll_data as a struct notify * instead and mangle data badly. To fix this, the patch does: 1) Change CloseDownFileDescriptor so that it can be called multiple times on the same OsCommPtr. The calls related to the file descriptor are moved inside the check for trans_conn and oc->trans_conn is set to NULL after cleaning up. 2) Move the XdmcpCloseDisplay call into CloseDownFileDescriptor. I don't think the actually matters as we just need to know at some point that the session client has exited. Moving it avoids the possibility of having this accidentally trigger from another client with the same fd which closes down at around the same time. 3) Change AbortClient to call CloseDownFileDescriptor. This makes sure that all of the fd-related clean up happens in the same way everywhere, in particular ensures that ospoll is notified about the closed file descriptor at the time it is closed and not some time later. Debian-bug: https://bugs.debian.org/862824 Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2017-06-13os: Eliminate ConnectionTranslationKeith Packard2-140/+1
This infrastructure is no longer read, only written; the mapping from fd to client is now handled by ospoll. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2017-05-12os, xfree86: Stop being so weird about <limits.h>Adam Jackson2-19/+0
Whatever problem this is trying to fix, we don't care. Just include the thing and stop worrying about whether _POSIX_SOURCE is defined. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Julien Cristau <jcristau@debian.org> Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-05-10meson: Only detect each function oncePeter Harris1-9/+9
Use conf_data outside of include/ to avoid re-running detection of the same functions. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Peter Harris <pharris@opentext.com>
2017-05-10timingsafe_memcmp: Fix meson buildAdam Jackson1-1/+1
Include dix-config.h first to pick up _GNU_SOURCE so we get the definition for sigset_t. Reported-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-05-04meson: Test to build xserver_poll.c was invertedJon TURNEY1-2/+2
Test to build xserver_poll.c was inverted compared to autoconf. Build xserver_poll.c if poll is missing. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2017-04-29os: Mark client as ready to read when closing due to write failure [100863]Keith Packard1-1/+5
This makes sure the server will go look at the client again, notice that the FD is no longer valid and close the client down. Bugzilla: https://bugs.freedesktop.org/100863 Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
2017-04-29os: un-duplicate code to close client on write failureKeith Packard1-13/+21
There are three copies of the same short sequence of operations to close down a client when a write error occurs. Create a new function, AbortClient, which performs these operations and then call it from the three places. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
2017-04-27meson: Factor out the AC_REPLACE_FUNCS stuff to its own libraryAdam Jackson1-7/+17
This is all just stuff we wish we had in libc, and some of this gets used in eg. the dmx utilities build, so split it to its own library to avoid pulling in xserver stuff. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-04-26Add a Meson build system alongside autotools.Eric Anholt1-0/+65
This is a work in progress that builds Xvfb, Xephyr, Xwayland, Xnest, and Xdmx so far. The outline of Xquartz/Xwin support is in tree, but hasn't been built yet. The unit tests are also not done. The intent is to build this as a complete replacement for the autotools system, then eventually replace autotools. meson is faster to generate the build, faster to run the bulid, shorter to write the build files in, and less error-prone than autotools. v2: Fix indentation nits, move version declaration to project(), use existing meson_options for version-config.h's vendor name/web. Signed-off-by: Eric Anholt <eric@anholt.net> Acked-by: Keith Packard <keithp@keithp.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-26Use #ifdef instead of #if for features to make Meson easier.Eric Anholt1-8/+8
We mostly use #ifdef throughout the tree, and this lets the generated config.h files just be #define TOKEN instead of #define TOKEN 1. Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Eric Anholt <eric@anholt.net>
2017-04-26os: Handle SIGABRTMichel Dänzer2-0/+7
Without this, assertion failures can make life hard for users and those trying to help them. v2: * Change commit log wording slightly to "can make life hard", since apparently e.g. logind can alleviate that somewhat. * Set default handler for SIGABRT in hw/xfree86/common/xf86Init.c:InstallSignalHandlers() and hw/xquartz/quartz.c:QuartzInitOutput() (Eric Anholt) Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>