unbufcall(D3) unbufcall(D3)
NAME
unbufcall - cancel a pending bufcall request
SYNOPSIS
#include <sys/stream.h>
#include <sys/ddi.h>
void unbufcall(toid_t id);
Arguments
id Non-zero identifier returned from a prior call to
bufcall(D3) or esbbcall(D3).
DESCRIPTION
unbufcall cancels the pending bufcall or esbbcall request
specified by id.
Return Values
None
USAGE
On uniprocessor systems, if unbufcall is called while any
function called by the pending bufcall or esbbcall request is
running, the call to unbufcall has no effect.
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.
Level
Base or Interrupt.
Synchronization Constraints
Does not sleep.
Driver-defined basic locks, read/write locks, and sleep locks
may not be held across calls to this function.
Singlethreaded Example
See bufcall for the other half of this example.
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.
Copyright 1994 Novell, Inc. Page 1
unbufcall(D3) unbufcall(D3)
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;
...
Multithreaded Example
See bufcall for the other half of this example.
In the module close routine, the put(D2) and srv(D2) routines
are disabled by calling qprocsoff(D3) (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 field 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;
Copyright 1994 Novell, Inc. Page 2
unbufcall(D3) unbufcall(D3)
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);
. . .
REFERENCES
bufcall(D3) esbbcall(D3)
NOTICES
Portability
All processors
Applicability
ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp
The id argument is currently defined as a toid_t data type.
In earlier releases, it was an int.
Copyright 1994 Novell, Inc. Page 3