From: Philip Homburg Date: Mon, 25 Feb 2008 11:53:37 +0000 (+0000) Subject: Need separate 'prev_next' pointers for kernel and TTY. X-Git-Tag: v3.1.4~249 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/addsub.png?a=commitdiff_plain;h=65df875abb1f9820467f18b2b852a737adc6c16f;p=minix.git Need separate 'prev_next' pointers for kernel and TTY. --- diff --git a/drivers/log/diag.c b/drivers/log/diag.c index 3e72a59f9..eb8da9e00 100644 --- a/drivers/log/diag.c +++ b/drivers/log/diag.c @@ -26,20 +26,26 @@ message *m; /* notification message */ /* 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; } @@ -63,6 +69,7 @@ message *m; /* notification message */ 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 @@ -72,8 +79,9 @@ message *m; /* notification message */ * 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)]; @@ -89,7 +97,7 @@ message *m; /* notification message */ /* 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; }