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