Adds a system-wide process state-change notification routine.
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/proc.h>
void prochadd ( term)
struct proch *term;
Item | Description |
---|---|
term | Points to a proch structure containing a notification routine to be added from the chain of systemwide notification routines. |
The prochadd kernel service allows kernel extensions to register for notification of major process state transitions. The prochadd service allows the caller to be notified when a process:
The complete list of callouts is:
Callout | Description |
---|---|
PROCH_INITIALIZE | Process (pid) created (initp, kforkx) |
PROCH_TERMINATE | Process (pid) terminated (kexitx) |
PROCH_EXEC | Process (pid) executing (execvex) |
THREAD_INITIALIZE | Thread (tid) created (kforkx, thread_create) |
THREAD_TERMINATE | Thread (tid) created (kexitx, thread_terminate) |
The prochadd service is typically used to allow recovery or reassignment of resources when processes undergo major state changes.
The caller should allocate a proch structure and update the proch.handler field with the entry point of a caller-supplied notification routine before calling the prochadd kernel service. This notification routine is called once for each process in the system undergoing a major state change.
The proch structure has the following form:
struct proch
{
struct proch *next
void *handler ();
}
The prochadd kernel service can be called from the process environment only.