I'm logging system calls in OS X using a kext, like so:
int hook_read(struct proc *p, struct read_args *u, user_ssize_t *r) {
/* get som params here... */
printf("[IDEN] SYS_read called, %s, %d, %d, %d.\n", params);
return read(p, u, r);
}
This logs to system.log
. The issue now is that if the printf
load is high (many system calls are called), the output in system.log
is often malformed:
ID]SYS_readEN] callparam, 123, ed 123, 123
for example. The string is scrambled. If I use kprintf
, which prints to a serial port, malformed logs never occur.
Any idea's what's causing this behaviour are much appreciated!