1 /* 2 * Copyright (c) 1990 Jan-Simon Pendry 3 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine 4 * Copyright (c) 1990, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Jan-Simon Pendry at Imperial College, London. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. Neither the name of the University nor the names of its contributors 19 * may be used to endorse or promote products derived from this software 20 * without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * from: @(#)config.h 8.1 (Berkeley) 6/6/93 35 * $Id: config.h,v 1.5 2003/06/02 23:36:52 millert Exp $ 36 */ 37 38 #ifdef __GNUC__ 39 #define INLINE /* __inline */ 40 #else 41 #define INLINE 42 #endif /* __GNUC__ */ 43 44 /* 45 * Pick up target dependent definitions 46 */ 47 #include "os-defaults.h" 48 #include OS_HDR 49 50 #include <stdio.h> 51 #include <sys/types.h> 52 #include <sys/errno.h> 53 extern int errno; 54 #include <sys/time.h> 55 56 #define clocktime() (clock_valid ? clock_valid : time(&clock_valid)) 57 extern time_t clock_valid; /* Clock needs recalculating */ 58 59 extern char *__progname; 60 extern char hostname[]; /* "kiska" */ 61 extern pid_t mypid; /* Current process id */ 62 63 #ifdef HAS_SYSLOG 64 extern int syslogging; /* Really using syslog */ 65 #endif /* HAS_SYSLOG */ 66 extern FILE *logfp; /* Log file */ 67 extern int xlog_level; /* Logging level */ 68 extern int xlog_level_init; 69 70 extern int orig_umask; /* umask() on startup */ 71 72 #define XLOG_FATAL 0x0001 73 #define XLOG_ERROR 0x0002 74 #define XLOG_USER 0x0004 75 #define XLOG_WARNING 0x0008 76 #define XLOG_INFO 0x0010 77 #define XLOG_DEBUG 0x0020 78 #define XLOG_MAP 0x0040 79 #define XLOG_STATS 0x0080 80 81 #define XLOG_DEFSTR "all,nomap,nostats" /* Default log options */ 82 #define XLOG_ALL (XLOG_FATAL|XLOG_ERROR|XLOG_USER|XLOG_WARNING|XLOG_INFO|XLOG_MAP|XLOG_STATS) 83 84 #ifdef DEBUG 85 #define D_ALL (~0) 86 87 #ifdef DEBUG_MEM 88 #define free(x) xfree(__FILE__,__LINE__,x) 89 #endif /* DEBUG_MEM */ 90 91 #define Debug(x) if (!(debug_flags & (x))) ; else 92 #define dlog Debug(D_FULL) dplog 93 #endif /* DEBUG */ 94 95 /* 96 * Option tables 97 */ 98 struct opt_tab { 99 char *opt; 100 int flag; 101 }; 102 103 extern struct opt_tab xlog_opt[]; 104 105 extern int cmdoption(char *, struct opt_tab *, int *); 106 extern void going_down(int); 107 #ifdef DEBUG 108 #define dplog(fmt, args...) plog(XLOG_DEBUG, fmt, ## args) 109 #endif /* DEBUG */ 110 extern void plog(int, char *, ...); 111 extern void show_opts(int ch, struct opt_tab *); 112 extern void *xmalloc(int); 113 extern void *xrealloc(void *, int); 114