Stick the kthread API in a kthread_* namespace, and the specialized kproc
functions in a kproc_* namespace. Reviewed by: -arch
This commit is contained in:
parent
4979e034c1
commit
ffc831da27
@ -122,7 +122,7 @@ kthread_exit(int ecode)
|
||||
* Participation is voluntary.
|
||||
*/
|
||||
int
|
||||
suspend_kproc(struct proc *p, int timo)
|
||||
kthread_suspend(struct proc *p, int timo)
|
||||
{
|
||||
/*
|
||||
* Make sure this is indeed a system process and we can safely
|
||||
@ -131,11 +131,11 @@ suspend_kproc(struct proc *p, int timo)
|
||||
if ((p->p_flag & P_SYSTEM) == 0)
|
||||
return (EINVAL);
|
||||
SIGADDSET(p->p_siglist, SIGSTOP);
|
||||
return tsleep((caddr_t)&p->p_siglist, PPAUSE, "suspkp", timo);
|
||||
return tsleep((caddr_t)&p->p_siglist, PPAUSE, "suspkt", timo);
|
||||
}
|
||||
|
||||
int
|
||||
resume_kproc(struct proc *p)
|
||||
kthread_resume(struct proc *p)
|
||||
{
|
||||
/*
|
||||
* Make sure this is indeed a system process and we can safely
|
||||
@ -149,10 +149,10 @@ resume_kproc(struct proc *p)
|
||||
}
|
||||
|
||||
void
|
||||
kproc_suspend_loop(struct proc *p)
|
||||
kthread_suspend_check(struct proc *p)
|
||||
{
|
||||
while (SIGISMEMBER(p->p_siglist, SIGSTOP)) {
|
||||
wakeup((caddr_t)&p->p_siglist);
|
||||
tsleep((caddr_t)&p->p_siglist, PPAUSE, "kpsusp", 0);
|
||||
tsleep((caddr_t)&p->p_siglist, PPAUSE, "ktsusp", 0);
|
||||
}
|
||||
}
|
||||
|
@ -601,7 +601,7 @@ SYSCTL_INT(_kern_shutdown, OID_AUTO, kproc_shutdown_wait, CTLFLAG_RW,
|
||||
&kproc_shutdown_wait, 0, "");
|
||||
|
||||
void
|
||||
shutdown_kproc(void *arg, int howto)
|
||||
kproc_shutdown(void *arg, int howto)
|
||||
{
|
||||
struct proc *p;
|
||||
int error;
|
||||
@ -612,7 +612,7 @@ shutdown_kproc(void *arg, int howto)
|
||||
p = (struct proc *)arg;
|
||||
printf("Waiting (max %d seconds) for system process `%s' to stop...",
|
||||
kproc_shutdown_wait, p->p_comm);
|
||||
error = suspend_kproc(p, kproc_shutdown_wait * hz);
|
||||
error = kthread_suspend(p, kproc_shutdown_wait * hz);
|
||||
|
||||
if (error == EWOULDBLOCK)
|
||||
printf("timed out\n");
|
||||
|
@ -1774,7 +1774,7 @@ buf_daemon()
|
||||
/*
|
||||
* This process needs to be suspended prior to shutdown sync.
|
||||
*/
|
||||
EVENTHANDLER_REGISTER(shutdown_pre_sync, shutdown_kproc, bufdaemonproc,
|
||||
EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown, bufdaemonproc,
|
||||
SHUTDOWN_PRI_LAST);
|
||||
|
||||
/*
|
||||
@ -1788,7 +1788,7 @@ buf_daemon()
|
||||
bd_flushinc = 1;
|
||||
|
||||
for (;;) {
|
||||
kproc_suspend_loop(bufdaemonproc);
|
||||
kthread_suspend_check(bufdaemonproc);
|
||||
|
||||
bd_request = 0;
|
||||
|
||||
|
@ -1012,11 +1012,11 @@ sched_sync(void)
|
||||
|
||||
mtx_enter(&Giant, MTX_DEF);
|
||||
|
||||
EVENTHANDLER_REGISTER(shutdown_pre_sync, shutdown_kproc, p,
|
||||
EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown, p,
|
||||
SHUTDOWN_PRI_LAST);
|
||||
|
||||
for (;;) {
|
||||
kproc_suspend_loop(p);
|
||||
kthread_suspend_check(p);
|
||||
|
||||
starttime = time_second;
|
||||
|
||||
|
@ -1012,11 +1012,11 @@ sched_sync(void)
|
||||
|
||||
mtx_enter(&Giant, MTX_DEF);
|
||||
|
||||
EVENTHANDLER_REGISTER(shutdown_pre_sync, shutdown_kproc, p,
|
||||
EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown, p,
|
||||
SHUTDOWN_PRI_LAST);
|
||||
|
||||
for (;;) {
|
||||
kproc_suspend_loop(p);
|
||||
kthread_suspend_check(p);
|
||||
|
||||
starttime = time_second;
|
||||
|
||||
|
@ -43,13 +43,12 @@ struct kproc_desc {
|
||||
};
|
||||
|
||||
void kproc_start __P((const void *));
|
||||
void kproc_shutdown __P((void *, int));
|
||||
int kthread_create __P((void (*)(void *), void *, struct proc **,
|
||||
int flags, const char *, ...)) __printflike(5, 6);
|
||||
void kthread_exit __P((int)) __dead2;
|
||||
|
||||
int suspend_kproc __P((struct proc *, int));
|
||||
int resume_kproc __P((struct proc *));
|
||||
void kproc_suspend_loop __P((struct proc *));
|
||||
void shutdown_kproc __P((void *, int));
|
||||
int kthread_resume __P((struct proc *));
|
||||
int kthread_suspend __P((struct proc *, int));
|
||||
void kthread_suspend_check __P((struct proc *));
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user