Skip to content

Instantly share code, notes, and snippets.

@lucindo
Created March 22, 2016 22:30
Show Gist options
  • Save lucindo/434b92ad978440ba27eb to your computer and use it in GitHub Desktop.
Save lucindo/434b92ad978440ba27eb to your computer and use it in GitHub Desktop.
#include <sys/klog.h>
#include <stdlib.h>
#include <unistd.h>
int main(void) {
int logsize = klogctl(10 /* SYSLOG_ACTION_SIZE_BUFFER */, 0, 0);
char *bufp = malloc(logsize);
klogctl(3 /* SYSLOG_ACTION_READ_ALL */, bufp, logsize);
write(1, bufp, logsize);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment