selreg Kernel Service

Purpose

Registers an asynchronous poll or select request with the kernel.

Syntax

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

int selreg ( corl,  dev_id,  unique_id,  reqevents,  notify)
int corl;
int dev_id;
int unique_id;
ushort reqevents;
void (*notify) ( );

Parameters

Item Description
corl The correlator for the poll or select request. The corl parameter is used by the poll and select subroutines to correlate the returned events in a specific select control block with a process' file descriptor or message queue.
dev_id Primary resource identification value. Along with the unique_id parameter, the dev_id parameter is used to record in the select control block the resource on which the requested poll or select events are expected to occur.
unique_id Unique resource identification value. Along with the dev_id parameter, the unique_id parameter denotes the resource on which the requested events are expected to occur. For a multiplexed device driver, this parameter specifies the number of the channel on which the requested events are expected to occur. For a nonmultiplexed device driver, this parameter must be set to 0.
reqevents Requested events parameter. The reqevents parameter consists of a set of bit flags denoting the events for which notification is being requested. These flags have the same definitions as the event flags provided by the events parameter on the unsatisfied call to the object's select subroutine (see the sys/poll.h file for the definitions).
Note: The POLLSYNC bit flag should not be set in this parameter.
notify Notification routine entry point. This parameter points to a notification routine used for nested poll and select calls.

Description

The selreg kernel service is used by select file operations in the top half of the kernel to register an unsatisfied asynchronous poll or select event request with the kernel. This registration enables later calls to the selnotify kernel service from resources in the bottom half of the kernel to correctly identify processes awaiting events on those resources.

The event requests may originate from calls to the poll or select subroutine, from processes, or from calls to the fp_poll or fp_select kernel service. A select file operation calls the selreg kernel service under the following circumstances:

A registered event request takes the form of a select control block. The select control block is a structure containing the following:

The selreg kernel service allocates and initializes a select control block each time it is called.

When an event occurs on a resource that supports the select file operation, the resource calls the selnotify kernel service. The selnotify kernel service locates all select control blocks whose primary and unique identifiers match those of the resource, and whose requested event flags match the occurred events on the resource. Then, for each of the matching control blocks, the selnotify kernel service takes one of two courses of action, depending upon whether the control block's notification routine pointer is non-null (nested) or null (non-nested):

Execution Environment

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

Returns Values

Item Description
0 Indicates successful completion.
EAGAIN Indicates the selreg kernel service was unable to allocate a select control block.