Hi, I am using utrace for a school project. I would like to trace system calls for an application an all its descendants, and transmit them to user space. I have implemented a circular buffer, in which i can place a simple message, and then export the buffer to user space with a character device.
At any time i can only have on process reading the buffer. Essentially this is a producer consumer problem, with one consumer and multiple producers. I want to make sure that i don't loose anything, so if the buffer is full, i must suspend the producers. Suspending the consumer was straightforward (i did it with set_current_status(TASK_INTERRUPTIBLE) and sleep() then wake_up_task from the producers). I tried to synchronized the consumers with UTRACE_STOP and utrace_control(UTRACE_RESUME) and it works fine. The problem is that (if i understood correctly) when returning from UTRACE_STOP from a monitor function like SYSCALL_ENTRY, my callback won' be called again for the same system call on UTRACE_RESUME. This way if the buffer is full and i return UTRACE_STOP, i will loose the possibility to log the syscall_entry into the buffer. Calling schedule() from the utrace callback while the buffer is full would solve the problem, but as i understand that is not recommended, since it doesn't play nice with other monitoring engines that might be active. How could i solve this problem and still be friendly with utrace? Alpar Torok