]> git.saurik.com Git - apple/launchd.git/blob - src/log.h
launchd-842.1.4.tar.gz
[apple/launchd.git] / src / log.h
1 #ifndef __LAUNCHD_LOG_H__
2 #define __LAUNCHD_LOG_H__
3
4 #include <mach/mach.h>
5 #include <sys/types.h>
6 #include <sys/time.h>
7 #include <sys/queue.h>
8 #include <sys/fcntl.h>
9 #include <malloc/malloc.h>
10 #include <unistd.h>
11 #include <pthread.h>
12 #include <errno.h>
13 #include <string.h>
14 #include <ctype.h>
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <stdbool.h>
18 #include <syslog.h>
19
20 extern char *launchd_username;
21 extern char *launchd_label;
22 extern mach_port_t launchd_drain_reply_port;
23 extern bool launchd_var_available;
24 extern int64_t launchd_system_start;
25
26 struct launchd_syslog_attr {
27 const char *from_name;
28 const char *about_name;
29 const char *session_name;
30 int priority;
31 uid_t from_uid;
32 pid_t from_pid;
33 pid_t about_pid;
34 };
35
36 /* These constants must not have the high bit set so we can safely mask them
37 * mask them with LOG_CONSOLE.
38 */
39 #define LOG_PERF 0x5252615d
40 #define LOG_APPLEONLY 0x4141504c
41 #define LOG_CONSOLE (1 << 31)
42
43 __attribute__((visibility("default")))
44 __attribute__((used))
45 extern bool
46 _launchd_os_redirect(const char *message);
47
48 int
49 runtime_setlogmask(int maskpri);
50
51 void
52 launchd_closelog(void);
53
54 __attribute__((format(printf, 2, 3)))
55 void
56 launchd_syslog(int pri, const char *message, ...);
57
58 __attribute__((format(printf, 2, 0)))
59 void
60 launchd_vsyslog(struct launchd_syslog_attr *attr, const char *message, va_list args);
61
62 void
63 launchd_log_push(void);
64
65 kern_return_t
66 launchd_log_forward(uid_t forward_uid, gid_t forward_gid, vm_offset_t inval, mach_msg_type_number_t invalCnt);
67
68 kern_return_t
69 launchd_log_drain(mach_port_t srp, vm_offset_t *outval, mach_msg_type_number_t *outvalCnt);
70
71 #endif /* __LAUNCHD_LOG_H__ */