1*43a90889SApple OSS Distributions /* 2*43a90889SApple OSS Distributions * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. 3*43a90889SApple OSS Distributions * 4*43a90889SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5*43a90889SApple OSS Distributions * 6*43a90889SApple OSS Distributions * This file contains Original Code and/or Modifications of Original Code 7*43a90889SApple OSS Distributions * as defined in and that are subject to the Apple Public Source License 8*43a90889SApple OSS Distributions * Version 2.0 (the 'License'). You may not use this file except in 9*43a90889SApple OSS Distributions * compliance with the License. The rights granted to you under the License 10*43a90889SApple OSS Distributions * may not be used to create, or enable the creation or redistribution of, 11*43a90889SApple OSS Distributions * unlawful or unlicensed copies of an Apple operating system, or to 12*43a90889SApple OSS Distributions * circumvent, violate, or enable the circumvention or violation of, any 13*43a90889SApple OSS Distributions * terms of an Apple operating system software license agreement. 14*43a90889SApple OSS Distributions * 15*43a90889SApple OSS Distributions * Please obtain a copy of the License at 16*43a90889SApple OSS Distributions * http://www.opensource.apple.com/apsl/ and read it before using this file. 17*43a90889SApple OSS Distributions * 18*43a90889SApple OSS Distributions * The Original Code and all software distributed under the License are 19*43a90889SApple OSS Distributions * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20*43a90889SApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21*43a90889SApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22*43a90889SApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23*43a90889SApple OSS Distributions * Please see the License for the specific language governing rights and 24*43a90889SApple OSS Distributions * limitations under the License. 25*43a90889SApple OSS Distributions * 26*43a90889SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27*43a90889SApple OSS Distributions */ 28*43a90889SApple OSS Distributions /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ 29*43a90889SApple OSS Distributions /*- 30*43a90889SApple OSS Distributions * Copyright (c) 1982, 1986, 1988, 1993 31*43a90889SApple OSS Distributions * The Regents of the University of California. All rights reserved. 32*43a90889SApple OSS Distributions * 33*43a90889SApple OSS Distributions * Redistribution and use in source and binary forms, with or without 34*43a90889SApple OSS Distributions * modification, are permitted provided that the following conditions 35*43a90889SApple OSS Distributions * are met: 36*43a90889SApple OSS Distributions * 1. Redistributions of source code must retain the above copyright 37*43a90889SApple OSS Distributions * notice, this list of conditions and the following disclaimer. 38*43a90889SApple OSS Distributions * 2. Redistributions in binary form must reproduce the above copyright 39*43a90889SApple OSS Distributions * notice, this list of conditions and the following disclaimer in the 40*43a90889SApple OSS Distributions * documentation and/or other materials provided with the distribution. 41*43a90889SApple OSS Distributions * 4. Neither the name of the University nor the names of its contributors 42*43a90889SApple OSS Distributions * may be used to endorse or promote products derived from this software 43*43a90889SApple OSS Distributions * without specific prior written permission. 44*43a90889SApple OSS Distributions * 45*43a90889SApple OSS Distributions * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 46*43a90889SApple OSS Distributions * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 47*43a90889SApple OSS Distributions * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 48*43a90889SApple OSS Distributions * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 49*43a90889SApple OSS Distributions * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 50*43a90889SApple OSS Distributions * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 51*43a90889SApple OSS Distributions * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 52*43a90889SApple OSS Distributions * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 53*43a90889SApple OSS Distributions * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 54*43a90889SApple OSS Distributions * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 55*43a90889SApple OSS Distributions * SUCH DAMAGE. 56*43a90889SApple OSS Distributions * 57*43a90889SApple OSS Distributions * @(#)syslog.h 8.1 (Berkeley) 6/2/93 58*43a90889SApple OSS Distributions * $FreeBSD: src/sys/sys/syslog.h,v 1.27.2.1.4.1 2010/06/14 02:09:06 kensmith Exp $ 59*43a90889SApple OSS Distributions */ 60*43a90889SApple OSS Distributions 61*43a90889SApple OSS Distributions #ifndef _SYS_SYSLOG_H_ 62*43a90889SApple OSS Distributions #define _SYS_SYSLOG_H_ 63*43a90889SApple OSS Distributions 64*43a90889SApple OSS Distributions #include <sys/appleapiopts.h> 65*43a90889SApple OSS Distributions #include <sys/cdefs.h> 66*43a90889SApple OSS Distributions 67*43a90889SApple OSS Distributions #define _PATH_LOG "/var/run/syslog" 68*43a90889SApple OSS Distributions 69*43a90889SApple OSS Distributions /* 70*43a90889SApple OSS Distributions * priorities/facilities are encoded into a single 32-bit quantity, where the 71*43a90889SApple OSS Distributions * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility 72*43a90889SApple OSS Distributions * (0-big number). Both the priorities and the facilities map roughly 73*43a90889SApple OSS Distributions * one-to-one to strings in the syslogd(8) source code. This mapping is 74*43a90889SApple OSS Distributions * included in this file. 75*43a90889SApple OSS Distributions * 76*43a90889SApple OSS Distributions * priorities (these are ordered) 77*43a90889SApple OSS Distributions */ 78*43a90889SApple OSS Distributions #define LOG_EMERG 0 /* system is unusable */ 79*43a90889SApple OSS Distributions #define LOG_ALERT 1 /* action must be taken immediately */ 80*43a90889SApple OSS Distributions #define LOG_CRIT 2 /* critical conditions */ 81*43a90889SApple OSS Distributions #define LOG_ERR 3 /* error conditions */ 82*43a90889SApple OSS Distributions #define LOG_WARNING 4 /* warning conditions */ 83*43a90889SApple OSS Distributions #define LOG_NOTICE 5 /* normal but significant condition */ 84*43a90889SApple OSS Distributions #define LOG_INFO 6 /* informational */ 85*43a90889SApple OSS Distributions #define LOG_DEBUG 7 /* debug-level messages */ 86*43a90889SApple OSS Distributions 87*43a90889SApple OSS Distributions #define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ 88*43a90889SApple OSS Distributions /* extract priority */ 89*43a90889SApple OSS Distributions #define LOG_PRI(p) ((p) & LOG_PRIMASK) 90*43a90889SApple OSS Distributions #define LOG_MAKEPRI(fac, pri) ((fac) | (pri)) 91*43a90889SApple OSS Distributions 92*43a90889SApple OSS Distributions #ifdef SYSLOG_NAMES 93*43a90889SApple OSS Distributions #define INTERNAL_NOPRI 0x10 /* the "no priority" priority */ 94*43a90889SApple OSS Distributions /* mark "facility" */ 95*43a90889SApple OSS Distributions #define INTERNAL_MARK LOG_MAKEPRI((LOG_NFACILITIES<<3), 0) 96*43a90889SApple OSS Distributions typedef struct _code { 97*43a90889SApple OSS Distributions const char *c_name; 98*43a90889SApple OSS Distributions int c_val; 99*43a90889SApple OSS Distributions } CODE; 100*43a90889SApple OSS Distributions 101*43a90889SApple OSS Distributions CODE prioritynames[] = { 102*43a90889SApple OSS Distributions { "alert", LOG_ALERT, }, 103*43a90889SApple OSS Distributions { "crit", LOG_CRIT, }, 104*43a90889SApple OSS Distributions { "debug", LOG_DEBUG, }, 105*43a90889SApple OSS Distributions { "emerg", LOG_EMERG, }, 106*43a90889SApple OSS Distributions { "err", LOG_ERR, }, 107*43a90889SApple OSS Distributions { "error", LOG_ERR, }, /* DEPRECATED */ 108*43a90889SApple OSS Distributions { "info", LOG_INFO, }, 109*43a90889SApple OSS Distributions { "none", INTERNAL_NOPRI, }, /* INTERNAL */ 110*43a90889SApple OSS Distributions { "notice", LOG_NOTICE, }, 111*43a90889SApple OSS Distributions { "panic", LOG_EMERG, }, /* DEPRECATED */ 112*43a90889SApple OSS Distributions { "warn", LOG_WARNING, }, /* DEPRECATED */ 113*43a90889SApple OSS Distributions { "warning", LOG_WARNING, }, 114*43a90889SApple OSS Distributions { NULL, -1, } 115*43a90889SApple OSS Distributions }; 116*43a90889SApple OSS Distributions #endif 117*43a90889SApple OSS Distributions 118*43a90889SApple OSS Distributions /* facility codes */ 119*43a90889SApple OSS Distributions #define LOG_KERN (0<<3) /* kernel messages */ 120*43a90889SApple OSS Distributions #define LOG_USER (1<<3) /* random user-level messages */ 121*43a90889SApple OSS Distributions #define LOG_MAIL (2<<3) /* mail system */ 122*43a90889SApple OSS Distributions #define LOG_DAEMON (3<<3) /* system daemons */ 123*43a90889SApple OSS Distributions #define LOG_AUTH (4<<3) /* authorization messages */ 124*43a90889SApple OSS Distributions #define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ 125*43a90889SApple OSS Distributions #define LOG_LPR (6<<3) /* line printer subsystem */ 126*43a90889SApple OSS Distributions #define LOG_NEWS (7<<3) /* network news subsystem */ 127*43a90889SApple OSS Distributions #define LOG_UUCP (8<<3) /* UUCP subsystem */ 128*43a90889SApple OSS Distributions #define LOG_CRON (9<<3) /* clock daemon */ 129*43a90889SApple OSS Distributions #define LOG_AUTHPRIV (10<<3) /* authorization messages (private) */ 130*43a90889SApple OSS Distributions /* Facility #10 clashes in DEC UNIX, where */ 131*43a90889SApple OSS Distributions /* it's defined as LOG_MEGASAFE for AdvFS */ 132*43a90889SApple OSS Distributions /* event logging. */ 133*43a90889SApple OSS Distributions #define LOG_FTP (11<<3) /* ftp daemon */ 134*43a90889SApple OSS Distributions //#define LOG_NTP (12<<3) /* NTP subsystem */ 135*43a90889SApple OSS Distributions //#define LOG_SECURITY (13<<3) /* security subsystems (firewalling, etc.) */ 136*43a90889SApple OSS Distributions //#define LOG_CONSOLE (14<<3) /* /dev/console output */ 137*43a90889SApple OSS Distributions #define LOG_NETINFO (12<<3) /* NetInfo */ 138*43a90889SApple OSS Distributions #define LOG_REMOTEAUTH (13<<3) /* remote authentication/authorization */ 139*43a90889SApple OSS Distributions #define LOG_INSTALL (14<<3) /* installer subsystem */ 140*43a90889SApple OSS Distributions #define LOG_RAS (15<<3) /* Remote Access Service (VPN / PPP) */ 141*43a90889SApple OSS Distributions 142*43a90889SApple OSS Distributions /* other codes through 15 reserved for system use */ 143*43a90889SApple OSS Distributions #define LOG_LOCAL0 (16<<3) /* reserved for local use */ 144*43a90889SApple OSS Distributions #define LOG_LOCAL1 (17<<3) /* reserved for local use */ 145*43a90889SApple OSS Distributions #define LOG_LOCAL2 (18<<3) /* reserved for local use */ 146*43a90889SApple OSS Distributions #define LOG_LOCAL3 (19<<3) /* reserved for local use */ 147*43a90889SApple OSS Distributions #define LOG_LOCAL4 (20<<3) /* reserved for local use */ 148*43a90889SApple OSS Distributions #define LOG_LOCAL5 (21<<3) /* reserved for local use */ 149*43a90889SApple OSS Distributions #define LOG_LOCAL6 (22<<3) /* reserved for local use */ 150*43a90889SApple OSS Distributions #define LOG_LOCAL7 (23<<3) /* reserved for local use */ 151*43a90889SApple OSS Distributions 152*43a90889SApple OSS Distributions #define LOG_LAUNCHD (24<<3) /* launchd - general bootstrap daemon */ 153*43a90889SApple OSS Distributions 154*43a90889SApple OSS Distributions #define LOG_NFACILITIES 25 /* current number of facilities */ 155*43a90889SApple OSS Distributions #define LOG_FACMASK 0x03f8 /* mask to extract facility part */ 156*43a90889SApple OSS Distributions /* facility of pri */ 157*43a90889SApple OSS Distributions #define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) 158*43a90889SApple OSS Distributions 159*43a90889SApple OSS Distributions #ifdef SYSLOG_NAMES 160*43a90889SApple OSS Distributions CODE facilitynames[] = { 161*43a90889SApple OSS Distributions { "auth", LOG_AUTH, }, 162*43a90889SApple OSS Distributions { "authpriv", LOG_AUTHPRIV, }, 163*43a90889SApple OSS Distributions { "cron", LOG_CRON, }, 164*43a90889SApple OSS Distributions { "daemon", LOG_DAEMON, }, 165*43a90889SApple OSS Distributions { "ftp", LOG_FTP, }, 166*43a90889SApple OSS Distributions { "install", LOG_INSTALL }, 167*43a90889SApple OSS Distributions { "kern", LOG_KERN, }, 168*43a90889SApple OSS Distributions { "lpr", LOG_LPR, }, 169*43a90889SApple OSS Distributions { "mail", LOG_MAIL, }, 170*43a90889SApple OSS Distributions { "mark", INTERNAL_MARK, }, /* INTERNAL */ 171*43a90889SApple OSS Distributions { "netinfo", LOG_NETINFO, }, 172*43a90889SApple OSS Distributions { "ras", LOG_RAS }, 173*43a90889SApple OSS Distributions { "remoteauth", LOG_REMOTEAUTH }, 174*43a90889SApple OSS Distributions { "news", LOG_NEWS, }, 175*43a90889SApple OSS Distributions { "security", LOG_AUTH }, /* DEPRECATED */ 176*43a90889SApple OSS Distributions { "syslog", LOG_SYSLOG, }, 177*43a90889SApple OSS Distributions { "user", LOG_USER, }, 178*43a90889SApple OSS Distributions { "uucp", LOG_UUCP, }, 179*43a90889SApple OSS Distributions { "local0", LOG_LOCAL0, }, 180*43a90889SApple OSS Distributions { "local1", LOG_LOCAL1, }, 181*43a90889SApple OSS Distributions { "local2", LOG_LOCAL2, }, 182*43a90889SApple OSS Distributions { "local3", LOG_LOCAL3, }, 183*43a90889SApple OSS Distributions { "local4", LOG_LOCAL4, }, 184*43a90889SApple OSS Distributions { "local5", LOG_LOCAL5, }, 185*43a90889SApple OSS Distributions { "local6", LOG_LOCAL6, }, 186*43a90889SApple OSS Distributions { "local7", LOG_LOCAL7, }, 187*43a90889SApple OSS Distributions { "launchd", LOG_LAUNCHD }, 188*43a90889SApple OSS Distributions { NULL, -1, } 189*43a90889SApple OSS Distributions }; 190*43a90889SApple OSS Distributions #endif 191*43a90889SApple OSS Distributions 192*43a90889SApple OSS Distributions #ifdef KERNEL 193*43a90889SApple OSS Distributions #ifdef __APPLE_API_PRIVATE 194*43a90889SApple OSS Distributions #define LOG_PRINTF -1 /* pseudo-priority to indicate use of printf */ 195*43a90889SApple OSS Distributions #endif /* __APPLE_API_PRIVATE */ 196*43a90889SApple OSS Distributions #endif 197*43a90889SApple OSS Distributions 198*43a90889SApple OSS Distributions /* 199*43a90889SApple OSS Distributions * arguments to setlogmask. 200*43a90889SApple OSS Distributions */ 201*43a90889SApple OSS Distributions #define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ 202*43a90889SApple OSS Distributions #define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ 203*43a90889SApple OSS Distributions 204*43a90889SApple OSS Distributions /* 205*43a90889SApple OSS Distributions * Option flags for openlog. 206*43a90889SApple OSS Distributions * 207*43a90889SApple OSS Distributions * LOG_ODELAY no longer does anything. 208*43a90889SApple OSS Distributions * LOG_NDELAY is the inverse of what it used to be. 209*43a90889SApple OSS Distributions */ 210*43a90889SApple OSS Distributions #define LOG_PID 0x01 /* log the pid with each message */ 211*43a90889SApple OSS Distributions #define LOG_CONS 0x02 /* log on the console if errors in sending */ 212*43a90889SApple OSS Distributions #define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ 213*43a90889SApple OSS Distributions #define LOG_NDELAY 0x08 /* don't delay open */ 214*43a90889SApple OSS Distributions #define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ 215*43a90889SApple OSS Distributions #define LOG_PERROR 0x20 /* log to stderr as well */ 216*43a90889SApple OSS Distributions 217*43a90889SApple OSS Distributions #ifndef KERNEL 218*43a90889SApple OSS Distributions 219*43a90889SApple OSS Distributions /* 220*43a90889SApple OSS Distributions * Don't use va_list in the vsyslog() prototype. Va_list is typedef'd in two 221*43a90889SApple OSS Distributions * places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one 222*43a90889SApple OSS Distributions * of them here we may collide with the utility's includes. It's unreasonable 223*43a90889SApple OSS Distributions * for utilities to have to include one of them to include syslog.h, so we get 224*43a90889SApple OSS Distributions * __va_list from <sys/_types.h> and use it. 225*43a90889SApple OSS Distributions */ 226*43a90889SApple OSS Distributions #include <sys/_types.h> 227*43a90889SApple OSS Distributions 228*43a90889SApple OSS Distributions __BEGIN_DECLS 229*43a90889SApple OSS Distributions void closelog(void); 230*43a90889SApple OSS Distributions void openlog(const char *, int, int); 231*43a90889SApple OSS Distributions int setlogmask(int); 232*43a90889SApple OSS Distributions #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __DARWIN_C_LEVEL >= __DARWIN_C_FULL 233*43a90889SApple OSS Distributions void syslog(int, const char *, ...) __DARWIN_ALIAS_STARTING(__MAC_10_13, __IPHONE_NA, __DARWIN_EXTSN(syslog)) __printflike(2, 3) __not_tail_called; 234*43a90889SApple OSS Distributions #else 235*43a90889SApple OSS Distributions void syslog(int, const char *, ...) __printflike(2, 3) __not_tail_called; 236*43a90889SApple OSS Distributions #endif 237*43a90889SApple OSS Distributions #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL 238*43a90889SApple OSS Distributions void vsyslog(int, const char *, __darwin_va_list) __printflike(2, 0) __not_tail_called; 239*43a90889SApple OSS Distributions #endif 240*43a90889SApple OSS Distributions __END_DECLS 241*43a90889SApple OSS Distributions 242*43a90889SApple OSS Distributions #else /* !KERNEL */ 243*43a90889SApple OSS Distributions #ifdef __APPLE_API_OBSOLETE 244*43a90889SApple OSS Distributions /* 245*43a90889SApple OSS Distributions * bit field descriptions for printf %r and %R formats 246*43a90889SApple OSS Distributions */ 247*43a90889SApple OSS Distributions 248*43a90889SApple OSS Distributions /* 249*43a90889SApple OSS Distributions * printf("%r %R", val, reg_descp); 250*43a90889SApple OSS Distributions * struct reg_desc *reg_descp; 251*43a90889SApple OSS Distributions * 252*43a90889SApple OSS Distributions * the %r and %R formats allow formatted output of bit fields. 253*43a90889SApple OSS Distributions * reg_descp points to an array of reg_desc structures, each element of the 254*43a90889SApple OSS Distributions * array describes a range of bits within val. the array should have a 255*43a90889SApple OSS Distributions * final element with all structure elements 0. 256*43a90889SApple OSS Distributions * %r outputs a string of the format "<bit field descriptions>" 257*43a90889SApple OSS Distributions * %R outputs a string of the format "0x%x<bit field descriptions>" 258*43a90889SApple OSS Distributions * 259*43a90889SApple OSS Distributions * The fields in a reg_desc are: 260*43a90889SApple OSS Distributions * unsigned rd_mask; An appropriate mask to isolate the bit field 261*43a90889SApple OSS Distributions * within a word, and'ed with val 262*43a90889SApple OSS Distributions * 263*43a90889SApple OSS Distributions * int rd_shift; A shift amount to be done to the isolated 264*43a90889SApple OSS Distributions * bit field. done before printing the isolate 265*43a90889SApple OSS Distributions * bit field with rd_format and before searching 266*43a90889SApple OSS Distributions * for symbolic value names in rd_values 267*43a90889SApple OSS Distributions * 268*43a90889SApple OSS Distributions * char *rd_name; If non-null, a bit field name to label any 269*43a90889SApple OSS Distributions * out from rd_format or searching rd_values. 270*43a90889SApple OSS Distributions * if neither rd_format or rd_values is non-null 271*43a90889SApple OSS Distributions * rd_name is printed only if the isolated 272*43a90889SApple OSS Distributions * bit field is non-null. 273*43a90889SApple OSS Distributions * 274*43a90889SApple OSS Distributions * char *rd_format; If non-null, the shifted bit field value 275*43a90889SApple OSS Distributions * is printed using this format. 276*43a90889SApple OSS Distributions * 277*43a90889SApple OSS Distributions * struct reg_values *rd_values; If non-null, a pointer to a table 278*43a90889SApple OSS Distributions * matching numeric values with symbolic names. 279*43a90889SApple OSS Distributions * rd_values are searched and the symbolic 280*43a90889SApple OSS Distributions * value is printed if a match is found, if no 281*43a90889SApple OSS Distributions * match is found "???" is printed. 282*43a90889SApple OSS Distributions * 283*43a90889SApple OSS Distributions * printf("%n %N", val, reg_valuesp); 284*43a90889SApple OSS Distributions * struct reg_values *reg_valuesp; 285*43a90889SApple OSS Distributions * 286*43a90889SApple OSS Distributions * the %n and %N formats allow formatted output of symbolic constants 287*43a90889SApple OSS Distributions * Reg_valuesp is a pointer to an array of struct reg_values which pairs 288*43a90889SApple OSS Distributions * numeric values (rv_value) with symbolic names (rv_name). The array is 289*43a90889SApple OSS Distributions * terminated with a reg_values entry that has a null pointer for the 290*43a90889SApple OSS Distributions * rv_name field. When %n or %N is used rd_values are searched and the 291*43a90889SApple OSS Distributions * symbolic value is printed if a match is found, if no match is found 292*43a90889SApple OSS Distributions * "???" is printed. 293*43a90889SApple OSS Distributions * 294*43a90889SApple OSS Distributions * printf("%C", val); 295*43a90889SApple OSS Distributions * int val; 296*43a90889SApple OSS Distributions * 297*43a90889SApple OSS Distributions * the %C format prints an int as a 4 character string. 298*43a90889SApple OSS Distributions * The most significant byte of the int is printed first, the least 299*43a90889SApple OSS Distributions * significant byte is printed last. 300*43a90889SApple OSS Distributions */ 301*43a90889SApple OSS Distributions 302*43a90889SApple OSS Distributions /* 303*43a90889SApple OSS Distributions * register values 304*43a90889SApple OSS Distributions * map between numeric values and symbolic values 305*43a90889SApple OSS Distributions */ 306*43a90889SApple OSS Distributions struct reg_values { 307*43a90889SApple OSS Distributions unsigned rv_value; 308*43a90889SApple OSS Distributions char *rv_name; 309*43a90889SApple OSS Distributions }; 310*43a90889SApple OSS Distributions 311*43a90889SApple OSS Distributions /* 312*43a90889SApple OSS Distributions * register descriptors are used for formatted prints of register values 313*43a90889SApple OSS Distributions * rd_mask and rd_shift must be defined, other entries may be null 314*43a90889SApple OSS Distributions */ 315*43a90889SApple OSS Distributions struct reg_desc { 316*43a90889SApple OSS Distributions unsigned rd_mask; /* mask to extract field */ 317*43a90889SApple OSS Distributions int rd_shift; /* shift for extracted value, - >>, + << */ 318*43a90889SApple OSS Distributions char *rd_name; /* field name */ 319*43a90889SApple OSS Distributions char *rd_format; /* format to print field */ 320*43a90889SApple OSS Distributions struct reg_values *rd_values; /* symbolic names of values */ 321*43a90889SApple OSS Distributions }; 322*43a90889SApple OSS Distributions 323*43a90889SApple OSS Distributions #endif /* __APPLE_API_OBSOLETE */ 324*43a90889SApple OSS Distributions 325*43a90889SApple OSS Distributions #include <stdarg.h> 326*43a90889SApple OSS Distributions __BEGIN_DECLS 327*43a90889SApple OSS Distributions void log(int, const char *, ...) __printflike(2, 3); 328*43a90889SApple OSS Distributions #ifdef XNU_KERNEL_PRIVATE 329*43a90889SApple OSS Distributions void logtime(time_t); 330*43a90889SApple OSS Distributions #endif /* XNU_KERNEL_PRIVATE */ 331*43a90889SApple OSS Distributions 332*43a90889SApple OSS Distributions __END_DECLS 333*43a90889SApple OSS Distributions 334*43a90889SApple OSS Distributions #endif /* !KERNEL */ 335*43a90889SApple OSS Distributions #endif /* !_SYS_SYSLOG_H_ */ 336