prochadd Kernel Service

Purpose

Adds a system-wide process state-change notification routine.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/proc.h>

void prochadd ( term)
struct proch *term;

Parameters

Item Description
term Points to a proch structure containing a notification routine to be added from the chain of systemwide notification routines.

Description

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 ();
}

Execution Environment

The prochadd kernel service can be called from the process environment only.