#include <kern/cpu_number.h> /* for cpu_number() */
#include <machine/spl.h>
#include <libkern/libkern.h>
+#include <os/log_private.h>
/* for vaddlog(): the following are implemented in osfmk/kern/printf.c */
extern void bsd_log_lock(void);
va_list argp,
void (*)(int, void *),
void *arg,
- int radix);
+ int radix,
+ int is_log);
/*
* Record cpu that panic'd and lock around panic data
if (pca.tty != NULL)
tty_lock(pca.tty);
va_start(ap, fmt);
- __doprnt(fmt, ap, putchar, &pca, 10);
+ __doprnt(fmt, ap, putchar, &pca, 10, FALSE);
va_end(ap);
if (pca.tty != NULL)
tty_unlock(pca.tty);
tprintf(tpr_t tpr, const char *fmt, ...)
{
struct session *sess = (struct session *)tpr;
- struct tty *tp = TTY_NULL;
- int flags = TOLOG;
+ struct tty *tp;
va_list ap;
struct putchar_args pca;
/* ttycheckoutq(), tputchar() require a locked tp */
tty_lock(tp);
if(ttycheckoutq(tp, 0)) {
- flags |= TOTTY;
+ pca.flags = TOTTY;
/* going to the tty; leave locked */
- } else {
- /* not going to the tty... */
- tty_unlock(tp);
- tp = TTY_NULL;
+ pca.tty = tp;
+ va_start(ap, fmt);
+ __doprnt(fmt, ap, putchar, &pca, 10, FALSE);
+ va_end(ap);
}
+ tty_unlock(tp);
}
-
- pca.flags = flags;
- pca.tty = tp;
+
+ pca.flags = TOLOG;
+ pca.tty = TTY_NULL;
va_start(ap, fmt);
- __doprnt(fmt, ap, putchar, &pca, 10);
+ __doprnt(fmt, ap, putchar, &pca, 10, TRUE);
va_end(ap);
- if (tp != NULL)
- tty_unlock(tp); /* lock/unlock is guarded by tp, above */
-
logwakeup();
+
+ va_start(ap, fmt);
+ os_log_with_args(OS_LOG_DEFAULT, OS_LOG_TYPE_DEFAULT, fmt, ap, __builtin_return_address(0));
+ va_end(ap);
}
/*
pca.tty = tp;
va_start(ap, fmt);
- __doprnt(fmt, ap, putchar, &pca, 10);
+ __doprnt(fmt, ap, putchar, &pca, 10, TRUE);
va_end(ap);
}
}
}
bsd_log_lock();
- __doprnt(fmt, ap, putchar, &pca, 10);
+ __doprnt(fmt, ap, putchar, &pca, 10, TRUE);
bsd_log_unlock();
logwakeup();
tty_lock(ttyp);
va_start(ap, format);
- __doprnt(format, ap, putchar, &pca, 10);
+ __doprnt(format, ap, putchar, &pca, 10, TRUE);
va_end(ap);
tty_unlock(ttyp);
pca.flags = flags;
pca.tty = ttyp;
- __doprnt(fmt, ap, putchar, &pca, 10);
+ __doprnt(fmt, ap, putchar, &pca, 10, TRUE);
return 0;
}
}
int
-vprintf(const char *fmt, va_list ap)
+vprintf_log_locked(const char *fmt, va_list ap)
{
struct putchar_args pca;
- pca.flags = TOLOG | TOCONS;
+ pca.flags = TOLOGLOCKED;
pca.tty = NULL;
- __doprnt(fmt, ap, putchar, &pca, 10);
+ __doprnt(fmt, ap, putchar, &pca, 10, TRUE);
return 0;
}
info.str = buf;
info.remain = 999999;
- retval = __doprnt(cfmt, ap, snprintf_func, &info, 10);
+ retval = __doprnt(cfmt, ap, snprintf_func, &info, 10, FALSE);
if (info.remain >= 1) {
*info.str++ = '\0';
}
info.str = str;
info.remain = size;
- retval = __doprnt(format, ap, snprintf_func, &info, 10);
+ retval = __doprnt(format, ap, snprintf_func, &info, 10, FALSE);
if (info.remain >= 1)
*info.str++ = '\0';
return retval;
int
kvprintf(char const *fmt, void (*func)(int, void*), void *arg, int radix, va_list ap)
{
- __doprnt(fmt, ap, func, arg, radix);
+ __doprnt(fmt, ap, func, arg, radix, TRUE);
return 0;
}