aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/dix
Commit message (Collapse)AuthorAgeFilesLines
* NXproperty.c: prevent deletion of NX_AGENT_VERSION propertyUlrich Sibiller2019-09-291-0/+2
| | | | Fixes ArcticaProject/nx-libs#825
* Update currentTime in dispatch loopUlrich Sibiller2019-09-291-0/+3
| | | | | | | | | | | | | | | | | | commit 312910b4e34215aaa50fc0c6092684d5878dc32f Author: Chase Douglas <chase.douglas@canonical.com> Date: Wed Apr 18 11:15:40 2012 -0700 Update currentTime in dispatch loop A request, like input device grabs, may check a request timestamp against currentTime. It is possible for currentTime to lag a previously sent event timestamp. If the client makes a request based on such an event timestamp, the request may fail the validity check against currentTime unless we always update the time before processing the request. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* nxagent: drop nxagentRootTileWindowUlrich Sibiller2019-08-271-2/+0
| | | | | | | | We either use a solid black or a white background and no backround pixmap. So nxagentRootTileWindow is always empty and we can drop all stuff around it. remove nxagentSplashCount, too, since it is no longer checked anywhere.
* rework xkb device private handlingUlrich Sibiller2019-06-221-0/+9
| | | | | | | We can only free the xkbDevicePrivate because we do not know the details of any other (possible) extension. So let's limit to that one private for now and call the new xkbFreePrivates from dix (where such a function is completely missing).
* dix/dispatch: fix a small memory leakUlrich Sibiller2019-06-221-0/+3
|
* CloseDevice: call XkbRemoveResourceClient before freeing key class structUlrich Sibiller2019-06-191-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | This patch is not necessary at the current code level. But when xkb code introduced the dev->key check Xorg upstream missed that. So we backport it now to skip that trap when updating xkb code. Author: Alan Coopersmith <alan.coopersmith@sun.com> Date: Mon Jan 4 18:21:54 2010 -0800 CloseDevice: call XkbRemoveResourceClient before freeing key class struct XkbRemoveResourceClient() returns immediately if dev->key is NULL. CloseDevice calls XkbRemoveResourceClient until it removes all resources. If we free dev->key and NULL it before XkbRemoveResourceClient, then infinite loop ensues, and the server appears to hang on exit or crash. Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Keith Packard <keithp@keithp.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Remove the Must_have_memory hack.Ulrich Sibiller2019-06-121-17/+8
| | | | | | | | | | | | | 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.
* NXdispatch.c: use upstream version of ProcSetSelectionOwnerUlrich Sibiller2019-06-111-2/+0
|
* Fix NXevents.c: Reactivate errornously commented functionUlrich Sibiller2019-06-111-0/+4
| | | | | | | | | CheckMotion() had been commented in add881931f2e702fb1952f4e1baba04b3dc536ee as it looked identical to the version from dix/events.c except for some commented code. But this based (probably) on a thinko - code that had been disabled by NX became active again this way. Fix this by removing the comments and by adding #ifdef/else to emphasize the difference.
* dix: remove unused requestLogIndexUlrich Sibiller2019-05-291-9/+0
| | | | | | | | | | | | | | | | | | | | | As done in these commits: commit 6583477035234e23ead2fad9db7a07e5862447a4 Author: Nicolai Hähnle <nhaehnle@gmail.com> Date: Sat May 23 13:35:24 2009 +0200 Remove reference to non-existing requestLog and requestLogIndex These fields were removed in 252ec504817e05b185e4896a2d899e9c00b8aeef. Signed-off-by: Nicolai Haehnle <nhaehnle@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> commit 252ec504817e05b185e4896a2d899e9c00b8aeef Author: Adam Jackson <ajax@redhat.com> Date: Mon Mar 30 15:18:30 2009 -0400 Document which bits of ClientRec are currently unused
* Fix uninitialized bytesUlrich Sibiller2018-12-181-1/+1
| | | | | | | | | | | | | | | | | | | | Fixes this valgrind finding ==16977== Warning: invalid file descriptor -1 in syscall close() ==16977== Conditional jump or move depends on uninitialised value(s) ==16977== at 0x544B6B: XkbSendNewKeyboardNotify (xkbEvents.c:62) ==16977== by 0x540481: ProcXkbGetKbdByName (xkb.c:5330) ==16977== by 0x4341C5: Dispatch (NXdispatch.c:482) ==16977== by 0x40EB02: main (main.c:353) ==16977== Uninitialised value was created by a heap allocation ==16977== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==16977== by 0x431BD7: NextAvailableClient (dispatch.c:3719) ==16977== by 0x47B297: AllocNewConnection (connection.c:821) ==16977== by 0x47B297: EstablishNewConnections (connection.c:910) ==16977== by 0x463DFE: ProcessWorkQueue (dixutils.c:541) ==16977== by 0x47635E: WaitForSomething (WaitFor.c:213) ==16977== by 0x434089: Dispatch (NXdispatch.c:360) ==16977== by 0x40EB02: main (main.c:353)
* Fix some memory leaks.Mario Trangoni2018-07-031-0/+1
|
* dixfonts.c: use calloc for LFclosurePtrMike Gabriel2018-07-031-1/+1
| | | | ... to keep dix/dixfonts and hw/nxagnet/NXdixfonts.c in sync.
* dix/dixfonts.c: free() can handle NULLMike Gabriel2018-07-031-8/+6
| | | | so let's remove some superflous tests
* ProcGetPointerMapping uses rep.nElts before it is initializedUlrich Sibiller2018-07-031-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport of this xorg upstream commit (with omitting the mentioned d792ac125a0462a04a930af543cbc732f8cdab7d). commit 34cf559bcf99dad550527b5ff53f247f0e8e73ee Author: Keith Packard <keithp@keithp.com> Date: Tue Jul 10 15:58:48 2012 -0700 ProcGetPointerMapping uses rep.nElts before it is initialized In: commit d792ac125a0462a04a930af543cbc732f8cdab7d Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Mon Jul 9 19:12:43 2012 -0700 Use C99 designated initializers in dix Replies the initializer for the .length element of the xGetPointerMappingReply structure uses the value of rep.nElts, but that won't be set until after this initializer runs, so we get garbage in the length element and clients using it will generally wedge. Easy to verify: $ xmodmap -pp Fixed by creating a local nElts variable and using that. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Fix some valgrind findingsUlrich Sibiller2018-07-031-10/+8
| | | | | | Some of them have not been seen in the wild yet. Partly fixes ArcticaProject/nx-libs#711
* Do not reset lastDeviceEventTime when we do dixSaveScreensRichard Hughes2018-07-031-2/+0
| | | | | | | | | | | | | | | | | Backported from X.org's Xserver: commit 6b5978dcf1f7ac3ecc2f22df06f7000f360e2066 Author: Richard Hughes <richard@hughsie.com> Date: Mon Aug 17 09:15:32 2009 +0100 Do not reset lastDeviceEventTime when we do dixSaveScreens When we turn off DPMS with DPMSModeOff and do dixSaveScreens, don't reset the event time else session clients using IDLETIME will be reset. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* Lift dix to xorg-xserver-1.3.0.0 state - non-functional changes onlyUlrich Sibiller2018-02-263-8/+4
|
* Lift dix to xorg-xserver-1.3.0.0 stateUlrich Sibiller2018-02-2611-71/+164
|
* Lift dix to xorg-xserver-7.1/1.1.0 state - non-functional changes onlyUlrich Sibiller2018-02-263-1/+24
|
* Lift dix to xorg-xserver-7.1/1.1.0 stateUlrich Sibiller2018-02-265-8/+47
|
* Xext: lift DPMS extension to xorg-xserver-7.1/1.1 stateUlrich Sibiller2018-02-071-6/+0
|
* Xext: lift screensaver extension to XORG-7_1 stateUlrich Sibiller2018-02-072-1/+5
|
* reduce usage of uninitialised bytesUlrich Sibiller2017-12-284-52/+43
| | | | as reported by valgrind
* Support building with legacy (pre-1.4.2) libXfont(1) versions.Mihai Moldovan2017-12-161-0/+6
| | | | | | | | Partly reverts ec30a857eb0d67b232f8d43e63a6370023f4c4d0, but in a forward-compatible manner. Legacy libXfont1 versions are automatically detected by the main Makefile.
* DIX: XKB: Set xkbInfo to NULL as well as freeing itDaniel Stone2017-12-071-0/+1
| | | | | | | | | | | | | | | | | Backported from X.org: commit 512bac25ec0e980968b93a2ebe88bd89bf99b697 Author: Daniel Stone <daniel@fooishbar.org> Date: Tue Nov 6 14:52:03 2007 +0000 DIX: XKB: Set xkbInfo to NULL as well as freeing it (bug # 10639) XkbRemoveResourceClient wants to access xkbInfo if it exists, so make sure we NULL it after freeing it. It doesn't make much sense to move the RemoveResourceClient call first, as there's not much point in notifying clients while we're shutting the server down anyway. Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Clearing comments from $XFree86$ (et al.) header lines.Mike Gabriel2017-04-191-1/+0
|
* Regression fix for added libXfont2 API support:Mike Gabriel2017-04-101-3/+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.
* Add CreatePixmap allocation hints.Aaron Plattner2017-04-105-6/+7
| | | | | | | | | | | | | | | | Backported from X.org: commit f2e310132fbe1520c1b5f3da4faa2d2d47835e72 Author: Aaron Plattner <aplattner@nvidia.com> Date: Wed Oct 31 14:15:35 2007 -0700 Add CreatePixmap allocation hints. These hints allow an acceleration architecture to optimize allocation of certain types of pixmaps, such as pixmaps that will serve as backing pixmaps for redirected windows. Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* Xserver: Support building against libXfont2 (v2) API and old libXfont(1) API ↵Mike Gabriel2017-04-104-3/+389
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* SetFontPath: set client->errorValue on failure.Jamey Sharp2017-04-103-10/+6
| | | | | | | | | | | | | | | | | | | | | | | Backported from X.org: commit 21ceae9002c6364deb3d074cf2da7d3864cf6879 Author: Jamey Sharp <jamey@minilop.net> Date: Tue May 11 10:24:00 2010 -0700 SetFontPath: set client->errorValue on failure. Previously the callers were only setting errorValue on Success, when it's ignored, and leaving it alone on failure, when it's sent to the client. Since SetFontPath takes the ClientPtr, let it set client->errorValue instead of letting the callers continue to get it wrong. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Keith Packard <keithp@keithp.com> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* dix: pass a valid ClientPtr to SetFontPath in all cases.Eamon Walsh2017-04-101-1/+1
| | | | | | | | | | | | Backported from X.org: commit 7e9e01a4a34fa45521067d43c5bbff942dd5d51a Author: Eamon Walsh <ewalsh@tycho.nsa.gov> Date: Wed Oct 10 17:40:22 2007 -0400 dix: pass a valid ClientPtr to SetFontPath in all cases. Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* dix: Move InitFonts up above screen initializationMike Gabriel2017-04-102-2/+3
| | | | | | | | | | | | | | | | | | | | | Backport from X.org: commit 91ea0965dd4dfeba0a914c47ad4a64768e983b1b Author: Keith Packard <keithp@keithp.com> Date: Wed Nov 11 22:02:04 2015 -0800 dix: Move InitFonts up above screen initialization Font initialization was split into two stages, the first was to set up font privates with a call to ResetFontPrivateIndex, then much later the call to InitFonts to set up all of the FPEs. Doing the full font initialization before initializing the video drivers means that we can move the call to ResetFontPrivateIndex inside InitFonts. 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>
* Revert "regression fix for 52872a0: Keep index parameter in AddScreen() for ↵Mike Gabriel2017-04-101-3/+2
| | | | | | | | | | now. Requires proper ABI backport. (was: copy+paste error)." This reverts commit 342758254b1b8507c9ec774f40d8ec62baf394a8. Other than stated in the original commit msg, both regressions are related to inproper rebasing of two pull requests touch the same code portion.
* xserver: remove index from CloseScreen (API/ABI breakage)Dave Airlie2017-04-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extracted from X.org bulk commit: commit 1f0e8bd5eb1a5539689cfc4f5a6b86b530907ec5 Author: Dave Airlie <airlied@redhat.com> Date: Tue Jun 5 13:22:18 2012 +0100 api: rework the X server driver API to avoid global arrays. This is a squash merge containing all the API changes, as well as the video ABI bump. Its been squashed to make bisection easier. Full patch log below: [...] commit 06729dbbc804a20242e6499f446acb5d94023c3c Author: Dave Airlie <airlied@gmail.com> Date: Tue Apr 10 14:04:59 2012 +0100 xserver: remove index from CloseScreen (API/ABI breakage) This drops the index from the CloseScreen callback, its always been useless really, since the pScreen contains it. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Acked-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* regression fix for 52872a0: Keep index parameter in AddScreen() for now. ↵Mike Gabriel2017-03-271-2/+3
| | | | Requires proper ABI backport. (was: copy+paste error).
* dix: Remove insane BC hacksMike Gabriel2017-03-241-12/+1
| | | | | | | | | | | | | commit 6b5206e7cb8e5279816b48f014d47d3f03f16972 Author: Daniel Stone <daniel@fooishbar.org> Date: Fri Jul 18 15:38:10 2008 +0300 dix: Remove insane BC hacks If your DDX needs a 1bpp mode and doesn't set it up, your DDX is incompetent. Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* Move AddScreen() comment where it actually belongs. Should be done in X.org, ↵Mike Gabriel2017-03-241-0/+7
| | | | too.
* dix: Move AddScreen() over into dispatch.c and introduce init_screen()Mike Gabriel2017-03-242-215/+214
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Partially pruned out of X.org commits: commit 987579c930bda803427a28cb82773c389f5110d6 Author: Peter Hutterer <peter.hutterer@who-t.net> Date: Wed Apr 22 13:26:40 2009 +1000 dix: remove all but main() from main.c All other functions are pushed into where they seemed to fit. main.c is now linked separately into libmain.a and linked in by the various DDXs. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> commit 3478af3374abffa0c226ee077fda1fcfc0751e74 Author: Dave Airlie <airlied@redhat.com> Date: Tue Jun 5 17:01:21 2012 +0100 screen: split out screen init code. (v2) This is a precursor for reusing this code to init gpu screens. v2: fixup int check as per Keith's review. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
* Handle -displayfd and an explicit display number sensiblyJon TURNEY2017-03-211-1/+2
| | | | | | | | | | | | | | | | | | | 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>
* os: Add -displayfd optionChase Douglas2017-03-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Move SIGUSR1 notification as late as possible.Adam Jackson2017-03-211-0/+2
| | | | | | | | | | | | | | | | | | 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-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* os: Add facilities for client ID tracking.Rami Ylimäki2017-03-212-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-211-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-11/+14
| | | | | | | | | | | | | | | | | | | 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>
* dix: Fix compiler warningUlrich Sibiller2017-03-101-1/+2
| | | | | | devices.c: In function ‘_AddInputDevice’: devices.c:120:22: warning: assignment from incompatible pointer type [enabled by default] dev->devPrivates = dev->unwrapProc = NULL;
* replace (DE)ALLOCATE_LOCAL by malloc/freeUlrich Sibiller2017-03-039-76/+76
| | | | | | | | | | | | | | | | | | | | | | This is basically a backport of the following commits + replacing xalloc/xfree by malloc/free. Fixes ArcticaProject/nx-libs#358. commit 2761c103311a1160bc483fd0367d654733df8598 Author: Daniel Stone <daniel@fooishbar.org> Date: Mon Nov 5 14:03:26 2007 +0000 OS: Remove usage of alloca Replace with heap allocations. commit 5e363500c86042c394595e1a6633581eb8fcd1bb Author: Daniel Stone <daniel@fooishbar.org> Date: Mon Nov 5 14:38:28 2007 +0000 OS: Remove ALLOCATE_LOCAL from os.h Remove ALLOCATE_LOCAL_FALLBACK and DEALLOCATE_LOCAL_FALLBACK from os.h, and remove the include of Xalloca.h as well.
* misc nx-X11/programs/Xserver/{composite,dix,randr}/: switch to using ↵Mihai Moldovan2017-03-031-9/+0
| | | | reallocarray, since it has been ported now.
* Fix "uninitialised byte(s)" complaints from valgrindUlrich Sibiller2017-03-024-20/+29
|