aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/os
Commit message (Collapse)AuthorAgeFilesLines
* Remove the Must_have_memory hack.Ulrich Sibiller2019-06-121-2/+0
| | | | | | | | | | | | | We are not using any alloc function that respects that variable, so lets drop it. Backport of this commit: commit 0ce61e21d6d7dcca0090e319bbcdb678570f2c3f Author: Adam Jackson <ajax@redhat.com> Date: Fri Oct 3 16:05:19 2008 -0400 Remove the Must_have_memory hack. Also remove an astonishing amount of misunderstanding of how casts work.
* os: fix BigReq ignoring when another request is pendingUlrich Sibiller2019-06-111-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not sure how it came to this situation, but the following commit is partly contained in our version of the code. Some lines had not been removed, tough... commit c80c41767eb101e9dbd8393d8cca7764b4e248a4 Author: Aaron Plattner <aplattner@nvidia.com> Date: Mon Oct 25 22:01:32 2010 -0700 os: Fix BigReq ignoring when another request is pending Commit cf88363db0ebb42df7cc286b85d30d7898aea840 fixed the handling of BigReq requests that are way too large and handles the case where the read() syscall returns a short read. However, it neglected to handle the case where it returns a long read, which happens when the client has another request in the queue after the bogus large one. Handle the long read case by subtracting the smaller of 'needed' and 'gotnow' from oci->ignoreBytes. If needed < gotnow, simply subtract the two, leaving gotnow equal to the number of extra bytes read. Since the code immediately following the (oci->ignoreBytes > 0) block tries to handle the next request, advance oci->bufptr immediately instead of setting oci->lenLastReq and letting the next call to ReadRequestFromClient do it. Fixes the XTS pChangeKeyboardMapping-3 test. CASES TESTS PASS UNSUP UNTST NOTIU WARN FIP FAIL UNRES UNIN ABORT -Xproto 122 389 367 2 19 0 0 0 1 0 0 0 +Xproto 122 389 368 2 19 0 0 0 0 0 0 0 Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
* Die XTESTEXT1, die!Ulrich Sibiller2019-05-101-19/+1
| | | | | | | | | | | | | | | | | | | | | | | | commit a73e0f8cdfec1c9199ffe696146ba7d677c4c10d Author: Daniel Stone <daniel@fooishbar.org> Date: Thu Jun 1 18:47:47 2006 +0000 Die XTESTEXT1, die! Citing an email from the xorg-modular mailing list: On Tuesday 21 February 2006 23:04, Enrico Weigelt wrote: > Hi folks, > > I'm wondering what's the difference between XTEST and XTESTEXT1 > (the second one can be configured w/ my current patch ...) > Are they both the same ( -> XTest extension ) ? > Can I put both symbols together ? They're not the same extension. XTest is the one you want, if you want either. The other hasn't been built by default in ages and I should probably go ahead and nuke it from the tree. - ajax
* nxagent: Fix an excessive request size limitation that broke big-requests.Ulrich Sibiller2018-10-061-1/+3
| | | | | | | | | | | | | | | | | Fixes ArcticaProject/nx-libs#301, #631 Backport from xorg-xserver: commit ca82d4bddf235c9b68d51d68636bab40eafb9889 Author: Eric Anholt <eric@anholt.net> Date: Fri Aug 31 13:00:23 2007 -0700 Bug #7186: Fix an excessive request size limitation that broke big-requests. MAXBUFSIZE appears to be a leftover of some previous time. Instead, just use maxBigRequestSize when bigreqs are available (limiting buffers to ~16MB). When bigreqs are not available, needed won't be larger than the maximum size of a non-bigreqs request (256kB).
* Use min() [defined in include/misc.h] instead of MIN() [not defined in any ↵Alan Coopersmith2018-08-211-3/+3
| | | | | | | | | | | | | | | Xorg header]. Backport from X.org: commit 724dbc2f8bbe2f21bf16f20ca7b8bb555516626c Author: Alan Coopersmith <Alan.Coopersmith@sun.com> Date: Tue May 2 01:30:37 2006 +0000 Use min() [defined in include/misc.h] instead of MIN() [not defined in any Xorg header]. Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* [PATCH] os: XDMCP options like -query etc. should imply -listen tcpMihai Moldovan2018-07-181-0/+17
| | | | | | | | | | | | | | | | | | | | | Backported from X.org: commit 491cf02e191e70c5ce24c19da880bb79bebfc03c Author: Jon TURNEY <jon.turney@dronecode.org.uk> Date: Tue Feb 10 2015 14:37:26 +0000 [PATCH] os: XDMCP options like -query etc. should imply -listen tcp In X server 1.17, the default configuration is now -nolisten tcp. In this configuration, XDMCP options don't work usefully, as the X server is not listening on the port for the display that it tells the display manager to connect to. Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Colin Harrison <colin.harrison@virgin.net> Backported-to-NX-by: Mihai Moldovan <ionic@ionic.de
* os/io.c: fix unitialised bytesUlrich Sibiller2018-07-031-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... by implementing some kind of recalloc (mix of realloc and calloc). Fixes this valgrind finding: ==7061== Syscall param writev(vector[...]) points to uninitialised byte(s) ==7061== at 0x781EFE0: __writev_nocancel (syscall-template.S:84) ==7061== by 0x488974: _XSERVTransSocketWritev (Xtranssock.c:2914) ==7061== by 0x47DBD3: FlushClient (io.c:1080) ==7061== by 0x47DBD3: FlushAllOutput.part.0 (io.c:817) ==7061== by 0x477304: WaitForSomething (WaitFor.c:246) ==7061== by 0x434369: Dispatch (NXdispatch.c:360) ==7061== by 0x40EB92: main (main.c:353) ==7061== Address 0x102106f3 is 50,211 bytes inside a block of size 54,308 alloc'd ==7061== at 0x4C2FD5F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==7061== by 0x47F08F: FlushClient (io.c:1123) ==7061== by 0x47F307: WriteToClient (io.c:991) ==7061== by 0x42903C: doListFontsAndAliases (NXdixfonts.c:660) ==7061== by 0x42B7D6: ListFonts (NXdixfonts.c:735) ==7061== by 0x433A6D: ProcListFonts (NXdispatch.c:989) ==7061== by 0x4344A5: Dispatch (NXdispatch.c:482) ==7061== by 0x40EB92: main (main.c:353) ==7061== Uninitialised value was created by a heap allocation ==7061== at 0x4C2FD5F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==7061== by 0x47F08F: FlushClient (io.c:1123) ==7061== by 0x47F307: WriteToClient (io.c:991) ==7061== by 0x42903C: doListFontsAndAliases (NXdixfonts.c:660) ==7061== by 0x42B7D6: ListFonts (NXdixfonts.c:735) ==7061== by 0x433A6D: ProcListFonts (NXdispatch.c:989) ==7061== by 0x4344A5: Dispatch (NXdispatch.c:482) ==7061== by 0x40EB92: main (main.c:353) ==7061==
* nx-X11/programs/Xserver/{,os/}Imakefile: implement libtirpc forcing via ↵Mihai Moldovan2018-03-151-0/+8
| | | | UseTIRPC.
* os: hide ttyxx optionUlrich Sibiller2018-02-281-0/+6
| | | | is used nowhere anyway
* Lift os to XORG-7_1 state - non-functional changes onlyUlrich Sibiller2018-02-271-0/+1
|
* Lift os to XORG-7_1 stateUlrich Sibiller2018-02-273-9/+6
|
* hw/nxagent/: Stop using non-portable '__progname', set up our own ↵Mike Gabriel2018-02-261-2/+2
| | | | 'nxagentProgName' instead and pass it around where needed.
* nxagent: Print correct application in usage message.Simon Matter2018-02-261-0/+5
| | | | Fixes ArcticaProject/nx-libs#639.
* Lift dix to xorg-xserver-1.3.0.0 stateUlrich Sibiller2018-02-261-2/+0
|
* Xext: lift DPMS extension to xorg-xserver-7.1/1.1 stateUlrich Sibiller2018-02-071-91/+102
|
* nx-X11/programs/Xserver/os/xprintf.c: completely drop NX-related changes.Mihai Moldovan2017-12-131-9/+0
|
* Xserver/os/xprintf.c: Drop NoMachine's own implementation of Xvasprintf(). ↵Mike Gabriel2017-12-111-50/+1
| | | | | | | | | | | | | | | | | | | | | | Use stock implementation instead. * Reason from NoMachine's NX CHANGELOG for having its own implementation of Xvasprintf() (from around nxagent 3.3.0): - Fixed TR06G02225. The implementation of Xvprintf() has been reviewed to work on more platforms. Previous implementation caused a failure in the build of keyboard map on some platform like Solaris 8 and 9. - Fixed TR03G02198. Reimplemented Xvprintf() in Xserver/os to handle the case in which vsnprintf returned -1. * Reason for removing it again: - Fixes segfaults in SetDefaultFontPath when launching nxagent. - All locations in Xserver/** using the code check for return value of -1. - Solaris 8 and 9 are beyond of our support scope. - Keep more in sync with X.org. - Good moment to drop more GPL-2 code from Xserver's code base.
* nx-X11/programs/Xserver/os/xprintf.c: remove doubly-defined Xscnprintf ↵Mihai Moldovan2017-12-111-22/+2
| | | | | | | function, add missing header includes. Fix up for 1e3a97482840401af9ffcf73db6008ebfe6c1d52, which has been faulty in this regard.
* os/xprintf: add Xvscnprintf and XscnprintfDaniel Kurtz2017-12-101-0/+44
| | | | | | | | | | | | | | | | | | | | | | Backported from X.org: commit 5c2e2a164d615ab06be28a663734e782614b5cc7 Author: Daniel Kurtz <djkurtz@chromium.org> Date: Wed Apr 18 09:51:51 2012 +0000 os/xprintf: add Xvscnprintf and Xscnprintf Normal snprintf() usually returns the number of bytes that would have been written into a buffer had the buffer been long enough. The scnprintf() variants return the actual number of bytes written, excluding the trailing '\0'. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Backported-to-NX-by: Mihai Moldovan <ionic@ionic.de>
* Typo in xserver Xvasprintf()Colin Harrison2017-12-101-2/+2
| | | | | | | | | | | | | | | | | Backported from X.org: commit 1324b0ca9f8a7fdaf03b374c75eb3c9df407c2f1 Author: Colin Harrison <colin.harrison@virgin.net> Date: Fri Dec 10 00:08:24 2010 +0000 Typo in xserver Xvasprintf() I needed this patch in the wrapper around vsnprintf() in os/xprintf.c (MinGW for Windows build) to correct various crashes. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Mihai Moldovan <ionic@ionic.de>
* Add asprintf() implementation for platforms without itAlan Coopersmith2017-12-101-44/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backported from X.org: commit c95c1d338fdb62dbe3dba934b97324fa778b7fce Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Sat Nov 27 18:43:12 2010 -0800 Add asprintf() implementation for platforms without it Provides a portable implementation of this common allocating sprintf() API found in many, but not yet all, of the platforms we support. If the platform provides vasprintf() we simply wrap it, otherwise we implement it - either way callers can use it regardless of platform. Since not all platforms guarantee to NULL out the return pointer on failure, we don't either, and require callers to check the return value for -1. The old Xprintf() API is deprecated, but left for compatibility for now. The new API is added in a new header so that it can be used in parts of the server such as hw/xfree86/parser that don't include all the server headers. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net> Includes re-indentation changes from 9838b7032ea9792bec21af424c53c07078636d21. Backported-to-NX-by: Mihai Moldovan <ionic@ionic.de>
* Reintroduce -co as no-opUlrich Sibiller2017-12-071-0/+11
| | | | | | nxagent will abort if it encounters an unknown command line option. As we want 3.6 to be a drop-in replacement for 3.5 we cannot simply drop old options but must accept them as no-op.
* nx-X11/programs/Xserver/os/connection.c: compact display autodetection code.Mihai Moldovan2017-04-201-4/+2
|
* Xserver/os/connection.c: If -displayfd and an explicit display port number ↵Mike Gabriel2017-04-201-0/+11
| | | | are given, use the explicit display number as a starting point for auto-detecting the next available display number.
* Xserver/os/connection.c: Accompany display number with some human-readable ↵Mike Gabriel2017-04-201-0/+9
| | | | (machine-parseable) text when -displayfd is set to STDERR.
* Clearing comments from $XFree86$ (et al.) header lines.Mike Gabriel2017-04-192-7/+0
|
* Regression fix for added libXfont2 API support:Mike Gabriel2017-04-101-1/+1
| | | | | | | | | | - Move FONT_DEFINES and XLIBFONT definition to from Server.tmpl to Imake.tmpl. - Add FONT_DEFINES to ALLDEFINES. - Drop SpecialCObjectRules with FONT_DEFINES from various Imakefiles again, FONT_DEFINES is now set "globally". - Hand over FONT_DEFINES from main Makefile to nx-X11's make BuildEnv to make gccmakedep happy.
* Xserver: Support building against libXfont2 (v2) API and old libXfont(1) API ↵Mike Gabriel2017-04-102-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | alike. Fixes ArcticaProject/nx-libs#296. Inspired by the following X.org commit. Other than X.org, we will continue support for building nx-libs against libXfont1 for a while. commit 05a793f5b3c40747d5a92a076def7f4fb673c7e7 Author: Keith Packard <keithp@keithp.com> Date: Tue Sep 1 18:50:55 2015 -0700 dix: Switch to the libXfont2 API (v2) This new libXfont API eliminates exposing internal X server symbols to the font library, replacing those with a struct full of the entire API needed to use that library. v2: Use libXfont2 instead of libXfont_2 Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
* os: Remove the useless -x optionAdam Jackson2017-03-211-9/+0
| | | | | | | | | | commit cbb165ab88cb0810268001e84d87671440baf837 Author: Adam Jackson <ajax@redhat.com> Date: Fri Apr 3 18:34:45 2009 -0400 os: Remove the useless -x option Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* os: FatalError if -displayfd writes fail AND Clear the -displayfd option ↵Keith Packard2017-03-211-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | after closing the file commit d72f691c0c9cace857975a6608a4cb431c8b6846 Author: Keith Packard <keithp@keithp.com> Date: Fri Apr 18 15:00:30 2014 -0700 os: FatalError if -displayfd writes fail When the server is started with the -displayfd option, check to make sure that the writes succeed and give up running if they don't. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> commit 4957e986841225e9984daca76f1a0ee08df125bb Author: Keith Packard <keithp@keithp.com> Date: Fri Apr 18 15:00:35 2014 -0700 os: Clear the -displayfd option after closing the file Failing to clear this means that we'll attempt to write the display number to a random file descriptor on subsequent X server generations. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* Use unique logfile names when starting server with -displayfdAlan Coopersmith2017-03-212-29/+99
| | | | | | | | | | | | | | | | | | | | commit edcb6426f20c3be5dd5f50b76a686754aef2f64e Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Fri Jan 1 18:11:14 2016 -0800 Use unique logfile names when starting server with -displayfd Fixes https://bugs.freedesktop.org/show_bug.cgi?id=93212 Previously all X servers started with -displayfd would overwrite Xorg.0.log - now a temporary name of Xorg.pid-<pid>.log is used until after -displayfd finds an open display - then it is renamed to the traditional Xorg.<display>.log name. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* os: -displayfd should check ports up to 65535Jon TURNEY2017-03-211-1/+1
| | | | | | | | | | | | | | | | | | commit ea5b2b0a2e2143ad1414fcbdc081b5d584588346 Author: Jon TURNEY <jon.turney@dronecode.org.uk> Date: Tue Oct 21 15:03:55 2014 +0100 os: -displayfd should check ports up to 65535 -displayfd should check ports up to 65535 Noticed during https://cygwin.com/ml/cygwin-xfree/2014-07/msg00024.html Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* os: Use NotifyFd interface for listen descriptorsKeith Packard2017-03-212-70/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bundle X.org backport of these commits: commit 7ea64fb4374504bd3d524fc08c90efdab9f253ea Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Mon Mar 9 09:55:57 2015 -0700 Clear ListenTransConns entries in CloseWellKnownConnections Since _XSERVTransClose frees the connection pointer passed to it, remove that pointer from the array, so we don't try to double free it if we come back into CloseWellKnownConnections again. Should fix https://bugzilla.yoctoproject.org/show_bug.cgi?id=6665 in which the shutdown section of the main() loop called CloseWellKnownConnections() and then moved on to ddxGiveUp(), which failed to release the VT and thus called AbortServer(), which called CloseWellKnownConnections() again. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> commit 7b02f0b87ec2fa0cc5a65307a1fd55c671cec884 Author: Keith Packard <keithp@keithp.com> Date: Wed Nov 11 22:02:17 2015 -0800 os: Use NotifyFd interface for listen descriptors Replace the custom path for dealing with new incoming connections with the general-purpose NotifyFd API. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com> commit ba71b69f94f00a6f6910597185610668e79c10be Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Fri Jan 1 17:34:41 2016 -0800 Avoid segfault in CloseWellKnownConnections when using -displayfd When -displayfd is looping through the possible display ids to use, if it can't open all the listening sockets for one (say when :0 is already in use), it calls CloseWellKnownConnections to close all the ListenTransConns entries before the point that ListenTransFds was allocated & initialized, so CloseWellKnownConnections would segfault trying to read entries from a NULL ListenTransFds pointer. Introduced by commit 7b02f0b8 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* Handle -displayfd and an explicit display number sensiblyJon TURNEY2017-03-212-7/+6
| | | | | | | | | | | | | | | | | | | commit bc348bd2c42f3f18786085ccef2f010eff5bf3d2 Author: Jon TURNEY <jon.turney@dronecode.org.uk> Date: Mon Mar 11 14:34:32 2013 +0000 Handle -displayfd and an explicit display number sensibly Handle -displayfd and an explicit display number sensibly, e.g. use the explicitly specified display number, and write it to the displayfd v2: displayfd might be 0, so use -1 as invalid value v3: Rebase for addition of NoListenAll flag Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* Xserver/os/utils.c: Add NXAGENT_SERVER specific -nolisten parameter: ANY.Mike Gabriel2017-03-212-0/+6
| | | | This allows us to trigger the NoListenAll := TRUE code path in nxagent.
* os: Add a mechanism to prevent creating any listen socketsKristian Høgsberg2017-03-212-4/+8
| | | | | | | | | | | | | | | | | | | | | | commit 44fe1b8ea284df6bbaef67e246016d104665b2fe Author: Kristian Høgsberg <krh@bitplanet.net> Date: Wed Mar 19 14:03:13 2014 -0700 os: Add a mechanism to prevent creating any listen sockets A socket-activated server will receive its listening sockets from the parent process and should not create its own sockets. This patch introduces a NoListen flag that can be set by a DDX to prevent the server from creating the sockets. When NoListen is enabled, we also disable the server lock checking, since the parent process is responsible for checking the lock before picking the display name and creating the sockets. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* os: Add -displayfd optionChase Douglas2017-03-212-26/+60
| | | | | | | | | | | | | | | | | | | | | | | | | commit 88bacc49f06da5927f716869f5a32672a8297ed0 Author: Chase Douglas <chase.douglas@canonical.com> Date: Wed Apr 4 15:29:42 2012 -0700 os: Add -displayfd option This option specifies a file descriptor in the launching process. X will scan for an available display number and write that number back to the launching process, at the same time as SIGUSR1 generation. This means display managers don't need to guess at available display numbers. As a consequence, if X fails to start when using -displayfd, it's not because the display was in use, so there's no point in retrying the X launch on a higher display number. Signed-off-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Julien Cristau <jcristau@debian.org> Tested-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* os: Use NotifyFd for ErrorConnMaxKeith Packard2017-03-212-18/+19
| | | | | | | | | | | | | | | | commit c3fea428aed919826130ef8ebdb2cceb445a845b Author: Keith Packard <keithp@keithp.com> Date: Tue May 24 20:51:31 2016 -0700 os: Use NotifyFd for ErrorConnMax Instead of open-coding a single FD wait, use NotifyFd to wait for the FD to become readable before returning the error message. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* Move SIGUSR1 notification as late as possible.Adam Jackson2017-03-211-38/+49
| | | | | | | | | | | | | | | | | | commit f01e149d1af14ef9ee0e8a6743ab6a08f3bb677c Author: Adam Jackson <ajax@redhat.com> Date: Thu Nov 1 15:41:11 2007 -0400 Move SIGUSR1 notification as late as possible. If we inherited a signal mask from the parent process that ignores SIGUSR1, then we will send SIGUSR1 to the parent to indicate when we're ready to accept connections. Unfortunately, we send this notification way too early, right after creating the sockets rather than just before entering the main loop. Move it to just before Dispatch() so we're not lying quite so much. Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* dix: Extend initial connection handshake for forwarding proxiesAdam Jackson2017-03-211-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | commit 78fa121f4097d29458e5453c13473595df06e26e Author: Adam Jackson <ajax@redhat.com> Date: Fri Jun 17 13:43:38 2011 -0400 dix: Extend initial connection handshake for forwarding proxies Forwarding proxies like sshd will appear to be local, even though they aren't really. This leads to weird behaviour for extensions that truly require running under the same OS services as the client, like MIT-SHM and DRI2. Add two new legal values for the initial connection's byteOrder field, 'r' and 'R'. These act like 'l' and 'B' respectively, but have the side effect of forcing the client to be treated as non-local. Forwarding proxies should attempt to munge the first packet of the connection accordingly; older servers will reject connections thusly munged, so the proxy should fall back to passthrough if the munged connection attempt fails. Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* dix: Pull client-is-local flag up to the ClientRecAdam Jackson2017-03-213-10/+2
| | | | | | | | | | | | | | | Backported from X.org commit ff8e3ad8074cd2c8bed49b39c40c2b4892118270 Author: Adam Jackson <ajax@redhat.com> Date: Thu Sep 20 13:16:59 2012 -0400 dix: Pull client-is-local flag up to the ClientRec Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* os: always check if client is local when connection is acceptedPauli Nieminen2017-03-213-3/+19
| | | | | | | | | | | | | | | | | | | Backported from X.org: commit 2d67ada3c4079a11c52024a9c3d4138becca5171 Author: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Date: Thu Dec 30 19:19:43 2010 +0200 os: always check if client is local when connection is accepted LocalClient is used for all DRI2 requests that makes it frequently called function. Querying if connection is local or not takes 10-15us (on ARM) depending on malloc speed. Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* os: Add facilities for client ID tracking.Rami Ylimäki2017-03-212-0/+399
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 6d6d4cb6043905d850834946e9bfc526ed5a9ef7 Author: Matthieu Herrb <matthieu.herrb@laas.fr> Date: Mon Jan 2 13:23:59 2012 +0000 Add OpenBSD support to DetermineClientCmd() Uses kvm_getargv() from libkvm. Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com> commit cfc4c3d7fa8bd4da4c08b2ab8e6f85435f75353a Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Sat Dec 24 10:00:56 2011 -0800 Add Solaris support to DetermineClientCmd Uses /proc/pid/psinfo to read command & partial arguments. Moves cmdsize & argsize variables into non-Solaris #else clause to avoid unused variable warnings. Fixes format mismatch errors when building with DEBUG defined on a 64-bit platform (where Mask is defined as CARD32). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi> Signed-off-by: Keith Packard <keithp@keithp.com> commit 780133f9ae7fada462714b47e79d26075bbd9abe Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Fri Oct 28 21:29:50 2011 -0700 Convert DetermineClientCmd to use strdup instead of malloc+strncpy *cmdname is initialized to NULL earlier in the function, so it's okay to overwrite it with NULL if strdup fails, don't need that extra check. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> commit 2ef4ff45ef1fcfc4967ebe3d550408769e5f6500 Author: Erkki Seppälä <erkki.seppala@vincit.fi> Date: Fri Mar 25 10:38:23 2011 +0200 os/client: Prevent rare fd leak in DetermineClientPid DetermineClientPid didn't close file descriptor if read on /proc/pid/cmdline failed. Adjusted the code to disregard the close return value and perform the return after that, if the read failed or returned EOF. Signed-off-by: Mark Kettenis <mark.kettenis@xs4all.nl> Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi> Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi> Signed-off-by: Keith Packard <keithp@keithp.com> commit 1e933665bef26c74196bb7c59910e6a78bcacf0e Author: Rami Ylimäki <rami.ylimaki@vincit.fi> Date: Wed Dec 22 16:51:09 2010 +0200 os: Add facilities for client ID tracking. An interface is provided for figuring out the PID and process name of a client. Make some existing functionality from SELinux and IA extensions available for general use. Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi> Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* dix/os: backport various signal handling and smart scheduler changes from X.orgMike Gabriel2017-03-214-105/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backported from X.org: commit 6178b1c91cfc9e860914acc6f0be2f2d2e07a124 Author: Adam Jackson <ajax@redhat.com> Date: Tue Jun 7 15:52:11 2016 -0400 dix: Use OsSignal() not signal() As the man page for the latter states: The effects of signal() in a multithreaded process are unspecified. We already have an interface to call sigaction() instead, use it. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com> commit e10ba9e4b52269b2ac75c4802dce4ca47d169657 Author: Keith Packard <keithp@keithp.com> Date: Wed Nov 11 22:02:01 2015 -0800 Remove non-smart scheduler. Don't require setitimer. This allows the server to call GetTimeInMillis() after each request is processed to avoid needing setitimer. -dumbSched now turns off the setitimer. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com> commit 1f915e8b524dd02011158aa038935970684c7630 Author: Daniel Drake <drake@endlessm.com> Date: Wed May 20 13:16:12 2015 -0600 Keep SIGALRM restart flag after Popen Commit 94ab7455 added SA_RESTART to the SIGALRM handler. However, the Popen code tears down and recreates the SIGALRM handler via OsSignal(), and this flag is dropped at this time. Clean the code to use just a single codepath for creating this signal handler, always applying SA_RESTART. [ajax: Fixed commit id] Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Daniel Drake <drake@endlessm.com> commit 94ab7455abc213fc96760e29ab2e943ec682fb22 Author: Daniel Drake <drake@endlessm.com> Date: Tue May 12 16:39:22 2015 -0600 Allow system call restarts upon signal interruption The X server frequently deals with SIGIO and SIGALRM interruptions. If process execution is inside certain blocking system calls when these signals arrive, e.g. with the kernel blocked on a contended semaphore, the system calls will be interrupted. Some system calls are automatically restartable (the kernel re-executes them with the same parameters once the signal handler returns) but only if the signal handler allows it. Set SA_RESTART on the signal handlers to enable this convenient behaviour. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Daniel Drake <drake@endlessm.com> commit a6c71ce5d2d2fe89e07a2ef5041c915acc3dc686 Author: Tiago Vignatti <tiago.vignatti@nokia.com> Date: Mon Mar 28 19:21:28 2011 +0300 os: fix memory and fd leaks in Popen Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org> commit c9051b684b524549eab6d5b88ee3e195a6f6fbe8 Author: Alan Coopersmith <alan.coopersmith@sun.com> Date: Wed Nov 5 18:25:57 2008 -0800 Use OsSignal in Popen/Pclose to avoid SysV signal() stupidity commit 0e9ef65fa583bf2393dd0fda82df6f092387b425 Author: Keith Packard <keithp@koto.keithp.com> Date: Wed Nov 7 16:33:10 2007 -0800 Don't frob timers unless SmartSchedule is running commit 2338d5c9914e2a43c3a4f7ee0f4355ad0a1ad9e7 Author: Arjan van de Ven <arjan@linux.intel.com> Date: Sun Oct 28 09:37:52 2007 +0100 reduce wakeups from smart scheduler The smart scheduler itimer currently always fires after each request (which in turn causes the CPU to wake out of idle, burning precious power). Rather than doing this, just stop the timer before going into the select() portion of the WaitFor loop. It's a cheap system call, and it will only get called if there's no more commands batched up from the active fd. This change also allows some of the functions to be simplified; setitimer() will only fail if it's passed invalid data, and we don't do that... so make it void and remove all the conditional code that deals with failure. The change also allows us to remove a few variables that were used for housekeeping between the signal handler and the main loop. Signed-off-by: Keith Packard <keithp@koto.keithp.com> **Note**: The above change also required ABI changes in hw/nxagent/. commit abe0a51f3f790f8c055289465e130177c4b647cc Author: Ben Byer <bbyer@bbyer.apple.com> Date: Fri Sep 21 17:07:36 2007 -0700 So, like, checking return codes of system calls (signal, etc) is good. Also, only restore an old signal handler if one was actually set (prevents the server from dying on OS X). commit 6da39c67905500ab2db00a45cda4a9f756cdde96 Author: Eric Anholt <eric@anholt.net> Date: Wed Sep 12 13:23:13 2007 +0000 Fix build on FreeBSD after Popen changes. commit a5b8053606d6e786cdcf6734f271acc05f9cc588 Author: Adam Jackson <ajax@benzedrine.nwnk.net> Date: Tue Sep 11 11:37:06 2007 -0400 Ignore - not just block - SIGALRM around Popen()/Pclose(). Because our "popen" implementation uses stdio, and because nobody's stdio library is capable of surviving signals, we need to make absolutely sure that we hide the SIGALRM from the smart scheduler. Otherwise, when you open a menu in openoffice, and it recompiles XKB to deal with the accelerators, and you popen xkbcomp because we suck, then the scheduler will tell you you're taking forever doing something stupid, and the wait() code will get confused, and input will hang and your CPU usage slams to 100%. Down, not across. Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* dix/os: Merge priority computation into SmartScheduleClientKeith Packard2017-03-211-37/+4
| | | | | | | | | | | | | | | | | | | Backported from X.org: commit 7762a602c1dfdd8cfcf2b8c2281cf4d683d05216 Author: Keith Packard <keithp@keithp.com> Date: Thu May 19 15:05:55 2016 -0700 dix/os: Merge priority computation into SmartScheduleClient Instead of having scheduling done in two places (one in WaitForSomething, and the other in SmartScheduleClient), just stick all of the scheduling in SmartScheduleClient. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* os: Fix a memory leakPauli Nieminen2017-03-211-4/+6
| | | | | | | | | | | | | | | | Backported from X.org (+ coding style fixes in other free() calls): commit 617b7d22115ccaaaa7ec69c99885054d33a3bc37 Author: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Date: Thu Dec 30 19:19:42 2010 +0200 os: Fix a memory leak Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* Rework local client id finding code to be more uniformAlan Coopersmith2017-03-213-69/+142
| | | | | | | | | | | | | | | | | | | | | Backport of X.org commit: commit 2d93e69690d2c5d4a89a795ede6423796528e5df Author: Alan Coopersmith <alan.coopersmith@sun.com> Date: Thu Sep 27 16:47:06 2007 -0700 Rework local client id finding code to be more uniform Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Note: This commit also switches client_uid_string's size from 32 to 64 chars, as found in this X.org commit (spotted by Mihai Moldovan during code review): commit a7b944f0d96c3e0e15e75378a04def1ac96089fb Author: Alan Coopersmith <alan.coopersmith@sun.com> Date: Wed Nov 1 16:17:49 2006 -0800 If getpeerucred() is available, include pid & zoneid in audit messages too
* AUDIT messages should contain uid for local accesses (X.org bug #1997)Alan Coopersmith2017-03-211-5/+16
| | | | | | | | | | commit fbfb35189ef6666707097704b43e052cb2f919ae Author: Alan Coopersmith <alan.coopersmith@sun.com> Date: Wed Nov 1 15:11:48 2006 -0800 Bug #1997: AUDIT messages should contain uid for local accesses <https://bugs.freedesktop.org/show_bug.cgi?id=1997>
* LBX clean-up: Drop forgotten passage in Xserver/os/connection.c.Mike Gabriel2017-03-211-4/+0
|
* Xserver/os/: Drop not-used-anymore MNX_TCPCONN macro.Mike Gabriel2017-03-212-10/+9
|