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)
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.

View file

@ -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;

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_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;

View file

@ -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 */

View file

@ -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.

View file

@ -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];

View file

@ -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 */
}

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" },
{ 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" },
};

View file

@ -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 <stdarg.h>
#include <minix/com.h>
#include "kernel.h"
#include <stdarg.h>
#include <unistd.h>
#include <stddef.h>
#include <stdlib.h>
#include <signal.h>
#include <minix/com.h>
#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);
}
}

View file

@ -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);

View file

@ -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

View file

@ -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 */
};

View file

@ -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. */

View file

@ -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. */

View file

@ -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;