Wed Oct 14 15:58:09 2015 UTC ()
We really mean __sysloglike here...


(christos)
diff -r1.10 -r1.11 src/external/bsd/dhcpcd/dist/common.h

cvs diff -r1.10 -r1.11 src/external/bsd/dhcpcd/dist/Attic/common.h (expand / switch to unified diff)

--- src/external/bsd/dhcpcd/dist/Attic/common.h 2015/07/09 10:15:34 1.10
+++ src/external/bsd/dhcpcd/dist/Attic/common.h 2015/10/14 15:58:08 1.11
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: common.h,v 1.10 2015/07/09 10:15:34 roy Exp $ */ 1/* $NetBSD: common.h,v 1.11 2015/10/14 15:58:08 christos Exp $ */
2 2
3/* 3/*
4 * dhcpcd - DHCP client daemon 4 * dhcpcd - DHCP client daemon
5 * Copyright (c) 2006-2015 Roy Marples <roy@marples.name> 5 * Copyright (c) 2006-2015 Roy Marples <roy@marples.name>
6 * All rights reserved 6 * All rights reserved
7 7
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -111,41 +111,44 @@ @@ -111,41 +111,44 @@
111#define TIMEVAL_TO_TIMESPEC(tv, ts) do { \ 111#define TIMEVAL_TO_TIMESPEC(tv, ts) do { \
112 (ts)->tv_sec = (tv)->tv_sec; \ 112 (ts)->tv_sec = (tv)->tv_sec; \
113 (ts)->tv_nsec = (tv)->tv_usec * USEC_PER_NSEC; \ 113 (ts)->tv_nsec = (tv)->tv_usec * USEC_PER_NSEC; \
114} while (0 /* CONSTCOND */) 114} while (0 /* CONSTCOND */)
115#endif 115#endif
116 116
117#if __GNUC__ > 2 || defined(__INTEL_COMPILER) 117#if __GNUC__ > 2 || defined(__INTEL_COMPILER)
118# ifndef __dead 118# ifndef __dead
119# define __dead __attribute__((__noreturn__)) 119# define __dead __attribute__((__noreturn__))
120# endif 120# endif
121# ifndef __packed 121# ifndef __packed
122# define __packed __attribute__((__packed__)) 122# define __packed __attribute__((__packed__))
123# endif 123# endif
124# ifndef __printflike 124# ifndef __syslog_attribute__
125# define __printflike(a, b) __attribute__((format(printf, a, b))) 125# define __syslog__ __printf__
 126# endif
 127# ifndef __sysloglike
 128# define __sysloglike(a, b) __attribute__((__format__(__syslog__, a, b)))
126# endif 129# endif
127# ifndef __unused 130# ifndef __unused
128# define __unused __attribute__((__unused__)) 131# define __unused __attribute__((__unused__))
129# endif 132# endif
130#else 133#else
131# ifndef __dead 134# ifndef __dead
132# define __dead 135# define __dead
133# endif 136# endif
134# ifndef __packed 137# ifndef __packed
135# define __packed 138# define __packed
136# endif 139# endif
137# ifndef __printflike 140# ifndef __sysloglike
138# define __printflike 141# define __sysloglike
139# endif 142# endif
140# ifndef __unused 143# ifndef __unused
141# define __unused 144# define __unused
142# endif 145# endif
143#endif 146#endif
144 147
145#ifndef __arraycount 148#ifndef __arraycount
146#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0])) 149#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0]))
147#endif 150#endif
148 151
149/* We don't really need this as our supported systems define __restrict 152/* We don't really need this as our supported systems define __restrict
150 * automatically for us, but it is here for completeness. */ 153 * automatically for us, but it is here for completeness. */
151#ifndef __restrict 154#ifndef __restrict
@@ -164,27 +167,27 @@ extern int clock_monotonic; @@ -164,27 +167,27 @@ extern int clock_monotonic;
164int get_monotonic(struct timespec *); 167int get_monotonic(struct timespec *);
165 168
166/* We could shave a few k off the binary size by just using the 169/* We could shave a few k off the binary size by just using the
167 * syslog(3) interface. 170 * syslog(3) interface.
168 * However, this results in a ugly output on the command line 171 * However, this results in a ugly output on the command line
169 * and relies on syslogd(8) starting before dhcpcd which is not 172 * and relies on syslogd(8) starting before dhcpcd which is not
170 * always the case. */ 173 * always the case. */
171#ifndef USE_LOGFILE 174#ifndef USE_LOGFILE
172# define USE_LOGFILE 1 175# define USE_LOGFILE 1
173#endif 176#endif
174#if USE_LOGFILE 177#if USE_LOGFILE
175void logger_open(struct dhcpcd_ctx *); 178void logger_open(struct dhcpcd_ctx *);
176#define logger_mask(ctx, lvl) setlogmask((lvl)) 179#define logger_mask(ctx, lvl) setlogmask((lvl))
177__printflike(3, 4) void logger(struct dhcpcd_ctx *, int, const char *, ...); 180__sysloglike(3, 4) void logger(struct dhcpcd_ctx *, int, const char *, ...);
178void logger_close(struct dhcpcd_ctx *); 181void logger_close(struct dhcpcd_ctx *);
179#else 182#else
180#define logger_open(ctx) openlog(PACKAGE, LOG_PERROR | LOG_PID, LOG_DAEMON) 183#define logger_open(ctx) openlog(PACKAGE, LOG_PERROR | LOG_PID, LOG_DAEMON)
181#define logger_mask(ctx, lvl) setlogmask((lvl)) 184#define logger_mask(ctx, lvl) setlogmask((lvl))
182#define logger(ctx, pri, fmt, ...) \ 185#define logger(ctx, pri, fmt, ...) \
183 do { \ 186 do { \
184 UNUSED((ctx)); \ 187 UNUSED((ctx)); \
185 syslog((pri), (fmt), ##__VA_ARGS__); \ 188 syslog((pri), (fmt), ##__VA_ARGS__); \
186 } while (0 /*CONSTCOND */) 189 } while (0 /*CONSTCOND */)
187#define logger_close(ctx) closelog() 190#define logger_close(ctx) closelog()
188#endif 191#endif
189 192
190ssize_t setvar(struct dhcpcd_ctx *, 193ssize_t setvar(struct dhcpcd_ctx *,