SIGIO_INIT(9)

NAME
sigio_init, sigio_free, sigio_copy, sigio_setown, sigio_getown - asynchronous IO signal API

SYNOPSIS
#include <sys/sigio.h>
void
sigio_init(struct sigio_ref *sir);
void
sigio_free(struct sigio_ref *sir);
void
sigio_copy(struct sigio_ref *dst, struct sigio_ref *src);
int
sigio_setown(struct sigio_ref *sir, pid_t pgid);
pid_t
sigio_getown(struct sigio_ref *sir);

DESCRIPTION
The asynchronous IO signal API provides a means to manage signal registrations. It associates a process or process group with a signal source. The association is revoked automatically when the process or process group is deleted.

sigio_init() initializes the sigio reference sir.

sigio_free() clears any process or process group associated with reference sir.

sigio_copy() copies registration from reference src to reference dst.

sigio_setown() associates the reference sir with a process or process group. If pgid is positive, the ID is taken as a process ID. If pgid is negative, the ID is taken as a process group ID. The reference sir is cleared if pgid is zero.

When sigio_setown() is called, the invoking process' credentials are stored in the reference. These credentials are checked when the reference is used with pgsigio(9).

sigio_getown() returns the ID of the process or process group associated with the reference sir.

CONTEXT
sigio_init(), sigio_free(), sigio_copy(), sigio_setown() and sigio_getown() can be called during autoconf, or from process context.

RETURN VALUES
sigio_setown() returns 0 on success. Otherwise, the following error values are returned:

[EPERM]
    The invoking process belongs to another session than the process or process group pgid.

[ESRCH]
    The process or process group pgid does not exist.

[ESRCH]
    The process pgid is exiting.

The function sigio_getown() returns the ID of the process or process group associated with reference sir, or zero if no signal target has been registered.

SEE ALSO
pgsigio(9)

HISTORY
The sigio routines were adapted from FreeBSD and first appeared in OpenBSD 6.5.