|
|
#include <sys/stream.h> #include <sys/ddi.h>void unbufcall(toid_t id);
#include <sys/stream.h>void unbufcall(uint_t size, int pri, void (*func)(), long arg);
On multiprocessor systems, if unbufcall is called while any function called by the pending bufcall or esbbcall request is running, the call to unbufcall will not return until the function completes.
Note that any function that runs as a result of a call to bufcall (or to esbbcall) cannot use unbufcall to cancel itself.
Driver-defined basic locks, read/write locks, and sleep locks may not be held across calls to this function.
toid_t
data type.
In earlier DDI releases,
it is an int
.
In the module close routine,
if a bufcall request is pending (line 14),
we cancel it (line 15).
Otherwise, if a timeout request is pending (line 16),
we cancel it (line 17).
Then the m_type
field in the module's private
data structure is set to 0,
indicating no pending bufcall or timeout.
1 struct mod { 2 long m_id; 3 char m_type; ... 4 }; 5 #define TIMEOUT 1 6 #define BUFCALL 2 ... 7 modclose(q, flag, crp) 8 queue_t *q; 9 int flag; 10 cred_t *crp; 11 { 12 struct mod *modp;13 modp = (struct mod *)q->q_ptr; 14 if (modp->m_type == BUFCALL) 15 unbufcall(modp->m_id); 16 else if (modp->m_type == TIMEOUT) 17 untimeout(modp->m_id); 18 modp->m_type = 0; ...
In the module close routine, the
put(D2str)
and
srv(D2str)
routines
are disabled by calling
qprocsoff(D3str)
(line 16).
This will prevent any further bufcall
or timeout requests from being issued
by the service routine.
If a bufcall request is pending (line 17),
we cancel it (line 18).
Otherwise, if a timeout request is pending (line 19),
we cancel it (line 20).
Then the m_type
member of the
module's private data structure is set to 0,
indicating no pending bufcall or timeout.
1 struct mod { 2 toid_t m_id; 3 char m_type; 4 lock_t *m_lock; . . . 5 }; 6 #define TIMEOUT 1 7 #define BUFCALL 2 . . . 8 modclose(q, flag, crp) 9 queue_t *q; 10 int flag; 11 cred_t *crp; 12 { 13 struct mod *modp;14 modp = (struct mod *)q->q_ptr; 15 qprocsoff(q); 16 if (modp->m_type == BUFCALL) 17 unbufcall(modp->m_id); 18 else if (modp->m_type == TIMEOUT) 19 untimeout(modp->m_id); . . .