Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在macOS上释放os_log_create()返回的os_log_t类型?_Macos - Fatal编程技术网

如何在macOS上释放os_log_create()返回的os_log_t类型?

如何在macOS上释放os_log_create()返回的os_log_t类型?,macos,Macos,我正在为macOS编写一个设备驱动程序(Kext)。我通过返回日志对象的os\u log\u create函数进行日志记录 我还没有找到任何相应的方法来释放返回的对象,一旦我完成了它。未描述如何释放由os\u log\u create返回的对象 当我处理完此对象时,是否应该对此对象调用os\u release() 下面是我如何使用os\u log\u create()的示例: 当文档对此保持沉默(这是哑的)时,头文件不是。当您向下滚动到os\u log\u create()的声明时,您可以找到应

我正在为macOS编写一个设备驱动程序(Kext)。我通过返回日志对象的
os\u log\u create
函数进行日志记录

我还没有找到任何相应的方法来释放返回的对象,一旦我完成了它。未描述如何释放由
os\u log\u create
返回的对象

当我处理完此对象时,是否应该对此对象调用
os\u release()

下面是我如何使用
os\u log\u create()
的示例:


当文档对此保持沉默(这是哑的)时,头文件
不是。当您向下滚动到
os\u log\u create()
的声明时,您可以找到应该使用
os\u release()
的信息

复制粘贴,以防有人希望立即确认:

/*!
 * @function os_log_create
 *
 * @abstract
 * Creates a log object to be used with other log related functions.
 *
 * @discussion
 * Creates a log object to be used with other log related functions.  The
 * log object serves two purposes:  (1) tag related messages by subsystem
 * and category name for easy filtering, and (2) control logging system
 * behavior for messages.
 *
 * @param subsystem
 * The identifier of the given subsystem should be in reverse DNS form
 * (i.e., com.company.mysubsystem).
 *
 * @param category
 * The category within the given subsystem that specifies the settings for
 * the log object.
 *
 * @result
 * Returns an os_log_t value to be passed to other os_log API calls.  This
 * should be called once at log initialization and rely on system to detect
 * changes to settings.  This object should be released when no longer used
 * via os_release or -[release] method.
 *
 * A value will always be returned to allow for dynamic enablement.
 */
API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0))
OS_EXPORT OS_NOTHROW OS_WARN_RESULT OS_OBJECT_RETURNS_RETAINED OS_NONNULL_ALL
os_log_t
os_log_create(const char *subsystem, const char *category);
/*!
 * @function os_log_create
 *
 * @abstract
 * Creates a log object to be used with other log related functions.
 *
 * @discussion
 * Creates a log object to be used with other log related functions.  The
 * log object serves two purposes:  (1) tag related messages by subsystem
 * and category name for easy filtering, and (2) control logging system
 * behavior for messages.
 *
 * @param subsystem
 * The identifier of the given subsystem should be in reverse DNS form
 * (i.e., com.company.mysubsystem).
 *
 * @param category
 * The category within the given subsystem that specifies the settings for
 * the log object.
 *
 * @result
 * Returns an os_log_t value to be passed to other os_log API calls.  This
 * should be called once at log initialization and rely on system to detect
 * changes to settings.  This object should be released when no longer used
 * via os_release or -[release] method.
 *
 * A value will always be returned to allow for dynamic enablement.
 */
API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0))
OS_EXPORT OS_NOTHROW OS_WARN_RESULT OS_OBJECT_RETURNS_RETAINED OS_NONNULL_ALL
os_log_t
os_log_create(const char *subsystem, const char *category);