/* Notification for a new kernel message. */
struct kmessages kmess; /* entire kmess structure */
char print_buf[KMESS_BUF_SIZE]; /* copy new message here */
- static int prev_next = 0;
int bytes;
int i, r;
+ int *prev_nextp;
+
+ static int kernel_prev_next = 0;
+ static int tty_prev_next = 0;
if (m->m_source == TTY_PROC_NR)
{
cp_grant_id_t gid;
message mess;
+ prev_nextp= &tty_prev_next;
gid= cpf_grant_direct(TTY_PROC_NR, (vir_bytes)&kmess, sizeof(kmess),
CPF_WRITE);
if (gid == -1)
{
+#if 0
report("LOG","cpf_grant_direct failed for TTY", errno);
+#endif
return EDONTREPLY;
}
report("LOG","couldn't get copy of kmessages", r);
return EDONTREPLY;
}
+ prev_nextp= &kernel_prev_next;
}
/* Print only the new part. Determine how many new bytes there are with
* Check for size being positive, the buffer might as well be emptied!
*/
if (kmess.km_size > 0) {
- bytes = ((kmess.km_next + KMESS_BUF_SIZE) - prev_next) % KMESS_BUF_SIZE;
- r=prev_next; /* start at previous old */
+ bytes = ((kmess.km_next + KMESS_BUF_SIZE) - (*prev_nextp)) %
+ KMESS_BUF_SIZE;
+ r= *prev_nextp; /* start at previous old */
i=0;
while (bytes > 0) {
print_buf[i] = kmess.km_buf[(r%KMESS_BUF_SIZE)];
/* Almost done, store 'next' so that we can determine what part of the
* kernel messages buffer to print next time a notification arrives.
*/
- prev_next = kmess.km_next;
+ *prev_nextp = kmess.km_next;
return EDONTREPLY;
}