Skip to content

Commit 96c85c1

Browse files
committed
Auto merge of #2946 - devnexen:os_log_macos, r=JohnTitor
os_log/signpost for apple api subset
2 parents 8501d72 + b94ddf9 commit 96c85c1

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ fn test_apple(target: &str) {
232232
"netinet/tcp.h",
233233
"netinet/udp.h",
234234
"os/lock.h",
235+
"os/signpost.h",
235236
"poll.h",
236237
"pthread.h",
237238
"pthread_spis.h",

libc-test/semver/apple.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,14 @@ OFDEL
10031003
OFILL
10041004
OLD_TIME
10051005
ONOEOT
1006+
OS_LOG_TYPE_DEBUG
1007+
OS_LOG_TYPE_DEFAULT
1008+
OS_LOG_TYPE_ERROR
1009+
OS_LOG_TYPE_FAULT
1010+
OS_LOG_TYPE_INFO
1011+
OS_SIGNPOST_EVENT
1012+
OS_SIGNPOST_INTERVAL_BEGIN
1013+
OS_SIGNPOST_INTERVAL_END
10061014
OS_UNFAIR_LOCK_INIT
10071015
OXTABS
10081016
O_ASYNC
@@ -1994,6 +2002,15 @@ open_memstream
19942002
open_wmemstream
19952003
openat
19962004
openpty
2005+
os_log_create
2006+
os_log_t
2007+
os_log_type_t
2008+
os_log_type_enabled
2009+
os_signpost_enabled
2010+
os_signpost_id_generate
2011+
os_signpost_id_make_with_pointer
2012+
os_signpost_id_t
2013+
os_signpost_type_t
19972014
os_unfair_lock
19982015
os_unfair_lock_s
19992016
os_unfair_lock_t

src/unix/bsd/apple/mod.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ pub type pthread_jit_write_callback_t = ::Option<extern "C" fn(ctx: *mut ::c_voi
124124
pub type os_unfair_lock = os_unfair_lock_s;
125125
pub type os_unfair_lock_t = *mut os_unfair_lock;
126126

127+
pub type os_log_t = *mut ::c_void;
128+
pub type os_log_type_t = u8;
129+
pub type os_signpost_id_t = u64;
130+
pub type os_signpost_type_t = u8;
131+
127132
pub type vm_statistics_t = *mut vm_statistics;
128133
pub type vm_statistics_data_t = vm_statistics;
129134
pub type vm_statistics64_t = *mut vm_statistics64;
@@ -3895,6 +3900,16 @@ pub const OS_UNFAIR_LOCK_INIT: os_unfair_lock = os_unfair_lock {
38953900
_os_unfair_lock_opaque: 0,
38963901
};
38973902

3903+
pub const OS_LOG_TYPE_DEFAULT: ::os_log_type_t = 0x00;
3904+
pub const OS_LOG_TYPE_INFO: ::os_log_type_t = 0x01;
3905+
pub const OS_LOG_TYPE_DEBUG: ::os_log_type_t = 0x02;
3906+
pub const OS_LOG_TYPE_ERROR: ::os_log_type_t = 0x10;
3907+
pub const OS_LOG_TYPE_FAULT: ::os_log_type_t = 0x11;
3908+
3909+
pub const OS_SIGNPOST_EVENT: ::os_signpost_type_t = 0x00;
3910+
pub const OS_SIGNPOST_INTERVAL_BEGIN: ::os_signpost_type_t = 0x01;
3911+
pub const OS_SIGNPOST_INTERVAL_END: ::os_signpost_type_t = 0x02;
3912+
38983913
pub const MINSIGSTKSZ: ::size_t = 32768;
38993914
pub const SIGSTKSZ: ::size_t = 131072;
39003915

@@ -5259,6 +5274,15 @@ extern "C" {
52595274
pub fn os_unfair_lock_assert_owner(lock: os_unfair_lock_t);
52605275
pub fn os_unfair_lock_assert_not_owner(lock: os_unfair_lock_t);
52615276

5277+
pub fn os_log_create(subsystem: *const ::c_char, category: *const ::c_char) -> ::os_log_t;
5278+
pub fn os_log_type_enabled(oslog: ::os_log_t, tpe: ::os_log_type_t) -> bool;
5279+
pub fn os_signpost_id_make_with_pointer(
5280+
log: ::os_log_t,
5281+
ptr: *const ::c_void,
5282+
) -> ::os_signpost_id_t;
5283+
pub fn os_signpost_id_generate(log: ::os_log_t) -> ::os_signpost_id_t;
5284+
pub fn os_signpost_enabled(log: ::os_log_t) -> bool;
5285+
52625286
pub fn thread_policy_set(
52635287
thread: thread_t,
52645288
flavor: thread_policy_flavor_t,

0 commit comments

Comments
 (0)