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.7 2005/12/21 01:40:24 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 <errno.h> 51 #include <stdio.h> 52 #include <sys/types.h> 53 #include <sys/time.h> 54 55 #define clocktime() (clock_valid ? clock_valid : time(&clock_valid)) 56 extern time_t clock_valid; /* Clock needs recalculating */ 57 58 extern char *__progname; 59 extern char hostname[]; /* "kiska" */ 60 extern pid_t mypid; /* Current process id */ 61 62 #ifdef HAS_SYSLOG 63 extern int syslogging; /* Really using syslog */ 64 #endif /* HAS_SYSLOG */ 65 extern FILE *logfp; /* Log file */ 66 extern int xlog_level; /* Logging level */ 67 extern int xlog_level_init; 68 69 extern int orig_umask; /* umask() on startup */ 70 71 #define XLOG_FATAL 0x0001 72 #define XLOG_ERROR 0x0002 73 #define XLOG_USER 0x0004 74 #define XLOG_WARNING 0x0008 75 #define XLOG_INFO 0x0010 76 #define XLOG_DEBUG 0x0020 77 #define XLOG_MAP 0x0040 78 #define XLOG_STATS 0x0080 79 80 #define XLOG_DEFSTR "all,nomap,nostats" /* Default log options */ 81 #define XLOG_ALL (XLOG_FATAL|XLOG_ERROR|XLOG_USER|XLOG_WARNING|XLOG_INFO|XLOG_MAP|XLOG_STATS) 82 83 #ifdef DEBUG 84 #define D_ALL (~0) 85 86 #ifdef DEBUG_MEM 87 #define free(x) xfree(__FILE__,__LINE__,x) 88 #endif /* DEBUG_MEM */ 89 90 #define Debug(x) if (!(debug_flags & (x))) ; else 91 #define dlog Debug(D_FULL) dplog 92 #endif /* DEBUG */ 93 94 /* 95 * Option tables 96 */ 97 struct opt_tab { 98 char *opt; 99 int flag; 100 }; 101 102 extern struct opt_tab xlog_opt[]; 103 104 extern int cmdoption(char *, struct opt_tab *, int *); 105 extern void going_down(int); 106 #ifdef DEBUG 107 #define dplog(fmt, args...) plog(XLOG_DEBUG, fmt, ## args) 108 #endif /* DEBUG */ 109 extern void plog(int, char *, ...); 110 extern void show_opts(int ch, struct opt_tab *); 111 extern void *xmalloc(int); 112 extern void *xrealloc(void *, int); 113