DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SVR5 and SCO OpenServer 5

unbufcall(D3str)


unbufcall -- cancel a pending bufcall request

Synopsis (DDI)

   #include <sys/stream.h>
   #include <sys/ddi.h>
   

void unbufcall(toid_t id);

Synopsis (ODDI)

   #include <sys/stream.h>
   

void unbufcall(uint_t size, int pri, void (*func)(), long arg);

Description

unbufcall cancels the pending bufcall(D3str) or esbbcall(D3str) request. In DDI drivers, id identifies the request. In ODDI drivers, the size, pri, func, and arg arguments identify the call to be cancelled.

Arguments


id
Non-zero identifier returned from a prior call to bufcall(D3str) or esbbcall(D3str).

size
Number of bytes in the data buffer, to match the size argument specified to the corresponding bufcall(D3str) or esballoc(D3str) call.

pri
Priority of the allocb(D3str) allocation request. Valid values are BPRI_LO, BPRI_MED, or BPRI_HI as defined on the bufcall(D3str) and esballoc(D3str) pages.

func
Callback function to be called when a suitable buffer becomes available.

arg
Argument to func when it is called.

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.

Note that any function that runs as a result of a call to bufcall (or to esbbcall) cannot use unbufcall to cancel itself.

Context

Base or Interrupt.

Synchronization constraints

Does not block.

Driver-defined basic locks, read/write locks, and sleep locks may not be held across calls to this function.

Hardware applicability

All

Version applicability

ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp
oddi: 1, 2, 2mp, 3, 3mp, 4, 4mp, 5, 5mp, 6, 6mp

Differences between releases

The id argument is currently defined as a toid_t data type. In earlier DDI releases, it is an int.

References

bufcall(D3str) esbbcall(D3str)

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.

    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(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); . . .


19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005