.TH chpoll "" "" "Entry-Point Routine"
.PC "Entry point for the polling routine"
.B "#include <sys/poll.h>"
\fBint \fIprefix\fBchpoll(\fIdevice\^\fB, \fIevents\^\fB, \fIpointer\^\fB, \fIevents\^\fB, \fIpollhead\^\fB)\fR
\fBdev_t \fIdevice\^\fB; short \fIevents\^\fB; int \fIpointer\^\fB; short \fIevents\^\fB;\fR
\fBstruct pollhead **\fIhead\^\fB;\fR
.PP
.B chpoll
is the entry point for polling a device.
It is used only by character drivers that use the DDI/DKI interface;
\*(ST drivers do not use it.
.PP
A
.B chpoll
routine takes the following arguments:
.IP "\fIdevice\fR"
The device being polled.
.IP "\fIevents\fR"
A bitmask of the events to be polled, as follows:
.RS
.IP \fBPOLLIN\fR 1.25i
Are data waiting to be read?
.IS \fBPOLLOUT\fR
May data be written without blocking?
.IS \fBPOLLPRI\fR
Are high-priority data waiting to be read?
.IS \fBPOLLHUP\fR
Has a device hung up?
.IS \fBPOLLERR\fR
Has a device error occurred?
.IS \fBPOLLRDNORM\fR
Are normal data waiting to be read?
.IS \fBPOLLWRNORM\fR
May normal data be written without blocking?
.IS \fBPOLLRDBAND\fR
Are out-of-band data waiting to be read?
.IS \fBPOLLWRBAND\fR
May out-of-band data be written without blocking?
.RE
.IP "\fIpointer\fR"
If this flag is set to true, the driver should return a pointer to its
.B pollhead
structure.
.IP "\fIevents\fR"
The
.B chpoll
routine writes at this address a mask of the events that have occurred.
.IP "\fIhead\fR"
The address of the
.B pollhead
structure to interrogate.
.PP
Note that the
.B pollhead
structure is totally opaque; a driver has no access to any of its fields.
.PP
The
.B chpoll
routine returns zero if all goes well.
If something goes wrong, it returns an appropriate error value.
.SH "See Also"
.B
entry points,
phalloc(),
phfree(),
pollhead,
pollwakeup()
.R
.SH Notes
This entry point is used only drivers that use the DDI/DKI interface.
It is optional.
