xref: /xnu-8792.81.2/libkern/os/log_private.h (revision 19c3b8c28c31cb8130e034cfb5df6bf9ba342d90)
1*19c3b8c2SApple OSS Distributions /*
2*19c3b8c2SApple OSS Distributions  * Copyright (c) 2015-2022 Apple Inc. All rights reserved.
3*19c3b8c2SApple OSS Distributions  *
4*19c3b8c2SApple OSS Distributions  * @APPLE_LICENSE_HEADER_START@
5*19c3b8c2SApple OSS Distributions  *
6*19c3b8c2SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*19c3b8c2SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*19c3b8c2SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*19c3b8c2SApple OSS Distributions  * compliance with the License. Please obtain a copy of the License at
10*19c3b8c2SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this
11*19c3b8c2SApple OSS Distributions  * file.
12*19c3b8c2SApple OSS Distributions  *
13*19c3b8c2SApple OSS Distributions  * The Original Code and all software distributed under the License are
14*19c3b8c2SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15*19c3b8c2SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16*19c3b8c2SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17*19c3b8c2SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18*19c3b8c2SApple OSS Distributions  * Please see the License for the specific language governing rights and
19*19c3b8c2SApple OSS Distributions  * limitations under the License.
20*19c3b8c2SApple OSS Distributions  *
21*19c3b8c2SApple OSS Distributions  * @APPLE_LICENSE_HEADER_END@
22*19c3b8c2SApple OSS Distributions  */
23*19c3b8c2SApple OSS Distributions 
24*19c3b8c2SApple OSS Distributions #ifndef __os_log_private_h
25*19c3b8c2SApple OSS Distributions #define __os_log_private_h
26*19c3b8c2SApple OSS Distributions 
27*19c3b8c2SApple OSS Distributions #include <os/log.h>
28*19c3b8c2SApple OSS Distributions #include <firehose/tracepoint_private.h>
29*19c3b8c2SApple OSS Distributions #include <sys/queue.h>
30*19c3b8c2SApple OSS Distributions 
31*19c3b8c2SApple OSS Distributions #define OS_LOG_MAX_SIZE_ORDER 10 // Maximum log size order (1024 bytes)
32*19c3b8c2SApple OSS Distributions 
33*19c3b8c2SApple OSS Distributions __BEGIN_DECLS
34*19c3b8c2SApple OSS Distributions 
35*19c3b8c2SApple OSS Distributions /*!
36*19c3b8c2SApple OSS Distributions  * @function os_log_with_args
37*19c3b8c2SApple OSS Distributions  *
38*19c3b8c2SApple OSS Distributions  * @abstract
39*19c3b8c2SApple OSS Distributions  * os_log variant that supports va_list args.
40*19c3b8c2SApple OSS Distributions  *
41*19c3b8c2SApple OSS Distributions  * @discussion
42*19c3b8c2SApple OSS Distributions  * os_log variant that supports va_list args.  This SPI should only be used
43*19c3b8c2SApple OSS Distributions  * to shim legacy logging systems through os_log.
44*19c3b8c2SApple OSS Distributions  *
45*19c3b8c2SApple OSS Distributions  * @param oslog
46*19c3b8c2SApple OSS Distributions  * Pass OS_LOG_DEFAULT or a log object previously created with os_log_create.
47*19c3b8c2SApple OSS Distributions  *
48*19c3b8c2SApple OSS Distributions  * @param type
49*19c3b8c2SApple OSS Distributions  * Pass one of the following message types.
50*19c3b8c2SApple OSS Distributions  *   OS_LOG_TYPE_DEFAULT
51*19c3b8c2SApple OSS Distributions  *   OS_LOG_TYPE_DEBUG
52*19c3b8c2SApple OSS Distributions  *   OS_LOG_TYPE_INFO
53*19c3b8c2SApple OSS Distributions  *   OS_LOG_TYPE_ERROR
54*19c3b8c2SApple OSS Distributions  *   OS_LOG_TYPE_FAULT
55*19c3b8c2SApple OSS Distributions  *
56*19c3b8c2SApple OSS Distributions  * @param format
57*19c3b8c2SApple OSS Distributions  * A format string to generate a human-readable log message when the log
58*19c3b8c2SApple OSS Distributions  * line is decoded.  Supports all standard printf types in addition to %@
59*19c3b8c2SApple OSS Distributions  * and %m (objects and errno respectively).
60*19c3b8c2SApple OSS Distributions  *
61*19c3b8c2SApple OSS Distributions  * @param args
62*19c3b8c2SApple OSS Distributions  * A va_list containing the values for the format string.
63*19c3b8c2SApple OSS Distributions  *
64*19c3b8c2SApple OSS Distributions  * @param ret_addr
65*19c3b8c2SApple OSS Distributions  * Pass the __builtin_return_address(0) of the function that created the
66*19c3b8c2SApple OSS Distributions  * va_list from variadic arguments.  The caller must be the same binary
67*19c3b8c2SApple OSS Distributions  * that generated the message and provided the format string.
68*19c3b8c2SApple OSS Distributions  */
69*19c3b8c2SApple OSS Distributions     __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0)
70*19c3b8c2SApple OSS Distributions OS_EXPORT OS_NOTHROW OS_LOG_NOTAILCALL
71*19c3b8c2SApple OSS Distributions void
72*19c3b8c2SApple OSS Distributions os_log_with_args(os_log_t oslog, os_log_type_t type, const char *format, va_list args, void *ret_addr) __osloglike(3, 0);
73*19c3b8c2SApple OSS Distributions 
74*19c3b8c2SApple OSS Distributions __END_DECLS
75*19c3b8c2SApple OSS Distributions 
76*19c3b8c2SApple OSS Distributions #endif // __os_log_private_h
77