AT_FORK(9)

NAME
at_fork, rm_at_fork - ask that a function be run at fork

SYNOPSIS
#include <sys/types.h>
#include <sys/systm.h>
typedef void
(*forklist_fn)(struct proc *, struct proc *, int);

int
at_fork(forklist_fn func);
int
rm_at_fork(forklist_fn func);

DESCRIPTION
The at_fork facility allows a kernel module to ensure that it is notified at any process fork. The function func is called with the a pointer to the forking process's proc structure, a pointer to the child's process structure and a flag word, as used in rfork(2) to indicate the type of fork.

If the requirement for notification is removed, then the function rm_at_fork() must be called with the exact func argument as the corresponding call to at_fork().

RETURN VALUES
at_fork() returns an errno, 0 meaning success. rm_at_fork() returns the number of items removed (should be 0 or 1).

SEE ALSO
fork(2)

HISTORY
The at_fork() function appeared in FreeBSD 2.2.

AUTHORS
The function was written by Julian Elischer <julian@FreeBSD.org>.