mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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).
This commit is contained in:
parent
237266b2e6
commit
a13ec35b05
2 changed files with 27 additions and 33 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue