xref: /openbsd-src/usr.sbin/amd/include/config.h (revision b2ea75c1b17e1a9a339660e7ed45cd24946b230e)
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. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *	This product includes software developed by the University of
21  *	California, Berkeley and its contributors.
22  * 4. Neither the name of the University nor the names of its contributors
23  *    may be used to endorse or promote products derived from this software
24  *    without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36  * SUCH DAMAGE.
37  *
38  *	from: @(#)config.h	8.1 (Berkeley) 6/6/93
39  *	$Id: config.h,v 1.1.1.1 1995/10/18 08:47:21 deraadt Exp $
40  */
41 
42 /*
43  * Get this in now so that OS_HDR can use it
44  */
45 #ifdef __STDC__
46 #define	P(x) x
47 #define	P_void void
48 #define	Const const
49 #else
50 #define P(x) ()
51 #define P_void /* as nothing */
52 #define Const /* as nothing */
53 #endif /* __STDC__ */
54 
55 #ifdef __GNUC__
56 #define INLINE /* __inline */
57 #else
58 #define	INLINE
59 #endif /* __GNUC__ */
60 
61 /*
62  * Pick up target dependent definitions
63  */
64 #include "os-defaults.h"
65 #include OS_HDR
66 
67 #ifdef VOIDP
68 typedef void *voidp;
69 #else
70 typedef char *voidp;
71 #endif /* VOIDP */
72 
73 #include <stdio.h>
74 #include <sys/types.h>
75 #include <sys/errno.h>
76 extern int errno;
77 #include <sys/time.h>
78 
79 #define clocktime() (clock_valid ? clock_valid : time(&clock_valid))
80 extern time_t time P((time_t *));
81 extern time_t clock_valid;	/* Clock needs recalculating */
82 
83 extern char *progname;		/* "amd"|"mmd" */
84 extern char hostname[];		/* "kiska" */
85 extern int mypid;		/* Current process id */
86 
87 #ifdef HAS_SYSLOG
88 extern int syslogging;		/* Really using syslog */
89 #endif /* HAS_SYSLOG */
90 extern FILE *logfp;		/* Log file */
91 extern int xlog_level;		/* Logging level */
92 extern int xlog_level_init;
93 
94 extern int orig_umask;		/* umask() on startup */
95 
96 #define	XLOG_FATAL	0x0001
97 #define	XLOG_ERROR	0x0002
98 #define	XLOG_USER	0x0004
99 #define	XLOG_WARNING	0x0008
100 #define	XLOG_INFO	0x0010
101 #define	XLOG_DEBUG	0x0020
102 #define	XLOG_MAP	0x0040
103 #define	XLOG_STATS	0x0080
104 
105 #define XLOG_DEFSTR	"all,nomap,nostats"		/* Default log options */
106 #define XLOG_ALL	(XLOG_FATAL|XLOG_ERROR|XLOG_USER|XLOG_WARNING|XLOG_INFO|XLOG_MAP|XLOG_STATS)
107 
108 #ifdef DEBUG
109 #define	D_ALL	(~0)
110 
111 #ifdef DEBUG_MEM
112 #define free(x) xfree(__FILE__,__LINE__,x)
113 #endif /* DEBUG_MEM */
114 
115 #define Debug(x) if (!(debug_flags & (x))) ; else
116 #define dlog Debug(D_FULL) dplog
117 #endif /* DEBUG */
118 
119 /*
120  * Option tables
121  */
122 struct opt_tab {
123 	char *opt;
124 	int flag;
125 };
126 
127 extern struct opt_tab xlog_opt[];
128 
129 extern int cmdoption P((char*, struct opt_tab*, int*));
130 extern void going_down P((int));
131 #ifdef DEBUG
132 extern void dplog ();
133 /*extern void dplog P((char*, ...));*/
134 #endif /* DEBUG */
135 extern void plog ();
136 /*extern void plog P((int, char*, ...));*/
137 extern void show_opts P((int ch, struct opt_tab*));
138 extern char* strchr P((const char*, int)); /* C */
139 extern voidp xmalloc P((int));
140 extern voidp xrealloc P((voidp, int));
141