summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2013-11-18 20:21:52 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2013-11-18 20:21:52 +0000
commit34f42c48d1fdabc4198ec57554652a5de2784927 (patch)
treea31f24276c56c3c04a003573a41c01ed368442b0 /sys
parent2e7693ff115858ab829cfeb57ae881e5f7e37e91 (diff)
simplify kthread_create(). no more stdarg
ok matthew guenther mikeb
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/arm/xscale/pxa2x0_apm.c4
-rw-r--r--sys/arch/arm/xscale/pxa2x0_pcic.c6
-rw-r--r--sys/arch/i386/i386/apm.c4
-rw-r--r--sys/arch/macppc/dev/mediabay.c5
-rw-r--r--sys/arch/macppc/dev/xlights.c6
-rw-r--r--sys/arch/sparc/dev/ts102.c4
-rw-r--r--sys/dev/hil/hil.c4
-rw-r--r--sys/dev/ic/aac.c4
-rw-r--r--sys/dev/ic/i82365.c7
-rw-r--r--sys/dev/ic/tcic2.c7
-rw-r--r--sys/dev/ic/twe.c4
-rw-r--r--sys/dev/onewire/onewire.c4
-rw-r--r--sys/dev/sbus/stp4020.c5
-rw-r--r--sys/dev/sdmmc/sdmmc.c4
-rw-r--r--sys/dev/usb/usbf.c4
-rw-r--r--sys/kern/kern_kthread.c9
-rw-r--r--sys/kern/kern_task.c4
-rw-r--r--sys/kern/kern_workq.c4
-rw-r--r--sys/sys/kthread.h5
19 files changed, 48 insertions, 46 deletions
diff --git a/sys/arch/arm/xscale/pxa2x0_apm.c b/sys/arch/arm/xscale/pxa2x0_apm.c
index 1bc8e38b4fe..f2df85177b4 100644
--- a/sys/arch/arm/xscale/pxa2x0_apm.c
+++ b/sys/arch/arm/xscale/pxa2x0_apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxa2x0_apm.c,v 1.39 2012/10/17 22:49:27 deraadt Exp $ */
+/* $OpenBSD: pxa2x0_apm.c,v 1.40 2013/11/18 20:21:51 deraadt Exp $ */
/*-
* Copyright (c) 2001 Alexander Guy. All rights reserved.
@@ -433,7 +433,7 @@ apm_thread_create(void *v)
struct pxa2x0_apm_softc *sc = v;
if (kthread_create(apm_thread, sc, &sc->sc_thread,
- "%s", sc->sc_dev.dv_xname)) {
+ sc->sc_dev.dv_xname)) {
/* apm_disconnect(sc); */
printf("%s: failed to create kernel thread, disabled",
sc->sc_dev.dv_xname);
diff --git a/sys/arch/arm/xscale/pxa2x0_pcic.c b/sys/arch/arm/xscale/pxa2x0_pcic.c
index 1fa35cecec7..855446b532a 100644
--- a/sys/arch/arm/xscale/pxa2x0_pcic.c
+++ b/sys/arch/arm/xscale/pxa2x0_pcic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxa2x0_pcic.c,v 1.17 2005/12/14 15:08:51 uwe Exp $ */
+/* $OpenBSD: pxa2x0_pcic.c,v 1.18 2013/11/18 20:21:51 deraadt Exp $ */
/*
* Copyright (c) 2005 Dale Rahn <drahn@openbsd.org>
@@ -403,6 +403,7 @@ pxapcic_create_event_thread(void *arg)
{
struct pxapcic_socket *sock = arg;
struct pxapcic_softc *sc = sock->sc;
+ char name[MAXCOMLEN+1];
u_int cs;
/* If there's a card there, attach it. */
@@ -410,8 +411,9 @@ pxapcic_create_event_thread(void *arg)
if (cs == PXAPCIC_CARD_VALID)
pxapcic_attach_card(sock);
+ snprintf(name, sizeof name, "%s-%d", sc->sc_dev.dv_xname, sock->socket);
if (kthread_create(pxapcic_event_thread, sock, &sock->event_thread,
- sc->sc_dev.dv_xname, sock->socket ? "1" : "0")) {
+ name))
printf("%s: unable to create event thread for %s\n",
sc->sc_dev.dv_xname, sock->socket ? "1" : "0");
}
diff --git a/sys/arch/i386/i386/apm.c b/sys/arch/i386/i386/apm.c
index 1b65ffe489f..e8a6b0cba39 100644
--- a/sys/arch/i386/i386/apm.c
+++ b/sys/arch/i386/i386/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.100 2012/10/17 22:49:27 deraadt Exp $ */
+/* $OpenBSD: apm.c,v 1.101 2013/11/18 20:21:51 deraadt Exp $ */
/*-
* Copyright (c) 1998-2001 Michael Shalayeff. All rights reserved.
@@ -882,7 +882,7 @@ apm_thread_create(void *v)
}
#endif
- if (kthread_create(apm_thread, sc, &sc->sc_thread, "%s",
+ if (kthread_create(apm_thread, sc, &sc->sc_thread,
sc->sc_dev.dv_xname)) {
apm_disconnect(sc);
printf("%s: failed to create kernel thread, disabled",
diff --git a/sys/arch/macppc/dev/mediabay.c b/sys/arch/macppc/dev/mediabay.c
index 2093e3babeb..c10fcee8cc1 100644
--- a/sys/arch/macppc/dev/mediabay.c
+++ b/sys/arch/macppc/dev/mediabay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mediabay.c,v 1.5 2012/12/05 23:20:13 deraadt Exp $ */
+/* $OpenBSD: mediabay.c,v 1.6 2013/11/18 20:21:51 deraadt Exp $ */
/* $NetBSD: mediabay.c,v 1.9 2003/07/15 02:43:29 lukem Exp $ */
/*-
@@ -223,7 +223,8 @@ mediabay_create_kthread(v)
{
struct mediabay_softc *sc = v;
- kthread_create(mediabay_kthread, sc, &sc->sc_kthread, "media-bay");
+ kthread_create(mediabay_kthread, sc, &sc->sc_kthread,
+ sc->sc_dev.dv_xname);
}
void
diff --git a/sys/arch/macppc/dev/xlights.c b/sys/arch/macppc/dev/xlights.c
index daf2e0e2603..ef76ac30f3c 100644
--- a/sys/arch/macppc/dev/xlights.c
+++ b/sys/arch/macppc/dev/xlights.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xlights.c,v 1.5 2011/05/15 09:10:26 mpi Exp $ */
+/* $OpenBSD: xlights.c,v 1.6 2013/11/18 20:21:51 deraadt Exp $ */
/*
* Copyright (c) 2007 Gordon Willem Klok <gwk@openbsd,org>
*
@@ -210,7 +210,9 @@ nodma:
void
xlights_deferred(void *v)
{
- kthread_create(xlights_theosDOT, v, NULL, "xlights");
+ struct xlights_softc *sc = (struct xlights_softc *)v;
+
+ kthread_create(xlights_theosDOT, v, NULL, sc->sc_dev.dv_xname);
}
/*
diff --git a/sys/arch/sparc/dev/ts102.c b/sys/arch/sparc/dev/ts102.c
index 2223582a188..398ef0fccf8 100644
--- a/sys/arch/sparc/dev/ts102.c
+++ b/sys/arch/sparc/dev/ts102.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ts102.c,v 1.19 2009/04/10 20:54:57 miod Exp $ */
+/* $OpenBSD: ts102.c,v 1.20 2013/11/18 20:21:51 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004, Miodrag Vallat.
*
@@ -599,7 +599,7 @@ tslot_create_event_thread(void *v)
struct tslot_softc *sc = v;
const char *name = sc->sc_dev.dv_xname;
- if (kthread_create(tslot_event_thread, sc, &sc->sc_thread, "%s",
+ if (kthread_create(tslot_event_thread, sc, &sc->sc_thread,
name) != 0) {
panic("%s: unable to create event kthread", name);
}
diff --git a/sys/dev/hil/hil.c b/sys/dev/hil/hil.c
index 3d48f8daca3..5bab6695a50 100644
--- a/sys/dev/hil/hil.c
+++ b/sys/dev/hil/hil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hil.c,v 1.24 2010/11/20 16:45:46 miod Exp $ */
+/* $OpenBSD: hil.c,v 1.25 2013/11/18 20:21:51 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004, Miodrag Vallat.
* All rights reserved.
@@ -252,7 +252,7 @@ hil_attach_deferred(void *v)
* Create asynchronous loop event handler thread.
*/
if (kthread_create(hil_thread, sc, &sc->sc_thread,
- "%s", sc->sc_dev.dv_xname) != 0) {
+ sc->sc_dev.dv_xname) != 0) {
printf("%s: unable to create event thread\n",
sc->sc_dev.dv_xname);
return;
diff --git a/sys/dev/ic/aac.c b/sys/dev/ic/aac.c
index 851cb0cb4c1..10c17978e05 100644
--- a/sys/dev/ic/aac.c
+++ b/sys/dev/ic/aac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aac.c,v 1.57 2013/11/13 05:47:58 mlarkin Exp $ */
+/* $OpenBSD: aac.c,v 1.58 2013/11/18 20:21:51 deraadt Exp $ */
/*-
* Copyright (c) 2000 Michael Smith
@@ -284,7 +284,7 @@ aac_create_thread(void *arg)
{
struct aac_softc *sc = arg;
- if (kthread_create(aac_command_thread, sc, &sc->aifthread, "%s",
+ if (kthread_create(aac_command_thread, sc, &sc->aifthread,
sc->aac_dev.dv_xname)) {
/* TODO disable aac */
printf("%s: failed to create kernel thread, disabled",
diff --git a/sys/dev/ic/i82365.c b/sys/dev/ic/i82365.c
index 47a30f2048c..ebb87061422 100644
--- a/sys/dev/ic/i82365.c
+++ b/sys/dev/ic/i82365.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i82365.c,v 1.29 2010/09/06 19:20:21 deraadt Exp $ */
+/* $OpenBSD: i82365.c,v 1.30 2013/11/18 20:21:51 deraadt Exp $ */
/* $NetBSD: i82365.c,v 1.10 1998/06/09 07:36:55 thorpej Exp $ */
/*
@@ -386,6 +386,7 @@ pcic_create_event_thread(arg)
void *arg;
{
struct pcic_handle *h = arg;
+ char name[MAXCOMLEN+1];
const char *cs;
switch (h->sock) {
@@ -405,8 +406,8 @@ pcic_create_event_thread(arg)
panic("pcic_create_event_thread: unknown pcic socket");
}
- if (kthread_create(pcic_event_thread, h, &h->event_thread,
- "%s,%s", h->ph_parent->dv_xname, cs)) {
+ snprintf(name, sizeof name, "%s,%s", h->ph_parent->dv_xname, cs);
+ if (kthread_create(pcic_event_thread, h, &h->event_thread, name)) {
printf("%s: unable to create event thread for sock 0x%02x\n",
h->ph_parent->dv_xname, h->sock);
panic("pcic_create_event_thread");
diff --git a/sys/dev/ic/tcic2.c b/sys/dev/ic/tcic2.c
index 67308e1b7fe..83742e3d39d 100644
--- a/sys/dev/ic/tcic2.c
+++ b/sys/dev/ic/tcic2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcic2.c,v 1.8 2007/11/25 16:40:04 jmc Exp $ */
+/* $OpenBSD: tcic2.c,v 1.9 2013/11/18 20:21:51 deraadt Exp $ */
/* $NetBSD: tcic2.c,v 1.3 2000/01/13 09:38:17 joda Exp $ */
#undef TCICDEBUG
@@ -446,6 +446,7 @@ tcic_create_event_thread(arg)
void *arg;
{
struct tcic_handle *h = arg;
+ char name[MAXCOMLEN+1];
const char *cs;
switch (h->sock) {
@@ -459,8 +460,8 @@ tcic_create_event_thread(arg)
panic("tcic_create_event_thread: unknown tcic socket");
}
- if (kthread_create(tcic_event_thread, h, &h->event_thread,
- "%s,%s", h->sc->dev.dv_xname, cs)) {
+ snprintf(name, sizeof name, "%s,%s", h->sc->dev.dv_xname, cs);
+ if (kthread_create(tcic_event_thread, h, &h->event_thread, name)) {
printf("%s: unable to create event thread for sock 0x%02x\n",
h->sc->dev.dv_xname, h->sock);
panic("tcic_create_event_thread");
diff --git a/sys/dev/ic/twe.c b/sys/dev/ic/twe.c
index d1aca481b44..a2ad3c3d0cc 100644
--- a/sys/dev/ic/twe.c
+++ b/sys/dev/ic/twe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: twe.c,v 1.41 2011/07/17 22:46:48 matthew Exp $ */
+/* $OpenBSD: twe.c,v 1.42 2013/11/18 20:21:51 deraadt Exp $ */
/*
* Copyright (c) 2000-2002 Michael Shalayeff. All rights reserved.
@@ -419,7 +419,7 @@ twe_thread_create(void *v)
struct twe_softc *sc = v;
if (kthread_create(twe_thread, sc, &sc->sc_thread,
- "%s", sc->sc_dev.dv_xname)) {
+ sc->sc_dev.dv_xname)) {
/* TODO disable twe */
printf("%s: failed to create kernel thread, disabled\n",
sc->sc_dev.dv_xname);
diff --git a/sys/dev/onewire/onewire.c b/sys/dev/onewire/onewire.c
index 745fd594c17..7cf3eff1875 100644
--- a/sys/dev/onewire/onewire.c
+++ b/sys/dev/onewire/onewire.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: onewire.c,v 1.13 2013/04/10 01:35:55 guenther Exp $ */
+/* $OpenBSD: onewire.c,v 1.14 2013/11/18 20:21:51 deraadt Exp $ */
/*
* Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org>
@@ -415,7 +415,7 @@ onewire_createthread(void *arg)
struct onewire_softc *sc = arg;
if (kthread_create(onewire_thread, sc, &sc->sc_thread,
- "%s", sc->sc_dev.dv_xname) != 0)
+ sc->sc_dev.dv_xname) != 0)
printf("%s: can't create kernel thread\n",
sc->sc_dev.dv_xname);
}
diff --git a/sys/dev/sbus/stp4020.c b/sys/dev/sbus/stp4020.c
index 63645b3bc7d..e0c156e7b59 100644
--- a/sys/dev/sbus/stp4020.c
+++ b/sys/dev/sbus/stp4020.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: stp4020.c,v 1.16 2009/04/10 20:54:58 miod Exp $ */
+/* $OpenBSD: stp4020.c,v 1.17 2013/11/18 20:21:51 deraadt Exp $ */
/* $NetBSD: stp4020.c,v 1.23 2002/06/01 23:51:03 lukem Exp $ */
/*-
@@ -295,10 +295,9 @@ stp4020_create_event_thread(arg)
void *arg;
{
struct stp4020_softc *sc = arg;
- const char *name = sc->sc_dev.dv_xname;
if (kthread_create(stp4020_event_thread, sc, &sc->event_thread,
- "%s", name)) {
+ sc->sc_dev.dv_xname)) {
panic("%s: unable to create event thread", name);
}
}
diff --git a/sys/dev/sdmmc/sdmmc.c b/sys/dev/sdmmc/sdmmc.c
index 2129b3fbb6c..33cd8acff43 100644
--- a/sys/dev/sdmmc/sdmmc.c
+++ b/sys/dev/sdmmc/sdmmc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdmmc.c,v 1.28 2013/09/12 11:54:04 rapha Exp $ */
+/* $OpenBSD: sdmmc.c,v 1.29 2013/11/18 20:21:51 deraadt Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -176,7 +176,7 @@ sdmmc_create_thread(void *arg)
struct sdmmc_softc *sc = arg;
if (kthread_create(sdmmc_task_thread, sc, &sc->sc_task_thread,
- "%s", DEVNAME(sc)) != 0)
+ DEVNAME(sc)) != 0)
printf("%s: can't create task thread\n", DEVNAME(sc));
}
diff --git a/sys/dev/usb/usbf.c b/sys/dev/usb/usbf.c
index 8f42e158c3c..75099d48965 100644
--- a/sys/dev/usb/usbf.c
+++ b/sys/dev/usb/usbf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usbf.c,v 1.15 2013/04/15 09:23:02 mglocker Exp $ */
+/* $OpenBSD: usbf.c,v 1.16 2013/11/18 20:21:51 deraadt Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -225,7 +225,7 @@ usbf_create_thread(void *arg)
{
struct usbf_softc *sc = arg;
- if (kthread_create(usbf_task_thread, sc, &sc->sc_proc, "%s",
+ if (kthread_create(usbf_task_thread, sc, &sc->sc_proc,
DEVNAME(sc)) != 0) {
printf("%s: can't create task thread\n", DEVNAME(sc));
return;
diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c
index f5ed894c2c7..469d75a9f5e 100644
--- a/sys/kern/kern_kthread.c
+++ b/sys/kern/kern_kthread.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_kthread.c,v 1.32 2013/03/28 16:55:25 deraadt Exp $ */
+/* $OpenBSD: kern_kthread.c,v 1.33 2013/11/18 20:21:51 deraadt Exp $ */
/* $NetBSD: kern_kthread.c,v 1.3 1998/12/22 21:21:36 kleink Exp $ */
/*-
@@ -56,11 +56,10 @@ int kthread_create_now;
*/
int
kthread_create(void (*func)(void *), void *arg,
- struct proc **newpp, const char *fmt, ...)
+ struct proc **newpp, const char *name)
{
struct proc *p;
int error;
- va_list ap;
/*
* First, create the new process. Share the memory, file
@@ -78,9 +77,7 @@ kthread_create(void (*func)(void *), void *arg,
atomic_setbits_int(&p->p_flag, P_SYSTEM);
/* Name it as specified. */
- va_start(ap, fmt);
- vsnprintf(p->p_comm, sizeof p->p_comm, fmt, ap);
- va_end(ap);
+ strlcpy(p->p_comm, name, sizeof p->p_comm);
/* All done! */
if (newpp != NULL)
diff --git a/sys/kern/kern_task.c b/sys/kern/kern_task.c
index f04a1b750d1..4299c1983f1 100644
--- a/sys/kern/kern_task.c
+++ b/sys/kern/kern_task.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_task.c,v 1.5 2013/10/30 02:11:32 dlg Exp $ */
+/* $OpenBSD: kern_task.c,v 1.6 2013/11/18 20:21:51 deraadt Exp $ */
/*
* Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
@@ -138,7 +138,7 @@ taskq_create_thread(void *arg)
tq->tq_running++;
mtx_leave(&tq->tq_mtx);
- rv = kthread_create(taskq_thread, tq, NULL, "%s", tq->tq_name);
+ rv = kthread_create(taskq_thread, tq, NULL, tq->tq_name);
mtx_enter(&tq->tq_mtx);
if (rv != 0) {
diff --git a/sys/kern/kern_workq.c b/sys/kern/kern_workq.c
index cfcae6d3741..24f6d2a3eb4 100644
--- a/sys/kern/kern_workq.c
+++ b/sys/kern/kern_workq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_workq.c,v 1.12 2010/08/23 04:49:10 dlg Exp $ */
+/* $OpenBSD: kern_workq.c,v 1.13 2013/11/18 20:21:51 deraadt Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -179,7 +179,7 @@ workq_create_thread(void *arg)
wq->wq_running++;
mtx_leave(&wq->wq_mtx);
- rv = kthread_create(workq_thread, wq, NULL, "%s", wq->wq_name);
+ rv = kthread_create(workq_thread, wq, NULL, wq->wq_name);
mtx_enter(&wq->wq_mtx);
if (rv != 0) {
diff --git a/sys/sys/kthread.h b/sys/sys/kthread.h
index 67e348c9375..851f2ff490a 100644
--- a/sys/sys/kthread.h
+++ b/sys/sys/kthread.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: kthread.h,v 1.5 2011/05/30 18:51:17 martynas Exp $ */
+/* $OpenBSD: kthread.h,v 1.6 2013/11/18 20:21:51 deraadt Exp $ */
/* $NetBSD: kthread.h,v 1.2 1998/11/14 00:08:49 thorpej Exp $ */
/*-
@@ -42,8 +42,7 @@
#include <sys/proc.h> /* struct proc, tsleep(), wakeup() */
int kthread_create(void (*)(void *), void *, struct proc **,
- const char *, ...)
- __attribute__((__format__(__kprintf__,4,5)));
+ const char *);
void kthread_create_deferred(void (*)(void *), void *);
void kthread_run_deferred_queue(void);
void kthread_exit(int) __attribute__((__noreturn__));