kproc, pexit, postnote – kernel process creation, termination and interruption
void kproc(char *name, void (*func)(void*), void *arg)
void pexit(char *note, int freemem)
int postnote(Proc *p, int dolock, char *n, int flag)
creates a new kernel process
to run the function
which is invoked as
is copied into the
field of the
structure of the new process; this value is the name of the kproc in
the output of
The process is made runnable; it
will run when selected by the scheduler
The process is created with base and current priorities set to
It shares the kernel process group and thus name space.
A kernel process terminates only when it calls
thereby terminating itself.
There is no mechanism for one process to force the termination of another,
although it can send a software interrupt using
is a null string on normal termination, or
the cause of
any memory allocated by the process is discarded;
it should normally be non-zero for any process created
Use the following to terminate a kernel process normally:
sends a software interrupt to process
causing it, if necessary, to wake from
or break out of a
notes can be pending at once (currently 5);
if more than that arrive, the process is forced
but the message itself is discarded.
returns non-zero iff the note has been
synchronises delivery of the note with the debugger
and other operations of
is zero, or one of the following
Print the note message on the user’s standard error.
Furthermore, suspend the process in a
state, preserving its memory, for later debugging.
Deliver the note quietly.
The note comes from another process, not the system.
The kernel uses
to signal processes that commit grave faults,
and to implement the note and kill functions of
A device driver should use
only to tell a service process,
previously started by the driver using
that it should stop;
the note will cause that process to raise an
For example, a process started to read packets from a network device could
be stopped as follows when the interface is unbound:
postnote(readp, 1, "unbind", 0);
points to the appropriate
The text of the message is typically irrelevant.