aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2004-05-14 20:51:42 +0000
committerBruce Evans <bde@FreeBSD.org>2004-05-14 20:51:42 +0000
commita13ec35b05d47c55e29d8e36d79c65dd3429a93a (patch)
treef0af971960bca6e2b4a6e0fb08a00de62ecd8115 /sys
parent237266b2e696b5f15d5d7f8f106357168e5aca8f (diff)
downloadsrc-a13ec35b05d47c55e29d8e36d79c65dd3429a93a.tar.gz
src-a13ec35b05d47c55e29d8e36d79c65dd3429a93a.zip
Fixed some common printf format errors. Don't assume that "struct foo *"
is "void *" (it isn't) or that the default promotion of pid_t is int. Instead, assume that casting "struct foo *" to "void *" and printing the result with %p is useful, and that all pid_t's are representable as longs. Fixed some minor style bugs (mainly spelling errors in comments).
Notes
Notes: svn path=/head/; revision=129241
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_synch.c33
-rw-r--r--sys/kern/subr_sleepqueue.c27
2 files changed, 27 insertions, 33 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 280f24f88116..9fa44bdd6791 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -118,7 +118,6 @@ sleepinit(void)
* entered before msleep returns. If priority includes the PDROP
* flag the mutex is not entered before returning.
*/
-
int
msleep(ident, mtx, priority, wmesg, timo)
void *ident;
@@ -148,8 +147,8 @@ msleep(ident, mtx, priority, wmesg, timo)
if (cold) {
/*
* During autoconfiguration, just return;
- * don't run any other procs or panic below,
- * in case this is the idle process and already asleep.
+ * don't run any other threads or panic below,
+ * in case this is the idle thread and already asleep.
* XXX: this used to do "s = splhigh(); splx(safepri);
* splx(s);" to give interrupts a chance, but there is
* no way to give interrupts a chance now.
@@ -199,8 +198,8 @@ msleep(ident, mtx, priority, wmesg, timo)
}
}
mtx_unlock_spin(&sched_lock);
- CTR5(KTR_PROC, "msleep: thread %p (pid %d, %s) on %s (%p)",
- td, p->p_pid, p->p_comm, wmesg, ident);
+ CTR5(KTR_PROC, "msleep: thread %p (pid %ld, %s) on %s (%p)",
+ (void *)td, (long)p->p_pid, p->p_comm, wmesg, ident);
DROP_GIANT();
if (mtx != NULL) {
@@ -233,9 +232,9 @@ msleep(ident, mtx, priority, wmesg, timo)
sig = 0;
/*
- * Adjust this threads priority.
+ * Adjust this thread's priority.
*
- * XXX: Do we need to save priority in td_base_pri?
+ * XXX: do we need to save priority in td_base_pri?
*/
mtx_lock_spin(&sched_lock);
sched_prio(td, priority & PRIMASK);
@@ -251,10 +250,6 @@ msleep(ident, mtx, priority, wmesg, timo)
sleepq_wait(ident);
rval = 0;
}
-
- /*
- * We're awake from voluntary sleep.
- */
if (rval == 0 && catch)
rval = sleepq_calc_signal_retval(sig);
#ifdef KTRACE
@@ -270,7 +265,7 @@ msleep(ident, mtx, priority, wmesg, timo)
}
/*
- * Make all processes sleeping on the specified identifier runnable.
+ * Make all threads sleeping on the specified identifier runnable.
*/
void
wakeup(ident)
@@ -281,8 +276,8 @@ wakeup(ident)
}
/*
- * Make a process sleeping on the specified identifier runnable.
- * May wake more than one process if a target process is currently
+ * Make a thread sleeping on the specified identifier runnable.
+ * May wake more than one thread if a target thread is currently
* swapped out.
*/
void
@@ -294,7 +289,7 @@ wakeup_one(ident)
}
/*
- * The machine independent parts of mi_switch().
+ * The machine independent parts of context switching.
*/
void
mi_switch(int flags)
@@ -357,14 +352,14 @@ mi_switch(int flags)
cnt.v_swtch++;
PCPU_SET(switchtime, new_switchtime);
PCPU_SET(switchticks, ticks);
- CTR3(KTR_PROC, "mi_switch: old thread %p (pid %d, %s)", td, p->p_pid,
- p->p_comm);
+ CTR3(KTR_PROC, "mi_switch: old thread %p (pid %ld, %s)",
+ (void *)td, (long)p->p_pid, p->p_comm);
if (td->td_proc->p_flag & P_SA)
thread_switchout(td);
sched_switch(td);
- CTR3(KTR_PROC, "mi_switch: new thread %p (pid %d, %s)", td, p->p_pid,
- p->p_comm);
+ CTR3(KTR_PROC, "mi_switch: new thread %p (pid %ld, %s)",
+ (void *)td, (long)p->p_pid, p->p_comm);
/*
* If the last thread was exiting, finish cleaning it up.
diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c
index 611ec63c1b77..e3f1996d8511 100644
--- a/sys/kern/subr_sleepqueue.c
+++ b/sys/kern/subr_sleepqueue.c
@@ -303,8 +303,8 @@ sleepq_catch_signals(void *wchan)
mtx_assert(&sc->sc_lock, MA_OWNED);
MPASS(td->td_sleepqueue == NULL);
MPASS(wchan != NULL);
- CTR3(KTR_PROC, "sleepq catching signals: thread %p (pid %d, %s)", td,
- p->p_pid, p->p_comm);
+ CTR3(KTR_PROC, "sleepq catching signals: thread %p (pid %ld, %s)",
+ (void *)td, (long)p->p_pid, p->p_comm);
/* Mark thread as being in an interruptible sleep. */
mtx_lock_spin(&sched_lock);
@@ -373,8 +373,8 @@ sleepq_switch(void *wchan)
TD_SET_SLEEPING(td);
mi_switch(SW_VOL);
KASSERT(TD_IS_RUNNING(td), ("running but not TDS_RUNNING"));
- CTR3(KTR_PROC, "sleepq resume: thread %p (pid %d, %s)", td,
- td->td_proc->p_pid, td->td_proc->p_comm);
+ CTR3(KTR_PROC, "sleepq resume: thread %p (pid %ld, %s)",
+ (void *)td, (long)td->td_proc->p_pid, (void *)td->td_proc->p_comm);
}
/*
@@ -430,7 +430,6 @@ sleepq_check_signals(void)
/* We are no longer in an interruptible sleep. */
td->td_flags &= ~TDF_SINTR;
- /* If we were interrupted, return td_intrval. */
if (td->td_flags & TDF_INTERRUPT)
return (td->td_intrval);
return (0);
@@ -584,8 +583,8 @@ sleepq_resume_thread(struct thread *td, int pri)
* do it. However, we can't assert that it is set.
*/
mtx_lock_spin(&sched_lock);
- CTR3(KTR_PROC, "sleepq_wakeup: thread %p (pid %d, %s)", td,
- td->td_proc->p_pid, td->td_proc->p_comm);
+ CTR3(KTR_PROC, "sleepq_wakeup: thread %p (pid %ld, %s)",
+ (void *)td, (long)td->td_proc->p_pid, td->td_proc->p_comm);
TD_CLR_SLEEPING(td);
/* Adjust priority if requested. */
@@ -676,9 +675,9 @@ sleepq_timeout(void *arg)
struct thread *td;
void *wchan;
- td = (struct thread *)arg;
- CTR3(KTR_PROC, "sleepq_timeout: thread %p (pid %d, %s)",
- td, td->td_proc->p_pid, td->td_proc->p_comm);
+ td = arg;
+ CTR3(KTR_PROC, "sleepq_timeout: thread %p (pid %ld, %s)",
+ (void *)td, (long)td->td_proc->p_pid, (void *)td->td_proc->p_comm);
/*
* First, see if the thread is asleep and get the wait channel if
@@ -768,8 +767,8 @@ sleepq_remove(struct thread *td, void *wchan)
}
/*
- * Abort a thread as if an interrupt had occured. Only abort
- * interruptable waits (unfortunately it isn't safe to abort others).
+ * Abort a thread as if an interrupt had occurred. Only abort
+ * interruptible waits (unfortunately it isn't safe to abort others).
*
* XXX: What in the world does the comment below mean?
* Also, whatever the signal code does...
@@ -790,8 +789,8 @@ sleepq_abort(struct thread *td)
if (td->td_flags & TDF_TIMEOUT)
return;
- CTR3(KTR_PROC, "sleepq_abort: thread %p (pid %d, %s)", td,
- td->td_proc->p_pid, td->td_proc->p_comm);
+ CTR3(KTR_PROC, "sleepq_abort: thread %p (pid %ld, %s)",
+ (void *)td, (long)td->td_proc->p_pid, (void *)td->td_proc->p_comm);
wchan = td->td_wchan;
mtx_unlock_spin(&sched_lock);
sleepq_remove(td, wchan);