From 7c1094dcb06e4b5ecf886418c39c7251fb78fb41 Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Fri, 2 Feb 2018 21:49:35 +0100
Subject: [PATCH] WIP %r removal

---
 contrib/gcc-4.7/gcc/c-family/c-format.c |  1 -
 contrib/gcc-5.0/gcc/c-family/c-format.c |  1 -
 sys/ddb/db_command.c                    |  2 +-
 sys/ddb/db_examine.c                    | 12 ++++--
 sys/ddb/db_lex.c                        | 34 ++++++++++++++++
 sys/ddb/db_lex.h                        |  2 +-
 sys/ddb/db_output.c                     | 32 +++++++++++++--
 sys/ddb/db_output.h                     |  1 +
 sys/ddb/db_print.c                      | 12 ++++--
 sys/ddb/db_sym.c                        | 14 +++++--
 sys/ddb/db_write_cmd.c                  |  8 +++-
 sys/dev/raid/vinum/vinumconfig.c        |  2 +-
 sys/kern/subr_prf.c                     | 70 +++++----------------------------
 sys/kern/subr_sbuf.c                    |  2 +-
 sys/sys/systm.h                         |  7 +---
 sys/vfs/devfs/devfs_core.c              |  4 +-
 16 files changed, 116 insertions(+), 88 deletions(-)

diff --git a/contrib/gcc-4.7/gcc/c-family/c-format.c b/contrib/gcc-4.7/gcc/c-family/c-format.c
index 35c0f9a83a..71a5ffe11e 100644
--- a/contrib/gcc-4.7/gcc/c-family/c-format.c
+++ b/contrib/gcc-4.7/gcc/c-family/c-format.c
@@ -650,7 +650,6 @@ static const format_char_info print_char_table[] =
      which produces:	reg=3<BITTWO,BITONE>
    */
   { "b",   0, STD_EXT, { T89_I,  BADLEN,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN }, "-wp",       "",   &dfly_ext_char_info },
-  { "ry",  0, STD_EXT, { T89_I,  BADLEN,   BADLEN,   T89_L,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN }, "-wp0 +#",   "i",  NULL },
   { NULL,  0, STD_C89, NOLENGTHS, NULL, NULL, NULL }
 };
 
diff --git a/contrib/gcc-5.0/gcc/c-family/c-format.c b/contrib/gcc-5.0/gcc/c-family/c-format.c
index fb2af0d9c9..f918201202 100644
--- a/contrib/gcc-5.0/gcc/c-family/c-format.c
+++ b/contrib/gcc-5.0/gcc/c-family/c-format.c
@@ -636,7 +636,6 @@ static const format_char_info print_char_table[] =
      which produces:	reg=3<BITTWO,BITONE>
    */
   { "b",   0, STD_EXT, { T89_I,  BADLEN,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN }, "-wp",       "",   &dfly_ext_char_info },
-  { "ry",  0, STD_EXT, { T89_I,  BADLEN,   BADLEN,   T89_L,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN }, "-wp0 +#",   "i",  NULL },
   { NULL,  0, STD_C89, NOLENGTHS, NULL, NULL, NULL }
 };
 
diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c
index cabaca15ef..4665fab552 100644
--- a/sys/ddb/db_command.c
+++ b/sys/ddb/db_command.c
@@ -598,7 +598,7 @@ db_fncall(db_expr_t dummy1, boolean_t dummy2, db_expr_t dummy3, char *dummy4)
 		retval = 0;
 		break;
 	}
-	db_printf("%#lr\n", (long)retval);
+	db_printf("%s\n", db_num_to_str(retval));
 }
 
 /* Enter GDB remote protocol debugger on the next trap. */
diff --git a/sys/ddb/db_examine.c b/sys/ddb/db_examine.c
index 4111f9f8e7..01fd24cbf8 100644
--- a/sys/ddb/db_examine.c
+++ b/sys/ddb/db_examine.c
@@ -125,7 +125,8 @@ db_examine(db_addr_t addr, char *fmt, int count)
 			case 'r':	/* signed, current radix */
 				value = db_get_value(addr, size, TRUE);
 				addr += size;
-				db_printf("%+-*lr", width, (long)value);
+				db_format_radix(tbuf, 24, value, FALSE);
+				db_printf("%-*s", width, tbuf);
 				break;
 			case 'x':	/* unsigned hex */
 				value = db_get_value(addr, size, FALSE);
@@ -212,8 +213,13 @@ db_print_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *modif)
 		db_printsym((db_addr_t)addr, DB_STGY_ANY);
 		break;
 	    case 'r':
-		db_printf("%+11lr", (long)addr);
-		break;
+		{
+		    char tbuf[24];
+
+		    db_format_radix(tbuf, 24, addr, FALSE);
+		    db_printf("%11s", tbuf);
+		    break;
+		}
 	    case 'x':
 		db_printf("%8lx", (unsigned long)addr);
 		break;
diff --git a/sys/ddb/db_lex.c b/sys/ddb/db_lex.c
index 225b684cf7..6f0d8bc1ad 100644
--- a/sys/ddb/db_lex.c
+++ b/sys/ddb/db_lex.c
@@ -35,10 +35,13 @@
  * Lexical analyzer.
  */
 #include <sys/param.h>
+#include <sys/systm.h>
 
 #include <ddb/ddb.h>
 #include <ddb/db_lex.h>
 
+#define	DB_EXPR_T_IS_QUAD (/* CONSTCOND */ sizeof(db_expr_t) > sizeof(long))
+
 static char	db_line[120];
 static char *	db_lp, *db_endlp;
 
@@ -118,6 +121,37 @@ char	db_tok_string[TOK_STRING_SIZE];
 
 db_expr_t	db_radix = 16;
 
+/*
+ * Convert the number to a string in the current radix.
+ */
+
+char *
+db_num_to_str(db_expr_t val)
+{
+
+	/*
+	 * 2 chars for "0x", 1 for a sign ("-")
+	 * up to 21 chars for a 64-bit number:
+	 *   % echo 2^64 | bc | wc -c
+	 *   21
+	 * and 1 char for a terminal NUL
+	 * 2+1+21+1 => 25
+	 */
+	static char buf[25];
+
+	if (db_radix == 16)
+		ksnprintf(buf, sizeof(buf), DB_EXPR_T_IS_QUAD ? "%#qx" : "%#lx",
+		    val);
+	else if (db_radix == 8)
+		ksnprintf(buf, sizeof(buf), DB_EXPR_T_IS_QUAD ? "%#qo" : "%#lo",
+		    val);
+	else
+		ksnprintf(buf, sizeof(buf), DB_EXPR_T_IS_QUAD ? "%qu" : "%lu",
+		    val);
+
+	return (buf);
+}
+
 void
 db_flush_lex(void)
 {
diff --git a/sys/ddb/db_lex.h b/sys/ddb/db_lex.h
index 247b8710fd..ff756a641e 100644
--- a/sys/ddb/db_lex.h
+++ b/sys/ddb/db_lex.h
@@ -24,7 +24,6 @@
  * rights to redistribute these changes.
  *
  * $FreeBSD: src/sys/ddb/db_lex.h,v 1.12 1999/08/28 00:41:08 peter Exp $
- * $DragonFly: src/sys/ddb/db_lex.h,v 1.4 2006/05/20 02:42:01 dillon Exp $
  */
 
 #ifndef _DDB_DB_LEX_H_
@@ -69,6 +68,7 @@
  * Lexical analyzer.
  */
 void	db_flush_lex (void);
+char   *db_num_to_str(db_expr_t);
 int	db_read_line (void);
 int	db_read_token (void);
 void	db_unread_token (int t);
diff --git a/sys/ddb/db_output.c b/sys/ddb/db_output.c
index f3188b7d20..6fcb7d192c 100644
--- a/sys/ddb/db_output.c
+++ b/sys/ddb/db_output.c
@@ -184,7 +184,7 @@ db_printf(const char *fmt, ...)
 	__va_list listp;
 
 	__va_start(listp, fmt);
-	kvcprintf (fmt, db_putchar, NULL, db_radix, listp);
+	kvcprintf (fmt, db_putchar, NULL, listp);
 	__va_end(listp);
 /*	DELAY(100000);*/
 }
@@ -192,7 +192,7 @@ db_printf(const char *fmt, ...)
 void
 db_vprintf(const char *fmt, __va_list va)
 {
-	kvcprintf (fmt, db_putchar, NULL, db_radix, va);
+	kvcprintf (fmt, db_putchar, NULL, va);
 /*	DELAY(100000);*/
 }
 
@@ -209,7 +209,7 @@ db_iprintf(const char *fmt,...)
 	while (--i >= 0)
 		db_printf(" ");
 	__va_start(listp, fmt);
-	kvcprintf (fmt, db_putchar, NULL, db_radix, listp);
+	kvcprintf (fmt, db_putchar, NULL, listp);
 	__va_end(listp);
 }
 
@@ -271,6 +271,32 @@ db_format_hex(char *buf, size_t bufsiz, quad_t val, int altflag)
 	ksnprintf(buf, bufsiz, fmt, val);
 }
 
+/*
+ * Replacement for old '%r' kprintf format.
+ */
+void
+db_format_radix(char *buf, size_t bufsiz, quad_t val, int altflag)
+{
+	const char *fmt;
+
+	if (db_radix == 16) {
+		db_format_hex(buf, bufsiz, val, altflag);
+		return;
+	}
+
+	if (db_radix == 8)
+		fmt = altflag ? "-%#qo" : "-%qo";
+	else
+		fmt = altflag ? "-%#qu" : "-%qu";
+
+	if (val < 0)
+		val = -val;
+	else
+		++fmt;
+
+	ksnprintf(buf, bufsiz, fmt, val);
+}
+
 /* #define TEMPORARY_DEBUGGING */
 #ifdef TEMPORARY_DEBUGGING
 
diff --git a/sys/ddb/db_output.h b/sys/ddb/db_output.h
index 8edd81c168..a45c490c7c 100644
--- a/sys/ddb/db_output.h
+++ b/sys/ddb/db_output.h
@@ -41,6 +41,7 @@
 void	db_end_line(int);
 void	db_force_whitespace (void);
 void	db_format_hex(char *, size_t, quad_t, int);
+void	db_format_radix(char *, size_t, quad_t, int);
 int	db_print_position (void);
 
 #endif /* !_DDB_DB_OUTPUT_H_ */
diff --git a/sys/ddb/db_print.c b/sys/ddb/db_print.c
index 52b66e784e..18718eb404 100644
--- a/sys/ddb/db_print.c
+++ b/sys/ddb/db_print.c
@@ -38,6 +38,8 @@
 #include <sys/param.h>
 
 #include <ddb/ddb.h>
+#include <ddb/db_lex.h>
+#include <ddb/db_output.h>
 #include <ddb/db_variables.h>
 #include <ddb/db_sym.h>
 
@@ -50,13 +52,17 @@ db_show_regs(db_expr_t dummy1, boolean_t dummy2, db_expr_t dummy3, char *dummy4)
 
 	for (regp = db_regs; regp < db_eregs; regp++) {
 	    db_read_variable(regp, &value);
-	    db_printf("%-12s%#10lr", regp->name, (unsigned long)value);
+	    db_printf("%-12s%s", regp->name, db_num_to_str(value));
 	    db_find_xtrn_sym_and_offset((db_addr_t)value, &name, &offset);
 	    if (name != NULL && offset <= (unsigned long)db_maxoff &&
 		offset != value) {
 		db_printf("\t%s", name);
-		if (offset != 0)
-		    db_printf("+%+#lr", (long)offset);
+		if (offset != 0) {
+		    char tbuf[24];
+
+		    db_format_radix(tbuf, 24, offset, TRUE);
+		    db_printf("+%s", tbuf);
+		}
 	    }
 	    db_printf("\n");
 	}
diff --git a/sys/ddb/db_sym.c b/sys/ddb/db_sym.c
index 6b8feb6c50..cc428bd84e 100644
--- a/sys/ddb/db_sym.c
+++ b/sys/ddb/db_sym.c
@@ -34,6 +34,7 @@
 #include <sys/systm.h>
 
 #include <ddb/ddb.h>
+#include <ddb/db_output.h>
 #include <ddb/db_sym.h>
 
 /*
@@ -274,22 +275,27 @@ db_printsym(db_expr_t off, db_strategy_t strategy)
 	db_expr_t	value;
 	int 		linenum;
 	c_db_sym_t	cursym;
+	char		tbuf[24];
 
 	cursym = db_search_symbol(off, strategy, &d);
 	db_symbol_values(cursym, &name, &value);
 	if (name == NULL)
 		value = off;
 	if (value >= DB_SMALL_VALUE_MIN && value <= DB_SMALL_VALUE_MAX) {
-		db_printf("%+#lr", (long)off);
+		db_format_radix(tbuf, 24, (long)off, TRUE);
+		db_printf("%s", tbuf);
 		return;
 	}
 	if (name == NULL || d >= (unsigned long)db_maxoff) {
-		db_printf("%#lr", (unsigned long)off);
+		db_format_radix(tbuf, 24, (unsigned long)off, TRUE);
+		db_printf("%s", tbuf);
 		return;
 	}
 	db_printf("%s", name);
-	if (d)
-		db_printf("+%+#lr", (long)d);
+	if (d) {
+		db_format_radix(tbuf, 24, (long)d, TRUE);
+		db_printf("+%s", tbuf);
+	}
 	if (strategy == DB_STGY_PROC) {
 		if (db_line_at_pc(cursym, &filename, &linenum, off))
 			db_printf(" [%s:%d]", filename, linenum);
diff --git a/sys/ddb/db_write_cmd.c b/sys/ddb/db_write_cmd.c
index e80a0f548a..0de00d2910 100644
--- a/sys/ddb/db_write_cmd.c
+++ b/sys/ddb/db_write_cmd.c
@@ -37,6 +37,7 @@
 #include <ddb/ddb.h>
 #include <ddb/db_access.h>
 #include <ddb/db_command.h>
+#include <ddb/db_output.h>
 #include <ddb/db_sym.h>
 
 /*
@@ -72,9 +73,14 @@ db_write_cmd(db_expr_t address, boolean_t have_addr, db_expr_t count,
 	}
 
 	while (db_expression(&new_value)) {
+	    char tbuf[24];
+
 	    old_value = db_get_value(addr, size, FALSE);
 	    db_printsym(addr, DB_STGY_ANY);
-	    db_printf("\t\t%#8lr\t=\t%#8lr\n", (long)old_value,(long)new_value);
+	    db_format_radix(tbuf, 24, (long)old_value, TRUE);
+	    db_printf("\t\t%8s\t=\t", tbuf);
+	    db_format_radix(tbuf, 24, (long)new_value, TRUE);
+	    db_printf("%8s\n", tbuf);
 	    db_put_value(addr, size, new_value);
 	    addr += size;
 
diff --git a/sys/dev/raid/vinum/vinumconfig.c b/sys/dev/raid/vinum/vinumconfig.c
index f100bb12d9..3a66a14d64 100644
--- a/sys/dev/raid/vinum/vinumconfig.c
+++ b/sys/dev/raid/vinum/vinumconfig.c
@@ -111,7 +111,7 @@ throw_rude_remark(int error, char *msg,...)
 	 * We can't just format to ioctl_reply, since it
 	 * may contain our input parameters
 	 */
-	    kvasnrprintf(&text, MSG_MAX, 10, msg, ap);
+	    kvasnprintf(&text, MSG_MAX, msg, ap);
 	    strcpy(ioctl_reply->msg, text);
 	    ioctl_reply->error = error;			    /* first byte is the error number */
 	    kvasfree(&text);
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index c3cc6cfe5b..35675266ab 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -148,7 +148,7 @@ uprintf(const char *fmt, ...)
 		pca.tty = p->p_session->s_ttyp;
 		pca.flags = TOTTY;
 
-		retval = kvcprintf(fmt, kputchar, &pca, 10, ap);
+		retval = kvcprintf(fmt, kputchar, &pca, ap);
 		__va_end(ap);
 	}
 	return (retval);
@@ -193,7 +193,7 @@ tprintf(tpr_t tpr, const char *fmt, ...)
 	pca.tty = tp;
 	pca.flags = flags;
 	pca.pri = LOG_INFO;
-	retval = kvcprintf(fmt, kputchar, &pca, 10, ap);
+	retval = kvcprintf(fmt, kputchar, &pca, ap);
 	__va_end(ap);
 	msgbuftrigger = 1;
 	return (retval);
@@ -214,7 +214,7 @@ ttyprintf(struct tty *tp, const char *fmt, ...)
 	__va_start(ap, fmt);
 	pca.tty = tp;
 	pca.flags = TOTTY;
-	retval = kvcprintf(fmt, kputchar, &pca, 10, ap);
+	retval = kvcprintf(fmt, kputchar, &pca, ap);
 	__va_end(ap);
 	return (retval);
 }
@@ -239,7 +239,7 @@ log(int level, const char *fmt, ...)
 		pca.flags = TOCONS;
 
 	__va_start(ap, fmt);
-	retval = kvcprintf(fmt, kputchar, &pca, 10, ap);
+	retval = kvcprintf(fmt, kputchar, &pca, ap);
 	__va_end(ap);
 
 	msgbuftrigger = 1;
@@ -308,7 +308,7 @@ kprintf(const char *fmt, ...)
 	pca.tty = NULL;
 	pca.flags = kprintf_logging & ~TOTTY;
 	pca.pri = -1;
-	retval = kvcprintf(fmt, kputchar, &pca, 10, ap);
+	retval = kvcprintf(fmt, kputchar, &pca, ap);
 	__va_end(ap);
 	if (!panicstr)
 		msgbuftrigger = 1;
@@ -328,7 +328,7 @@ kvprintf(const char *fmt, __va_list ap)
 	pca.tty = NULL;
 	pca.flags = kprintf_logging & ~TOTTY;
 	pca.pri = -1;
-	retval = kvcprintf(fmt, kputchar, &pca, 10, ap);
+	retval = kvcprintf(fmt, kputchar, &pca, ap);
 	if (!panicstr)
 		msgbuftrigger = 1;
 	consintr = savintr;		/* reenable interrupts */
@@ -401,7 +401,7 @@ ksprintf(char *buf, const char *cfmt, ...)
 	__va_list ap;
 
 	__va_start(ap, cfmt);
-	retval = kvcprintf(cfmt, NULL, buf, 10, ap);
+	retval = kvcprintf(cfmt, NULL, buf, ap);
 	buf[retval] = '\0';
 	__va_end(ap);
 	return (retval);
@@ -415,7 +415,7 @@ kvsprintf(char *buf, const char *cfmt, __va_list ap)
 {
 	int retval;
 
-	retval = kvcprintf(cfmt, NULL, buf, 10, ap);
+	retval = kvcprintf(cfmt, NULL, buf, ap);
 	buf[retval] = '\0';
 	return (retval);
 }
@@ -446,49 +446,7 @@ kvsnprintf(char *str, size_t size, const char *format, __va_list ap)
 
 	info.str = str;
 	info.remain = size;
-	retval = kvcprintf(format, snprintf_func, &info, 10, ap);
-	if (info.remain >= 1)
-		*info.str++ = '\0';
-	return (retval);
-}
-
-int
-ksnrprintf(char *str, size_t size, int radix, const char *format, ...)
-{
-	int retval;
-	__va_list ap;
-
-	__va_start(ap, format);
-	retval = kvsnrprintf(str, size, radix, format, ap);
-	__va_end(ap);
-	return(retval);
-}
-
-int
-kvsnrprintf(char *str, size_t size, int radix, const char *format, __va_list ap)
-{
-	struct snprintf_arg info;
-	int retval;
-
-	info.str = str;
-	info.remain = size;
-	retval = kvcprintf(format, snprintf_func, &info, radix, ap);
-	if (info.remain >= 1)
-		*info.str++ = '\0';
-	return (retval);
-}
-
-int
-kvasnrprintf(char **strp, size_t size, int radix,
-	     const char *format, __va_list ap)
-{
-	struct snprintf_arg info;
-	int retval;
-
-	*strp = kmalloc(size, M_TEMP, M_WAITOK);
-	info.str = *strp;
-	info.remain = size;
-	retval = kvcprintf(format, snprintf_func, &info, radix, ap);
+	retval = kvcprintf(format, snprintf_func, &info, ap);
 	if (info.remain >= 1)
 		*info.str++ = '\0';
 	return (retval);
@@ -563,7 +521,7 @@ ksprintn(char *nbuf, uintmax_t num, int base, int *lenp, int upper)
 
 int
 kvcprintf(char const *fmt, void (*func)(int, void*), void *arg,
-	  int radix, __va_list ap)
+	  __va_list ap)
 {
 	char nbuf[MAXNBUF];
 	char *d;
@@ -600,9 +558,6 @@ kvcprintf(char const *fmt, void (*func)(int, void*), void *arg,
 	if (fmt == NULL)
 		fmt = "(fmt null)\n";
 
-	if (radix < 2 || radix > 36)
-		radix = 10;
-
 	usespin = (func == kputchar &&
 		   (kprintf_logging & TONOSPIN) == 0 &&
 		   panic_cpu_gd != mycpu &&
@@ -748,11 +703,6 @@ kvcprintf(char const *fmt, void (*func)(int, void*), void *arg,
 		case 'q':
 			qflag = 1;
 			goto reswitch;
-		case 'r':
-			base = radix;
-			if (sign)
-				goto handle_sign;
-			goto handle_nosign;
 		case 's':
 			p = __va_arg(ap, char *);
 			if (p == NULL)
diff --git a/sys/kern/subr_sbuf.c b/sys/kern/subr_sbuf.c
index 17254e4fa9..9d7fe08c1f 100644
--- a/sys/kern/subr_sbuf.c
+++ b/sys/kern/subr_sbuf.c
@@ -550,7 +550,7 @@ sbuf_vprintf(struct sbuf *s, const char *fmt, __va_list ap)
 	KASSERT(fmt != NULL,
 	    ("%s called with a NULL format string", __func__));
 
-	(void)kvcprintf(fmt, sbuf_putc_func, s, 10, ap);
+	(void)kvcprintf(fmt, sbuf_putc_func, s, ap);
 	if (s->s_error != 0)
 		return (-1);
 	return (0);
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index a25c558568..7f77f531a4 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -192,7 +192,7 @@ uint32_t calculate_crc32c(uint32_t crc32c, const unsigned char *buffer,
 void	init_param1 (void);
 void	init_param2 (int physpages);
 void	tablefull (const char *);
-int	kvcprintf (char const *, void (*)(int, void*), void *, int,
+int	kvcprintf (char const *, void (*)(int, void*), void *,
 		      __va_list) __printf0like(1, 0);
 void	kvcreinitspin(void);
 int	log (int, const char *, ...) __printflike(2, 3);
@@ -202,16 +202,11 @@ int	kprintf (const char *, ...) __printflike(1, 2);
 void	kprintf0 (const char *, ...) __printflike(1, 2);
 void	krateprintf (struct krate *, const char *, ...) __printflike(2, 3);
 int	ksnprintf (char *, size_t, const char *, ...) __printflike(3, 4);
-int	ksnrprintf (char *, size_t, int, const char *, ...) __printflike(4, 5);
 int	ksprintf (char *buf, const char *, ...) __printflike(2, 3);
 int	uprintf (const char *, ...) __printflike(1, 2);
 int	kvprintf (const char *, __va_list) __printflike(1, 0);
 int	kvsnprintf (char *, size_t, const char *,
 			__va_list) __printflike(3, 0);
-int	kvsnrprintf (char *, size_t, int, const char *,
-			__va_list) __printflike(4, 0);
-int	kvasnrprintf (char **, size_t, int, const char *,
-			__va_list) __printflike(4, 0);
 int	kvsprintf (char *buf, const char *,
 			__va_list) __printflike(2, 0);
 int	ttyprintf (struct tty *, const char *, ...) __printflike(2, 3);
diff --git a/sys/vfs/devfs/devfs_core.c b/sys/vfs/devfs/devfs_core.c
index dbd5976ee1..1f9f52eaca 100644
--- a/sys/vfs/devfs/devfs_core.c
+++ b/sys/vfs/devfs/devfs_core.c
@@ -827,7 +827,7 @@ devfs_find_device_by_name(const char *fmt, ...)
 		return NULL;
 
 	__va_start(ap, fmt);
-	kvasnrprintf(&target, PATH_MAX, 10, fmt, ap);
+	kvasnprintf(&target, PATH_MAX, fmt, ap);
 	__va_end(ap);
 
 	msg = devfs_msg_get();
@@ -1989,7 +1989,7 @@ devfs_create_device_node(struct devfs_node *root, cdev_t dev,
 
 	if (path_fmt != NULL) {
 		__va_start(ap, path_fmt);
-		kvasnrprintf(&path, PATH_MAX, 10, path_fmt, ap);
+		kvasnprintf(&path, PATH_MAX, path_fmt, ap);
 		__va_end(ap);
 	}
 
-- 
2.15.1

