OUTPUT_PROCS_ARRAY in <minix/config.h>, in that order, terminated by NONE.
log no longer forwards messages to tty itself. This leads to less funny
loops and more robust debug-message handling. Also the list of
processes receiving messages can easily be changed around or disabled by
editing the array (e.g. disable it by changing the array to { NONE }.).
cd $d/libdriver && $(MAKE)
# install with other drivers
-install: /usr/sbin/$(DRIVER)
-/usr/sbin/$(DRIVER): $(DRIVER)
+install: /sbin/$(DRIVER)
+/sbin/$(DRIVER): $(DRIVER)
install -o root -cs $? $@
# clean up local files
* user. It also saves a copy in a local buffer so that messages can be
* reviewed at a later time.
*/
- int result;
int proc_nr;
vir_bytes src;
int count;
int i = 0;
static char diagbuf[10240];
- /* Forward the message to the TTY driver. Inform the TTY driver about the
- * original sender, so that it knows where the buffer to be printed is.
- * The message type, DIAGNOSTICS, remains the same.
- */
+ /* Change SELF to actual process number. */
if ((proc_nr = m->DIAG_PROC_NR) == SELF)
m->DIAG_PROC_NR = proc_nr = m->m_source;
- 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.
}
log_append(diagbuf, i);
- return result;
+ return OK;
}
#define ENABLE_BINCOMPAT 0 /* for binaries using obsolete calls */
#define ENABLE_SRCCOMPAT 0 /* for sources using obsolete calls */
-/* Which process should receive diagnostics from the kernel and system?
+/* Which processes should receive diagnostics from the kernel and system?
* Directly sending it to TTY only displays the output. Sending it to the
* log driver will cause the diagnostics to be buffered and displayed.
+ * Messages are sent by src/lib/sysutil/kputc.c to these processes, in
+ * the order of this array, which must be terminated by NONE. This is used
+ * by drivers and servers that printf().
+ * The kernel does this for its own kprintf() in kernel/utility.c, also using
+ * this array, but a slightly different mechanism.
*/
-#define OUTPUT_PROC_NR LOG_PROC_NR /* TTY_PROC_NR or LOG_PROC_NR */
+#define OUTPUT_PROCS_ARRAY { TTY_PROC_NR, LOG_PROC_NR, NONE }
/* NR_CONS, NR_RS_LINES, and NR_PTYS determine the number of terminals the
* system can handle.
kmess.km_size += 1;
kmess.km_next = (kmess.km_next + 1) % KMESS_BUF_SIZE;
} else {
- send_sig(OUTPUT_PROC_NR, SIGKMESS);
+ int p, outprocs[] = OUTPUT_PROCS_ARRAY;
+ for(p = 0; outprocs[p] != NONE; p++) {
+ send_sig(outprocs[p], SIGKMESS);
+ }
}
}
message m;
if ((c == 0 && buf_count > 0) || buf_count == sizeof(print_buf)) {
+ int procs[] = OUTPUT_PROCS_ARRAY;
+ int p;
- /* 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(OUTPUT_PROC_NR, &m);
+ for(p = 0; procs[p] != NONE; p++) {
+ /* Send the buffer to this output driver. */
+ m.DIAG_BUF_COUNT = buf_count;
+ m.DIAG_PRINT_BUF = print_buf;
+ m.DIAG_PROC_NR = SELF;
+ m.m_type = DIAGNOSTICS;
+ (void) _sendrec(procs[p], &m);
+ }
buf_count = 0;
/* If the output fails, e.g., due to an ELOCKED, do not retry output