void ssyasl_init(char* progname) { ssyasl_gAslClient = asl_open(NULL, NULL, ASL_OPT_STDERR) ; char* path = ssyasl_create_log_path(progname) ; ssyasl_gFileDescriptor = open(path, FWRITE | O_CREAT | O_APPEND, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) ; free(path) ; asl_add_log_file(ssyasl_gAslClient, ssyasl_gFileDescriptor) ; // Without the following, you sometimes get two sysbeeps whenever asl_log is // invoked with level ASL_LEVEL_EMERG. Makes no sense to me. asl_set_filter(ssyasl_gAslClient, ASL_LEVEL_EMERG) ; ssyasl_set_filter(ASL_LEVEL_NOTICE) ; }
void _init_asl(int source, int to_stderr) { if (asl != NULL){ asl_close(asl);; asl = NULL; } if (log_file_fd >= 0) close(log_file_fd); char source_desc[64]; log_get_source_desc(source, source_desc, sizeof(source_desc)); int opt = (to_stderr)?ASL_OPT_STDERR:0; asl = asl_open(FCT_LOG_IDENTITY, source_desc, opt); log_file_fd = open(sock_file, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (log_file_fd >= 0) asl_add_log_file(asl, log_file_fd); }
boolean_t IOHIDEventSystemStatistics::open(IOHIDSessionRef session, IOOptionBits options) { CFTypeRef bootArgs = nil; io_registry_entry_t entry = IO_OBJECT_NULL; (void)session; (void)options; entry = IORegistryEntryFromPath(kIOMasterPortDefault, "IODeviceTree:/options"); if(entry){ bootArgs = IORegistryEntryCreateCFProperty(entry, CFSTR("boot-args"), nil, 0); if (bootArgs){ if (CFGetTypeID(bootArgs) == CFStringGetTypeID()){ CFRange findRange; CFStringRef bootArgsString = (CFStringRef)bootArgs; findRange = CFStringFind(bootArgsString, CFSTR("opposing-button-logging"), 0); if (findRange.length != 0) _logButtonFiltering = true; } CFRelease(bootArgs); IOObjectRelease(entry); } } if (_logButtonFiltering) { _logStrings = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); _asl = asl_open("ButtonLogging", "Button Filtering Information", 0); _logfd = ::open("/var/mobile/Library/Logs/button.log", O_CREAT | O_APPEND | O_RDWR, 0644); if ((_logfd != -1) && (_asl != NULL)) asl_add_log_file(_asl, _logfd); } return true; }