/** * Write log directly to the disk by sending message to FS. * * @param fmt The format string. * * @return How many chars have been printed. *****************************************************************************/ PUBLIC int syslog(const char *fmt, ...) { int i; char buf[STR_DEFAULT_LEN]; va_list arg = (va_list)((char*)(&fmt) + 4); /** * 4: size of `fmt' in * the stack */ i = vsprintf(buf, fmt, arg); assert(strlen(buf) == i); return disklog(buf); }
/** * Perform syslog() system call . * * @return *****************************************************************************/ PUBLIC int do_disklog() { char buf[STR_DEFAULT_LEN]; /* get parameters from the message */ int str_len = fs_msg.CNT; /* length of filename */ int src = fs_msg.source; /* caller proc nr. */ assert(str_len < STR_DEFAULT_LEN); phys_copy((void*)va2la(TASK_FS, buf), /* to */ (void*)va2la(src, fs_msg.BUF), /* from */ str_len); buf[str_len] = 0; /* terminate the string */ return disklog(buf); }