Thu Oct 15 06:15:22 2015 UTC ()
Include <sys/cdefs.h>, <sys/featuretest.h>, and <sys/ansi.h>
unconditionally, not only #ifndef _KERNEL. The kernel declarations
require cdefs.h and standard practice is to include cdefs.h where it's
used; they also require sys/ansi.h; and while they don't require
featuretest.h it's also harmless... and includes should be at the top
anyhow.

PR 46557 from Richard Hansen.


(dholland)
diff -r1.37 -r1.38 src/sys/sys/syslog.h

cvs diff -r1.37 -r1.38 src/sys/sys/syslog.h (expand / switch to unified diff)

--- src/sys/sys/syslog.h 2015/10/14 15:52:40 1.37
+++ src/sys/sys/syslog.h 2015/10/15 06:15:22 1.38
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: syslog.h,v 1.37 2015/10/14 15:52:40 christos Exp $ */ 1/* $NetBSD: syslog.h,v 1.38 2015/10/15 06:15:22 dholland Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1982, 1986, 1988, 1993 4 * Copyright (c) 1982, 1986, 1988, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -24,26 +24,30 @@ @@ -24,26 +24,30 @@
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 * 30 *
31 * @(#)syslog.h 8.1 (Berkeley) 6/2/93 31 * @(#)syslog.h 8.1 (Berkeley) 6/2/93
32 */ 32 */
33 33
34#ifndef _SYS_SYSLOG_H_ 34#ifndef _SYS_SYSLOG_H_
35#define _SYS_SYSLOG_H_ 35#define _SYS_SYSLOG_H_
36 36
 37#include <sys/cdefs.h>
 38#include <sys/featuretest.h>
 39#include <sys/ansi.h>
 40
37#define _PATH_LOG "/var/run/log" 41#define _PATH_LOG "/var/run/log"
38 42
39/* 43/*
40 * priorities/facilities are encoded into a single 32-bit quantity, where the 44 * priorities/facilities are encoded into a single 32-bit quantity, where the
41 * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility 45 * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
42 * (0-big number). Both the priorities and the facilities map roughly 46 * (0-big number). Both the priorities and the facilities map roughly
43 * one-to-one to strings in the syslogd(8) source code. This mapping is 47 * one-to-one to strings in the syslogd(8) source code. This mapping is
44 * included in this file. 48 * included in this file.
45 * 49 *
46 * priorities (these are ordered) 50 * priorities (these are ordered)
47 */ 51 */
48#define LOG_EMERG 0 /* system is unusable */ 52#define LOG_EMERG 0 /* system is unusable */
49#define LOG_ALERT 1 /* action must be taken immediately */ 53#define LOG_ALERT 1 /* action must be taken immediately */
@@ -183,30 +187,26 @@ struct syslog_data { @@ -183,30 +187,26 @@ struct syslog_data {
183 187
184#define SYSLOG_DATA_INIT { \ 188#define SYSLOG_DATA_INIT { \
185 .log_version = 1, \ 189 .log_version = 1, \
186 .log_file = -1, \ 190 .log_file = -1, \
187 .log_connected = 0, \ 191 .log_connected = 0, \
188 .log_opened = 0, \ 192 .log_opened = 0, \
189 .log_stat = 0, \ 193 .log_stat = 0, \
190 .log_tag = 0, \ 194 .log_tag = 0, \
191 .log_hostname = { '\0' }, \ 195 .log_hostname = { '\0' }, \
192 .log_fac = LOG_USER, \ 196 .log_fac = LOG_USER, \
193 .log_mask = 0xff, \ 197 .log_mask = 0xff, \
194} 198}
195 199
196#include <sys/cdefs.h> 
197#include <sys/featuretest.h> 
198#include <sys/ansi.h> 
199 
200__BEGIN_DECLS 200__BEGIN_DECLS
201void closelog(void); 201void closelog(void);
202void openlog(const char *, int, int); 202void openlog(const char *, int, int);
203int setlogmask(int); 203int setlogmask(int);
204void syslog(int, const char *, ...) __sysloglike(2, 3); 204void syslog(int, const char *, ...) __sysloglike(2, 3);
205#if defined(_NETBSD_SOURCE) 205#if defined(_NETBSD_SOURCE)
206void vsyslog(int, const char *, __va_list) __sysloglike(2, 0); 206void vsyslog(int, const char *, __va_list) __sysloglike(2, 0);
207#ifndef __LIBC12_SOURCE__ 207#ifndef __LIBC12_SOURCE__
208void closelog_r(struct syslog_data *) __RENAME(__closelog_r60); 208void closelog_r(struct syslog_data *) __RENAME(__closelog_r60);
209void openlog_r(const char *, int, int, struct syslog_data *) 209void openlog_r(const char *, int, int, struct syslog_data *)
210 __RENAME(__openlog_r60); 210 __RENAME(__openlog_r60);
211int setlogmask_r(int, struct syslog_data *) __RENAME(__setlogmask_r60); 211int setlogmask_r(int, struct syslog_data *) __RENAME(__setlogmask_r60);
212void syslog_r(int, struct syslog_data *, const char *, ...) 212void syslog_r(int, struct syslog_data *, const char *, ...)