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 void (*OsVendorVErrorFProc)(const char *, va_list args);
|
---|
97 |
|
---|
98 | extern int WaitForSomething(
|
---|
99 | int* /*pClientsReady*/
|
---|
100 | );
|
---|
101 |
|
---|
102 | extern int ReadRequestFromClient(ClientPtr /*client*/);
|
---|
103 |
|
---|
104 | extern Bool InsertFakeRequest(
|
---|
105 | ClientPtr /*client*/,
|
---|
106 | char* /*data*/,
|
---|
107 | int /*count*/);
|
---|
108 |
|
---|
109 | extern void ResetCurrentRequest(ClientPtr /*client*/);
|
---|
110 |
|
---|
111 | extern void FlushAllOutput(void);
|
---|
112 |
|
---|
113 | extern void FlushIfCriticalOutputPending(void);
|
---|
114 |
|
---|
115 | extern void SetCriticalOutputPending(void);
|
---|
116 |
|
---|
117 | extern int WriteToClient(ClientPtr /*who*/, int /*count*/, const void* /*buf*/);
|
---|
118 |
|
---|
119 | extern void ResetOsBuffers(void);
|
---|
120 |
|
---|
121 | extern void InitConnectionLimits(void);
|
---|
122 |
|
---|
123 | extern void NotifyParentProcess(void);
|
---|
124 |
|
---|
125 | extern void CreateWellKnownSockets(void);
|
---|
126 |
|
---|
127 | extern void ResetWellKnownSockets(void);
|
---|
128 |
|
---|
129 | extern void CloseWellKnownConnections(void);
|
---|
130 |
|
---|
131 | extern XID AuthorizationIDOfClient(ClientPtr /*client*/);
|
---|
132 |
|
---|
133 | extern char *ClientAuthorized(
|
---|
134 | ClientPtr /*client*/,
|
---|
135 | unsigned int /*proto_n*/,
|
---|
136 | char* /*auth_proto*/,
|
---|
137 | unsigned int /*string_n*/,
|
---|
138 | char* /*auth_string*/);
|
---|
139 |
|
---|
140 | extern Bool EstablishNewConnections(
|
---|
141 | ClientPtr /*clientUnused*/,
|
---|
142 | pointer /*closure*/);
|
---|
143 |
|
---|
144 | extern void CheckConnections(void);
|
---|
145 |
|
---|
146 | extern void CloseDownConnection(ClientPtr /*client*/);
|
---|
147 |
|
---|
148 | extern void AddGeneralSocket(int /*fd*/);
|
---|
149 |
|
---|
150 | extern void RemoveGeneralSocket(int /*fd*/);
|
---|
151 |
|
---|
152 | extern void AddEnabledDevice(int /*fd*/);
|
---|
153 |
|
---|
154 | extern void RemoveEnabledDevice(int /*fd*/);
|
---|
155 |
|
---|
156 | extern int OnlyListenToOneClient(ClientPtr /*client*/);
|
---|
157 |
|
---|
158 | extern void ListenToAllClients(void);
|
---|
159 |
|
---|
160 | extern void IgnoreClient(ClientPtr /*client*/);
|
---|
161 |
|
---|
162 | extern void AttendClient(ClientPtr /*client*/);
|
---|
163 |
|
---|
164 | extern void MakeClientGrabImpervious(ClientPtr /*client*/);
|
---|
165 |
|
---|
166 | extern void MakeClientGrabPervious(ClientPtr /*client*/);
|
---|
167 |
|
---|
168 | #ifdef XQUARTZ
|
---|
169 | extern void ListenOnOpenFD(int /* fd */, int /* noxauth */);
|
---|
170 | #endif
|
---|
171 |
|
---|
172 | extern CARD32 GetTimeInMillis(void);
|
---|
173 |
|
---|
174 | extern void AdjustWaitForDelay(
|
---|
175 | pointer /*waitTime*/,
|
---|
176 | unsigned long /*newdelay*/);
|
---|
177 |
|
---|
178 | typedef struct _OsTimerRec *OsTimerPtr;
|
---|
179 |
|
---|
180 | typedef CARD32 (*OsTimerCallback)(
|
---|
181 | OsTimerPtr /* timer */,
|
---|
182 | CARD32 /* time */,
|
---|
183 | pointer /* arg */);
|
---|
184 |
|
---|
185 | extern void TimerInit(void);
|
---|
186 |
|
---|
187 | extern Bool TimerForce(OsTimerPtr /* timer */);
|
---|
188 |
|
---|
189 | #define TimerAbsolute (1<<0)
|
---|
190 | #define TimerForceOld (1<<1)
|
---|
191 |
|
---|
192 | extern OsTimerPtr TimerSet(
|
---|
193 | OsTimerPtr /* timer */,
|
---|
194 | int /* flags */,
|
---|
195 | CARD32 /* millis */,
|
---|
196 | OsTimerCallback /* func */,
|
---|
197 | pointer /* arg */);
|
---|
198 |
|
---|
199 | extern void TimerCheck(void);
|
---|
200 | extern void TimerCancel(OsTimerPtr /* pTimer */);
|
---|
201 | extern void TimerFree(OsTimerPtr /* pTimer */);
|
---|
202 |
|
---|
203 | extern void SetScreenSaverTimer(void);
|
---|
204 | extern void FreeScreenSaverTimer(void);
|
---|
205 |
|
---|
206 | extern SIGVAL AutoResetServer(int /*sig*/);
|
---|
207 |
|
---|
208 | extern SIGVAL GiveUp(int /*sig*/);
|
---|
209 |
|
---|
210 | extern void UseMsg(void);
|
---|
211 |
|
---|
212 | extern void ProcessCommandLine(int /*argc*/, char* /*argv*/[]);
|
---|
213 |
|
---|
214 | extern int set_font_authorizations(
|
---|
215 | char ** /* authorizations */,
|
---|
216 | int * /*authlen */,
|
---|
217 | pointer /* client */);
|
---|
218 |
|
---|
219 | #ifndef _HAVE_XALLOC_DECLS
|
---|
220 | #define _HAVE_XALLOC_DECLS
|
---|
221 | extern pointer Xalloc(unsigned long /*amount*/);
|
---|
222 | extern pointer Xcalloc(unsigned long /*amount*/);
|
---|
223 | extern pointer Xrealloc(pointer /*ptr*/, unsigned long /*amount*/);
|
---|
224 | extern void Xfree(pointer /*ptr*/);
|
---|
225 | #endif
|
---|
226 |
|
---|
227 | extern pointer XNFalloc(unsigned long /*amount*/);
|
---|
228 | extern pointer XNFcalloc(unsigned long /*amount*/);
|
---|
229 | extern pointer XNFrealloc(pointer /*ptr*/, unsigned long /*amount*/);
|
---|
230 |
|
---|
231 | extern char *Xstrdup(const char *s);
|
---|
232 | extern char *XNFstrdup(const char *s);
|
---|
233 | extern char *Xprintf(const char *fmt, ...);
|
---|
234 | extern char *Xvprintf(const char *fmt, va_list va);
|
---|
235 | extern char *XNFprintf(const char *fmt, ...);
|
---|
236 | extern char *XNFvprintf(const char *fmt, va_list va);
|
---|
237 |
|
---|
238 | typedef SIGVAL (*OsSigHandlerPtr)(int /* sig */);
|
---|
239 |
|
---|
240 | extern OsSigHandlerPtr OsSignal(int /* sig */, OsSigHandlerPtr /* handler */);
|
---|
241 |
|
---|
242 | extern int auditTrailLevel;
|
---|
243 |
|
---|
244 | extern void LockServer(void);
|
---|
245 | extern void UnlockServer(void);
|
---|
246 |
|
---|
247 | extern int OsLookupColor(
|
---|
248 | int /*screen*/,
|
---|
249 | char * /*name*/,
|
---|
250 | unsigned /*len*/,
|
---|
251 | unsigned short * /*pred*/,
|
---|
252 | unsigned short * /*pgreen*/,
|
---|
253 | unsigned short * /*pblue*/);
|
---|
254 |
|
---|
255 | extern void OsInit(void);
|
---|
256 |
|
---|
257 | extern void OsCleanup(Bool);
|
---|
258 |
|
---|
259 | extern void OsVendorFatalError(void);
|
---|
260 |
|
---|
261 | extern void OsVendorInit(void);
|
---|
262 |
|
---|
263 | void OsBlockSignals (void);
|
---|
264 |
|
---|
265 | void OsReleaseSignals (void);
|
---|
266 |
|
---|
267 | #if !defined(WIN32)
|
---|
268 | extern int System(char *);
|
---|
269 | extern pointer Popen(char *, char *);
|
---|
270 | extern int Pclose(pointer);
|
---|
271 | extern pointer Fopen(char *, char *);
|
---|
272 | extern int Fclose(pointer);
|
---|
273 | #else
|
---|
274 | #define System(a) system(a)
|
---|
275 | #define Popen(a,b) popen(a,b)
|
---|
276 | #define Pclose(a) pclose(a)
|
---|
277 | #define Fopen(a,b) fopen(a,b)
|
---|
278 | #define Fclose(a) fclose(a)
|
---|
279 | #endif
|
---|
280 |
|
---|
281 | extern void CheckUserParameters(int argc, char **argv, char **envp);
|
---|
282 | extern void CheckUserAuthorization(void);
|
---|
283 |
|
---|
284 | extern int AddHost(
|
---|
285 | ClientPtr /*client*/,
|
---|
286 | int /*family*/,
|
---|
287 | unsigned /*length*/,
|
---|
288 | pointer /*pAddr*/);
|
---|
289 |
|
---|
290 | extern Bool ForEachHostInFamily (
|
---|
291 | int /*family*/,
|
---|
292 | Bool (* /*func*/ )(
|
---|
293 | unsigned char * /* addr */,
|
---|
294 | short /* len */,
|
---|
295 | pointer /* closure */),
|
---|
296 | pointer /*closure*/);
|
---|
297 |
|
---|
298 | extern int RemoveHost(
|
---|
299 | ClientPtr /*client*/,
|
---|
300 | int /*family*/,
|
---|
301 | unsigned /*length*/,
|
---|
302 | pointer /*pAddr*/);
|
---|
303 |
|
---|
304 | extern int GetHosts(
|
---|
305 | pointer * /*data*/,
|
---|
306 | int * /*pnHosts*/,
|
---|
307 | int * /*pLen*/,
|
---|
308 | BOOL * /*pEnabled*/);
|
---|
309 |
|
---|
310 | typedef struct sockaddr * sockaddrPtr;
|
---|
311 |
|
---|
312 | extern int InvalidHost(sockaddrPtr /*saddr*/, int /*len*/, ClientPtr client);
|
---|
313 |
|
---|
314 | extern int LocalClient(ClientPtr /* client */);
|
---|
315 |
|
---|
316 | extern int LocalClientCred(ClientPtr, int *, int *);
|
---|
317 |
|
---|
318 | #define LCC_UID_SET (1 << 0)
|
---|
319 | #define LCC_GID_SET (1 << 1)
|
---|
320 | #define LCC_PID_SET (1 << 2)
|
---|
321 | #define LCC_ZID_SET (1 << 3)
|
---|
322 |
|
---|
323 | typedef struct {
|
---|
324 | int fieldsSet; /* Bit mask of fields set */
|
---|
325 | int euid; /* Effective uid */
|
---|
326 | int egid; /* Primary effective group id */
|
---|
327 | int nSuppGids; /* Number of supplementary group ids */
|
---|
328 | int *pSuppGids; /* Array of supplementary group ids */
|
---|
329 | int pid; /* Process id */
|
---|
330 | int zoneid; /* Only set on Solaris 10 & later */
|
---|
331 | } LocalClientCredRec;
|
---|
332 |
|
---|
333 | extern int GetLocalClientCreds(ClientPtr, LocalClientCredRec **);
|
---|
334 | extern void FreeLocalClientCreds(LocalClientCredRec *);
|
---|
335 |
|
---|
336 | extern int ChangeAccessControl(ClientPtr /*client*/, int /*fEnabled*/);
|
---|
337 |
|
---|
338 | extern int GetAccessControl(void);
|
---|
339 |
|
---|
340 |
|
---|
341 | extern void AddLocalHosts(void);
|
---|
342 |
|
---|
343 | extern void ResetHosts(char *display);
|
---|
344 |
|
---|
345 | extern void EnableLocalHost(void);
|
---|
346 |
|
---|
347 | extern void DisableLocalHost(void);
|
---|
348 |
|
---|
349 | extern void AccessUsingXdmcp(void);
|
---|
350 |
|
---|
351 | extern void DefineSelf(int /*fd*/);
|
---|
352 |
|
---|
353 | extern void AugmentSelf(pointer /*from*/, int /*len*/);
|
---|
354 |
|
---|
355 | extern void InitAuthorization(char * /*filename*/);
|
---|
356 |
|
---|
357 | /* extern int LoadAuthorization(void); */
|
---|
358 |
|
---|
359 | extern void RegisterAuthorizations(void);
|
---|
360 |
|
---|
361 | extern int AuthorizationFromID (
|
---|
362 | XID id,
|
---|
363 | unsigned short *name_lenp,
|
---|
364 | char **namep,
|
---|
365 | unsigned short *data_lenp,
|
---|
366 | char **datap);
|
---|
367 |
|
---|
368 | extern XID CheckAuthorization(
|
---|
369 | unsigned int /*namelength*/,
|
---|
370 | char * /*name*/,
|
---|
371 | unsigned int /*datalength*/,
|
---|
372 | char * /*data*/,
|
---|
373 | ClientPtr /*client*/,
|
---|
374 | char ** /*reason*/
|
---|
375 | );
|
---|
376 |
|
---|
377 | extern void ResetAuthorization(void);
|
---|
378 |
|
---|
379 | extern int RemoveAuthorization (
|
---|
380 | unsigned short name_length,
|
---|
381 | char *name,
|
---|
382 | unsigned short data_length,
|
---|
383 | char *data);
|
---|
384 |
|
---|
385 | extern int AddAuthorization(
|
---|
386 | unsigned int /*name_length*/,
|
---|
387 | char * /*name*/,
|
---|
388 | unsigned int /*data_length*/,
|
---|
389 | char * /*data*/);
|
---|
390 |
|
---|
391 | extern XID GenerateAuthorization(
|
---|
392 | unsigned int /* name_length */,
|
---|
393 | char * /* name */,
|
---|
394 | unsigned int /* data_length */,
|
---|
395 | char * /* data */,
|
---|
396 | unsigned int * /* data_length_return */,
|
---|
397 | char ** /* data_return */);
|
---|
398 |
|
---|
399 | extern int ddxProcessArgument(int /*argc*/, char * /*argv*/ [], int /*i*/);
|
---|
400 |
|
---|
401 | extern void ddxUseMsg(void);
|
---|
402 |
|
---|
403 | /* int ReqLen(xReq *req, ClientPtr client)
|
---|
404 | * Given a pointer to a *complete* request, return its length in bytes.
|
---|
405 | * Note that if the request is a big request (as defined in the Big
|
---|
406 | * Requests extension), the macro lies by returning 4 less than the
|
---|
407 | * length that it actually occupies in the request buffer. This is so you
|
---|
408 | * can blindly compare the length with the various sz_<request> constants
|
---|
409 | * in Xproto.h without having to know/care about big requests.
|
---|
410 | */
|
---|
411 | #define ReqLen(_pxReq, _client) \
|
---|
412 | ((_pxReq->length ? \
|
---|
413 | (_client->swapped ? lswaps(_pxReq->length) : _pxReq->length) \
|
---|
414 | : ((_client->swapped ? \
|
---|
415 | lswapl(((CARD32*)_pxReq)[1]) : ((CARD32*)_pxReq)[1])-1) \
|
---|
416 | ) << 2)
|
---|
417 |
|
---|
418 | /* otherReqTypePtr CastxReq(xReq *req, otherReqTypePtr)
|
---|
419 | * Cast the given request to one of type otherReqTypePtr to access
|
---|
420 | * fields beyond the length field.
|
---|
421 | */
|
---|
422 | #define CastxReq(_pxReq, otherReqTypePtr) \
|
---|
423 | (_pxReq->length ? (otherReqTypePtr)_pxReq \
|
---|
424 | : (otherReqTypePtr)(((CARD32*)_pxReq)+1))
|
---|
425 |
|
---|
426 | /* stuff for ReplyCallback */
|
---|
427 | extern CallbackListPtr ReplyCallback;
|
---|
428 | typedef struct {
|
---|
429 | ClientPtr client;
|
---|
430 | const void *replyData;
|
---|
431 | unsigned long dataLenBytes;
|
---|
432 | unsigned long bytesRemaining;
|
---|
433 | Bool startOfReply;
|
---|
434 | } ReplyInfoRec;
|
---|
435 |
|
---|
436 | /* stuff for FlushCallback */
|
---|
437 | extern CallbackListPtr FlushCallback;
|
---|
438 |
|
---|
439 | extern void AbortDDX(void);
|
---|
440 | extern void ddxGiveUp(void);
|
---|
441 | extern int TimeSinceLastInputEvent(void);
|
---|
442 |
|
---|
443 | /* strcasecmp.c */
|
---|
444 | #if NEED_STRCASECMP
|
---|
445 | #define strcasecmp xstrcasecmp
|
---|
446 | extern int xstrcasecmp(const char *s1, const char *s2);
|
---|
447 | #endif
|
---|
448 |
|
---|
449 | #if NEED_STRNCASECMP
|
---|
450 | #define strncasecmp xstrncasecmp
|
---|
451 | extern int xstrncasecmp(const char *s1, const char *s2, size_t n);
|
---|
452 | #endif
|
---|
453 |
|
---|
454 | #if NEED_STRCASESTR
|
---|
455 | #define strcasestr xstrcasestr
|
---|
456 | extern char *xstrcasestr(const char *s, const char *find);
|
---|
457 | #endif
|
---|
458 |
|
---|
459 | #ifndef HAS_STRLCPY
|
---|
460 | extern size_t strlcpy(char *dst, const char *src, size_t siz);
|
---|
461 | extern size_t strlcat(char *dst, const char *src, size_t siz);
|
---|
462 | #endif
|
---|
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__) && (__GNUC__ > 2)
|
---|
489 | #define _printf_attribute(a,b) __attribute((format(__printf__,a,b)))
|
---|
490 | #else
|
---|
491 | #define _printf_attribute(a,b) /**/
|
---|
492 | #endif
|
---|
493 |
|
---|
494 | extern const char *LogInit(const char *fname, const char *backup);
|
---|
495 | extern void LogClose(void);
|
---|
496 | extern Bool LogSetParameter(LogParameter param, int value);
|
---|
497 | extern void LogVWrite(int verb, const char *f, va_list args);
|
---|
498 | extern void LogWrite(int verb, const char *f, ...) _printf_attribute(2,3);
|
---|
499 | extern void LogVMessageVerb(MessageType type, int verb, const char *format,
|
---|
500 | va_list args);
|
---|
501 | extern void LogMessageVerb(MessageType type, int verb, const char *format,
|
---|
502 | ...) _printf_attribute(3,4);
|
---|
503 | extern void LogMessage(MessageType type, const char *format, ...)
|
---|
504 | _printf_attribute(2,3);
|
---|
505 | extern void FreeAuditTimer(void);
|
---|
506 | extern void AuditF(const char *f, ...) _printf_attribute(1,2);
|
---|
507 | extern void VAuditF(const char *f, va_list args);
|
---|
508 | extern void FatalError(const char *f, ...) _printf_attribute(1,2)
|
---|
509 | #if defined(__GNUC__) && (__GNUC__ > 2)
|
---|
510 | __attribute((noreturn))
|
---|
511 | #endif
|
---|
512 | ;
|
---|
513 |
|
---|
514 | #ifdef DEBUG
|
---|
515 | #define DebugF ErrorF
|
---|
516 | #else
|
---|
517 | #define DebugF(...) /* */
|
---|
518 | #endif
|
---|
519 |
|
---|
520 | extern void VErrorF(const char *f, va_list args);
|
---|
521 | extern void ErrorF(const char *f, ...) _printf_attribute(1,2);
|
---|
522 | extern void Error(char *str);
|
---|
523 | extern void LogPrintMarkers(void);
|
---|
524 |
|
---|
525 | extern void xorg_backtrace(void);
|
---|
526 |
|
---|
527 | #endif /* OS_H */
|
---|