-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mac: prjfs-log improvements #158
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key> | ||
<false/> | ||
</dict> | ||
</plist> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
#include <IOKit/IOKitLib.h> | ||
#include <mach/mach_time.h> | ||
|
||
|
||
static const char* KextLogLevelAsString(KextLog_Level level); | ||
|
||
int main(int argc, const char * argv[]) | ||
|
@@ -24,7 +23,9 @@ int main(int argc, const char * argv[]) | |
std::cerr << "Failed to set up shared data queue.\n"; | ||
return 1; | ||
} | ||
|
||
|
||
__block int lineCount = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not Objective-C per se. Apple's C++ compiler has an extension to support blocks, which is how we can call the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh okay thanks! I missed that |
||
|
||
dispatch_source_set_event_handler(dataQueue.dispatchSource, ^{ | ||
struct { | ||
mach_msg_header_t msgHdr; | ||
|
@@ -39,15 +40,19 @@ int main(int argc, const char * argv[]) | |
{ | ||
break; | ||
} | ||
|
||
int messageSize = entry->size; | ||
if (messageSize >= sizeof(KextLog_MessageHeader) + 2) | ||
{ | ||
struct KextLog_MessageHeader message = {}; | ||
memcpy(&message, entry->data, sizeof(KextLog_MessageHeader)); | ||
const char* messageType = KextLogLevelAsString(message.level); | ||
int logStringLength = messageSize - sizeof(KextLog_MessageHeader) - 1; | ||
printf("%s: %.*s\n", messageType, logStringLength, entry->data + sizeof(KextLog_MessageHeader)); | ||
|
||
printf("(%d: %llu) %s: %.*s\n", lineCount, message.machAbsoluteTimestamp, messageType, logStringLength, entry->data + sizeof(KextLog_MessageHeader)); | ||
lineCount++; | ||
} | ||
|
||
IODataQueueDequeue(dataQueue.queueMemory, nullptr, nullptr); | ||
} | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How messy would the output be to separate these with
|
rather than newlines?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends on the event. Sometimes we'll see 3-4 actions in a single kauth event. I'm not opposed to reformatting this though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with going what you have now and we can see how it feels in practice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep feel free to clean it up if the multiple lines gets to be too much