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.12 2015/12/11 04:26:01 mmcc Exp $
36 */
37
38/*
39 * Pick up target dependent definitions
40 */
41#include <sys/types.h>
42#include <sys/time.h>
43#include <errno.h>
44#include <stdio.h>
45
46#define clocktime() (clock_valid ? clock_valid : time(&clock_valid))
47extern time_t clock_valid;	/* Clock needs recalculating */
48
49extern char *__progname;
50extern char hostname[];		/* "kiska" */
51extern pid_t mypid;		/* Current process id */
52
53extern int syslogging;		/* Really using syslog */
54extern FILE *logfp;		/* Log file */
55extern int xlog_level;		/* Logging level */
56extern int xlog_level_init;
57
58extern int orig_umask;		/* umask() on startup */
59
60#define	XLOG_FATAL	0x0001
61#define	XLOG_ERROR	0x0002
62#define	XLOG_USER	0x0004
63#define	XLOG_WARNING	0x0008
64#define	XLOG_INFO	0x0010
65#define	XLOG_DEBUG	0x0020
66#define	XLOG_MAP	0x0040
67#define	XLOG_STATS	0x0080
68
69#define XLOG_DEFSTR	"all,nomap,nostats"		/* Default log options */
70#define XLOG_ALL	(XLOG_FATAL|XLOG_ERROR|XLOG_USER|XLOG_WARNING|XLOG_INFO|XLOG_MAP|XLOG_STATS)
71
72#ifdef DEBUG
73#define	D_ALL	(~0)
74
75#define Debug(x) if (!(debug_flags & (x))) ; else
76#define dlog Debug(D_FULL) dplog
77#endif /* DEBUG */
78
79/*
80 * Option tables
81 */
82struct opt_tab {
83	char *opt;
84	int flag;
85};
86
87extern struct opt_tab xlog_opt[];
88
89extern int cmdoption(char *, struct opt_tab *, int *);
90extern void going_down(int);
91#ifdef DEBUG
92#define dplog(fmt, args...) plog(XLOG_DEBUG, fmt, ## args)
93#endif /* DEBUG */
94extern void plog(int, const char *, ...)
95    __attribute__((__format__ (syslog, 2, 3)));
96extern void show_opts(int ch, struct opt_tab *);
97__dead void xmallocfailure(void);
98extern void *xmalloc(size_t);
99extern void *xreallocarray(void *, size_t, size_t);
100