void DNSXRefDeAlloc(DNSXConnRef connRef) { if (connRef == NULL) { os_log(OS_LOG_DEFAULT, "dns_services: DNSXRefDeAlloc called with NULL DNSXConnRef"); return; } // Schedule this work on the internal library queue dispatch_sync(connRef->lib_q, ^{ xpc_connection_set_event_handler((connRef)->conn_ref, ^(__unused xpc_object_t event){}); // ignore any more events xpc_release(connRef->conn_ref); connRef->conn_ref = NULL; dispatch_release(connRef->lib_q); connRef->lib_q = NULL; connRef->AppCallBack = NULL; os_log_info(OS_LOG_DEFAULT, "dns_services: DNSXRefDeAlloc successfully DeAllocated conn_ref & lib_q"); dispatch_async((connRef)->client_q, ^{ dispatch_release(connRef->client_q); connRef->client_q = NULL; free(connRef); os_log_info(OS_LOG_DEFAULT, "dns_services: DNSXRefDeAlloc successfully DeAllocated client_q & freed connRef"); }); });
static void LogDebug(const char *prefix, xpc_object_t o) { if (!LogDebugEnabled()) return; char *desc = xpc_copy_description(o); os_log_info(OS_LOG_DEFAULT, "%s: %s", prefix, desc); free(desc); }
int main(int argc, char** argv) { os_log_t logger_sub1 = os_log_create("org.llvm.lldb.test.sub1", "cat1"); os_log_t logger_sub2 = os_log_create("org.llvm.lldb.test.sub2", "cat2"); if (!logger_sub1 || !logger_sub2) return 1; // Note we cannot use the os_log() line as the breakpoint because, as of // the initial writing of this test, we get multiple breakpoints for that // line, which confuses the pexpect test logic. printf("About to log\n"); // break here os_log_info(logger_sub1, "source-log-sub1-cat1"); os_log(logger_sub2, "source-log-sub2-cat2"); // Sleep, as the darwin log reporting doesn't always happen until a bit // later. We need the message to come out before the process terminates. sleep(FINAL_WAIT_SECONDS); return 0; }
void mono_log_write_asl (const char *log_domain, GLogLevelFlags level, mono_bool hdr, const char *message) { switch (level & G_LOG_LEVEL_MASK) { case G_LOG_LEVEL_MESSAGE: os_log (OS_LOG_DEFAULT, "%s%s%s\n", log_domain != NULL ? log_domain : "", log_domain != NULL ? ": " : "", message); break; case G_LOG_LEVEL_INFO: os_log_info (OS_LOG_DEFAULT, "%s%s%s\n", log_domain != NULL ? log_domain : "", log_domain != NULL ? ": " : "", message); break; case G_LOG_LEVEL_DEBUG: os_log_debug (OS_LOG_DEFAULT, "%s%s%s\n", log_domain != NULL ? log_domain : "", log_domain != NULL ? ": " : "", message); break; case G_LOG_LEVEL_ERROR: case G_LOG_LEVEL_WARNING: os_log_error (OS_LOG_DEFAULT, "%s%s%s\n", log_domain != NULL ? log_domain : "", log_domain != NULL ? ": " : "", message); case G_LOG_LEVEL_CRITICAL: default: os_log_fault (OS_LOG_DEFAULT, "%s%s%s\n", log_domain != NULL ? log_domain : "", log_domain != NULL ? ": " : "", message); break; } if (level & G_LOG_LEVEL_ERROR) abort(); }
static void if_low_power_evhdlr_callback(__unused struct eventhandler_entry_arg arg, struct ifnet *ifp, if_low_power_ev_code_t event_code) { struct kev_dl_low_power_mode kev; if (!IF_FULLY_ATTACHED(ifp)) return; if (if_low_power_verbose > 0) { os_log_info(OS_LOG_DEFAULT, "%s: ifp %s event_code %d", __func__, if_name(ifp), event_code); } ifnet_lock_exclusive(ifp); if (event_code == IF_LOW_POWER_EVENT_OFF) { ifp->if_xflags &= ~IFXF_LOW_POWER; } else { ifp->if_xflags |= IFXF_LOW_POWER; } ifnet_lock_done(ifp); if (event_code == IF_LOW_POWER_EVENT_ON) { atomic_add_32(&ifp->if_low_power_gencnt, 1); if (if_low_power_restricted != 0) { shutdown_sockets_on_interface(ifp); intf_event_enqueue_nwk_wq_entry(ifp, NULL, INTF_EVENT_CODE_LOW_POWER_UPDATE); } } bzero(&kev, sizeof(struct kev_dl_low_power_mode)); kev.low_power_event = event_code; dlil_post_msg(ifp, KEV_DL_SUBCLASS, KEV_DL_LOW_POWER_MODE_CHANGED, (struct net_event_data *)&kev, sizeof(struct kev_dl_low_power_mode)); }