215
215
#ifndef _HAVE_XALLOC_DECLS
216
216
#define _HAVE_XALLOC_DECLS
217
extern _X_EXPORT pointer Xalloc(unsigned long /*amount*/);
218
extern _X_EXPORT pointer Xcalloc(unsigned long /*amount*/);
219
extern _X_EXPORT pointer Xrealloc(pointer /*ptr*/, unsigned long /*amount*/);
220
extern _X_EXPORT void Xfree(pointer /*ptr*/);
219
* Use malloc(3) instead.
221
extern _X_EXPORT void *Xalloc(unsigned long /*amount*/) _X_DEPRECATED;
223
* Use calloc(3) instead
225
extern _X_EXPORT void *Xcalloc(unsigned long /*amount*/) _X_DEPRECATED;
227
* Use realloc(3) instead
229
extern _X_EXPORT void *Xrealloc(void * /*ptr*/, unsigned long /*amount*/)
232
* Use free(3) instead
234
extern _X_EXPORT void Xfree(void * /*ptr*/) _X_DEPRECATED;
223
extern _X_EXPORT pointer XNFalloc(unsigned long /*amount*/);
224
extern _X_EXPORT pointer XNFcalloc(unsigned long /*amount*/);
225
extern _X_EXPORT pointer XNFrealloc(pointer /*ptr*/, unsigned long /*amount*/);
239
* This function malloc(3)s buffer, terminating the server if there is not
242
extern _X_EXPORT void *XNFalloc(unsigned long /*amount*/);
244
* This function calloc(3)s buffer, terminating the server if there is not
247
extern _X_EXPORT void *XNFcalloc(unsigned long /*amount*/);
249
* This function realloc(3)s passed buffer, terminating the server if there is
252
extern _X_EXPORT void *XNFrealloc(void * /*ptr*/, unsigned long /*amount*/);
255
* This function strdup(3)s passed string. The only difference from the library
256
* function that it is safe to pass NULL, as NULL will be returned.
227
258
extern _X_EXPORT char *Xstrdup(const char *s);
261
* This function strdup(3)s passed string, terminating the server if there is
262
* not enough memory. If NULL is passed to this function, NULL is returned.
228
264
extern _X_EXPORT char *XNFstrdup(const char *s);
229
extern _X_EXPORT char *Xprintf(const char *fmt, ...);
266
extern _X_EXPORT char *Xprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
230
267
extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va);
231
extern _X_EXPORT char *XNFprintf(const char *fmt, ...);
268
extern _X_EXPORT char *XNFprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
232
269
extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va);
234
271
typedef void (*OsSigHandlerPtr)(int /* sig */);
381
418
extern _X_EXPORT int RemoveAuthorization (
382
419
unsigned short name_length,
384
421
unsigned short data_length,
387
424
extern _X_EXPORT int AddAuthorization(
388
425
unsigned int /*name_length*/,
426
const char * /*name*/,
390
427
unsigned int /*data_length*/,
391
428
char * /*data*/);
393
430
#ifdef XCSECURITY
394
431
extern _X_EXPORT XID GenerateAuthorization(
395
432
unsigned int /* name_length */,
433
const char * /* name */,
397
434
unsigned int /* data_length */,
435
const char * /* data */,
399
436
unsigned int * /* data_length_return */,
400
437
char ** /* data_return */);
488
525
X_UNKNOWN = -1 /* unknown -- this must always be last */
491
/* XXX Need to check which GCC versions have the format(printf) attribute. */
492
#if defined(__GNUC__) && (__GNUC__ > 2)
493
#define _printf_attribute(a,b) __attribute((format(__printf__,a,b)))
495
#define _printf_attribute(a,b) /**/
498
528
extern _X_EXPORT const char *LogInit(const char *fname, const char *backup);
499
529
extern _X_EXPORT void LogClose(void);
500
530
extern _X_EXPORT Bool LogSetParameter(LogParameter param, int value);
501
531
extern _X_EXPORT void LogVWrite(int verb, const char *f, va_list args);
502
extern _X_EXPORT void LogWrite(int verb, const char *f, ...) _printf_attribute(2,3);
532
extern _X_EXPORT void LogWrite(int verb, const char *f, ...) _X_ATTRIBUTE_PRINTF(2,3);
503
533
extern _X_EXPORT void LogVMessageVerb(MessageType type, int verb, const char *format,
505
535
extern _X_EXPORT void LogMessageVerb(MessageType type, int verb, const char *format,
506
...) _printf_attribute(3,4);
536
...) _X_ATTRIBUTE_PRINTF(3,4);
507
537
extern _X_EXPORT void LogMessage(MessageType type, const char *format, ...)
508
_printf_attribute(2,3);
538
_X_ATTRIBUTE_PRINTF(2,3);
509
539
extern _X_EXPORT void FreeAuditTimer(void);
510
extern _X_EXPORT void AuditF(const char *f, ...) _printf_attribute(1,2);
540
extern _X_EXPORT void AuditF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
511
541
extern _X_EXPORT void VAuditF(const char *f, va_list args);
512
extern _X_EXPORT void FatalError(const char *f, ...) _printf_attribute(1,2)
513
#if defined(__GNUC__) && (__GNUC__ > 2)
514
__attribute((noreturn))
542
extern _X_EXPORT void FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_NORETURN;
519
545
#define DebugF ErrorF
524
550
extern _X_EXPORT void VErrorF(const char *f, va_list args);
525
extern _X_EXPORT void ErrorF(const char *f, ...) _printf_attribute(1,2);
551
extern _X_EXPORT void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
526
552
extern _X_EXPORT void Error(char *str);
527
553
extern _X_EXPORT void LogPrintMarkers(void);