2 * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
28 #include <sys/types.h>
29 #include <sys/queue.h>
32 #include <asl_private.h>
36 #define ADDFD_FLAGS_LOCAL 0x00000001
38 #define ASL_DB_NOTIFICATION "com.apple.system.logger.message"
40 #define ASL_KEY_READ_UID "ReadUID"
41 #define ASL_KEY_READ_GID "ReadGID"
42 #define ASL_KEY_EXPIRE_TIME "ASLExpireTime"
43 #define ASL_KEY_IGNORE "ASLIgnore"
44 #define ASL_KEY_TIME_NSEC "TimeNanoSec"
45 #define ASL_KEY_REF_PID "RefPID"
46 #define ASL_KEY_REF_PROC "RefProc"
47 #define ASL_KEY_SESSION "Session"
49 #define _PATH_PIDFILE "/var/run/syslog.pid"
50 #define _PATH_ASL_IN "/var/run/asl_input"
51 #define _PATH_ASL_DIR "/var/log"
52 #define _PATH_ASL_DB "/var/log/asl.db"
53 #define _PATH_SYSLOG_CONF "/etc/syslog.conf"
54 #define _PATH_SYSLOG_IN "/var/run/syslog"
55 #define _PATH_KLOG "/dev/klog"
56 #define _PATH_MODULE_LIB "/usr/lib/asl"
58 #define KERN_DISASTER_LEVEL 3
60 extern launch_data_t launch_dict
;
69 TAILQ_ENTRY(module_list
) entries
;
72 int aslevent_init(void);
73 int aslevent_fdsets(fd_set
*, fd_set
*, fd_set
*);
74 void aslevent_handleevent(fd_set
*, fd_set
*, fd_set
*);
76 void asl_archive(void);
78 char *get_line_from_file(FILE *f
);
80 int asldebug(const char *, ...);
81 int asl_log_string(const char *str
);
83 char *asl_msg_to_string(asl_msg_t
*msg
, uint32_t *len
);
84 asl_msg_t
*asl_msg_from_string(const char *buf
);
85 int asl_msg_cmp(asl_msg_t
*a
, asl_msg_t
*b
);
86 time_t asl_parse_time(const char *str
);
88 typedef asl_msg_t
*(*aslreadfn
)(int);
89 typedef char *(*aslwritefn
)(const char *, int);
90 typedef char *(*aslexceptfn
)(int);
91 typedef int (*aslsendmsgfn
)(asl_msg_t
*msg
, const char *outid
);
93 int aslevent_addfd(int fd
, uint32_t flags
, aslreadfn
, aslwritefn
, aslexceptfn
);
94 int aslevent_removefd(int fd
);
95 int aslevent_addmatch(asl_msg_t
*query
, char *outid
);
97 int aslevent_addoutput(aslsendmsgfn
, const char *outid
);
99 int asl_syslog_faciliy_name_to_num(const char *fac
);
100 const char *asl_syslog_faciliy_num_to_name(int num
);
101 asl_msg_t
*asl_input_parse(const char *in
, int len
, char *rhost
, int flag
);
103 uint32_t db_prune(aslresponse query
);
104 uint32_t db_archive(time_t cut
, uint64_t max
);
105 uint32_t db_compact(void);
107 /* message refcount utilities */
108 uint32_t asl_msg_type(asl_msg_t
*m
);
109 asl_msg_t
*asl_msg_retain(asl_msg_t
*m
);
110 void asl_msg_release(asl_msg_t
*m
);
113 uint32_t notify_register_plain(const char *name
, int *out_token
);
115 #endif /* __DAEMON_H__ */