diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c
index 24952561449b..a8f6b689bff7 100644
--- a/sys/kern/kern_cons.c
+++ b/sys/kern/kern_cons.c
@@ -333,7 +333,7 @@ sysctl_kern_console(SYSCTL_HANDLER_ARGS)
sbuf_clear(sb);
STAILQ_FOREACH(cnd, &cn_devlist, cnd_next)
sbuf_printf(sb, "%s,", cnd->cnd_cn->cn_name);
- sbuf_printf(sb, "/");
+ sbuf_putc(sb, '/');
SET_FOREACH(list, cons_set) {
cp = *list;
if (cp->cn_name[0] != '\0')
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index f9445a481d92..112f9c7b0f33 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -804,13 +804,13 @@ kern_abort2(struct thread *td, const char *why, int nargs, void **uargs)
if (error < 0)
goto out;
} else {
- sbuf_printf(sb, "(null)");
+ sbuf_cat(sb, "(null)");
}
if (nargs > 0) {
- sbuf_printf(sb, "(");
+ sbuf_putc(sb, '(');
for (i = 0;i < nargs; i++)
sbuf_printf(sb, "%s%p", i == 0 ? "" : ", ", uargs[i]);
- sbuf_printf(sb, ")");
+ sbuf_putc(sb, ')');
}
/*
* Final stage: arguments were proper, string has been
@@ -821,7 +821,7 @@ kern_abort2(struct thread *td, const char *why, int nargs, void **uargs)
out:
if (sig == SIGKILL) {
sbuf_trim(sb);
- sbuf_printf(sb, " (Reason text inaccessible)");
+ sbuf_cat(sb, " (Reason text inaccessible)");
}
sbuf_cat(sb, "\n");
sbuf_finish(sb);
diff --git a/sys/kern/kern_fail.c b/sys/kern/kern_fail.c
index f60500b22ef4..883b664aef0d 100644
--- a/sys/kern/kern_fail.c
+++ b/sys/kern/kern_fail.c
@@ -721,31 +721,31 @@ fail_point_get(struct fail_point *fp, struct sbuf *sb,
if (ent->fe_pid != NO_PID)
sbuf_printf(sb, "[pid %d]", ent->fe_pid);
if (TAILQ_NEXT(ent, fe_entries))
- sbuf_printf(sb, "->");
+ sbuf_cat(sb, "->");
}
if (!printed_entry_count)
- sbuf_printf(sb, "off");
+ sbuf_cat(sb, "off");
fp_free(fp_entry_cpy);
if (verbose) {
#ifdef STACK
/* Print number of sleeping threads. queue=0 is the argument
* used by msleep when sending our threads to sleep. */
- sbuf_printf(sb, "\nsleeping_thread_stacks = {\n");
+ sbuf_cat(sb, "\nsleeping_thread_stacks = {\n");
sleepq_sbuf_print_stacks(sb, FP_SLEEP_CHANNEL(fp), 0,
&cnt_sleeping);
- sbuf_printf(sb, "},\n");
+ sbuf_cat(sb, "},\n");
#endif
sbuf_printf(sb, "sleeping_thread_count = %d,\n",
cnt_sleeping);
#ifdef STACK
- sbuf_printf(sb, "paused_thread_stacks = {\n");
+ sbuf_cat(sb, "paused_thread_stacks = {\n");
sleepq_sbuf_print_stacks(sb, FP_PAUSE_CHANNEL(fp), 0,
&cnt_sleeping);
- sbuf_printf(sb, "},\n");
+ sbuf_cat(sb, "},\n");
#endif
sbuf_printf(sb, "paused_thread_count = %d\n",
cnt_sleeping);
diff --git a/sys/kern/kern_rctl.c b/sys/kern/kern_rctl.c
index 8e65fabeddc9..f6f781ade697 100644
--- a/sys/kern/kern_rctl.c
+++ b/sys/kern/kern_rctl.c
@@ -580,7 +580,7 @@ rctl_enforce(struct proc *p, int resource, uint64_t amount)
continue;
}
sbuf_new(&sb, buf, RCTL_LOG_BUFSIZE, SBUF_FIXEDLEN);
- sbuf_printf(&sb, "rule=");
+ sbuf_cat(&sb, "rule=");
rctl_rule_to_sbuf(&sb, rule);
sbuf_printf(&sb, " pid=%d ruid=%d jail=%s",
p->p_pid, p->p_ucred->cr_ruid,
@@ -1484,28 +1484,28 @@ rctl_rule_to_sbuf(struct sbuf *sb, const struct rctl_rule *rule)
switch (rule->rr_subject_type) {
case RCTL_SUBJECT_TYPE_PROCESS:
if (rule->rr_subject.rs_proc == NULL)
- sbuf_printf(sb, ":");
+ sbuf_putc(sb, ':');
else
sbuf_printf(sb, "%d:",
rule->rr_subject.rs_proc->p_pid);
break;
case RCTL_SUBJECT_TYPE_USER:
if (rule->rr_subject.rs_uip == NULL)
- sbuf_printf(sb, ":");
+ sbuf_putc(sb, ':');
else
sbuf_printf(sb, "%d:",
rule->rr_subject.rs_uip->ui_uid);
break;
case RCTL_SUBJECT_TYPE_LOGINCLASS:
if (rule->rr_subject.rs_loginclass == NULL)
- sbuf_printf(sb, ":");
+ sbuf_putc(sb, ':');
else
sbuf_printf(sb, "%s:",
rule->rr_subject.rs_loginclass->lc_name);
break;
case RCTL_SUBJECT_TYPE_JAIL:
if (rule->rr_subject.rs_prison_racct == NULL)
- sbuf_printf(sb, ":");
+ sbuf_putc(sb, ':');
else
sbuf_printf(sb, "%s:",
rule->rr_subject.rs_prison_racct->prr_name);
@@ -1697,7 +1697,7 @@ rctl_get_rules_callback(struct racct *racct, void *arg2, void *arg3)
if (!rctl_rule_matches(link->rrl_rule, filter))
continue;
rctl_rule_to_sbuf(sb, link->rrl_rule);
- sbuf_printf(sb, ",");
+ sbuf_putc(sb, ',');
}
}
@@ -1754,7 +1754,7 @@ sys_rctl_get_rules(struct thread *td, struct rctl_get_rules_args *uap)
if (!rctl_rule_matches(link->rrl_rule, filter))
continue;
rctl_rule_to_sbuf(sb, link->rrl_rule);
- sbuf_printf(sb, ",");
+ sbuf_putc(sb, ',');
}
RACCT_UNLOCK();
}
@@ -1847,7 +1847,7 @@ sys_rctl_get_limits(struct thread *td, struct rctl_get_limits_args *uap)
LIST_FOREACH(link, &filter->rr_subject.rs_proc->p_racct->r_rule_links,
rrl_next) {
rctl_rule_to_sbuf(sb, link->rrl_rule);
- sbuf_printf(sb, ",");
+ sbuf_putc(sb, ',');
}
RACCT_UNLOCK();
if (sbuf_error(sb) == ENOMEM) {
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index c847783cd3da..8726c35e15a5 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -3971,7 +3971,7 @@ corefile_open(const char *comm, uid_t uid, pid_t pid, struct thread *td,
}
getcredhostname(td->td_ucred, hostname,
MAXHOSTNAMELEN);
- sbuf_printf(&sb, "%s", hostname);
+ sbuf_cat(&sb, hostname);
break;
case 'I': /* autoincrementing index */
if (indexpos != -1) {
@@ -4010,9 +4010,9 @@ corefile_open(const char *comm, uid_t uid, pid_t pid, struct thread *td,
sx_sunlock(&corefilename_lock);
free(hostname, M_TEMP);
if (compress == COMPRESS_GZIP)
- sbuf_printf(&sb, GZIP_SUFFIX);
+ sbuf_cat(&sb, GZIP_SUFFIX);
else if (compress == COMPRESS_ZSTD)
- sbuf_printf(&sb, ZSTD_SUFFIX);
+ sbuf_cat(&sb, ZSTD_SUFFIX);
if (sbuf_error(&sb) != 0) {
log(LOG_ERR, "pid %ld (%s), uid (%lu): corename is too "
"long\n", (long)pid, comm, (u_long)uid);
@@ -4168,10 +4168,10 @@ coredump(struct thread *td)
sb = sbuf_new_auto();
if (vn_fullpath_global(p->p_textvp, &fullpath, &freepath) != 0)
goto out2;
- sbuf_printf(sb, "comm=\"");
+ sbuf_cat(sb, "comm=\"");
devctl_safe_quote_sb(sb, fullpath);
free(freepath, M_TEMP);
- sbuf_printf(sb, "\" core=\"");
+ sbuf_cat(sb, "\" core=\"");
/*
* We can't lookup core file vp directly. When we're replacing a core, and
@@ -4190,7 +4190,7 @@ coredump(struct thread *td)
sbuf_putc(sb, '/');
}
devctl_safe_quote_sb(sb, name);
- sbuf_printf(sb, "\"");
+ sbuf_putc(sb, '"');
if (sbuf_finish(sb) == 0)
devctl_notify("kernel", "signal", "coredump", sbuf_data(sb));
out2:
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index a4bfe8e21aed..8baa78951501 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -421,9 +421,9 @@ sysctl_warn_reuse(const char *func, struct sysctl_oid *leaf)
sbuf_printf(&sb, "%s%.*s", nodes[i]->oid_name,
i != (rc - 1), ".");
} else {
- sbuf_printf(&sb, "%s", leaf->oid_name);
+ sbuf_cat(&sb, leaf->oid_name);
}
- sbuf_printf(&sb, ")!\n");
+ sbuf_cat(&sb, ")!\n");
(void)sbuf_finish(&sb);
}
diff --git a/sys/kern/kern_tslog.c b/sys/kern/kern_tslog.c
index a22370b85b02..7b0847d5d187 100644
--- a/sys/kern/kern_tslog.c
+++ b/sys/kern/kern_tslog.c
@@ -110,23 +110,23 @@ sysctl_debug_tslog(SYSCTL_HANDLER_ARGS)
(unsigned long long)timestamps[i].tsc);
switch (timestamps[i].type) {
case TS_ENTER:
- sbuf_printf(sb, " ENTER");
+ sbuf_cat(sb, " ENTER");
break;
case TS_EXIT:
- sbuf_printf(sb, " EXIT");
+ sbuf_cat(sb, " EXIT");
break;
case TS_THREAD:
- sbuf_printf(sb, " THREAD");
+ sbuf_cat(sb, " THREAD");
break;
case TS_EVENT:
- sbuf_printf(sb, " EVENT");
+ sbuf_cat(sb, " EVENT");
break;
}
sbuf_printf(sb, " %s", timestamps[i].f ? timestamps[i].f : "(null)");
if (timestamps[i].s)
sbuf_printf(sb, " %s\n", timestamps[i].s);
else
- sbuf_printf(sb, "\n");
+ sbuf_putc(sb, '\n');
}
error = sbuf_finish(sb);
sbuf_delete(sb);
@@ -210,7 +210,7 @@ sysctl_debug_tslog_user(SYSCTL_HANDLER_ARGS)
procs[pid].execname : "");
sbuf_printf(sb, " \"%s\"", procs[pid].namei ?
procs[pid].namei : "");
- sbuf_printf(sb, "\n");
+ sbuf_putc(sb, '\n');
}
error = sbuf_finish(sb);
sbuf_delete(sb);
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index 20515f4e430b..ebd7139fa612 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -3229,25 +3229,25 @@ sysctl_kern_sched_topology_spec_internal(struct sbuf *sb, struct cpu_group *cg,
for (i = cg->cg_first; i <= cg->cg_last; i++) {
if (CPU_ISSET(i, &cg->cg_mask)) {
if (!first)
- sbuf_printf(sb, ", ");
+ sbuf_cat(sb, ", ");
else
first = FALSE;
sbuf_printf(sb, "%d", i);
}
}
- sbuf_printf(sb, "\n");
+ sbuf_cat(sb, "\n");
if (cg->cg_flags != 0) {
sbuf_printf(sb, "%*s ", indent, "");
if ((cg->cg_flags & CG_FLAG_HTT) != 0)
- sbuf_printf(sb, "HTT group");
+ sbuf_cat(sb, "HTT group");
if ((cg->cg_flags & CG_FLAG_THREAD) != 0)
- sbuf_printf(sb, "THREAD group");
+ sbuf_cat(sb, "THREAD group");
if ((cg->cg_flags & CG_FLAG_SMT) != 0)
- sbuf_printf(sb, "SMT group");
+ sbuf_cat(sb, "SMT group");
if ((cg->cg_flags & CG_FLAG_NODE) != 0)
- sbuf_printf(sb, "NUMA node");
- sbuf_printf(sb, "\n");
+ sbuf_cat(sb, "NUMA node");
+ sbuf_cat(sb, "\n");
}
if (cg->cg_children > 0) {
@@ -3277,9 +3277,9 @@ sysctl_kern_sched_topology_spec(SYSCTL_HANDLER_ARGS)
if (topo == NULL)
return (ENOMEM);
- sbuf_printf(topo, "\n");
+ sbuf_cat(topo, "\n");
err = sysctl_kern_sched_topology_spec_internal(topo, cpu_top, 1);
- sbuf_printf(topo, "\n");
+ sbuf_cat(topo, "\n");
if (err == 0) {
err = sbuf_finish(topo);
diff --git a/sys/kern/subr_blist.c b/sys/kern/subr_blist.c
index 9b04518010e3..ac9d73ce3c6c 100644
--- a/sys/kern/subr_blist.c
+++ b/sys/kern/subr_blist.c
@@ -479,9 +479,9 @@ dump_gap_stats(const struct gap_stats *stats, struct sbuf *s)
sbuf_printf(s, "largest free range: %jd\n", (intmax_t)stats->max);
sbuf_printf(s, "average maximal free range size: %jd\n",
(intmax_t)stats->avg);
- sbuf_printf(s, "number of maximal free ranges of different sizes:\n");
- sbuf_printf(s, " count | size range\n");
- sbuf_printf(s, " ----- | ----------\n");
+ sbuf_cat(s, "number of maximal free ranges of different sizes:\n");
+ sbuf_cat(s, " count | size range\n");
+ sbuf_cat(s, " ----- | ----------\n");
for (i = 0; i < stats->max_bucket; i++) {
if (stats->histo[i] != 0) {
sbuf_printf(s, "%20jd | ",
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 8caab20cf709..648394abd026 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -5332,7 +5332,7 @@ device_get_path(device_t dev, const char *locator, struct sbuf *sb)
KASSERT(sb != NULL, ("sb is NULL"));
parent = device_get_parent(dev);
if (parent == NULL) {
- error = sbuf_printf(sb, "/");
+ error = sbuf_putc(sb, '/');
} else {
error = BUS_GET_DEVICE_PATH(parent, dev, locator, sb);
if (error == 0) {
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index 5c06bf8270f6..5136ece359e5 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -1240,24 +1240,24 @@ sbuf_hexdump(struct sbuf *sb, const void *ptr, int length, const char *hdr,
if (k < length)
sbuf_printf(sb, "%c%02x", delim, cp[k]);
else
- sbuf_printf(sb, " ");
+ sbuf_cat(sb, " ");
}
}
if ((flags & HD_OMIT_CHARS) == 0) {
- sbuf_printf(sb, " |");
+ sbuf_cat(sb, " |");
for (j = 0; j < cols; j++) {
k = i + j;
if (k >= length)
- sbuf_printf(sb, " ");
+ sbuf_putc(sb, ' ');
else if (cp[k] >= ' ' && cp[k] <= '~')
- sbuf_printf(sb, "%c", cp[k]);
+ sbuf_putc(sb, cp[k]);
else
- sbuf_printf(sb, ".");
+ sbuf_putc(sb, '.');
}
- sbuf_printf(sb, "|");
+ sbuf_putc(sb, '|');
}
- sbuf_printf(sb, "\n");
+ sbuf_putc(sb, '\n');
}
}
diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c
index bbbf753e3df0..15dbf396c557 100644
--- a/sys/kern/subr_sleepqueue.c
+++ b/sys/kern/subr_sleepqueue.c
@@ -1281,7 +1281,7 @@ sleepq_sbuf_print_stacks(struct sbuf *sb, const void *wchan, int queue,
sbuf_finish(td_infos[i]);
sbuf_printf(sb, "--- thread %s: ---\n", sbuf_data(td_infos[i]));
stack_sbuf_print(sb, st[i]);
- sbuf_printf(sb, "\n");
+ sbuf_putc(sb, '\n');
error = sbuf_error(sb);
if (error == 0)
@@ -1426,7 +1426,7 @@ dump_sleepq_prof_stats(SYSCTL_HANDLER_ARGS)
if (error != 0)
return (error);
sb = sbuf_new_for_sysctl(NULL, NULL, SLEEPQ_SBUFSIZE, req);
- sbuf_printf(sb, "\nwmesg\tcount\n");
+ sbuf_cat(sb, "\nwmesg\tcount\n");
enabled = prof_enabled;
mtx_lock_spin(&sleepq_prof_lock);
prof_enabled = 0;
diff --git a/sys/kern/subr_stats.c b/sys/kern/subr_stats.c
index 0e7d2fad5f68..6e8ec44681e7 100644
--- a/sys/kern/subr_stats.c
+++ b/sys/kern/subr_stats.c
@@ -2077,7 +2077,7 @@ stats_v1_itercb_tostr_freeform(struct statsblobv1 *sb, struct voi *v,
"data_off=%hu", vs->flags, vsd_dtype2name[vs->dtype],
vs->dsz, vs->data_off);
- sbuf_printf(buf, "\n\t\t\tvoistatdata: ");
+ sbuf_cat(buf, "\n\t\t\tvoistatdata: ");
stats_voistatdata_tostr(vsd, v->dtype, vs->dtype, vs->dsz,
sctx->fmt, buf, dump);
}
@@ -2124,7 +2124,7 @@ stats_v1_itercb_tostr_json(struct statsblobv1 *sb, struct voi *v, struct voistat
sbuf_printf(buf, "\"[%d]\":{\"id\":%d", ctx->vslot,
v->id);
if (v->id < 0) {
- sbuf_printf(buf, "},");
+ sbuf_cat(buf, "},");
return;
}
@@ -2156,7 +2156,7 @@ stats_v1_itercb_tostr_json(struct statsblobv1 *sb, struct voi *v, struct voistat
if (dump) {
sbuf_printf(buf, "\"[%hhd]\":", ctx->vsslot);
if (vs->stype < 0) {
- sbuf_printf(buf, "{\"stype\":-1},");
+ sbuf_cat(buf, "{\"stype\":-1},");
return;
}
sbuf_printf(buf, "{\"stype\":\"%s\",\"errs\":%hu,\"flags\":%hu,"
diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c
index 5b9f8afd9565..aa189e8cd057 100644
--- a/sys/kern/subr_witness.c
+++ b/sys/kern/subr_witness.c
@@ -2759,7 +2759,7 @@ restart:
tmp_w1->w_name, tmp_w1->w_class->lc_name,
tmp_w2->w_name, tmp_w2->w_class->lc_name);
stack_sbuf_print(sb, &tmp_data1->wlod_stack);
- sbuf_printf(sb, "\n");
+ sbuf_putc(sb, '\n');
}
if (data2 && data2 != data1) {
sbuf_printf(sb,
@@ -2767,7 +2767,7 @@ restart:
tmp_w2->w_name, tmp_w2->w_class->lc_name,
tmp_w1->w_name, tmp_w1->w_class->lc_name);
stack_sbuf_print(sb, &tmp_data2->wlod_stack);
- sbuf_printf(sb, "\n");
+ sbuf_putc(sb, '\n');
}
}
}
@@ -2905,7 +2905,7 @@ sysctl_debug_witness_fullgraph(SYSCTL_HANDLER_ARGS)
sb = sbuf_new_for_sysctl(NULL, NULL, FULLGRAPH_SBUF_SIZE, req);
if (sb == NULL)
return (ENOMEM);
- sbuf_printf(sb, "\n");
+ sbuf_putc(sb, '\n');
mtx_lock_spin(&w_mtx);
STAILQ_FOREACH(w, &w_all, w_list)
diff --git a/sys/kern/tty_info.c b/sys/kern/tty_info.c
index 15ba5995cea9..f54fc3a30f5e 100644
--- a/sys/kern/tty_info.c
+++ b/sys/kern/tty_info.c
@@ -309,17 +309,17 @@ tty_info(struct tty *tp)
load / 100, load % 100);
if (tp->t_session == NULL) {
- sbuf_printf(&sb, "not a controlling terminal\n");
+ sbuf_cat(&sb, "not a controlling terminal\n");
goto out;
}
if (tp->t_pgrp == NULL) {
- sbuf_printf(&sb, "no foreground process group\n");
+ sbuf_cat(&sb, "no foreground process group\n");
goto out;
}
PGRP_LOCK(tp->t_pgrp);
if (LIST_EMPTY(&tp->t_pgrp->pg_members)) {
PGRP_UNLOCK(tp->t_pgrp);
- sbuf_printf(&sb, "empty foreground process group\n");
+ sbuf_cat(&sb, "empty foreground process group\n");
goto out;
}
diff --git a/sys/kern/vfs_mountroot.c b/sys/kern/vfs_mountroot.c
index 7a429e6392b5..569f8560788c 100644
--- a/sys/kern/vfs_mountroot.c
+++ b/sys/kern/vfs_mountroot.c
@@ -895,18 +895,18 @@ vfs_mountroot_conf0(struct sbuf *sb)
char *s, *tok, *mnt, *opt;
int error;
- sbuf_printf(sb, ".onfail panic\n");
+ sbuf_cat(sb, ".onfail panic\n");
sbuf_printf(sb, ".timeout %d\n", root_mount_timeout);
if (boothowto & RB_ASKNAME)
- sbuf_printf(sb, ".ask\n");
+ sbuf_cat(sb, ".ask\n");
#ifdef ROOTDEVNAME
if (boothowto & RB_DFLTROOT)
sbuf_printf(sb, "%s\n", ROOTDEVNAME);
#endif
if (boothowto & RB_CDROM) {
- sbuf_printf(sb, "cd9660:/dev/cd0 ro\n");
- sbuf_printf(sb, ".timeout 0\n");
- sbuf_printf(sb, "cd9660:/dev/cd1 ro\n");
+ sbuf_cat(sb, "cd9660:/dev/cd0 ro\n");
+ sbuf_cat(sb, ".timeout 0\n");
+ sbuf_cat(sb, "cd9660:/dev/cd1 ro\n");
sbuf_printf(sb, ".timeout %d\n", root_mount_timeout);
}
s = kern_getenv("vfs.root.mountfrom");
@@ -933,7 +933,7 @@ vfs_mountroot_conf0(struct sbuf *sb)
sbuf_printf(sb, "%s\n", ROOTDEVNAME);
#endif
if (!(boothowto & RB_ASKNAME))
- sbuf_printf(sb, ".ask\n");
+ sbuf_cat(sb, ".ask\n");
}
static int