summaryrefslogtreecommitdiff
path: root/include/os.h
AgeCommit message (Collapse)AuthorFilesLines
2012-03-27Introduce a consistent coding styleKeith Packard1-243/+335
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> (cherry picked from commit 9838b7032ea9792bec21af424c53c07078636d21)
2012-01-12Revert "dix: Pull client-is-local flag up to the ClientRec"Keith Packard1-0/+2
This reverts commit 49d38b75c8f3276cfce33ffe6b8c4fbeb1081b96. ABI change pended for 1.13
2012-01-06dix: Pull client-is-local flag up to the ClientRecAdam Jackson1-2/+0
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-2/+2
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-12Constify string for authorization protocol namesAlan Coopersmith1-1/+1
gcc was warning from storing string constants in a char *name field: auth.c:64:1: warning: initialization discards qualifiers from pointer target type auth.c:72:1: warning: initialization discards qualifiers from pointer target type auth.c:81:1: warning: initialization discards qualifiers from pointer target type Making the field const requires changing AuthorizationFromID to take a const char ** pointer for the name argument which it sets to point to the matching name entry. Changing that argument requires changing its sole caller in the security extension to pass the address of a const char * variable to it, which it can do, since the only thing it does with the returned name is to pass it back to the RemoveAuthorization function that already expects a const char *name. 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-4/+4
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>
2011-11-23Mark arguments to fopen/popen/system wrappers as const char *Alan Coopersmith1-3/+3
Silencing more gcc -Wwrite-strings warnings Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Add fallback implementation of strndup()Alan Coopersmith1-0/+4
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Linux test code fixed by: Keith Packard <keithp@keithp.com>
2011-11-18record: Prevent out of bounds access when recording a reply.Rami Ylimäki1-1/+2
Any pad bytes in replies are written to the client from a zeroed array. However, record extension tries to incorrectly access the pad bytes from the end of reply data. Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi> Reviewed-by: Erkki Seppälä <erkki.seppala@vincit.fi>
2011-10-11os: Remove Error()Jeremy Huddleston1-1/+0
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-08-22os/log: Add LogVHdrMessageVerb and friendsDaniel Kurtz1-0/+13
LogVHdrMessageVerb allows a custom header to be inserted in a log message, between the Log system's MessageType string, and a formatted variable message body. The custom header can itself be a formatted variable string. These functions can be used, for example, by driver abstraction layers to format specific driver messages in a standard format, but do it in a way that is efficient, obeys the log-layers verbosity settings, and is safe to use in signal handlers (because they don't call malloc), even for types besides X_NONE. 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>
2011-07-27Terminate the log with one last message.Peter Hutterer1-3/+10
Instead of just closing the log when everything is done, put one more message in stating that we're actually terminating. Users or scripts that look at the Xorg.log will then know that a) the server has terminated properly and b) why the server terminated (to some degree, given that most real-world errors will be caused by AbortServer()). Acked-by: Gaetan Nadon <memsize@videotron.ca> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Tested-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Tested-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-25os: Add missing _X_ATTRIBUTE_PRINTF to va_list variantsJeremy Huddleston1-4/+4
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-12-07Merge remote branch 'alanc/master'Keith Packard1-4/+8
2010-12-07Add asprintf() implementation for platforms without itAlan Coopersmith1-4/+8
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>
2010-12-07Fix missing <string.h> include.Cyril Brulebois1-0/+1
The following happens otherwise (with -Wall -Werror): | In file included from /usr/include/X11/Xfuncs.h:47, | from ../../include/misc.h:112, | from ../../include/screenint.h:52, | from ../../include/scrnintstr.h:52, | from ../../dix/cursor.c:58: | /usr/include/string.h:534: error: conflicting types for ‘xstrcasecmp’ | ../../include/os.h:488: note: previous declaration of ‘xstrcasecmp’ was here | /usr/include/string.h:538: error: conflicting types for ‘xstrncasecmp’ | ../../include/os.h:493: note: previous declaration of ‘xstrncasecmp’ was here Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Cyril Brulebois <kibi@debian.org>
2010-11-30Simplify Error() - don't allocate temporary copy of error stringAlan Coopersmith1-1/+1
Doesn't seem to be any reason to just not pass the error string as another argument directly to LogVWrite() Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Julien Cristau <jcristau@debian.org>
2010-11-30Remove unused ReqLen & CastxReq macrosAlan Coopersmith1-23/+0
According to Xserver-spec, they were part of the now-deleted DBE "Idioms" code. The last callers of them were removed in commits fe616f9230b6 & 3d642905477f. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-13Use _X_ATTRIBUTE_PRINTF _X_DEPRECATED _X_NORETURNJeremy Huddleston1-21/+13
Use the values from xproto rather than duplicating the effort Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-13Mark OsAbort as noreturn function to make gcc happier.Mikhail Gusarov1-1/+1
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Matt Turner <mattst88@gmail.com>
2010-05-13Introduce X_NORETURN macro defined as __attribute__((noreturn)) for gccMikhail Gusarov1-4/+1
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Matt Turner <mattst88@gmail.com>
2010-05-13Deprecate allocation functions which are plain wrappers for C stdlibMikhail Gusarov1-4/+5
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-13Document allocation functions, noting deviations from C libraryMikhail Gusarov1-0/+36
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-13Clean {X,XNF}{alloc,calloc,realloc,free,strdup} from pre-C89 baggageMikhail Gusarov1-7/+7
C89 guarantees alignment of pointers returned from malloc/calloc/realloc, so stop fiddling with alignment manually and just pass the arguments to library functions. Also convert silent error when negative size is passed into function into warning in log file. Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-07Constify function prototypes in auth & xdmcp codeAlan Coopersmith1-8/+8
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-02-17os: Introduce OsAbort for proper core dumps.Rami Ylimaki1-0/+2
Signed-off-by: Rami Ylimaki <ext-rami.ylimaki@nokia.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2009-10-15Define ddxBeforeReset stubs in platform-neutral DDXsYaakov Selkowitz1-0/+4
XWin uses ddxBeforeReset, which is called in DIX. Other DDXs need to define these in order to avoid an undefined symbol error at link time when building alongside XWin. Xnest and Xvfb already provide empty stubs; this does the same for Xdmx and the platform-neutral KDrive servers. Also add a prototype to avoid a warning in all DDXs. Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2009-04-09Lift fatal signal handlers from DDX'es up to a common DIX implementationAlan Coopersmith1-0/+2
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2009-04-06os: signal handlers return void.Adam Jackson1-10/+3
2009-03-23FID, whatever that was, isn't anymoreTomas Carnecky1-3/+0
No traces of FID in the xserver nor in the modules listed in util/modular/xorg.modules Signed-off-by: Tomas Carnecky <tom@dbservice.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-13Fix build with --enable-visibility --disable-xdmcp.Michel Dänzer1-2/+4
2008-12-07Use libtool convenience libraries and better "symbol" table.Paulo Cesar Pereira de Andrade1-0/+4
All .a libraries were converted to .la, and instead of linking the Xorg binary with a mix of .a and .la, and adding some libraries more then once in the command line, etc, now it generates a single libxorg.la from all the required convenience libraries, and links with a dummy xorg.c (that should usually be the file with the main function...). This removes the requirement of some things like libosandcommon and libinit, that existed to circumvent problems when linking multiple .a and .la in the final Xorg binary. The "symbol table" is now generated dynamically, by a shell script, with an embedded gawk parser that parses cpp output. The new file sdksyms.sh is generated by hand by analyzing all Makefile.am's and making it create a sdksyms.c file, that includes all sdk headers that will add symbols for the Xorg binary. Module headers aren't read, and a in 2 files it was required to add a "<hash>ifndef XorgLoader" around declarations shared between the Xorg binary and libextmod. A few other changes were added to other sdk headers, like preventing multiple inclusion, or including other headers to satisfy dependencies. This should be a lot more portable, and better (hopefully properly) using libtool to generate convenience libraries.
2008-12-03Rework symbol visibility for easier maintenancePaulo Cesar Pereira de Andrade1-131/+131
Save in a few special cases, _X_EXPORT should not be used in C source files. Instead, it should be used in headers, and the proper C source include that header. Some special cases are symbols that need to be shared between modules, but not expected to be used by external drivers, and symbols that are accessible via LoaderSymbol/dlopen. This patch also adds conditionally some new sdk header files, depending on extensions enabled. These files were added to match pattern for other extensions/modules, that is, have the headers "deciding" symbol visibility in the sdk. These headers are: o Xext/panoramiXsrv.h, Xext/panoramiX.h o fbpict.h (unconditionally) o vidmodeproc.h o mioverlay.h (unconditionally, used only by xaa) o xfixes.h (unconditionally, symbols required by dri2) LoaderSymbol and similar functions now don't have different prototypes, in loaderProcs.h and xf86Module.h, so that both headers can be included, without the need of defining IN_LOADER. xf86NewInputDevice() device prototype readded to xf86Xinput.h, but not exported (and with a comment about it).
2008-10-26Add prototypes for strlcpy/strlcatJulien Cristau1-0/+5
2008-10-10Move xorg_backtrace() up to the OS level so we can call it from DIX.Adam Jackson1-0/+2
2008-10-08Remove unused declarations.Tiago Vignatti1-2/+0
AvailableClientInput (LBX debris) and xf86XinputFinalizeInit.
2008-10-03Drop the never-called SkippedRequestCallback list.Adam Jackson1-8/+0
2008-08-10Move strcasecmp(), strcasencmp() and strcasestr() prototypes to os.hMatthieu Herrb1-0/+16
And make sure os.h is included in files that use it.
2008-08-06XQuartz: Now properly disable xauth checking on launchd socket and mostly ↵Jeremy Huddleston1-1/+1
fix the xinitrc / launchd race condition
2008-07-24Remove some more MEMBUG garbage.Adam Jackson1-2/+0
2008-07-23Assume __GNUC__ >= 3.Adam Jackson1-4/+2
gcc 3.0 was seven years ago. Get with the times.
2008-07-17Dead code removalDaniel Stone1-2/+0
Remove a whole bunch of code that was never built, be it entire files or just dead ifdefs.
2008-07-17Nuke some ancient code for commandline-challenged OSes.Adam Jackson1-4/+0
This appears to have been dead code even in 6.7.
2008-07-16OS/KDrive/XFree86: Sanitise colour initialisationDaniel Stone1-3/+0
OsInitColors always just returned TRUE, so just remove calls to it and insane special-case logic. Remove unused kcolor.c implementation, and merge oscolor.h into oscolor.c since it was the only user. Remove open-coded strncasecmp in oscolor.c. Since we no longer need to call OsInitColors after reading the config file, just call PostConfigInit() from one place, and move PM handling to one place so we can install the signal handlers earlier.
2008-05-21drop xprint remnants: InitGlobalsGeorge Sapountzis1-4/+0
2008-05-17XQuartz: Added functionality to add a file descriptor to the connection list ↵Jeremy Huddleston1-0/+4
after the server is already running. (cherry picked from commit 543c2cd68d1ffef65d4644b860faad7191c6b9da)
2008-03-11Make WriteToClient take a const void * like any decent IO write function.Kristian Høgsberg1-2/+2
Enough with the casting. Doesn't break API or even ABI, but does make a lot of silly casts superfluos.
2007-11-05Merge branch 'master' into XACE-SELINUXEamon Walsh1-3/+2
Conflicts: dix/dispatch.c dix/property.c hw/xfree86/common/xf86VidMode.c include/xkbsrv.h render/glyph.c xkb/xkbActions.c
2007-11-05OS: Remove ALLOCATE_LOCAL from os.hDaniel Stone1-3/+0
Remove ALLOCATE_LOCAL_FALLBACK and DEALLOCATE_LOCAL_FALLBACK from os.h, and remove the include of Xalloca.h as well.
2007-11-02Move SIGUSR1 notification as late as possible.Adam Jackson1-0/+2
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.