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 | #define ALLOCATE_LOCAL_FALLBACK(_size) Xalloc((unsigned long)(_size))
|
---|
54 | #define DEALLOCATE_LOCAL_FALLBACK(_ptr) Xfree((pointer)(_ptr))
|
---|
55 | #include <X11/Xalloca.h>
|
---|
56 | #include <stdarg.h>
|
---|
57 |
|
---|
58 | #define NullFID ((FID) 0)
|
---|
59 |
|
---|
60 | #define SCREEN_SAVER_ON 0
|
---|
61 | #define SCREEN_SAVER_OFF 1
|
---|
62 | #define SCREEN_SAVER_FORCER 2
|
---|
63 | #define SCREEN_SAVER_CYCLE 3
|
---|
64 |
|
---|
65 | #ifndef MAX_REQUEST_SIZE
|
---|
66 | #define MAX_REQUEST_SIZE 65535
|
---|
67 | #endif
|
---|
68 | #ifndef MAX_BIG_REQUEST_SIZE
|
---|
69 | #define MAX_BIG_REQUEST_SIZE 4194303
|
---|
70 | #endif
|
---|
71 |
|
---|
72 | typedef pointer FID;
|
---|
73 | typedef struct _FontPathRec *FontPathPtr;
|
---|
74 | typedef struct _NewClientRec *NewClientPtr;
|
---|
75 |
|
---|
76 | #ifndef xalloc
|
---|
77 | #define xnfalloc(size) XNFalloc((unsigned long)(size))
|
---|
78 | #define xnfcalloc(_num, _size) XNFcalloc((unsigned long)(_num)*(unsigned long)(_size))
|
---|
79 | #define xnfrealloc(ptr, size) XNFrealloc((pointer)(ptr), (unsigned long)(size))
|
---|
80 |
|
---|
81 | #define xalloc(size) Xalloc((unsigned long)(size))
|
---|
82 | #define xcalloc(_num, _size) Xcalloc((unsigned long)(_num)*(unsigned long)(_size))
|
---|
83 | #define xrealloc(ptr, size) Xrealloc((pointer)(ptr), (unsigned long)(size))
|
---|
84 | #define xfree(ptr) Xfree((pointer)(ptr))
|
---|
85 | #define xstrdup(s) Xstrdup(s)
|
---|
86 | #define xnfstrdup(s) XNFstrdup(s)
|
---|
87 | #endif
|
---|
88 |
|
---|
89 | #include <stdio.h>
|
---|
90 | #include <stdarg.h>
|
---|
91 |
|
---|
92 | /* have to put $(SIGNAL_DEFINES) in DEFINES in Imakefile to get this right */
|
---|
93 | #ifdef SIGNALRETURNSINT
|
---|
94 | #define SIGVAL int
|
---|
95 | #else
|
---|
96 | #define SIGVAL void
|
---|
97 | #endif
|
---|
98 |
|
---|
99 | extern Bool OsDelayInitColors;
|
---|
100 | extern void (*OsVendorVErrorFProc)(const char *, va_list args);
|
---|
101 |
|
---|
102 | extern int WaitForSomething(
|
---|
103 | int* /*pClientsReady*/
|
---|
104 | );
|
---|
105 |
|
---|
106 | extern int ReadRequestFromClient(ClientPtr /*client*/);
|
---|
107 |
|
---|
108 | extern Bool InsertFakeRequest(
|
---|
109 | ClientPtr /*client*/,
|
---|
110 | char* /*data*/,
|
---|
111 | int /*count*/);
|
---|
112 |
|
---|
113 | extern void ResetCurrentRequest(ClientPtr /*client*/);
|
---|
114 |
|
---|
115 | extern void FlushAllOutput(void);
|
---|
116 |
|
---|
117 | extern void FlushIfCriticalOutputPending(void);
|
---|
118 |
|
---|
119 | extern void SetCriticalOutputPending(void);
|
---|
120 |
|
---|
121 | extern int WriteToClient(ClientPtr /*who*/, int /*count*/, char* /*buf*/);
|
---|
122 |
|
---|
123 | extern void ResetOsBuffers(void);
|
---|
124 |
|
---|
125 | extern void InitConnectionLimits(void);
|
---|
126 |
|
---|
127 | extern void CreateWellKnownSockets(void);
|
---|
128 |
|
---|
129 | extern void ResetWellKnownSockets(void);
|
---|
130 |
|
---|
131 | extern void CloseWellKnownConnections(void);
|
---|
132 |
|
---|
133 | extern XID AuthorizationIDOfClient(ClientPtr /*client*/);
|
---|
134 |
|
---|
135 | extern char *ClientAuthorized(
|
---|
136 | ClientPtr /*client*/,
|
---|
137 | unsigned int /*proto_n*/,
|
---|
138 | char* /*auth_proto*/,
|
---|
139 | unsigned int /*string_n*/,
|
---|
140 | char* /*auth_string*/);
|
---|
141 |
|
---|
142 | extern Bool EstablishNewConnections(
|
---|
143 | ClientPtr /*clientUnused*/,
|
---|
144 | pointer /*closure*/);
|
---|
145 |
|
---|
146 | extern void CheckConnections(void);
|
---|
147 |
|
---|
148 | extern void CloseDownConnection(ClientPtr /*client*/);
|
---|
149 |
|
---|
150 | extern void AddGeneralSocket(int /*fd*/);
|
---|
151 |
|
---|
152 | extern void RemoveGeneralSocket(int /*fd*/);
|
---|
153 |
|
---|
154 | extern void AddEnabledDevice(int /*fd*/);
|
---|
155 |
|
---|
156 | extern void RemoveEnabledDevice(int /*fd*/);
|
---|
157 |
|
---|
158 | extern void OnlyListenToOneClient(ClientPtr /*client*/);
|
---|
159 |
|
---|
160 | extern void ListenToAllClients(void);
|
---|
161 |
|
---|
162 | extern void IgnoreClient(ClientPtr /*client*/);
|
---|
163 |
|
---|
164 | extern void AttendClient(ClientPtr /*client*/);
|
---|
165 |
|
---|
166 | extern void MakeClientGrabImpervious(ClientPtr /*client*/);
|
---|
167 |
|
---|
168 | extern void MakeClientGrabPervious(ClientPtr /*client*/);
|
---|
169 |
|
---|
170 | extern void AvailableClientInput(ClientPtr /* client */);
|
---|
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 InitGlobals(void);
|
---|
213 |
|
---|
214 | extern void ProcessCommandLine(int /*argc*/, char* /*argv*/[]);
|
---|
215 |
|
---|
216 | extern int set_font_authorizations(
|
---|
217 | char ** /* authorizations */,
|
---|
218 | int * /*authlen */,
|
---|
219 | pointer /* client */);
|
---|
220 |
|
---|
221 | #ifndef _HAVE_XALLOC_DECLS
|
---|
222 | #define _HAVE_XALLOC_DECLS
|
---|
223 | extern pointer Xalloc(unsigned long /*amount*/);
|
---|
224 | extern pointer Xcalloc(unsigned long /*amount*/);
|
---|
225 | extern pointer Xrealloc(pointer /*ptr*/, unsigned long /*amount*/);
|
---|
226 | extern void Xfree(pointer /*ptr*/);
|
---|
227 | #endif
|
---|
228 |
|
---|
229 | extern pointer XNFalloc(unsigned long /*amount*/);
|
---|
230 | extern pointer XNFcalloc(unsigned long /*amount*/);
|
---|
231 | extern pointer XNFrealloc(pointer /*ptr*/, unsigned long /*amount*/);
|
---|
232 |
|
---|
233 | extern void OsInitAllocator(void);
|
---|
234 |
|
---|
235 | extern char *Xstrdup(const char *s);
|
---|
236 | extern char *XNFstrdup(const char *s);
|
---|
237 | extern char *Xprintf(const char *fmt, ...);
|
---|
238 | extern char *Xvprintf(const char *fmt, va_list va);
|
---|
239 | extern char *XNFprintf(const char *fmt, ...);
|
---|
240 | extern char *XNFvprintf(const char *fmt, va_list va);
|
---|
241 |
|
---|
242 | typedef SIGVAL (*OsSigHandlerPtr)(int /* sig */);
|
---|
243 |
|
---|
244 | extern OsSigHandlerPtr OsSignal(int /* sig */, OsSigHandlerPtr /* handler */);
|
---|
245 |
|
---|
246 | extern int auditTrailLevel;
|
---|
247 |
|
---|
248 | #ifdef SERVER_LOCK
|
---|
249 | extern void LockServer(void);
|
---|
250 | extern void UnlockServer(void);
|
---|
251 | #endif
|
---|
252 |
|
---|
253 | extern int OsLookupColor(
|
---|
254 | int /*screen*/,
|
---|
255 | char * /*name*/,
|
---|
256 | unsigned /*len*/,
|
---|
257 | unsigned short * /*pred*/,
|
---|
258 | unsigned short * /*pgreen*/,
|
---|
259 | unsigned short * /*pblue*/);
|
---|
260 |
|
---|
261 | extern void OsInit(void);
|
---|
262 |
|
---|
263 | extern void OsCleanup(Bool);
|
---|
264 |
|
---|
265 | extern void OsVendorFatalError(void);
|
---|
266 |
|
---|
267 | extern void OsVendorInit(void);
|
---|
268 |
|
---|
269 | extern int OsInitColors(void);
|
---|
270 |
|
---|
271 | void OsBlockSignals (void);
|
---|
272 |
|
---|
273 | void OsReleaseSignals (void);
|
---|
274 |
|
---|
275 | #if !defined(WIN32) && !defined(__UNIXOS2__)
|
---|
276 | extern int System(char *);
|
---|
277 | extern pointer Popen(char *, char *);
|
---|
278 | extern int Pclose(pointer);
|
---|
279 | extern pointer Fopen(char *, char *);
|
---|
280 | extern int Fclose(pointer);
|
---|
281 | #else
|
---|
282 | #define System(a) system(a)
|
---|
283 | #define Popen(a,b) popen(a,b)
|
---|
284 | #define Pclose(a) pclose(a)
|
---|
285 | #define Fopen(a,b) fopen(a,b)
|
---|
286 | #define Fclose(a) fclose(a)
|
---|
287 | #endif
|
---|
288 |
|
---|
289 | extern void CheckUserParameters(int argc, char **argv, char **envp);
|
---|
290 | extern void CheckUserAuthorization(void);
|
---|
291 |
|
---|
292 | extern int AddHost(
|
---|
293 | ClientPtr /*client*/,
|
---|
294 | int /*family*/,
|
---|
295 | unsigned /*length*/,
|
---|
296 | pointer /*pAddr*/);
|
---|
297 |
|
---|
298 | extern Bool ForEachHostInFamily (
|
---|
299 | int /*family*/,
|
---|
300 | Bool (* /*func*/ )(
|
---|
301 | unsigned char * /* addr */,
|
---|
302 | short /* len */,
|
---|
303 | pointer /* closure */),
|
---|
304 | pointer /*closure*/);
|
---|
305 |
|
---|
306 | extern int RemoveHost(
|
---|
307 | ClientPtr /*client*/,
|
---|
308 | int /*family*/,
|
---|
309 | unsigned /*length*/,
|
---|
310 | pointer /*pAddr*/);
|
---|
311 |
|
---|
312 | extern int GetHosts(
|
---|
313 | pointer * /*data*/,
|
---|
314 | int * /*pnHosts*/,
|
---|
315 | int * /*pLen*/,
|
---|
316 | BOOL * /*pEnabled*/);
|
---|
317 |
|
---|
318 | typedef struct sockaddr * sockaddrPtr;
|
---|
319 |
|
---|
320 | extern int InvalidHost(sockaddrPtr /*saddr*/, int /*len*/, ClientPtr client);
|
---|
321 |
|
---|
322 | extern int LocalClient(ClientPtr /* client */);
|
---|
323 |
|
---|
324 | extern int LocalClientCred(ClientPtr, int *, int *);
|
---|
325 |
|
---|
326 | extern int ChangeAccessControl(ClientPtr /*client*/, int /*fEnabled*/);
|
---|
327 |
|
---|
328 | extern int GetAccessControl(void);
|
---|
329 |
|
---|
330 |
|
---|
331 | extern void AddLocalHosts(void);
|
---|
332 |
|
---|
333 | extern void ResetHosts(char *display);
|
---|
334 |
|
---|
335 | extern void EnableLocalHost(void);
|
---|
336 |
|
---|
337 | extern void DisableLocalHost(void);
|
---|
338 |
|
---|
339 | extern void AccessUsingXdmcp(void);
|
---|
340 |
|
---|
341 | extern void DefineSelf(int /*fd*/);
|
---|
342 |
|
---|
343 | extern void AugmentSelf(pointer /*from*/, int /*len*/);
|
---|
344 |
|
---|
345 | extern void InitAuthorization(char * /*filename*/);
|
---|
346 |
|
---|
347 | /* extern int LoadAuthorization(void); */
|
---|
348 |
|
---|
349 | extern void RegisterAuthorizations(void);
|
---|
350 |
|
---|
351 | extern XID AuthorizationToID (
|
---|
352 | unsigned short name_length,
|
---|
353 | char *name,
|
---|
354 | unsigned short data_length,
|
---|
355 | char *data);
|
---|
356 |
|
---|
357 | extern int AuthorizationFromID (
|
---|
358 | XID id,
|
---|
359 | unsigned short *name_lenp,
|
---|
360 | char **namep,
|
---|
361 | unsigned short *data_lenp,
|
---|
362 | char **datap);
|
---|
363 |
|
---|
364 | extern XID CheckAuthorization(
|
---|
365 | unsigned int /*namelength*/,
|
---|
366 | char * /*name*/,
|
---|
367 | unsigned int /*datalength*/,
|
---|
368 | char * /*data*/,
|
---|
369 | ClientPtr /*client*/,
|
---|
370 | char ** /*reason*/
|
---|
371 | );
|
---|
372 |
|
---|
373 | extern void ResetAuthorization(void);
|
---|
374 |
|
---|
375 | extern int RemoveAuthorization (
|
---|
376 | unsigned short name_length,
|
---|
377 | char *name,
|
---|
378 | unsigned short data_length,
|
---|
379 | char *data);
|
---|
380 |
|
---|
381 | extern int AddAuthorization(
|
---|
382 | unsigned int /*name_length*/,
|
---|
383 | char * /*name*/,
|
---|
384 | unsigned int /*data_length*/,
|
---|
385 | char * /*data*/);
|
---|
386 |
|
---|
387 | extern XID GenerateAuthorization(
|
---|
388 | unsigned int /* name_length */,
|
---|
389 | char * /* name */,
|
---|
390 | unsigned int /* data_length */,
|
---|
391 | char * /* data */,
|
---|
392 | unsigned int * /* data_length_return */,
|
---|
393 | char ** /* data_return */);
|
---|
394 |
|
---|
395 | #ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS
|
---|
396 | extern void ExpandCommandLine(int * /*pargc*/, char *** /*pargv*/);
|
---|
397 | #endif
|
---|
398 |
|
---|
399 | extern void ddxInitGlobals(void);
|
---|
400 |
|
---|
401 | extern int ddxProcessArgument(int /*argc*/, char * /*argv*/ [], int /*i*/);
|
---|
402 |
|
---|
403 | extern void ddxUseMsg(void);
|
---|
404 |
|
---|
405 | /*
|
---|
406 | * idiom processing stuff
|
---|
407 | */
|
---|
408 |
|
---|
409 | extern xReqPtr PeekNextRequest(xReqPtr req, ClientPtr client, Bool readmore);
|
---|
410 |
|
---|
411 | extern void SkipRequests(xReqPtr req, ClientPtr client, int numskipped);
|
---|
412 |
|
---|
413 | /* int ReqLen(xReq *req, ClientPtr client)
|
---|
414 | * Given a pointer to a *complete* request, return its length in bytes.
|
---|
415 | * Note that if the request is a big request (as defined in the Big
|
---|
416 | * Requests extension), the macro lies by returning 4 less than the
|
---|
417 | * length that it actually occupies in the request buffer. This is so you
|
---|
418 | * can blindly compare the length with the various sz_<request> constants
|
---|
419 | * in Xproto.h without having to know/care about big requests.
|
---|
420 | */
|
---|
421 | #define ReqLen(_pxReq, _client) \
|
---|
422 | ((_pxReq->length ? \
|
---|
423 | (_client->swapped ? lswaps(_pxReq->length) : _pxReq->length) \
|
---|
424 | : ((_client->swapped ? \
|
---|
425 | lswapl(((CARD32*)_pxReq)[1]) : ((CARD32*)_pxReq)[1])-1) \
|
---|
426 | ) << 2)
|
---|
427 |
|
---|
428 | /* otherReqTypePtr CastxReq(xReq *req, otherReqTypePtr)
|
---|
429 | * Cast the given request to one of type otherReqTypePtr to access
|
---|
430 | * fields beyond the length field.
|
---|
431 | */
|
---|
432 | #define CastxReq(_pxReq, otherReqTypePtr) \
|
---|
433 | (_pxReq->length ? (otherReqTypePtr)_pxReq \
|
---|
434 | : (otherReqTypePtr)(((CARD32*)_pxReq)+1))
|
---|
435 |
|
---|
436 | /* stuff for SkippedRequestsCallback */
|
---|
437 | extern CallbackListPtr SkippedRequestsCallback;
|
---|
438 | typedef struct {
|
---|
439 | xReqPtr req;
|
---|
440 | ClientPtr client;
|
---|
441 | int numskipped;
|
---|
442 | } SkippedRequestInfoRec;
|
---|
443 |
|
---|
444 | /* stuff for ReplyCallback */
|
---|
445 | extern CallbackListPtr ReplyCallback;
|
---|
446 | typedef struct {
|
---|
447 | ClientPtr client;
|
---|
448 | pointer replyData;
|
---|
449 | unsigned long dataLenBytes;
|
---|
450 | unsigned long bytesRemaining;
|
---|
451 | Bool startOfReply;
|
---|
452 | } ReplyInfoRec;
|
---|
453 |
|
---|
454 | /* stuff for FlushCallback */
|
---|
455 | extern CallbackListPtr FlushCallback;
|
---|
456 |
|
---|
457 | extern void AbortDDX(void);
|
---|
458 | extern void ddxGiveUp(void);
|
---|
459 | extern int TimeSinceLastInputEvent(void);
|
---|
460 |
|
---|
461 | /* Logging. */
|
---|
462 | typedef enum _LogParameter {
|
---|
463 | XLOG_FLUSH,
|
---|
464 | XLOG_SYNC,
|
---|
465 | XLOG_VERBOSITY,
|
---|
466 | XLOG_FILE_VERBOSITY
|
---|
467 | } LogParameter;
|
---|
468 |
|
---|
469 | /* Flags for log messages. */
|
---|
470 | typedef enum {
|
---|
471 | X_PROBED, /* Value was probed */
|
---|
472 | X_CONFIG, /* Value was given in the config file */
|
---|
473 | X_DEFAULT, /* Value is a default */
|
---|
474 | X_CMDLINE, /* Value was given on the command line */
|
---|
475 | X_NOTICE, /* Notice */
|
---|
476 | X_ERROR, /* Error message */
|
---|
477 | X_WARNING, /* Warning message */
|
---|
478 | X_INFO, /* Informational message */
|
---|
479 | X_NONE, /* No prefix */
|
---|
480 | X_NOT_IMPLEMENTED, /* Not implemented */
|
---|
481 | X_UNKNOWN = -1 /* unknown -- this must always be last */
|
---|
482 | } MessageType;
|
---|
483 |
|
---|
484 | /* XXX Need to check which GCC versions have the format(printf) attribute. */
|
---|
485 | #if defined(__GNUC__) && \
|
---|
486 | ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ > 4)))
|
---|
487 | #define _printf_attribute(a,b) __attribute((format(__printf__,a,b)))
|
---|
488 | #else
|
---|
489 | #define _printf_attribute(a,b) /**/
|
---|
490 | #endif
|
---|
491 |
|
---|
492 | extern const char *LogInit(const char *fname, const char *backup);
|
---|
493 | extern void LogClose(void);
|
---|
494 | extern Bool LogSetParameter(LogParameter param, int value);
|
---|
495 | extern void LogVWrite(int verb, const char *f, va_list args);
|
---|
496 | extern void LogWrite(int verb, const char *f, ...) _printf_attribute(2,3);
|
---|
497 | extern void LogVMessageVerb(MessageType type, int verb, const char *format,
|
---|
498 | va_list args);
|
---|
499 | extern void LogMessageVerb(MessageType type, int verb, const char *format,
|
---|
500 | ...) _printf_attribute(3,4);
|
---|
501 | extern void LogMessage(MessageType type, const char *format, ...)
|
---|
502 | _printf_attribute(2,3);
|
---|
503 | extern void FreeAuditTimer(void);
|
---|
504 | extern void AuditF(const char *f, ...) _printf_attribute(1,2);
|
---|
505 | extern void VAuditF(const char *f, va_list args);
|
---|
506 | extern void FatalError(const char *f, ...) _printf_attribute(1,2)
|
---|
507 | #if defined(__GNUC__) && \
|
---|
508 | ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ > 4)))
|
---|
509 | __attribute((noreturn))
|
---|
510 | #endif
|
---|
511 | ;
|
---|
512 |
|
---|
513 | extern void VErrorF(const char *f, va_list args);
|
---|
514 | extern void ErrorF(const char *f, ...) _printf_attribute(1,2);
|
---|
515 | extern void Error(char *str);
|
---|
516 | extern void LogPrintMarkers(void);
|
---|
517 |
|
---|
518 | #endif /* OS_H */
|
---|