summaryrefslogtreecommitdiff
path: root/os/osdep.h
AgeCommit message (Collapse)AuthorFilesLines
2017-06-13os: Use CloseDownFileDescriptor from AbortClient, including ospoll_removeKeith Packard1-0/+3
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 Packard1-14/+0
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 Jackson1-7/+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-02-28auth: remove AuthToIDFunc and associated functions. Not used anymore.Matthieu Herrb1-6/+0
And the current code for MitToId has a use-after-free() issue. [Also remove the actual implementations - ajax] Signed-off-by: Matthieu Herrb <matthieu@herrb.eu> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2016-07-21os: eliminate fd value limits for clientsKeith Packard1-35/+7
With no code depending on the range of file descriptors, checking for that can be eliminated. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-07-21os: Switch server to poll(2) [v3]Keith Packard1-18/+9
Eliminates all of the fd_set mangling in the server main thread v2: Listen for POLLOUT while writes are blocked. v3: Only mark client not ready on EAGAIN return from read Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-07-18os: Move ETEST macro from io.c to osdep.hKeith Packard1-0/+14
This lets other code share this functionality Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-02-22Fix build on Cygwin by ensuring WIN32 check triggers only on MinGWJon TURNEY1-3/+3
The type of fd_mask was changed in Cygwin 2.4.0 headers from 'long' to 'unsigned long'. This exposes an existing problem with winauth.c, which includes Xwindows.h (which includes windows.h, which defines WIN32), before including osdep.h, which causes the now conflicting definition of fd_mask in osdep.h to be exposed: In file included from ../os/osdep.h:198:18: error: conflicting types for ‘fd_mask’ typedef long int fd_mask; /usr/include/sys/select.h:46:23: note: previous declaration of ‘fd_mask’ was here typedef unsigned long fd_mask; Adjust the include guards in osdep.h to make sure we only use WIN32 guarded code when not compiling for Cygwin (i.e. WIN32 && !__CYGWIN__) This isn't a very elegant, but unfortunately appears to be the best solution, since it doesn't seem to be possible to write the test in a positive form. Future work: Should also audit of all the other uses of WIN32 in xserver, and make sure they are correct. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2015-12-01os: Implement support for NotifyFd X_NOTIFY_WRITEKeith Packard1-1/+4
This adds the ability to be notified when a file descriptor is available for writing. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2015-12-01os: Add NotifyFd interfacesKeith Packard1-0/+5
This provides a callback-based interface to monitor file descriptors beyond the usual client and device interfaces. Modules within the server using file descriptors for reading and/or writing can call Bool SetNotifyFd(int fd, NotifyFdProcPtr notify_fd, int mask, void *data); mask can be any combination of X_NOTIFY_READ and X_NOTIFY_WRITE. When 'fd' becomes readable or writable, the notify_fd function will be called with the 'fd', the ready conditions and 'data' values as arguments, When the module no longer needs to monitor the fd, it will call void RemoveNotifyFd(int fd); RemoveNotifyFd may be called from the notify function. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2015-08-24configurable maximum number of clientsOlivier Fourdan1-4/+4
Make the maximum number of clients user configurable, either from the command line or from xorg.conf This patch works by using the MAXCLIENTS (raised to 512) as the maximum allowed number of clients, but allowing the actual limit to be set by the user to a lower value (keeping the default of 256). There is a limit size of 29 bits to be used to store both the client ID and the X resources ID, so by reducing the number of clients allowed to connect to the X server, the user can increase the number of X resources per client or vice-versa. Parts of this patch are based on a similar patch from Adam Jackson <ajax@redhat.com> This now requires at least xproto 7.0.28 Signed-off-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2014-11-12Drop trailing whitespacesPeter Hutterer1-4/+4
sed -i "s/[ ]\+$//g" **/*.(c|h) happy reviewing... git diff -w is an empty diff. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-09-20os: Hide the Connection{In,Out}put implementation detailsAdam Jackson1-16/+2
Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-09-20dix: Pull client-is-local flag up to the ClientRecAdam Jackson1-1/+0
Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-09-20os: Repack ConnectionOutput for LP64Adam Jackson1-1/+1
Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-03-21Introduce a consistent coding styleKeith Packard1-61/+55
This is strictly the application of the script 'x-indent-all.sh' from util/modular. Compared to the patch that Daniel posted in January, I've added a few indent flags: -bap -psl -T PrivatePtr -T pmWait -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT The typedefs were needed to make the output of sdksyms.sh match the previous output, otherwise, the code is formatted badly enough that sdksyms.sh generates incorrect output. The generated code was compared with the previous version and found to be essentially identical -- "assert" line numbers and BUILD_TIME were the only differences found. The comparison was done with this script: dir1=$1 dir2=$2 for dir in $dir1 $dir2; do (cd $dir && find . -name '*.o' | while read file; do dir=`dirname $file` base=`basename $file .o` dump=$dir/$base.dump objdump -d $file > $dump done) done find $dir1 -name '*.dump' | while read dump; do otherdump=`echo $dump | sed "s;$dir1;$dir2;"` diff -u $dump $otherdump done Signed-off-by: Keith Packard <keithp@keithp.com> Acked-by: Daniel Stone <daniel@fooishbar.org> Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-01-12Revert "os: Repack ConnectionOutput for LP64"Keith Packard1-1/+1
This reverts commit d5f724544afd2949cebfcf4f0b4510ec0c701bec. ABI change pended for 1.13
2012-01-12Revert "dix: Pull client-is-local flag up to the ClientRec"Keith Packard1-0/+1
This reverts commit 49d38b75c8f3276cfce33ffe6b8c4fbeb1081b96. ABI change pended for 1.13
2012-01-12Revert "os: Hide the Connection{In,Out}put implementation details"Keith Packard1-2/+16
This reverts commit 48e7a2ef574c8b38c4f8f07b45f54c8bfd02552b. ABI change pended for 1.13
2012-01-06os: Minor header cleanupAdam Jackson1-4/+0
Move some constants near their only users, and remove some getdtablesize() logic that's second-guessing configure. Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-01-06os: Hide the Connection{In,Out}put implementation detailsAdam Jackson1-16/+2
Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-01-06dix: Pull client-is-local flag up to the ClientRecAdam Jackson1-1/+0
Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
2012-01-06os: Repack ConnectionOutput for LP64Adam Jackson1-1/+1
Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
2011-12-12Constify the reason string throughout the authorization check frameworkAlan Coopersmith1-1/+1
Almost all of the places the string is assigned point to a literal string constant, so use const char * for those, and const char ** for function calls that return it via an argument. Fortunately the top level function, ClientAuthorized, which returns the string as its return value is called from only one place, ProcEstablishConnection. ProcEstablishConnection stores either that return value or a string literal in char *reason. It only uses reason as an argument to SendConnSetup. SendConnSetup passes the reason argument to strlen & WriteToClient, both of which already have const qualifiers on their args. Thus added const to the reason variable in ProcEstablishConnection and the reason argument to SendConnSetup. Fixes gcc warnings: dispatch.c: In function 'ProcEstablishConnection': dispatch.c:3711:9: warning: assignment discards qualifiers from pointer target type auth.c: In function 'CheckAuthorization': auth.c:218:14: warning: assignment discards qualifiers from pointer target type auth.c:220:20: warning: assignment discards qualifiers from pointer target type connection.c: In function 'ClientAuthorized': connection.c:683:3: warning: return discards qualifiers from pointer target type mitauth.c: In function 'MitCheckCookie': mitauth.c:88:13: warning: assignment discards qualifiers from pointer target type xdmauth.c:259:14: warning: assignment discards qualifiers from pointer target type xdmauth.c:270:14: warning: assignment discards qualifiers from pointer target type xdmauth.c:277:11: warning: assignment discards qualifiers from pointer target type xdmauth.c:293:15: warning: assignment discards qualifiers from pointer target type xdmauth.c:313:14: warning: assignment discards qualifiers from pointer target type xdmauth.c:322:11: warning: assignment discards qualifiers from pointer target type rpcauth.c: In function 'SecureRPCCheck': rpcauth.c:136:10: warning: assignment discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-05Move to autoconf standard function name checks & definesAlan Coopersmith1-6/+0
Replace multiple methods of checking for functions with AC_CHECK_FUNCS Replace multiple methods of selecting fallback funcs with AC_REPLACE_FUNCS Replace HAS_* and NEED_* #defines with autogenerated HAVE_* Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
2010-12-31os: always check if client is local when connection is acceptedPauli Nieminen1-0/+4
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>
2010-09-10os: Return BadLength instead of disconnecting BigReq clients (#4565)Aaron Plattner1-0/+1
If a client sends a big request that's too big (i.e. bigger than maxBigRequestSize << 2 bytes), the server just disconnects it. This makes the client receive SIGPIPE the next time it tries to send something. The X Test Suite sends requests that are too big when the test specifies the TOO_LONG test type. When the client receives SIGPIPE, XTS marks it as UNRESOLVED, which counts as a failure. Instead, remember how long the request is supposed to be and then return that size. Dispatch() checks the length and sends BadLength to the client. Then, whenever oci->ignoreBytes is nonzero, ignore the data read instead of trying to process it as a request. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-07Constify function prototypes in auth & xdmcp codeAlan Coopersmith1-11/+12
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Gaetan Nadon <memsize@videotron.ca> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-03-16Xming: Warning fixesColin Harrison1-1/+1
Fix warnings due to prototypes not specifying function arguments Fix warning with RegQueryValueEx() Tidy up an include Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-08-03Bug 16832: XDMCP related build error when --disable-xdmcp is usedPaul Bender1-0/+6
X.Org Bugzilla #16832: http://bugs.freedesktop.org/show_bug.cgi?id=16832 Patch #27279: http://bugs.freedesktop.org/attachment.cgi?id=27279
2009-06-18Clarify use of and need for mffs vs. ffsAlan Coopersmith1-1/+1
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2008-07-23Unifdef hpux.Adam Jackson1-1/+1
2008-07-23Unifdef sgi.Adam Jackson1-2/+0
2008-07-23Unifdef QNX.Adam Jackson1-3/+0
Again, hasn't worked since at least 7.0.
2008-07-17Dead code removalDaniel Stone1-8/+0
Remove a whole bunch of code that was never built, be it entire files or just dead ifdefs.
2008-03-11Make WriteToClient take a const void * like any decent IO write function.Kristian Høgsberg1-1/+1
Enough with the casting. Doesn't break API or even ABI, but does make a lot of silly casts superfluos.
2007-09-19Merge branch 'master' into XACE-SELINUXEamon Walsh1-3/+0
Conflicts: afb/afbpntwin.c afb/afbscrinit.c afb/afbwindow.c cfb/cfb.h cfb/cfballpriv.c cfb/cfbscrinit.c cfb/cfbwindow.c configure.ac fb/wfbrename.h hw/xfree86/xf4bpp/ppcIO.c hw/xfree86/xf4bpp/ppcPntWin.c hw/xfree86/xf4bpp/ppcWindow.c hw/xfree86/xf8_32bpp/cfbscrinit.c mfb/mfb.h mfb/mfbpntwin.c mfb/mfbscrinit.c mfb/mfbwindow.c mi/miexpose.c Note: conflicts caused by devPrivates rework vs. paintwindow changes.
2007-08-31Bug #7186: Fix an excessive request size limitation that broke big-requests.Eric Anholt1-3/+0
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).
2007-08-03security: drop support for XC-QUERY-SECURITY authorization method.Eamon Walsh1-3/+0
2007-06-28Remove the remnants of OS/2 support.Adam Jackson1-1/+1
This has never worked in any modular server release, and as far as I know was never tested in 6.7 through 6.9.
2007-06-04Remove the old Kerberos 5 authentication code.Adam Jackson1-23/+0
Before you complain, this code hasn't seen material change since at least X11R6. It certainly does not build with any modern version of Kerberos. Anybody wanting krb5 auth to their X server should probably be using GSSAPI instead of internal krb5 API anyway.
2007-03-25General DIX static and dead code cleanup.Adam Jackson1-8/+0
2007-03-25Static cleanups, dead code deletion.Adam Jackson1-6/+0
2006-07-21Remove RCS tags. Fix Xprint makefile braindamage.Adam Jackson1-2/+0
2006-06-01Kill LBX, too.Daniel Stone1-26/+0
2006-02-16Make more extensions optional in build (for kdrive). Fix kdrive build forKeith Packard1-0/+2
actual hardware. Fix kdrive pointer signed/unsigned types. Add kdrive-required YX rotation functions. Replace rgb text file loading with static rgb color table.
2005-07-07Bug #2901 <https://bugs.freedesktop.org/show_bug.cgi?id=2901> Add prototypeAlan Coopersmith1-0/+4
for XdmAuthenticationInit() (Peter Breitenlohner)
2005-07-03Add Xtrans definitions (FONT_t, TRANS_CLIENT) to clean up warnings.Daniel Stone1-0/+4
Add XSERV_t, TRANS_SERVER, TRANS_REOPEN to quash warnings. Add #include <dix-config.h> or <xorg-config.h>, as appropriate, to all source files in the xserver/xorg tree, predicated on defines of HAVE_{DIX,XORG}_CONFIG_H. Change all Xfont includes to <X11/fonts/foo.h>.
2005-05-02Fix comments for pointers in parameter lists to work with fussy compilersHarold L Hunt II1-1/+1
2005-04-20warning fix for Win32Alexander Gottwald1-1/+1