mirror of
https://github.com/darlinghq/darling.git
synced 2024-11-23 12:19:43 +00:00
Update submodules, implement more of os/log.h
This commit is contained in:
parent
cd2d1e829c
commit
45fa15cfce
1
platform-include/System/libkern
Symbolic link
1
platform-include/System/libkern
Symbolic link
@ -0,0 +1 @@
|
||||
../../src/lkm/libkern/libkern/
|
2
src/external/IOKitUser
vendored
2
src/external/IOKitUser
vendored
@ -1 +1 @@
|
||||
Subproject commit 1ec7f5d6a4630b4dd2b89ffbcc55e3cebf831719
|
||||
Subproject commit 8977c6fe8766e06e3faa3874e721e791ba8e2293
|
2
src/external/cocotron
vendored
2
src/external/cocotron
vendored
@ -1 +1 @@
|
||||
Subproject commit 2f1912988f2994705089e076b9b9c21ba55c86cf
|
||||
Subproject commit fccdb6a87c171c303f6b1f69248c211aa3fb642a
|
2
src/external/iokitd
vendored
2
src/external/iokitd
vendored
@ -1 +1 @@
|
||||
Subproject commit 0d64152ab8d19949f77c16a4f6317ed37f347242
|
||||
Subproject commit 024f5490fbecf27073b0d491981d6e2d4c0b3f1b
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <asl.h>
|
||||
|
||||
struct os_log_s
|
||||
{
|
||||
@ -9,6 +10,40 @@ struct os_log_s
|
||||
};
|
||||
|
||||
struct os_log_s _os_log_disabled;
|
||||
static asl_object_t asl_client;
|
||||
|
||||
static void deinit_asl(void)
|
||||
{
|
||||
asl_close(asl_client);
|
||||
}
|
||||
|
||||
static void init_asl(void)
|
||||
{
|
||||
if (!asl_client)
|
||||
{
|
||||
asl_client = asl_open(getprogname(), "user", 0);
|
||||
if (asl_client)
|
||||
atexit(deinit_asl);
|
||||
}
|
||||
}
|
||||
|
||||
static int log_type_os2asl(os_log_type_t t)
|
||||
{
|
||||
switch (t)
|
||||
{
|
||||
case OS_LOG_TYPE_INFO:
|
||||
return ASL_LEVEL_INFO;
|
||||
case OS_LOG_TYPE_DEBUG:
|
||||
return ASL_LEVEL_DEBUG;
|
||||
case OS_LOG_TYPE_ERROR:
|
||||
return ASL_LEVEL_ERR;
|
||||
case OS_LOG_TYPE_FAULT:
|
||||
return ASL_LEVEL_CRIT;
|
||||
case OS_LOG_TYPE_DEFAULT:
|
||||
default:
|
||||
return ASL_LEVEL_NOTICE;
|
||||
}
|
||||
}
|
||||
|
||||
bool os_log_type_enabled(os_log_t oslog, os_log_type_t type)
|
||||
{
|
||||
@ -40,12 +75,14 @@ void _os_log_fault_impl(void *dso, os_log_t log, os_log_type_t type,
|
||||
|
||||
void _os_log_internal(void *dso, os_log_t log, os_log_type_t type, const char *message, ...)
|
||||
{
|
||||
init_asl();
|
||||
|
||||
va_list ap;
|
||||
printf("_os_log_internal called: ");
|
||||
va_start(ap, message);
|
||||
vprintf(message, ap);
|
||||
|
||||
asl_vlog(asl_client, NULL, log_type_os2asl(type), message, ap);
|
||||
|
||||
va_end(ap);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
os_log_t _os_log_create(void *dso, const char *subsystem, const char *category)
|
||||
|
Loading…
Reference in New Issue
Block a user