void en_print(const char *level, const struct mlx4_en_priv *priv, const char *format, ...) { #if 0 // AKAROS_PORT va_list args; struct va_format vaf; va_start(args, format); vaf.fmt = format; vaf.va = &args; if (priv->registered) printk("%s%s: %s: %pV", level, DRV_NAME, priv->dev->name, &vaf); else printk("%s%s: %s: Port %d: %pV", level, DRV_NAME, dev_name(&priv->mdev->pdev->dev), priv->port, &vaf); va_end(args); #else va_list args; va_start(args, format); if (priv->registered) printk("%s%s: %s: ", level, DRV_NAME, priv->dev->name); else printk("%s%s: %s: Port %d: ", level, DRV_NAME, dev_name(&priv->mdev->pdev->dev), priv->port); vcprintf(format, args); va_end(args); #endif }
void cprintf(const char *fmt, ...) { va_list ap; va_start(ap, fmt); vcprintf(fmt, ap); va_end(ap); }
/* * * cprintf - formats a string and writes it to stdout * * The return value is the number of characters which would be * written to stdout. * */ int cprintf(const char *fmt, ...) { va_list ap; int cnt; va_start(ap, fmt); cnt = vcprintf(fmt, ap); va_end(ap); return cnt; }
int cprintf(const char *fmt, ...) { int n; va_list ap; va_start(ap, fmt); n = vcprintf(fmt, ap); va_end(ap); return n; }
/* __warn - like panic, but don't */ void __warn(const char *file, int line, const char *fmt, ...) { va_list ap; va_start(ap, fmt); cprintf("kernel warning at %s:%d:\n ", file, line); vcprintf(fmt, ap); cprintf("\n"); va_end(ap); }
/* Emit a NUL-terminated string of text, returning the number of * characters emitted. */ static int emit_text_ni (const char * s, hBSP430halSERIAL uart) { int rv = 0; if (uart) { while (s[rv]) { emit_char2_ni(s[rv++], uart); BSP430_CORE_WATCHDOG_CLEAR(); } } return rv; } int cputs (const char * s) { int rv = 0; hBSP430halSERIAL uart = console_hal_; BSP430_CORE_INTERRUPT_STATE_T istate; if (! uart) { return 0; } BSP430_CORE_SAVE_INTERRUPT_STATE(istate); BSP430_CORE_DISABLE_INTERRUPT(); rv = emit_text_ni(s, uart); emit_char2_ni('\n', uart); BSP430_CORE_RESTORE_INTERRUPT_STATE(istate); return 1+rv; } int cputtext_ni (const char * s) { return emit_text_ni(s, console_hal_); } #if configBSP430_CONSOLE_LIBC_HAS_ITOA - 0 int cputi_ni (int n, int radix) { char buffer[sizeof("-32767")]; return emit_text_ni(itoa(n, buffer, radix), console_hal_); } #endif /* configBSP430_CONSOLE_LIBC_HAS_ITOA */ #if configBSP430_CONSOLE_LIBC_HAS_UTOA - 0 int cputu_ni (unsigned int n, int radix) { char buffer[sizeof("65535")]; return emit_text_ni(utoa(n, buffer, radix), console_hal_); } #endif /* configBSP430_CONSOLE_LIBC_HAS_UTOA */ #if configBSP430_CONSOLE_LIBC_HAS_LTOA - 0 int cputl_ni (long n, int radix) { char buffer[sizeof("-2147483647")]; return emit_text_ni(ltoa(n, buffer, radix), console_hal_); } #endif /* configBSP430_CONSOLE_LIBC_HAS_LTOA */ #if configBSP430_CONSOLE_LIBC_HAS_ULTOA - 0 int cputul_ni (unsigned long n, int radix) { char buffer[sizeof("4294967295")]; return emit_text_ni(ultoa(n, buffer, radix), console_hal_); } #endif /* configBSP430_CONSOLE_LIBC_HAS_ULTOA */ #if configBSP430_CONSOLE_LIBC_HAS_VUPRINTF - 0 int #if __GNUC__ - 0 __attribute__((__format__(printf, 1, 2))) #endif /* __GNUC__ */ cprintf (const char *fmt, ...) { int rv; va_list argp; va_start(argp, fmt); rv = vcprintf(fmt, argp); va_end(argp); return rv; }
/* like panic, but don't */ void _warn(const char *file, int line, const char *fmt,...) { va_list ap; va_start(ap, fmt); printk("kernel warning at %s:%d, from core %d: ", file, line, core_id_early()); vcprintf(fmt, ap); cprintf("\n"); va_end(ap); }
int atomic_cprintf(const char *fmt, ...) { sys_disable_interrupt(); va_list ap; int cnt; va_start(ap, fmt); cnt = vcprintf(fmt, ap); va_end(ap); sys_enable_interrupt(); return cnt; }
static void panic(const char *fmt, ...) { va_list ap; cprintf("SYSTEM: "); va_start(ap, fmt); vcprintf(fmt, ap); va_end(ap); cprintf("\n"); for (;;) ; }
/* * Panic is called on unresolvable fatal errors. * It prints "panic: <message>", then causes a breakpoint exception, * which causes JOS to enter the JOS kernel monitor. */ void _panic(const char *file, int line, const char *fmt,...) { va_list ap; va_start(ap, fmt); // Print the panic message cprintf("%s: user panic at %s:%d: ", binaryname, file, line); vcprintf(fmt, ap); cprintf("\n"); // Cause a breakpoint exception while (1) asm volatile("int3"); }
void verr_printf(const char *fmt, va_list ap) { uval isDisabled; isDisabled = Scheduler::IsDisabled(); if (!isDisabled) { Scheduler::Disable(); } ALLOW_PRIMITIVE_PPC(); vcprintf(fmt, ap); UN_ALLOW_PRIMITIVE_PPC(); if (!isDisabled) { Scheduler::Enable(); } }
int readline(char *buf, size_t buf_l, const char *prompt, ...) { static spinlock_t readline_lock = SPINLOCK_INITIALIZER_IRQSAVE; int i, c, echoing, retval; va_list ap; spin_lock_irqsave(&readline_lock); va_start(ap, prompt); if (prompt != NULL) vcprintf(prompt, ap); va_end(ap); i = 0; echoing = iscons(0); while (1) { c = getchar(); if (c < 0) { printk("read error: %e\n", c); /* %e! */ retval = i; break; } else if (c == '\b' || c == 0x7f) { if (i > 0) { if (echoing) cputchar(c); i--; } continue; } else if (c == '\n' || c == '\r') { /* sending a \n regardless, since the serial port gives us a \r for * carriage returns. */ if (echoing) cputchar('\n'); assert(i <= buf_l - 1); /* never write to buf_l - 1 til the end */ buf[i++] = c; retval = i; break; } else if (c >= ' ' && i < buf_l - 1) { if (echoing) cputchar(c); buf[i++] = c; } } spin_unlock_irqsave(&readline_lock); return retval; }
/* * Panic is called on unresolvable fatal errors. * It prints "panic: mesg", and then enters the kernel monitor. */ void _panic(const char *file, int line, const char *fmt,...) { va_list ap; if (panicstr) goto dead; panicstr = fmt; va_start(ap, fmt); cprintf("kernel panic at %s:%d: ", file, line); vcprintf(fmt, ap); cprintf("\n"); va_end(ap); dead: /* break into the kernel monitor */ while (1) monitor(NULL); }
/* * Panic is called on unresolvable fatal errors. * It prints "panic: <message>", then causes a breakpoint exception, * which causes JOS to enter the JOS kernel monitor. */ void _panic (const char *file, int line, const char *fmt, ...) { va_list ap; va_start (ap, fmt); // Print the panic message if (argv0) cprintf ("%s: ", argv0); cprintf ("[%08x] user panic in %s at %s:%d: ", sys_getenvid (), binaryname, file, line); vcprintf (fmt, ap); cprintf ("\n"); // Cause a breakpoint exception while (1) asm volatile ("int3"); }
/* * * __panic - __panic is called on unresolvable fatal errors. it prints * "panic: 'message'", and then enters the kernel monitor. * */ void __panic(const char *file, int line, const char *fmt, ...) { if (is_panic) { goto panic_dead; } is_panic = 1; // print the 'message' va_list ap; va_start(ap, fmt); cprintf("kernel panic at %s:%d:\n ", file, line); vcprintf(fmt, ap); cprintf("\n"); va_end(ap); panic_dead: intr_disable(); while (1) { kmonitor(NULL); } }
/* * Panic is called on unresolvable fatal errors. * It prints "panic: mesg", and then enters the kernel monitor. */ void _panic(const char *file, int line, const char *fmt,...) { va_list ap; struct per_cpu_info *pcpui; /* We're panicing, possibly in a place that can't handle the lock checker */ pcpui = &per_cpu_info[core_id_early()]; pcpui->__lock_checking_enabled--; va_start(ap, fmt); printk("kernel panic at %s:%d, from core %d: ", file, line, core_id_early()); vcprintf(fmt, ap); cprintf("\n"); va_end(ap); dead: monitor(NULL); /* We could consider turning the lock checker back on here, but things are * probably a mess anyways, and with it on we would probably lock up right * away when we idle. */ //pcpui->__lock_checking_enabled++; smp_idle(); }
/* * Panic is called on unresolvable fatal errors. * It prints "panic: mesg", and then enters the kernel monitor. */ void _panic(const char *file, int line, const char *fmt,...) { va_list ap; if (panicstr) goto dead; panicstr = fmt; // Be extra sure that the machine is in as reasonable state __asm __volatile("cli; cld"); va_start(ap, fmt); cprintf("kernel panic on CPU %d at %s:%d: ", cpunum(), file, line); vcprintf(fmt, ap); cprintf("\n"); va_end(ap); dead: /* break into the kernel monitor */ while (1) monitor(NULL); }
void Console::cprintf(const char *format, ...){ va_list argptr; va_start(argptr, format); vcprintf(format, argptr); }
static int vkcprintf(const char *fmt, va_list ap) { vkprintf(fmt, ap); return vcprintf(fmt, ap); }
int error_proc(FMSG *errmsg, ...) { char *tmp_errmsg; va_list marker; #if SFX_LEVEL>=ARJ /* Check if the message could have a standard error code */ if(errno!=0&&is_std_error(errmsg)) { msg_cprintf(0, lf); error_report(); } #endif #if SFX_LEVEL>=ARJSFXV if(quiet_mode==ARJ_SILENT) freopen(dev_con, m_w, stdout); #endif #if SFX_LEVEL>=ARJ file_settype(stdout, ARJT_TEXT); #endif /* For SFX archives, don't forget to display our logo */ #if SFX_LEVEL==ARJSFXV show_sfx_logo(); #elif SFX_LEVEL==ARJSFX if(!logo_shown) { msg_cprintf(0, M_ARJSFX_BANNER, exe_name); msg_cprintf(0, M_PROCESSING_ARCHIVE, archive_name); } #endif #if SFX_LEVEL>=ARJ nputlf(); #elif SFX_LEVEL>=ARJSFXV fputc(LF, new_stdout); #else fputc(LF, stdout); #endif /* Format and print the error message */ va_start(marker, errmsg); #ifdef CUSTOM_PRINTF vcprintf(H_ERR, errmsg, marker); #else tmp_errmsg=malloc_fmsg(errmsg); #if SFX_LEVEL>=ARJSFXV vfprintf(new_stdout, (FMSG *)tmp_errmsg, marker); #else vprintf(tmp_errmsg, marker); #endif free_fmsg(tmp_errmsg); #endif va_end(marker); #if SFX_LEVEL>=ARJ nputlf(); #elif SFX_LEVEL>=ARJSFXV fputc(LF, new_stdout); #else fputc(LF, stdout); #endif /* Terminate the execution with a specific errorlevel */ #if SFX_LEVEL>=ARJSFXV /* If there's no errorlevel yet, select errorlevel by message class */ if(errorlevel==0) errorlevel=subclass_errors(errmsg); /* If the error was the lack of memory, display final memory statistics to find memory leaks */ #if SFX_LEVEL>=ARJ if(errorlevel==ARJ_ERL_NO_MEMORY) mem_stats(); #endif error_occured=1; exit(errorlevel); #elif defined(REARJ) exit(REARJ_ERL_WARNING); #elif defined(REGISTER) exit(REGISTER_ERL_ERROR); #elif SFX_LEVEL>=ARJSFX exit(ARJSFX_ERL_ERROR); #else exit(1); #endif return(0); }