Lines Matching +full:num +full:- +full:cols
1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
120 static char *ksprintn(char *nbuf, uintmax_t num, int base, int *len, int upper);
132 #define BOOT_TAG "---<<BOOT>>---"
180 if (td->td_proc == initproc) { in uprintf()
189 p = td->td_proc; in uprintf()
191 if ((p->p_flag & P_CONTROLT) == 0) { in uprintf()
196 SESS_LOCK(p->p_session); in uprintf()
197 pca.tty = p->p_session->s_ttyp; in uprintf()
198 SESS_UNLOCK(p->p_session); in uprintf()
238 if (pri != -1) in vtprintf()
242 if (p->p_flag & P_CONTROLT && p->p_session->s_ttyvp) { in vtprintf()
243 sess = p->p_session; in vtprintf()
246 tp = sess->s_ttyp; in vtprintf()
345 while (uio->uio_resid > 0) { in log_console()
346 c = imin(uio->uio_resid, CONSCHUNK - 1); in log_console()
350 /* Make sure we're NUL-terminated */ in log_console()
352 if (consbuffer[c - 1] == '\n') in log_console()
360 * log_console_add_linefeed is non-zero. For that behavior, if an in log_console()
371 * 'dmesg -a', you wind up with output that looks like this: in log_console()
411 retval = _vprintf(-1, TOCONS | TOLOG, fmt, ap); in vprintf()
448 msgbuf_addstr(&consmsgbuf, -1, in prf_putbuf()
460 if (ap->p_bufr == NULL) { in putbuf()
461 prf_putchar(c, ap->flags, ap->pri); in putbuf()
464 *ap->p_next++ = c; in putbuf()
465 ap->remain--; in putbuf()
468 *ap->p_next = '\0'; in putbuf()
471 if (ap->remain == 2 || c == '\n') { in putbuf()
472 prf_putbuf(ap->p_bufr, ap->flags, ap->pri); in putbuf()
474 ap->p_next = ap->p_bufr; in putbuf()
475 ap->remain = ap->n_bufr; in putbuf()
476 *ap->p_next = '\0'; in putbuf()
482 * ap->remain == 2 (if not sooner due to a newline), flush in putbuf()
487 KASSERT(ap->remain > 2, ("Bad buffer logic, remain = %zd", in putbuf()
488 ap->remain)); in putbuf()
501 struct tty *tp = ap->tty; in putchar()
502 int flags = ap->flags; in putchar()
601 if (info->remain >= 2) { in snprintf_func()
602 *info->str++ = ch; in snprintf_func()
603 info->remain--; in snprintf_func()
608 * Put a NUL-terminated ASCII number (base <= 36) in a buffer in reverse
614 ksprintn(char *nbuf, uintmax_t num, int base, int *lenp, int upper) in ksprintn() argument
621 c = hex2ascii(num % base); in ksprintn()
623 } while (num /= base); in ksprintn()
625 *lenp = p - nbuf; in ksprintn()
651 * XXX: %D -- Hexdump, takes pointer and separator string:
652 * ("%6D", ptr, ":") -> XX:XX:XX:XX:XX:XX
653 * ("%*D", len, ptr, " " -> XX XX XX XX ...
664 uintmax_t num; in kvprintf() local
671 num = 0; in kvprintf()
692 percent = fmt - 1; in kvprintf()
706 case '-': in kvprintf()
717 width = -width; in kvprintf()
732 n = n * 10 + ch - '0'; in kvprintf()
747 width -= 1; in kvprintf()
750 while (width--) in kvprintf()
754 while (width--) in kvprintf()
762 while(width--) { in kvprintf()
819 num = (uintptr_t)va_arg(ap, void *); in kvprintf()
841 width -= n; in kvprintf()
844 while (width--) in kvprintf()
846 while (n--) in kvprintf()
849 while (width--) in kvprintf()
872 num = va_arg(ap, uintmax_t); in kvprintf()
874 num = va_arg(ap, u_quad_t); in kvprintf()
876 num = va_arg(ap, ptrdiff_t); in kvprintf()
878 num = va_arg(ap, u_long); in kvprintf()
880 num = va_arg(ap, size_t); in kvprintf()
882 num = (u_short)va_arg(ap, int); in kvprintf()
884 num = (u_char)va_arg(ap, int); in kvprintf()
886 num = va_arg(ap, u_int); in kvprintf()
894 num = va_arg(ap, intmax_t); in kvprintf()
896 num = va_arg(ap, quad_t); in kvprintf()
898 num = va_arg(ap, ptrdiff_t); in kvprintf()
900 num = va_arg(ap, long); in kvprintf()
902 num = va_arg(ap, ssize_t); in kvprintf()
904 num = (short)va_arg(ap, int); in kvprintf()
906 num = (signed char)va_arg(ap, int); in kvprintf()
908 num = va_arg(ap, int); in kvprintf()
909 if ((intmax_t)num < 0) { in kvprintf()
910 sign = '-'; in kvprintf()
911 num = -(intmax_t)num; in kvprintf()
914 p = ksprintn(nbuf, num, base, &n, upper); in kvprintf()
916 if (sharpflag && num != 0) { in kvprintf()
926 dwidth = width - tmp; in kvprintf()
927 width -= tmp + imax(dwidth, n); in kvprintf()
928 dwidth -= n; in kvprintf()
930 while (width-- > 0) in kvprintf()
934 if (sharpflag && num != 0) { in kvprintf()
942 while (dwidth-- > 0) in kvprintf()
946 PCHAR(*p--); in kvprintf()
948 if (bconv && num != 0) { in kvprintf()
953 if (num & (1 << (n - 1))) { in kvprintf()
964 width -= retval - tmp; in kvprintf()
969 while (width-- > 0) in kvprintf()
995 static int lastpri = -1; in msglogchar()
1004 if (pri != -1 && pri != lastpri) { in msglogchar()
1011 msgbuf_addchar(msgbufp, *p--); in msglogchar()
1018 lastpri = -1; in msglogchar()
1041 size -= sizeof(*msgbufp); in msgbufinit()
1068 error = priv_check(req->td, PRIV_MSGBUF); in sysctl_kern_msgbuf()
1090 len -= bp - buf; in sysctl_kern_msgbuf()
1115 error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req); in sysctl_kern_msgbuf_clear()
1116 if (!error && req->newptr) { in sysctl_kern_msgbuf_clear()
1142 msgbufp->msg_magic, msgbufp->msg_size, msgbufp->msg_rseq, in DB_SHOW_COMMAND_FLAGS()
1143 msgbufp->msg_wseq, msgbufp->msg_ptr, msgbufp->msg_cksum); in DB_SHOW_COMMAND_FLAGS()
1144 for (i = 0; i < msgbufp->msg_size && !db_pager_quit; i++) { in DB_SHOW_COMMAND_FLAGS()
1145 j = MSGBUF_SEQ_TO_POS(msgbufp, i + msgbufp->msg_rseq); in DB_SHOW_COMMAND_FLAGS()
1146 db_printf("%c", msgbufp->msg_ptr[j]); in DB_SHOW_COMMAND_FLAGS()
1157 int cols; in hexdump() local
1167 cols = flags & HD_COLUMN_MASK; in hexdump()
1169 cols = 16; in hexdump()
1172 for (i = 0; i < length; i+= cols) { in hexdump()
1180 for (j = 0; j < cols; j++) { in hexdump()
1191 for (j = 0; j < cols; j++) { in hexdump()
1212 int cols; in sbuf_hexdump() local
1222 cols = flags & HD_COLUMN_MASK; in sbuf_hexdump()
1224 cols = 16; in sbuf_hexdump()
1227 for (i = 0; i < length; i+= cols) { in sbuf_hexdump()
1235 for (j = 0; j < cols; j++) { in sbuf_hexdump()
1246 for (j = 0; j < cols; j++) { in sbuf_hexdump()
1272 if (atomic_cmpset_int(counter, c, c - 1)) { in counted_warning()
1275 td->td_proc->p_pid, td->td_name, msg, in counted_warning()
1276 c > 1 ? "" : " - not logging anymore"); in counted_warning()
1288 prf_putbuf(sbuf_data(sb), TOLOG | TOCONS, -1); in sbuf_putbuf()
1318 prf_putbuf(dataptr, TOLOG | TOCONS, -1); in sbuf_printf_drain()
1327 return (-errno); in sbuf_printf_drain()