Fixed 'bug' in log driver that caused kernel messages not to be displayed.

This was caused by a change in the shared driver code. Not log's fault.

Renamed #definitions of driver process numbers, e.g., TTY now is TTY_PROC_NR.
All known (special) processes now have consistent naming scheme. Kernel tasks
don't follow this scheme.
This commit is contained in:
Jorrit Herder 2005-08-03 08:14:08 +00:00
parent 4a8c5316ec
commit b69ca94efb
15 changed files with 58 additions and 51 deletions

View File

@ -90,7 +90,7 @@ PUBLIC int do_diagnostics(message *m)
*/ */
if ((proc_nr = m->DIAG_PROC_NR) == SELF) if ((proc_nr = m->DIAG_PROC_NR) == SELF)
m->DIAG_PROC_NR = proc_nr = m->m_source; m->DIAG_PROC_NR = proc_nr = m->m_source;
result = _sendrec(TTY, m); result = _sendrec(TTY_PROC_NR, m);
/* Now also make a copy for the private buffer at the LOG server, so /* Now also make a copy for the private buffer at the LOG server, so
* that the messages can be reviewed at a later time. * that the messages can be reviewed at a later time.

View File

@ -25,9 +25,9 @@ int c;
m.DIAG_BUF_COUNT = buf_count; m.DIAG_BUF_COUNT = buf_count;
m.DIAG_PRINT_BUF = print_buf; m.DIAG_PRINT_BUF = print_buf;
m.DIAG_PROC_NR = SELF; m.DIAG_PROC_NR = SELF;
m.m_type = DIAGNOSTICS; /* request TTY to output this buffer */ m.m_type = DIAGNOSTICS; /* request TTY to output this buffer */
_sendrec(TTY, &m); /* if it fails, we cannot do better */ _sendrec(TTY_PROC_NR, &m); /* if it fails, we give up */
buf_count = 0; /* clear buffer for next batch */ buf_count = 0; /* clear buffer for next batch */
} }
if (c != 0) { if (c != 0) {
print_buf[buf_count++] = c; print_buf[buf_count++] = c;

View File

@ -30,6 +30,7 @@ FORWARD _PROTOTYPE( int log_transfer, (int proc_nr, int opcode, off_t position,
FORWARD _PROTOTYPE( int log_do_open, (struct driver *dp, message *m_ptr) ); FORWARD _PROTOTYPE( int log_do_open, (struct driver *dp, message *m_ptr) );
FORWARD _PROTOTYPE( int log_cancel, (struct driver *dp, message *m_ptr) ); FORWARD _PROTOTYPE( int log_cancel, (struct driver *dp, message *m_ptr) );
FORWARD _PROTOTYPE( int log_select, (struct driver *dp, message *m_ptr) ); FORWARD _PROTOTYPE( int log_select, (struct driver *dp, message *m_ptr) );
FORWARD _PROTOTYPE( void log_signal, (struct driver *dp, message *m_ptr) );
FORWARD _PROTOTYPE( int log_other, (struct driver *dp, message *m_ptr) ); FORWARD _PROTOTYPE( int log_other, (struct driver *dp, message *m_ptr) );
FORWARD _PROTOTYPE( void log_geometry, (struct partition *entry) ); FORWARD _PROTOTYPE( void log_geometry, (struct partition *entry) );
FORWARD _PROTOTYPE( void log_reply, (int code, int replyee, int proc, int status) ); FORWARD _PROTOTYPE( void log_reply, (int code, int replyee, int proc, int status) );
@ -45,7 +46,7 @@ PRIVATE struct driver log_dtab = {
log_transfer, /* do the I/O */ log_transfer, /* do the I/O */
nop_cleanup, /* no need to clean up */ nop_cleanup, /* no need to clean up */
log_geometry, /* geometry */ log_geometry, /* geometry */
nop_signal, /* no need to clean up on shutdown */ log_signal, /* handle system signal */
nop_alarm, /* no alarm */ nop_alarm, /* no alarm */
log_cancel, /* CANCEL request */ log_cancel, /* CANCEL request */
log_select, /* DEV_SELECT request */ log_select, /* DEV_SELECT request */
@ -403,6 +404,20 @@ PRIVATE void do_status(message *m_ptr)
return; return;
} }
/*============================================================================*
* log_signal *
*============================================================================*/
PRIVATE void log_signal(dp, m_ptr)
struct driver *dp;
message *m_ptr;
{
sigset_t sigset = m_ptr->NOTIFY_ARG;
if (sigismember(&sigset, SIGKMESS)) {
do_new_kmess(m_ptr);
}
}
/*============================================================================* /*============================================================================*
* log_other * * log_other *
*============================================================================*/ *============================================================================*/
@ -420,14 +435,6 @@ message *m_ptr;
r = do_diagnostics(m_ptr); r = do_diagnostics(m_ptr);
break; break;
} }
case SYS_SIG: {
sigset_t sigset = m_ptr->NOTIFY_ARG;
if (sigismember(&sigset, SIGKMESS)) {
do_new_kmess(m_ptr);
}
r = EDONTREPLY;
break;
}
case DEV_STATUS: { case DEV_STATUS: {
do_status(m_ptr); do_status(m_ptr);
r = EDONTREPLY; r = EDONTREPLY;

View File

@ -39,11 +39,11 @@
#define PM_PROC_NR 0 /* process manager */ #define PM_PROC_NR 0 /* process manager */
#define FS_PROC_NR 1 /* file system */ #define FS_PROC_NR 1 /* file system */
#define SM_PROC_NR 2 /* system service manager */ #define SM_PROC_NR 2 /* system service manager */
#define MEMORY 3 /* memory driver (RAM disk, null, etc.) */ #define MEM_PROC_NR 3 /* memory driver (RAM disk, null, etc.) */
#define LOG_PROC_NR 4 /* log device driver */ #define LOG_PROC_NR 4 /* log device driver */
#define TTY 5 /* terminal (TTY) driver */ #define TTY_PROC_NR 5 /* terminal (TTY) driver */
#define AT_WINI 6 /* AT Winchester */ #define AT_PROC_NR 6 /* AT Winchester */
#define BIOS_WINI 7 /* BIOS disk device */ #define BIOS_PROC_NR 7 /* BIOS disk device */
#define INIT_PROC_NR 8 /* init -- goes multiuser */ #define INIT_PROC_NR 8 /* init -- goes multiuser */
/* Number of processes contained in the system image. */ /* Number of processes contained in the system image. */
@ -66,7 +66,7 @@
# define SYS_SIG NOTIFY_FROM(SYSTEM) /* system signal */ # define SYS_SIG NOTIFY_FROM(SYSTEM) /* system signal */
# define HARD_INT NOTIFY_FROM(HARDWARE) /* hardware interrupt */ # define HARD_INT NOTIFY_FROM(HARDWARE) /* hardware interrupt */
# define NEW_KSIG NOTIFY_FROM(HARDWARE) /* new kernel signal */ # define NEW_KSIG NOTIFY_FROM(HARDWARE) /* new kernel signal */
# define FKEY_PRESSED NOTIFY_FROM(TTY) /* function key press */ # define FKEY_PRESSED NOTIFY_FROM(TTY_PROC_NR)/* function key press */
#define NOTIFICATION 0x800 /* flag for notifications */ #define NOTIFICATION 0x800 /* flag for notifications */
# define DEV_SELECTED (NOTIFICATION | 5) /* select() notification */ # define DEV_SELECTED (NOTIFICATION | 5) /* select() notification */

View File

@ -96,7 +96,7 @@
* Directly sending it to TTY only displays the output. Sending it to the * Directly sending it to TTY only displays the output. Sending it to the
* log driver will cause the diagnostics to be buffered and displayed. * log driver will cause the diagnostics to be buffered and displayed.
*/ */
#define PRINTF_PROC LOG_PROC_NR /* TTY or LOG_PROC_NR */ #define OUTPUT_PROC_NR LOG_PROC_NR /* TTY_PROC_NR or LOG_PROC_NR */
/* NR_CONS, NR_RS_LINES, and NR_PTYS determine the number of terminals the /* NR_CONS, NR_RS_LINES, and NR_PTYS determine the number of terminals the
* system can handle. * system can handle.

View File

@ -40,7 +40,8 @@
#define SERV_M (~0) #define SERV_M (~0)
#define SYST_M (~0) #define SYST_M (~0)
#define USER_M (s(PM_PROC_NR)|s(FS_PROC_NR)|s(SM_PROC_NR)) #define USER_M (s(PM_PROC_NR)|s(FS_PROC_NR)|s(SM_PROC_NR))
#define DRIV_M (USER_M | s(SYSTEM)|s(CLOCK)|s(LOG_PROC_NR)|s(TTY)) #define DRIV_M (USER_M | \
s(SYSTEM)|s(CLOCK)|s(LOG_PROC_NR)|s(TTY_PROC_NR))
/* Sanity check to make sure the send masks can be set. */ /* Sanity check to make sure the send masks can be set. */
extern int dummy[(BITCHUNK_BITS-NR_TASKS > INIT_PROC_NR) ? 1 : -1]; extern int dummy[(BITCHUNK_BITS-NR_TASKS > INIT_PROC_NR) ? 1 : -1];

View File

@ -196,7 +196,7 @@ int how;
*/ */
if (how == RBT_PANIC) { if (how == RBT_PANIC) {
m.m_type = PANIC_DUMPS; m.m_type = PANIC_DUMPS;
if (nb_send(TTY, &m) == OK) /* don't block if TTY isn't ready */ if (nb_send(TTY_PROC_NR,&m)==OK) /* don't block if TTY isn't ready */
return; /* await sys_abort() from TTY */ return; /* await sys_abort() from TTY */
} }

View File

@ -75,14 +75,14 @@ PUBLIC struct boot_image image[] = {
{ PM_PROC_NR, 0, SERV_F, 16, 3, 0, SERV_T, SERV_M, "PM" }, { PM_PROC_NR, 0, SERV_F, 16, 3, 0, SERV_T, SERV_M, "PM" },
{ FS_PROC_NR, 0, SERV_F, 16, 4, 0, SERV_T, SERV_M, "FS" }, { FS_PROC_NR, 0, SERV_F, 16, 4, 0, SERV_T, SERV_M, "FS" },
{ SM_PROC_NR, 0, SERV_F, 16, 3, 0, SERV_T, SYST_M, "SM" }, { SM_PROC_NR, 0, SERV_F, 16, 3, 0, SERV_T, SYST_M, "SM" },
{ TTY, 0, SERV_F, 16, 1, 0, SERV_T, SYST_M, "TTY" }, { TTY_PROC_NR, 0, SERV_F, 16, 1, 0, SERV_T, SYST_M, "TTY" },
{ MEMORY, 0, SERV_F, 16, 2, 0, SERV_T, DRIV_M, "MEMORY" }, { MEM_PROC_NR, 0, SERV_F, 16, 2, 0, SERV_T, DRIV_M, "MEMORY" },
{ LOG_PROC_NR, 0, SERV_F, 16, 2, 0, SERV_T, SYST_M, "LOG" }, { LOG_PROC_NR, 0, SERV_F, 16, 2, 0, SERV_T, SYST_M, "LOG" },
#if ENABLE_AT_WINI #if ENABLE_AT_WINI
{ AT_WINI, 0, SERV_F, 16, 2, 0, SERV_T, DRIV_M, "AT_WINI" }, { AT_PROC_NR, 0, SERV_F, 16, 2, 0, SERV_T, DRIV_M, "AT_WINI" },
#endif #endif
#if ENABLE_BIOS_WINI #if ENABLE_BIOS_WINI
{ BIOS_WINI, 0, SERV_F, 16, 2, 0, SERV_T, SYST_M, "BIOS" }, { BIOS_PROC_NR, 0, SERV_F, 16, 2, 0, SERV_T, SYST_M, "BIOS" },
#endif #endif
{ INIT_PROC_NR, 0, USER_F, 8, USER_Q, 0, USER_T, USER_M, "INIT" }, { INIT_PROC_NR, 0, USER_F, 8, USER_Q, 0, USER_T, USER_M, "INIT" },
}; };

View File

@ -7,18 +7,18 @@
* *
* This file contains the routines that take care of kernel messages, i.e., * This file contains the routines that take care of kernel messages, i.e.,
* diagnostic output within the kernel. Kernel messages are not directly * diagnostic output within the kernel. Kernel messages are not directly
* displayed on the console, because this must be done by the PRINT driver. * displayed on the console, because this must be done by the output driver.
* Instead, the kernel accumulates characters in a buffer and notifies the * Instead, the kernel accumulates characters in a buffer and notifies the
* output driver when a new message is ready. * output driver when a new message is ready.
*/ */
#include <stdarg.h> #include <minix/com.h>
#include "kernel.h" #include "kernel.h"
#include <stdarg.h>
#include <unistd.h> #include <unistd.h>
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <signal.h> #include <signal.h>
#include <minix/com.h>
#include "proc.h" #include "proc.h"
#define END_OF_KMESS -1 #define END_OF_KMESS -1
@ -130,7 +130,7 @@ PRIVATE void kputc(c)
int c; /* character to append */ int c; /* character to append */
{ {
/* Accumulate a single character for a kernel message. Send a notification /* Accumulate a single character for a kernel message. Send a notification
* the to PRINTF_PROC driver if an END_OF_KMESS is encountered. * the to output driver if an END_OF_KMESS is encountered.
*/ */
if (c != END_OF_KMESS) { if (c != END_OF_KMESS) {
kmess.km_buf[kmess.km_next] = c; /* put normal char in buffer */ kmess.km_buf[kmess.km_next] = c; /* put normal char in buffer */
@ -138,7 +138,7 @@ int c; /* character to append */
kmess.km_size += 1; kmess.km_size += 1;
kmess.km_next = (kmess.km_next + 1) % KMESS_BUF_SIZE; kmess.km_next = (kmess.km_next + 1) % KMESS_BUF_SIZE;
} else { } else {
send_sig(PRINTF_PROC, SIGKMESS); send_sig(OUTPUT_PROC_NR, SIGKMESS);
} }
} }

View File

@ -18,7 +18,7 @@ int *sfkeys; /* bit masks for Shift F1-F12 keys */
m.FKEY_REQUEST = request; m.FKEY_REQUEST = request;
m.FKEY_FKEYS = (fkeys) ? *fkeys : 0; m.FKEY_FKEYS = (fkeys) ? *fkeys : 0;
m.FKEY_SFKEYS = (sfkeys) ? *sfkeys : 0; m.FKEY_SFKEYS = (sfkeys) ? *sfkeys : 0;
s = _taskcall(TTY, FKEY_CONTROL, &m); s = _taskcall(TTY_PROC_NR, FKEY_CONTROL, &m);
if (fkeys) *fkeys = m.FKEY_FKEYS; if (fkeys) *fkeys = m.FKEY_FKEYS;
if (sfkeys) *sfkeys = m.FKEY_SFKEYS; if (sfkeys) *sfkeys = m.FKEY_SFKEYS;
return(s); return(s);

View File

@ -16,19 +16,18 @@ void kputc(c)
int c; int c;
{ {
/* Accumulate another character. If 0 or buffer full, print it. */ /* Accumulate another character. If 0 or buffer full, print it. */
static int buf_count; /* # characters in the buffer */ static int buf_count; /* # characters in the buffer */
static char print_buf[80]; /* output is buffered here */ static char print_buf[80]; /* output is buffered here */
message m; message m;
if ((c == 0 && buf_count > 0) || buf_count == sizeof(print_buf)) { if ((c == 0 && buf_count > 0) || buf_count == sizeof(print_buf)) {
/* Send the buffer to the PRINTF_PROC driver. */ /* Send the buffer to the OUTPUT_PROC_NR driver. */
m.DIAG_BUF_COUNT = buf_count; m.DIAG_BUF_COUNT = buf_count;
m.DIAG_PRINT_BUF = print_buf; m.DIAG_PRINT_BUF = print_buf;
m.DIAG_PROC_NR = SELF; m.DIAG_PROC_NR = SELF;
m.m_type = DIAGNOSTICS; m.m_type = DIAGNOSTICS;
(void) _sendrec(PRINTF_PROC, &m); (void) _sendrec(OUTPUT_PROC_NR, &m);
buf_count = 0; buf_count = 0;
/* If the output fails, e.g., due to an ELOCKED, do not retry output /* If the output fails, e.g., due to an ELOCKED, do not retry output

View File

@ -29,23 +29,23 @@
*/ */
struct dmap dmap[NR_DEVICES] = { struct dmap dmap[NR_DEVICES] = {
DT(1, no_dev, 0, 0, 0) /* 0 = not used */ DT(1, no_dev, 0, 0, 0) /* 0 = not used */
DT(1, gen_opcl, gen_io, MEMORY, 0) /* 1 = /dev/mem */ DT(1, gen_opcl, gen_io, MEM_PROC_NR, 0) /* 1 = /dev/mem */
DT(ENABLE_FLOPPY, gen_opcl, gen_io, NONE, DMAP_MUTABLE) /* 2 = /dev/fd0 */ DT(ENABLE_FLOPPY, gen_opcl, gen_io, NONE, DMAP_MUTABLE) /* 2 = /dev/fd0 */
DT(NR_CTRLRS >= 1, gen_opcl, gen_io, CTRLR(0),DMAP_MUTABLE) /* 3 = /dev/c0 */ DT(NR_CTRLRS >= 1, gen_opcl, gen_io, CTRLR(0),DMAP_MUTABLE) /* 3 = /dev/c0 */
DT(1, tty_opcl, gen_io, TTY, 0) /* 4 = /dev/tty00 */ DT(1, tty_opcl, gen_io, TTY_PROC_NR, 0) /* 4 = /dev/tty00 */
DT(1, ctty_opcl,ctty_io,TTY, 0) /* 5 = /dev/tty */ DT(1, ctty_opcl,ctty_io,TTY_PROC_NR, 0) /* 5 = /dev/tty */
DT(ENABLE_PRINTER, gen_opcl, gen_io, NONE, DMAP_MUTABLE) /* 6 = /dev/lp */ DT(ENABLE_PRINTER, gen_opcl, gen_io, NONE, DMAP_MUTABLE) /* 6 = /dev/lp */
#if (MACHINE == IBM_PC) #if (MACHINE == IBM_PC)
DT(1, no_dev, 0, 0, DMAP_MUTABLE) /* 7 = /dev/ip */ DT(1, no_dev, 0, 0, DMAP_MUTABLE) /* 7 = /dev/ip */
DT(NR_CTRLRS >= 2, gen_opcl, gen_io, CTRLR(1),DMAP_MUTABLE) /* 8 = /dev/c1 */ DT(NR_CTRLRS >= 2, gen_opcl, gen_io, CTRLR(1),DMAP_MUTABLE) /* 8 = /dev/c1 */
DT(0, 0, 0, 0, DMAP_MUTABLE) /* 9 = not used */ DT(0, 0, 0, 0, DMAP_MUTABLE) /* 9 = not used */
DT(NR_CTRLRS >= 3, gen_opcl, gen_io, CTRLR(2),DMAP_MUTABLE) /*10 = /dev/c2 */ DT(NR_CTRLRS >= 3, gen_opcl, gen_io, CTRLR(2),DMAP_MUTABLE) /*10 = /dev/c2 */
DT(0, 0, 0, 0, DMAP_MUTABLE) /*11 = not used */ DT(0, 0, 0, 0, DMAP_MUTABLE) /*11 = not used */
DT(NR_CTRLRS >= 4, gen_opcl, gen_io, CTRLR(3),DMAP_MUTABLE) /*12 = /dev/c3 */ DT(NR_CTRLRS >= 4, gen_opcl, gen_io, CTRLR(3),DMAP_MUTABLE) /*12 = /dev/c3 */
DT(ENABLE_SB16, gen_opcl, gen_io, NONE, DMAP_MUTABLE) /*13 = /dev/audio */ DT(ENABLE_SB16, gen_opcl, gen_io, NONE, DMAP_MUTABLE) /*13 = /dev/audio */
DT(ENABLE_SB16, gen_opcl, gen_io, NONE, DMAP_MUTABLE) /*14 = /dev/mixer */ DT(ENABLE_SB16, gen_opcl, gen_io, NONE, DMAP_MUTABLE) /*14 = /dev/mixer */
DT(1, gen_opcl, gen_io, LOG_PROC_NR, 0) /* 15 = /dev/klog */ DT(1, gen_opcl, gen_io, LOG_PROC_NR, 0) /*15 = /dev/klog */
#endif /* IBM_PC */ #endif /* IBM_PC */
}; };

View File

@ -344,7 +344,7 @@ PRIVATE void load_ram(void)
m_out.DEVICE = RAM_DEV; m_out.DEVICE = RAM_DEV;
m_out.REQUEST = MIOCRAMSIZE; /* I/O control to use */ m_out.REQUEST = MIOCRAMSIZE; /* I/O control to use */
m_out.POSITION = (ram_size_kb * 1024); /* request in bytes */ m_out.POSITION = (ram_size_kb * 1024); /* request in bytes */
if ((s=sendrec(MEMORY, &m_out)) != OK) if ((s=sendrec(MEM_PROC_NR, &m_out)) != OK)
panic("FS","sendrec from MEM failed", s); panic("FS","sendrec from MEM failed", s);
else if (m_out.REP_STATUS != OK) { else if (m_out.REP_STATUS != OK) {
/* Report and continue, unless RAM disk is required as root FS. */ /* Report and continue, unless RAM disk is required as root FS. */

View File

@ -25,7 +25,7 @@ PUBLIC int do_fkey_pressed(message *m)
*/ */
m->m_type = FKEY_CONTROL; m->m_type = FKEY_CONTROL;
m->FKEY_REQUEST = FKEY_EVENTS; m->FKEY_REQUEST = FKEY_EVENTS;
if (OK != (s=sendrec(TTY, m))) if (OK != (s=sendrec(TTY_PROC_NR, m)))
report("IS", "warning, sendrec to TTY failed", s); report("IS", "warning, sendrec to TTY failed", s);
/* Now check which keys were pressed: F1-F12. */ /* Now check which keys were pressed: F1-F12. */

View File

@ -146,7 +146,7 @@ PRIVATE void pm_init()
SIGEMT, SIGFPE, SIGUSR1, SIGSEGV, SIGUSR2 }; SIGEMT, SIGFPE, SIGUSR1, SIGSEGV, SIGUSR2 };
static char ign_sigs[] = { SIGCHLD }; static char ign_sigs[] = { SIGCHLD };
static int protected[] = {PM_PROC_NR, FS_PROC_NR, SM_PROC_NR, static int protected[] = {PM_PROC_NR, FS_PROC_NR, SM_PROC_NR,
TTY, AT_WINI, MEMORY}; TTY_PROC_NR, AT_PROC_NR, MEM_PROC_NR};
register struct mproc *rmp; register struct mproc *rmp;
register char *sig_ptr; register char *sig_ptr;
phys_clicks total_clicks, minix_clicks, free_clicks; phys_clicks total_clicks, minix_clicks, free_clicks;