1 | /***********************************************************
|
---|
2 |
|
---|
3 | Copyright 1987, 1998 The Open Group
|
---|
4 |
|
---|
5 | Permission to use, copy, modify, distribute, and sell this software and its
|
---|
6 | documentation for any purpose is hereby granted without fee, provided that
|
---|
7 | the above copyright notice appear in all copies and that both that
|
---|
8 | copyright notice and this permission notice appear in supporting
|
---|
9 | documentation.
|
---|
10 |
|
---|
11 | The above copyright notice and this permission notice shall be included in
|
---|
12 | all copies or substantial portions of the Software.
|
---|
13 |
|
---|
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
17 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
---|
18 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
20 |
|
---|
21 | Except as contained in this notice, the name of The Open Group shall not be
|
---|
22 | used in advertising or otherwise to promote the sale, use or other dealings
|
---|
23 | in this Software without prior written authorization from The Open Group.
|
---|
24 |
|
---|
25 |
|
---|
26 | Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
---|
27 |
|
---|
28 | All Rights Reserved
|
---|
29 |
|
---|
30 | Permission to use, copy, modify, and distribute this software and its
|
---|
31 | documentation for any purpose and without fee is hereby granted,
|
---|
32 | provided that the above copyright notice appear in all copies and that
|
---|
33 | both that copyright notice and this permission notice appear in
|
---|
34 | supporting documentation, and that the name of Digital not be
|
---|
35 | used in advertising or publicity pertaining to distribution of the
|
---|
36 | software without specific, written prior permission.
|
---|
37 |
|
---|
38 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
---|
39 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
---|
40 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
---|
41 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
---|
42 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
---|
43 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
---|
44 | SOFTWARE.
|
---|
45 |
|
---|
46 | ******************************************************************/
|
---|
47 |
|
---|
48 |
|
---|
49 | #ifndef OS_H
|
---|
50 | #define OS_H
|
---|
51 |
|
---|
52 | #include "misc.h"
|
---|
53 | #include <stdarg.h>
|
---|
54 |
|
---|
55 | #define NullFID ((FID) 0)
|
---|
56 |
|
---|
57 | #define SCREEN_SAVER_ON 0
|
---|
58 | #define SCREEN_SAVER_OFF 1
|
---|
59 | #define SCREEN_SAVER_FORCER 2
|
---|
60 | #define SCREEN_SAVER_CYCLE 3
|
---|
61 |
|
---|
62 | #ifndef MAX_REQUEST_SIZE
|
---|
63 | #define MAX_REQUEST_SIZE 65535
|
---|
64 | #endif
|
---|
65 | #ifndef MAX_BIG_REQUEST_SIZE
|
---|
66 | #define MAX_BIG_REQUEST_SIZE 4194303
|
---|
67 | #endif
|
---|
68 |
|
---|
69 | typedef pointer FID;
|
---|
70 | typedef struct _FontPathRec *FontPathPtr;
|
---|
71 | typedef struct _NewClientRec *NewClientPtr;
|
---|
72 |
|
---|
73 | #ifndef xalloc
|
---|
74 | #define xnfalloc(size) XNFalloc((unsigned long)(size))
|
---|
75 | #define xnfcalloc(_num, _size) XNFcalloc((unsigned long)(_num)*(unsigned long)(_size))
|
---|
76 | #define xnfrealloc(ptr, size) XNFrealloc((pointer)(ptr), (unsigned long)(size))
|
---|
77 |
|
---|
78 | #define xalloc(size) Xalloc((unsigned long)(size))
|
---|
79 | #define xcalloc(_num, _size) Xcalloc((unsigned long)(_num)*(unsigned long)(_size))
|
---|
80 | #define xrealloc(ptr, size) Xrealloc((pointer)(ptr), (unsigned long)(size))
|
---|
81 | #define xfree(ptr) Xfree((pointer)(ptr))
|
---|
82 | #define xstrdup(s) Xstrdup(s)
|
---|
83 | #define xnfstrdup(s) XNFstrdup(s)
|
---|
84 | #endif
|
---|
85 |
|
---|
86 | #include <stdio.h>
|
---|
87 | #include <stdarg.h>
|
---|
88 |
|
---|
89 | /* have to put $(SIGNAL_DEFINES) in DEFINES in Imakefile to get this right */
|
---|
90 | #ifdef SIGNALRETURNSINT
|
---|
91 | #define SIGVAL int
|
---|
92 | #else
|
---|
93 | #define SIGVAL void
|
---|
94 | #endif
|
---|
95 |
|
---|
96 | extern Bool OsDelayInitColors;
|
---|
97 | extern void (*OsVendorVErrorFProc)(const char *, va_list args);
|
---|
98 |
|
---|
99 | extern int WaitForSomething(
|
---|
100 | int* /*pClientsReady*/
|
---|
101 | );
|
---|
102 |
|
---|
103 | extern int ReadRequestFromClient(ClientPtr /*client*/);
|
---|
104 |
|
---|
105 | extern Bool InsertFakeRequest(
|
---|
106 | ClientPtr /*client*/,
|
---|
107 | char* /*data*/,
|
---|
108 | int /*count*/);
|
---|
109 |
|
---|
110 | extern void ResetCurrentRequest(ClientPtr /*client*/);
|
---|
111 |
|
---|
112 | extern void FlushAllOutput(void);
|
---|
113 |
|
---|
114 | extern void FlushIfCriticalOutputPending(void);
|
---|
115 |
|
---|
116 | extern void SetCriticalOutputPending(void);
|
---|
117 |
|
---|
118 | extern int WriteToClient(ClientPtr /*who*/, int /*count*/, char* /*buf*/);
|
---|
119 |
|
---|
120 | extern void ResetOsBuffers(void);
|
---|
121 |
|
---|
122 | extern void InitConnectionLimits(void);
|
---|
123 |
|
---|
124 | extern void NotifyParentProcess(void);
|
---|
125 |
|
---|
126 | extern void CreateWellKnownSockets(void);
|
---|
127 |
|
---|
128 | extern void ResetWellKnownSockets(void);
|
---|
129 |
|
---|
130 | extern void CloseWellKnownConnections(void);
|
---|
131 |
|
---|
132 | extern XID AuthorizationIDOfClient(ClientPtr /*client*/);
|
---|
133 |
|
---|
134 | extern char *ClientAuthorized(
|
---|
135 | ClientPtr /*client*/,
|
---|
136 | unsigned int /*proto_n*/,
|
---|
137 | char* /*auth_proto*/,
|
---|
138 | unsigned int /*string_n*/,
|
---|
139 | char* /*auth_string*/);
|
---|
140 |
|
---|
141 | extern Bool EstablishNewConnections(
|
---|
142 | ClientPtr /*clientUnused*/,
|
---|
143 | pointer /*closure*/);
|
---|
144 |
|
---|
145 | extern void CheckConnections(void);
|
---|
146 |
|
---|
147 | extern void CloseDownConnection(ClientPtr /*client*/);
|
---|
148 |
|
---|
149 | extern void AddGeneralSocket(int /*fd*/);
|
---|
150 |
|
---|
151 | extern void RemoveGeneralSocket(int /*fd*/);
|
---|
152 |
|
---|
153 | extern void AddEnabledDevice(int /*fd*/);
|
---|
154 |
|
---|
155 | extern void RemoveEnabledDevice(int /*fd*/);
|
---|
156 |
|
---|
157 | extern int OnlyListenToOneClient(ClientPtr /*client*/);
|
---|
158 |
|
---|
159 | extern void ListenToAllClients(void);
|
---|
160 |
|
---|
161 | extern void IgnoreClient(ClientPtr /*client*/);
|
---|
162 |
|
---|
163 | extern void AttendClient(ClientPtr /*client*/);
|
---|
164 |
|
---|
165 | extern void MakeClientGrabImpervious(ClientPtr /*client*/);
|
---|
166 |
|
---|
167 | extern void MakeClientGrabPervious(ClientPtr /*client*/);
|
---|
168 |
|
---|
169 | extern void AvailableClientInput(ClientPtr /* client */);
|
---|
170 |
|
---|
171 | extern CARD32 GetTimeInMillis(void);
|
---|
172 |
|
---|
173 | extern void AdjustWaitForDelay(
|
---|
174 | pointer /*waitTime*/,
|
---|
175 | unsigned long /*newdelay*/);
|
---|
176 |
|
---|
177 | typedef struct _OsTimerRec *OsTimerPtr;
|
---|
178 |
|
---|
179 | typedef CARD32 (*OsTimerCallback)(
|
---|
180 | OsTimerPtr /* timer */,
|
---|
181 | CARD32 /* time */,
|
---|
182 | pointer /* arg */);
|
---|
183 |
|
---|
184 | extern void TimerInit(void);
|
---|
185 |
|
---|
186 | extern Bool TimerForce(OsTimerPtr /* timer */);
|
---|
187 |
|
---|
188 | #define TimerAbsolute (1<<0)
|
---|
189 | #define TimerForceOld (1<<1)
|
---|
190 |
|
---|
191 | extern OsTimerPtr TimerSet(
|
---|
192 | OsTimerPtr /* timer */,
|
---|
193 | int /* flags */,
|
---|
194 | CARD32 /* millis */,
|
---|
195 | OsTimerCallback /* func */,
|
---|
196 | pointer /* arg */);
|
---|
197 |
|
---|
198 | extern void TimerCheck(void);
|
---|
199 | extern void TimerCancel(OsTimerPtr /* pTimer */);
|
---|
200 | extern void TimerFree(OsTimerPtr /* pTimer */);
|
---|
201 |
|
---|
202 | extern void SetScreenSaverTimer(void);
|
---|
203 | extern void FreeScreenSaverTimer(void);
|
---|
204 |
|
---|
205 | extern SIGVAL AutoResetServer(int /*sig*/);
|
---|
206 |
|
---|
207 | extern SIGVAL GiveUp(int /*sig*/);
|
---|
208 |
|
---|
209 | extern void UseMsg(void);
|
---|
210 |
|
---|
211 | extern void InitGlobals(void);
|
---|
212 |
|
---|
213 | extern void ProcessCommandLine(int /*argc*/, char* /*argv*/[]);
|
---|
214 |
|
---|
215 | extern int set_font_authorizations(
|
---|
216 | char ** /* authorizations */,
|
---|
217 | int * /*authlen */,
|
---|
218 | pointer /* client */);
|
---|
219 |
|
---|
220 | #ifndef _HAVE_XALLOC_DECLS
|
---|
221 | #define _HAVE_XALLOC_DECLS
|
---|
222 | extern pointer Xalloc(unsigned long /*amount*/);
|
---|
223 | extern pointer Xcalloc(unsigned long /*amount*/);
|
---|
224 | extern pointer Xrealloc(pointer /*ptr*/, unsigned long /*amount*/);
|
---|
225 | extern void Xfree(pointer /*ptr*/);
|
---|
226 | #endif
|
---|
227 |
|
---|
228 | extern pointer XNFalloc(unsigned long /*amount*/);
|
---|
229 | extern pointer XNFcalloc(unsigned long /*amount*/);
|
---|
230 | extern pointer XNFrealloc(pointer /*ptr*/, unsigned long /*amount*/);
|
---|
231 |
|
---|
232 | extern void OsInitAllocator(void);
|
---|
233 |
|
---|
234 | extern char *Xstrdup(const char *s);
|
---|
235 | extern char *XNFstrdup(const char *s);
|
---|
236 | extern char *Xprintf(const char *fmt, ...);
|
---|
237 | extern char *Xvprintf(const char *fmt, va_list va);
|
---|
238 | extern char *XNFprintf(const char *fmt, ...);
|
---|
239 | extern char *XNFvprintf(const char *fmt, va_list va);
|
---|
240 |
|
---|
241 | typedef SIGVAL (*OsSigHandlerPtr)(int /* sig */);
|
---|
242 |
|
---|
243 | extern OsSigHandlerPtr OsSignal(int /* sig */, OsSigHandlerPtr /* handler */);
|
---|
244 |
|
---|
245 | extern int auditTrailLevel;
|
---|
246 |
|
---|
247 | #ifdef SERVER_LOCK
|
---|
248 | extern void LockServer(void);
|
---|
249 | extern void UnlockServer(void);
|
---|
250 | #endif
|
---|
251 |
|
---|
252 | extern int OsLookupColor(
|
---|
253 | int /*screen*/,
|
---|
254 | char * /*name*/,
|
---|
255 | unsigned /*len*/,
|
---|
256 | unsigned short * /*pred*/,
|
---|
257 | unsigned short * /*pgreen*/,
|
---|
258 | unsigned short * /*pblue*/);
|
---|
259 |
|
---|
260 | extern void OsInit(void);
|
---|
261 |
|
---|
262 | extern void OsCleanup(Bool);
|
---|
263 |
|
---|
264 | extern void OsVendorFatalError(void);
|
---|
265 |
|
---|
266 | extern void OsVendorInit(void);
|
---|
267 |
|
---|
268 | extern int OsInitColors(void);
|
---|
269 |
|
---|
270 | void OsBlockSignals (void);
|
---|
271 |
|
---|
272 | void OsReleaseSignals (void);
|
---|
273 |
|
---|
274 | #if !defined(WIN32)
|
---|
275 | extern int System(char *);
|
---|
276 | extern pointer Popen(char *, char *);
|
---|
277 | extern int Pclose(pointer);
|
---|
278 | extern pointer Fopen(char *, char *);
|
---|
279 | extern int Fclose(pointer);
|
---|
280 | #else
|
---|
281 | #define System(a) system(a)
|
---|
282 | #define Popen(a,b) popen(a,b)
|
---|
283 | #define Pclose(a) pclose(a)
|
---|
284 | #define Fopen(a,b) fopen(a,b)
|
---|
285 | #define Fclose(a) fclose(a)
|
---|
286 | #endif
|
---|
287 |
|
---|
288 | extern void CheckUserParameters(int argc, char **argv, char **envp);
|
---|
289 | extern void CheckUserAuthorization(void);
|
---|
290 |
|
---|
291 | extern int AddHost(
|
---|
292 | ClientPtr /*client*/,
|
---|
293 | int /*family*/,
|
---|
294 | unsigned /*length*/,
|
---|
295 | pointer /*pAddr*/);
|
---|
296 |
|
---|
297 | extern Bool ForEachHostInFamily (
|
---|
298 | int /*family*/,
|
---|
299 | Bool (* /*func*/ )(
|
---|
300 | unsigned char * /* addr */,
|
---|
301 | short /* len */,
|
---|
302 | pointer /* closure */),
|
---|
303 | pointer /*closure*/);
|
---|
304 |
|
---|
305 | extern int RemoveHost(
|
---|
306 | ClientPtr /*client*/,
|
---|
307 | int /*family*/,
|
---|
308 | unsigned /*length*/,
|
---|
309 | pointer /*pAddr*/);
|
---|
310 |
|
---|
311 | extern int GetHosts(
|
---|
312 | pointer * /*data*/,
|
---|
313 | int * /*pnHosts*/,
|
---|
314 | int * /*pLen*/,
|
---|
315 | BOOL * /*pEnabled*/);
|
---|
316 |
|
---|
317 | typedef struct sockaddr * sockaddrPtr;
|
---|
318 |
|
---|
319 | extern int InvalidHost(sockaddrPtr /*saddr*/, int /*len*/, ClientPtr client);
|
---|
320 |
|
---|
321 | extern int LocalClient(ClientPtr /* client */);
|
---|
322 |
|
---|
323 | extern int LocalClientCred(ClientPtr, int *, int *);
|
---|
324 |
|
---|
325 | #define LCC_UID_SET (1 << 0)
|
---|
326 | #define LCC_GID_SET (1 << 1)
|
---|
327 | #define LCC_PID_SET (1 << 2)
|
---|
328 | #define LCC_ZID_SET (1 << 3)
|
---|
329 |
|
---|
330 | typedef struct {
|
---|
331 | int fieldsSet; /* Bit mask of fields set */
|
---|
332 | int euid; /* Effective uid */
|
---|
333 | int egid; /* Primary effective group id */
|
---|
334 | int nSuppGids; /* Number of supplementary group ids */
|
---|
335 | int *pSuppGids; /* Array of supplementary group ids */
|
---|
336 | int pid; /* Process id */
|
---|
337 | int zoneid; /* Only set on Solaris 10 & later */
|
---|
338 | } LocalClientCredRec;
|
---|
339 |
|
---|
340 | extern int GetLocalClientCreds(ClientPtr, LocalClientCredRec **);
|
---|
341 | extern void FreeLocalClientCreds(LocalClientCredRec *);
|
---|
342 |
|
---|
343 | extern int ChangeAccessControl(ClientPtr /*client*/, int /*fEnabled*/);
|
---|
344 |
|
---|
345 | extern int GetAccessControl(void);
|
---|
346 |
|
---|
347 |
|
---|
348 | extern void AddLocalHosts(void);
|
---|
349 |
|
---|
350 | extern void ResetHosts(char *display);
|
---|
351 |
|
---|
352 | extern void EnableLocalHost(void);
|
---|
353 |
|
---|
354 | extern void DisableLocalHost(void);
|
---|
355 |
|
---|
356 | extern void AccessUsingXdmcp(void);
|
---|
357 |
|
---|
358 | extern void DefineSelf(int /*fd*/);
|
---|
359 |
|
---|
360 | extern void AugmentSelf(pointer /*from*/, int /*len*/);
|
---|
361 |
|
---|
362 | extern void InitAuthorization(char * /*filename*/);
|
---|
363 |
|
---|
364 | /* extern int LoadAuthorization(void); */
|
---|
365 |
|
---|
366 | extern void RegisterAuthorizations(void);
|
---|
367 |
|
---|
368 | extern int AuthorizationFromID (
|
---|
369 | XID id,
|
---|
370 | unsigned short *name_lenp,
|
---|
371 | char **namep,
|
---|
372 | unsigned short *data_lenp,
|
---|
373 | char **datap);
|
---|
374 |
|
---|
375 | extern XID CheckAuthorization(
|
---|
376 | unsigned int /*namelength*/,
|
---|
377 | char * /*name*/,
|
---|
378 | unsigned int /*datalength*/,
|
---|
379 | char * /*data*/,
|
---|
380 | ClientPtr /*client*/,
|
---|
381 | char ** /*reason*/
|
---|
382 | );
|
---|
383 |
|
---|
384 | extern void ResetAuthorization(void);
|
---|
385 |
|
---|
386 | extern int RemoveAuthorization (
|
---|
387 | unsigned short name_length,
|
---|
388 | char *name,
|
---|
389 | unsigned short data_length,
|
---|
390 | char *data);
|
---|
391 |
|
---|
392 | extern int AddAuthorization(
|
---|
393 | unsigned int /*name_length*/,
|
---|
394 | char * /*name*/,
|
---|
395 | unsigned int /*data_length*/,
|
---|
396 | char * /*data*/);
|
---|
397 |
|
---|
398 | extern XID GenerateAuthorization(
|
---|
399 | unsigned int /* name_length */,
|
---|
400 | char * /* name */,
|
---|
401 | unsigned int /* data_length */,
|
---|
402 | char * /* data */,
|
---|
403 | unsigned int * /* data_length_return */,
|
---|
404 | char ** /* data_return */);
|
---|
405 |
|
---|
406 | #ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS
|
---|
407 | extern void ExpandCommandLine(int * /*pargc*/, char *** /*pargv*/);
|
---|
408 | #endif
|
---|
409 |
|
---|
410 | extern void ddxInitGlobals(void);
|
---|
411 |
|
---|
412 | extern int ddxProcessArgument(int /*argc*/, char * /*argv*/ [], int /*i*/);
|
---|
413 |
|
---|
414 | extern void ddxUseMsg(void);
|
---|
415 |
|
---|
416 | /* int ReqLen(xReq *req, ClientPtr client)
|
---|
417 | * Given a pointer to a *complete* request, return its length in bytes.
|
---|
418 | * Note that if the request is a big request (as defined in the Big
|
---|
419 | * Requests extension), the macro lies by returning 4 less than the
|
---|
420 | * length that it actually occupies in the request buffer. This is so you
|
---|
421 | * can blindly compare the length with the various sz_<request> constants
|
---|
422 | * in Xproto.h without having to know/care about big requests.
|
---|
423 | */
|
---|
424 | #define ReqLen(_pxReq, _client) \
|
---|
425 | ((_pxReq->length ? \
|
---|
426 | (_client->swapped ? lswaps(_pxReq->length) : _pxReq->length) \
|
---|
427 | : ((_client->swapped ? \
|
---|
428 | lswapl(((CARD32*)_pxReq)[1]) : ((CARD32*)_pxReq)[1])-1) \
|
---|
429 | ) << 2)
|
---|
430 |
|
---|
431 | /* otherReqTypePtr CastxReq(xReq *req, otherReqTypePtr)
|
---|
432 | * Cast the given request to one of type otherReqTypePtr to access
|
---|
433 | * fields beyond the length field.
|
---|
434 | */
|
---|
435 | #define CastxReq(_pxReq, otherReqTypePtr) \
|
---|
436 | (_pxReq->length ? (otherReqTypePtr)_pxReq \
|
---|
437 | : (otherReqTypePtr)(((CARD32*)_pxReq)+1))
|
---|
438 |
|
---|
439 | /* stuff for SkippedRequestsCallback */
|
---|
440 | extern CallbackListPtr SkippedRequestsCallback;
|
---|
441 | typedef struct {
|
---|
442 | xReqPtr req;
|
---|
443 | ClientPtr client;
|
---|
444 | int numskipped;
|
---|
445 | } SkippedRequestInfoRec;
|
---|
446 |
|
---|
447 | /* stuff for ReplyCallback */
|
---|
448 | extern CallbackListPtr ReplyCallback;
|
---|
449 | typedef struct {
|
---|
450 | ClientPtr client;
|
---|
451 | pointer replyData;
|
---|
452 | unsigned long dataLenBytes;
|
---|
453 | unsigned long bytesRemaining;
|
---|
454 | Bool startOfReply;
|
---|
455 | } ReplyInfoRec;
|
---|
456 |
|
---|
457 | /* stuff for FlushCallback */
|
---|
458 | extern CallbackListPtr FlushCallback;
|
---|
459 |
|
---|
460 | extern void AbortDDX(void);
|
---|
461 | extern void ddxGiveUp(void);
|
---|
462 | extern int TimeSinceLastInputEvent(void);
|
---|
463 |
|
---|
464 | /* Logging. */
|
---|
465 | typedef enum _LogParameter {
|
---|
466 | XLOG_FLUSH,
|
---|
467 | XLOG_SYNC,
|
---|
468 | XLOG_VERBOSITY,
|
---|
469 | XLOG_FILE_VERBOSITY
|
---|
470 | } LogParameter;
|
---|
471 |
|
---|
472 | /* Flags for log messages. */
|
---|
473 | typedef enum {
|
---|
474 | X_PROBED, /* Value was probed */
|
---|
475 | X_CONFIG, /* Value was given in the config file */
|
---|
476 | X_DEFAULT, /* Value is a default */
|
---|
477 | X_CMDLINE, /* Value was given on the command line */
|
---|
478 | X_NOTICE, /* Notice */
|
---|
479 | X_ERROR, /* Error message */
|
---|
480 | X_WARNING, /* Warning message */
|
---|
481 | X_INFO, /* Informational message */
|
---|
482 | X_NONE, /* No prefix */
|
---|
483 | X_NOT_IMPLEMENTED, /* Not implemented */
|
---|
484 | X_UNKNOWN = -1 /* unknown -- this must always be last */
|
---|
485 | } MessageType;
|
---|
486 |
|
---|
487 | /* XXX Need to check which GCC versions have the format(printf) attribute. */
|
---|
488 | #if defined(__GNUC__) && \
|
---|
489 | ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ > 4)))
|
---|
490 | #define _printf_attribute(a,b) __attribute((format(__printf__,a,b)))
|
---|
491 | #else
|
---|
492 | #define _printf_attribute(a,b) /**/
|
---|
493 | #endif
|
---|
494 |
|
---|
495 | extern const char *LogInit(const char *fname, const char *backup);
|
---|
496 | extern void LogClose(void);
|
---|
497 | extern Bool LogSetParameter(LogParameter param, int value);
|
---|
498 | extern void LogVWrite(int verb, const char *f, va_list args);
|
---|
499 | extern void LogWrite(int verb, const char *f, ...) _printf_attribute(2,3);
|
---|
500 | extern void LogVMessageVerb(MessageType type, int verb, const char *format,
|
---|
501 | va_list args);
|
---|
502 | extern void LogMessageVerb(MessageType type, int verb, const char *format,
|
---|
503 | ...) _printf_attribute(3,4);
|
---|
504 | extern void LogMessage(MessageType type, const char *format, ...)
|
---|
505 | _printf_attribute(2,3);
|
---|
506 | extern void FreeAuditTimer(void);
|
---|
507 | extern void AuditF(const char *f, ...) _printf_attribute(1,2);
|
---|
508 | extern void VAuditF(const char *f, va_list args);
|
---|
509 | extern void FatalError(const char *f, ...) _printf_attribute(1,2)
|
---|
510 | #if defined(__GNUC__) && \
|
---|
511 | ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ > 4)))
|
---|
512 | __attribute((noreturn))
|
---|
513 | #endif
|
---|
514 | ;
|
---|
515 |
|
---|
516 | #ifdef DEBUG
|
---|
517 | #define DebugF ErrorF
|
---|
518 | #else
|
---|
519 | #define DebugF(...) /* */
|
---|
520 | #endif
|
---|
521 |
|
---|
522 | extern void VErrorF(const char *f, va_list args);
|
---|
523 | extern void ErrorF(const char *f, ...) _printf_attribute(1,2);
|
---|
524 | extern void Error(char *str);
|
---|
525 | extern void LogPrintMarkers(void);
|
---|
526 |
|
---|
527 | extern void xorg_backtrace(void);
|
---|
528 |
|
---|
529 | #endif /* OS_H */
|
---|