From b69ca94efbde1473fad053fc9031d52ad69daf0c Mon Sep 17 00:00:00 2001 From: Jorrit Herder Date: Wed, 3 Aug 2005 08:14:08 +0000 Subject: [PATCH] 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. --- drivers/log/diag.c | 2 +- drivers/log/kputc.c | 6 +++--- drivers/log/log.c | 25 ++++++++++++++++--------- include/minix/com.h | 10 +++++----- include/minix/config.h | 2 +- kernel/ipc.h | 3 ++- kernel/main.c | 2 +- kernel/table.c | 8 ++++---- kernel/utility.c | 10 +++++----- lib/sysutil/fkey_ctl.c | 2 +- lib/sysutil/kputc.c | 5 ++--- servers/fs/dmap.c | 28 ++++++++++++++-------------- servers/fs/main.c | 2 +- servers/is/dmp.c | 2 +- servers/pm/main.c | 2 +- 15 files changed, 58 insertions(+), 51 deletions(-) diff --git a/drivers/log/diag.c b/drivers/log/diag.c index 2cce4157a..f25bee6d4 100644 --- a/drivers/log/diag.c +++ b/drivers/log/diag.c @@ -90,7 +90,7 @@ PUBLIC int do_diagnostics(message *m) */ if ((proc_nr = m->DIAG_PROC_NR) == SELF) 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 * that the messages can be reviewed at a later time. diff --git a/drivers/log/kputc.c b/drivers/log/kputc.c index 527118123..c75ec5a2c 100644 --- a/drivers/log/kputc.c +++ b/drivers/log/kputc.c @@ -25,9 +25,9 @@ int c; m.DIAG_BUF_COUNT = buf_count; m.DIAG_PRINT_BUF = print_buf; m.DIAG_PROC_NR = SELF; - m.m_type = DIAGNOSTICS; /* request TTY to output this buffer */ - _sendrec(TTY, &m); /* if it fails, we cannot do better */ - buf_count = 0; /* clear buffer for next batch */ + m.m_type = DIAGNOSTICS; /* request TTY to output this buffer */ + _sendrec(TTY_PROC_NR, &m); /* if it fails, we give up */ + buf_count = 0; /* clear buffer for next batch */ } if (c != 0) { print_buf[buf_count++] = c; diff --git a/drivers/log/log.c b/drivers/log/log.c index 67795bb8a..24b7794b5 100644 --- a/drivers/log/log.c +++ b/drivers/log/log.c @@ -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_cancel, (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( void log_geometry, (struct partition *entry) ); 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 */ nop_cleanup, /* no need to clean up */ log_geometry, /* geometry */ - nop_signal, /* no need to clean up on shutdown */ + log_signal, /* handle system signal */ nop_alarm, /* no alarm */ log_cancel, /* CANCEL request */ log_select, /* DEV_SELECT request */ @@ -403,6 +404,20 @@ PRIVATE void do_status(message *m_ptr) 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 * *============================================================================*/ @@ -420,14 +435,6 @@ message *m_ptr; r = do_diagnostics(m_ptr); 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: { do_status(m_ptr); r = EDONTREPLY; diff --git a/include/minix/com.h b/include/minix/com.h index 8a650b4b3..472605286 100755 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -39,11 +39,11 @@ #define PM_PROC_NR 0 /* process manager */ #define FS_PROC_NR 1 /* file system */ #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 TTY 5 /* terminal (TTY) driver */ -#define AT_WINI 6 /* AT Winchester */ -#define BIOS_WINI 7 /* BIOS disk device */ +#define TTY_PROC_NR 5 /* terminal (TTY) driver */ +#define AT_PROC_NR 6 /* AT Winchester */ +#define BIOS_PROC_NR 7 /* BIOS disk device */ #define INIT_PROC_NR 8 /* init -- goes multiuser */ /* Number of processes contained in the system image. */ @@ -66,7 +66,7 @@ # define SYS_SIG NOTIFY_FROM(SYSTEM) /* system signal */ # define HARD_INT NOTIFY_FROM(HARDWARE) /* hardware interrupt */ # 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 DEV_SELECTED (NOTIFICATION | 5) /* select() notification */ diff --git a/include/minix/config.h b/include/minix/config.h index d69342804..8af7ccf49 100755 --- a/include/minix/config.h +++ b/include/minix/config.h @@ -96,7 +96,7 @@ * Directly sending it to TTY only displays the output. Sending it to the * 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 * system can handle. diff --git a/kernel/ipc.h b/kernel/ipc.h index 04b86acd7..8e2a9651d 100644 --- a/kernel/ipc.h +++ b/kernel/ipc.h @@ -40,7 +40,8 @@ #define SERV_M (~0) #define SYST_M (~0) #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. */ extern int dummy[(BITCHUNK_BITS-NR_TASKS > INIT_PROC_NR) ? 1 : -1]; diff --git a/kernel/main.c b/kernel/main.c index 51d943065..fd873fe18 100755 --- a/kernel/main.c +++ b/kernel/main.c @@ -196,7 +196,7 @@ int how; */ if (how == RBT_PANIC) { 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 */ } diff --git a/kernel/table.c b/kernel/table.c index 466c4e9f9..3f245fce9 100755 --- a/kernel/table.c +++ b/kernel/table.c @@ -75,14 +75,14 @@ PUBLIC struct boot_image image[] = { { 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" }, { 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" }, - { MEMORY, 0, SERV_F, 16, 2, 0, SERV_T, DRIV_M, "MEMORY" }, + { TTY_PROC_NR, 0, SERV_F, 16, 1, 0, SERV_T, SYST_M, "TTY" }, + { 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" }, #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 #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 { INIT_PROC_NR, 0, USER_F, 8, USER_Q, 0, USER_T, USER_M, "INIT" }, }; diff --git a/kernel/utility.c b/kernel/utility.c index 9f8073623..ceb11ba43 100755 --- a/kernel/utility.c +++ b/kernel/utility.c @@ -7,18 +7,18 @@ * * This file contains the routines that take care of kernel messages, i.e., * 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 * output driver when a new message is ready. */ -#include +#include #include "kernel.h" +#include #include #include #include #include -#include #include "proc.h" #define END_OF_KMESS -1 @@ -130,7 +130,7 @@ PRIVATE void kputc(c) int c; /* character to append */ { /* 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) { 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_next = (kmess.km_next + 1) % KMESS_BUF_SIZE; } else { - send_sig(PRINTF_PROC, SIGKMESS); + send_sig(OUTPUT_PROC_NR, SIGKMESS); } } diff --git a/lib/sysutil/fkey_ctl.c b/lib/sysutil/fkey_ctl.c index 0de98f90f..38ea0f209 100644 --- a/lib/sysutil/fkey_ctl.c +++ b/lib/sysutil/fkey_ctl.c @@ -18,7 +18,7 @@ int *sfkeys; /* bit masks for Shift F1-F12 keys */ m.FKEY_REQUEST = request; m.FKEY_FKEYS = (fkeys) ? *fkeys : 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 (sfkeys) *sfkeys = m.FKEY_SFKEYS; return(s); diff --git a/lib/sysutil/kputc.c b/lib/sysutil/kputc.c index 5d3918fd2..0a52c2dc8 100644 --- a/lib/sysutil/kputc.c +++ b/lib/sysutil/kputc.c @@ -16,19 +16,18 @@ void kputc(c) int c; { /* Accumulate another character. If 0 or buffer full, print it. */ - static int buf_count; /* # characters in the buffer */ static char print_buf[80]; /* output is buffered here */ message m; 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_PRINT_BUF = print_buf; m.DIAG_PROC_NR = SELF; m.m_type = DIAGNOSTICS; - (void) _sendrec(PRINTF_PROC, &m); + (void) _sendrec(OUTPUT_PROC_NR, &m); buf_count = 0; /* If the output fails, e.g., due to an ELOCKED, do not retry output diff --git a/servers/fs/dmap.c b/servers/fs/dmap.c index d6f668c1a..8d3655d5c 100644 --- a/servers/fs/dmap.c +++ b/servers/fs/dmap.c @@ -29,23 +29,23 @@ */ struct dmap dmap[NR_DEVICES] = { DT(1, no_dev, 0, 0, 0) /* 0 = not used */ - DT(1, gen_opcl, gen_io, MEMORY, 0) /* 1 = /dev/mem */ - 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(1, tty_opcl, gen_io, TTY, 0) /* 4 = /dev/tty00 */ - DT(1, ctty_opcl,ctty_io,TTY, 0) /* 5 = /dev/tty */ + 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(NR_CTRLRS >= 1, gen_opcl, gen_io, CTRLR(0),DMAP_MUTABLE) /* 3 = /dev/c0 */ + DT(1, tty_opcl, gen_io, TTY_PROC_NR, 0) /* 4 = /dev/tty00 */ + 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 */ #if (MACHINE == IBM_PC) - 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(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(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(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(1, gen_opcl, gen_io, LOG_PROC_NR, 0) /* 15 = /dev/klog */ + 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(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(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(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(1, gen_opcl, gen_io, LOG_PROC_NR, 0) /*15 = /dev/klog */ #endif /* IBM_PC */ }; diff --git a/servers/fs/main.c b/servers/fs/main.c index fc44250a2..1b8d01ba0 100644 --- a/servers/fs/main.c +++ b/servers/fs/main.c @@ -344,7 +344,7 @@ PRIVATE void load_ram(void) m_out.DEVICE = RAM_DEV; m_out.REQUEST = MIOCRAMSIZE; /* I/O control to use */ 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); else if (m_out.REP_STATUS != OK) { /* Report and continue, unless RAM disk is required as root FS. */ diff --git a/servers/is/dmp.c b/servers/is/dmp.c index 7751e86e2..866ced590 100644 --- a/servers/is/dmp.c +++ b/servers/is/dmp.c @@ -25,7 +25,7 @@ PUBLIC int do_fkey_pressed(message *m) */ m->m_type = FKEY_CONTROL; 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); /* Now check which keys were pressed: F1-F12. */ diff --git a/servers/pm/main.c b/servers/pm/main.c index 14ee0f651..ec49e9ce6 100644 --- a/servers/pm/main.c +++ b/servers/pm/main.c @@ -146,7 +146,7 @@ PRIVATE void pm_init() SIGEMT, SIGFPE, SIGUSR1, SIGSEGV, SIGUSR2 }; static char ign_sigs[] = { SIGCHLD }; 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 char *sig_ptr; phys_clicks total_clicks, minix_clicks, free_clicks;