SVR5 and SCO OpenServer
close(D2str)
close --
relinquish access to a STREAMS device
Syntax
See
close(D2)
for DDI syntax, arguments, return values,
and basic usage information.
See
close(D2oddi)
for ODDI syntax, arguments, return values,
and basic usage information.
Usage
This entry point is required
in all drivers and STREAMS modules.
The
close( )
routines of
STREAMS drivers and modules are called
when a stream is dismantled or a module popped.
The steps for dismantling a stream
are performed in the following order:
-
Any non-persistent multiplexor links present are unlinked and the
lower streams are closed.
-
The following steps are performed for each module or driver
on the stream, starting at the head and working toward the tail:
-
The write queue is given a chance to drain.
-
Interrupts from STREAMS devices are blocked.
-
The close routine is called.
-
The module or driver is removed from the stream.
-
Any remaining messages on the queues are freed.
A close routine could perform any of the following general
functions, depending on the type of device and the service provided:
-
disable device interrupts
-
hang up phone lines
-
rewind a tape
-
deallocate buffers from a private buffering scheme
-
unlock an unsharable device
(that was locked in the open routine)
-
flush buffers
-
notify a device of the close
-
cancel any pending timeout or bufcall routines that access data that are deinitialized
or deallocated during close
-
deallocate any resources allocated on open
Multithreaded STREAMS drivers and modules
must call
qprocsoff(D3str)
to disable their
put(D2str)
and service
(srv(D2str))
routines before returning from the
close routine.
Synchronization constraints
The close routine has user context and can sleep.
However, STREAMS drivers and modules
must sleep such that signals do not cause
the sleep to longjump as discussed on the
sleep(D3)
manual page.
Also, if a close routine does sleep,
it is important that the driver writer synchronize
the driver's open and close routines,
since a driver can be reopened while being closed.
If the FNDELAY or FNONBLOCK flags
are specified in the flag argument,
the driver should try to avoid sleeping,
if possible, during close processing.
References
close(D2),
close(D2mdi),
close(D2oddi)
drv_priv(D3),
errnos(D5),
open(D2str),
qprocsoff(D3str),
queue(D4str),
sleep(D3),
unbufcall(D3str),
untimeout(D3),
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005