all build: $(DRIVER)
$(DRIVER): $(OBJ) $(LIBDRIVER)
$(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBDRIVER) $(LIBS)
- install -S 64w $(DRIVER)
+ install -S 4kb $(DRIVER)
$(LIBDRIVER):
cd $d/libdriver && $(MAKE)
i=0;
while (bytes > 0) {
print_buf[i] = kmess.km_buf[(r%KMESS_BUF_SIZE)];
- log_putc( kmess.km_buf[(r%KMESS_BUF_SIZE)] );
bytes --;
r ++;
i ++;
}
/* Now terminate the new message and print it. */
print_buf[i] = 0;
- printf(print_buf);
+ printf("%s", print_buf);
+ log_append(print_buf, i);
}
/* Almost done, store 'next' so that we can determine what part of the
int count;
char c;
int i = 0;
- static char diagbuf[1024];
+ 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.
*/
src = (vir_bytes) m->DIAG_PRINT_BUF;
count = m->DIAG_BUF_COUNT;
- while (count > 0) {
+ while (count > 0 && i < sizeof(diagbuf)-1) {
if (sys_datacopy(proc_nr, src, SELF, (vir_bytes) &c, 1) != OK)
break; /* stop copying on error */
- log_putc(c); /* accumulate character */
src ++;
count --;
+ diagbuf[i++] = c;
}
+ log_append(diagbuf, i);
return result;
}
-
-
-/*===========================================================================*
- * log_putc *
- *===========================================================================*/
-PUBLIC void log_putc(c)
-int c; /* char to be added to diag buffer */
-{
-
-}
-
-
-
count = LOG_SIZE - log->log_write;
buf = log->log_buffer + log->log_write;
- if((r=sys_vircopy(proc_nr,D,user_vir, SELF,D,(int)buf, count)) != OK)
- return r;
+ if(proc_nr == SELF) {
+ memcpy(buf, (char *) user_vir, count);
+ }
+ else {
+ if((r=sys_vircopy(proc_nr,D,user_vir, SELF,D,(int)buf, count)) != OK)
+ return r;
+ }
LOGINC(log->log_write, count);
log->log_size += count;
return count;
}
+/*===========================================================================*
+ * log_append *
+ *===========================================================================*/
+PUBLIC void
+log_append(char *buf, int count)
+{
+ int w = 0, skip = 0;
+
+ if(count < 1) return;
+ if(count > LOG_SIZE) skip = count - LOG_SIZE;
+ count -= skip;
+ buf += skip;
+ w = subwrite(&logdevices[0], count, SELF, (vir_bytes) buf);
+
+ if(w > 0 && w < count)
+ subwrite(&logdevices[0], count-w, SELF, (vir_bytes) buf+w);
+ return;
+}
+
/*===========================================================================*
* subread *
*===========================================================================*/
/* There's already someone hanging to read, or
* no real I/O requested.
*/
-#if LOG_DEBUG
- printf("someone (%d) is already blocking\n", log->log_proc_nr);
-#endif
return(OK);
}
}
/*============================================================================*
- * log_select *
+ * log_other *
*============================================================================*/
PRIVATE int log_other(dp, m_ptr)
struct driver *dp;
_PROTOTYPE( void kputc, (int c) );
_PROTOTYPE( int do_new_kmess, (message *m) );
_PROTOTYPE( int do_diagnostics, (message *m) );
-_PROTOTYPE( void log_putc, (int c) );
-
+_PROTOTYPE( void log_append, (char *buf, int len) );