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