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