[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Kernel and Subsystems, Volume 1

Process State-Change Notification Routine

Purpose

Allows kernel extensions to be notified of major process and thread state transitions.

Syntax


void prochadd_handler ( term, type, id)
struct proch *term;
int type;
long id;


void proch_reg_handler ( term, type, id)
struct prochr *term;
int type;
long id;

Parameters

term Points to the proch structure used in the prochadd call or to the prochr structure used in the proch_reg call.
type Defines the state change event being reported: process initialization, process termination, process exec, thread initialization, or thread termination. These values are defined in the /usr/include/sys/proc.h file. The values that may be passed as type also depend on how the callout is requested.

Possible prochadd_handler type values:

PROCH_INITIALIZE
Process is initializing.
PROCH_TERMINATE
Process is terminating.
PROCH_EXEC
Process is about to exec a new program.
THREAD_INITIALIZE
A new thread is created.
THREAD_TERMINATE
A thread is terminated.

Possible proch_reg_handler type values:

PROCHR_INITIALIZE
Process is initializing.
PROCHR_TERMINATE
Process is terminating.
PROCHR_EXEC
Process is about to exec a new program.
PROCHR_THREAD_INIT
A new thread is created.
PROCHR_THREAD_TERM
A thread is terminated.
id Defines either the process ID or the thread ID.

Description

The notification callout is set up by using either the prochadd or the proch_reg kernel service. If you request the notification using the prochadd kernel service, the callout follows the syntax shown first as prochadd_handler. If you request the notification using the proch_reg kernel service, the callout follows the syntax shown second as proch_reg_handler.

For process initialization, the process state-change notification routine is called in the execution environment of a parent process for the initialization of a newly created child process. For kernel processes, the notification routine is called when the initp kernel service is called to complete initialization.

For process termination, the notification routines are called before the kernel handles default termination procedures. The routines must be written so as not to allocate any resources under the terminating process. The notification routine is called under the process image of the terminating process.

Related Information

The prochadd kernel service, prochdel kernel service, proch_reg kernel service, proch_unreg kernel service.

Kernel Extension and Device Driver Management Kernel Services in AIX 5L Version 5.2 Kernel Extensions and Device Support Programming Concepts.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]