GETDOPT(2) — System Interface Manual — System Calls
NAME
getdopt, setdopt − get/set options associated with a descriptor
SYNOPSIS
#include <sys/descrip.h>
getdopt(d, whichway, dopt)
int d, whichway;
struct dopt ∗dopt;
setdopt(d, whichway, dopt)
int d, whichway;
struct dopt ∗dopt;
DESCRIPTION
N.B. This call is proposed for 4.2bsd, but not implemented in 4.1c.
I/O operations on descriptors are normally blocking in case a request can not be immediately completed. This mode of operation may be altered to be non-blocking or asynchronous through the setdopt call. The getdopt call allows a process to find out what mode a descriptor is presently using.
The descriptor is indicated as d. The whichway parameter is one of the following:
DOPT_INPUT0x1apply to input
DOPT_OUTPUT0x2apply to output
DOPT_EXCEPT0x3apply to any exceptional conditions
Dopt is a pointer to a structure of the form
struct dopt {
shortdo_flags;
intdo_pid;
};
#defineDOFLAG_DONTBLOCK0x1
#defineDOFLAG_SIGNALPROC0x2
#defineDOFLAG_SIGNALPGRP0x4
Operations on a non-blocking descriptor will either complete immediately, note an error EWOULDBLOCK, partially complete an input or output operation, returning a partial count or return an error EINPROGRESS noting the requested operation is in progress.
A descriptor which has signalling enabled will cause the specified process and/or process group to be signalled, with a SIGIO when input, output, or an in-progress operation completes, or with a SIGURG signal when an exceptional condition arises.
RETURN VALUE
If the call succeeds, then the call returns a 0 value. If an error occurs, a value −1 is returned and an error indication is stored in the global variable errno.
ERRORS
The possible errors for getdopt are:
[EBADF] D is not a valid descriptor.
[EFAULT] The dopt argument is at an illegal address.
[EACCESS] The process or process group specified in setdopt is not allowed to be signalled by the current process.
SEE ALSO
Sun System Release 0.3 — 25 April 1983