1 | /* |
2 | * Copyright (c) 2015-2016 Apple Inc. All rights reserved. |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ |
5 | * |
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 |
11 | * file. |
12 | * |
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. |
20 | * |
21 | * @APPLE_LICENSE_HEADER_END@ |
22 | */ |
23 | |
24 | #ifndef __os_log_private_h |
25 | #define __os_log_private_h |
26 | |
27 | #include <os/log.h> |
28 | #include <firehose/tracepoint_private.h> |
29 | #include <sys/queue.h> |
30 | |
31 | __BEGIN_DECLS |
32 | |
33 | /*! |
34 | * @function os_log_with_args |
35 | * |
36 | * @abstract |
37 | * os_log variant that supports va_list args. |
38 | * |
39 | * @discussion |
40 | * os_log variant that supports va_list args. This SPI should only be used |
41 | * to shim legacy logging systems through os_log. |
42 | * |
43 | * @param oslog |
44 | * Pass OS_LOG_DEFAULT or a log object previously created with os_log_create. |
45 | * |
46 | * @param type |
47 | * Pass one of the following message types. |
48 | * OS_LOG_TYPE_DEFAULT |
49 | * OS_LOG_TYPE_DEBUG |
50 | * OS_LOG_TYPE_INFO |
51 | * OS_LOG_TYPE_ERROR |
52 | * OS_LOG_TYPE_FAULT |
53 | * |
54 | * @param format |
55 | * A format string to generate a human-readable log message when the log |
56 | * line is decoded. Supports all standard printf types in addition to %@ |
57 | * and %m (objects and errno respectively). |
58 | * |
59 | * @param args |
60 | * A va_list containing the values for the format string. |
61 | * |
62 | * @param ret_addr |
63 | * Pass the __builtin_return_address(0) of the function that created the |
64 | * va_list from variadic arguments. The caller must be the same binary |
65 | * that generated the message and provided the format string. |
66 | */ |
67 | __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0) |
68 | OS_EXPORT OS_NOTHROW OS_LOG_NOTAILCALL |
69 | void |
70 | os_log_with_args(os_log_t oslog, os_log_type_t type, const char *format, va_list args, void *ret_addr); |
71 | |
72 | /*! |
73 | * @enum oslog_stream_link_type_t |
74 | */ |
75 | OS_ENUM(oslog_stream_link_type, uint8_t, |
76 | oslog_stream_link_type_log = 0x0, |
77 | oslog_stream_link_type_metadata = 0x1, |
78 | ); |
79 | |
80 | /*! |
81 | * @typedef oslog_stream_buf_entry_t |
82 | */ |
83 | typedef struct oslog_stream_buf_entry_s { |
84 | STAILQ_ENTRY(oslog_stream_buf_entry_s) buf_entries; |
85 | uint64_t timestamp; |
86 | int offset; |
87 | uint16_t size; |
88 | oslog_stream_link_type_t type; |
89 | struct firehose_tracepoint_s metadata[]; |
90 | } *oslog_stream_buf_entry_t; |
91 | |
92 | __END_DECLS |
93 | |
94 | #endif // __os_log_private_h |
95 | |