unweldq Utility

Purpose

Removes a previously established weld connection between STREAMS queues.

Syntax

#include <sys/stream.h>

int unweldq ( q1,  q2,  q3,  q4,  func,  arg,  protect_q)
queue_t *q1;
queue_t *q2;
queue_t *q3;
queue_t *q4;
weld_fcn_t func;
weld_arg_t arg;
queue_t *protect_q;

Description

The unweldq utility removes a weld connection previously established with the weld utility between two STREAMS queues (q1 and q2). The unweldq utility can be used to unweld two pairs of queues in one call (q1 and q2, q3 and q4).

The unwelding operation is performed by changing the first queue's q_next pointer so that it does not point to any queue. The unweldq utility does not actually perform the operation. Instead, it creates an unwelding request which STREAMS performs asynchronously. STREAMS acquires the appropriate synchronization queues before performing the operation.

Callers that need to know when the unwelding operation has actually taken place should specify a callback function (func parameter) when calling the unweldq utility. If the caller also specifies a synchronization queue (protect_q parameter) , STREAMS acquires the synchronization associated with that queue when calling func. If the callback function is not a protected STREAMS utility, such as the qenable utility, the caller should always specify a protect_q parameter. The caller can also use this parameter to synchronize callbacks with protected STREAMS utilities.

Note: The stream.h header file must be the last included header file of each source file using the stream library.

Parameters

Item Description
q1 Specifies the queue whose q_next pointer must be nulled.
q2 Specifies the queue that will be unwelded to q1.
q3 Specifies the second queue whose q_next pointer must be nulled. If the unweldq utility is used to unweld only one pair of queues, this parameter should be set to NULL.
q4 Specifies the queue that will be unwelded to q3.
func Specifies an optional callback function that will execute when the unwelding operation has completed.
arg Specifies the parameter for func.
protect_q Specifies an optional synchronization queue that protects func.

Return Values

Upon successful completion, 0 (zero) is returned. Otherwise, an error code is returned.

Error Codes

The unweldq utility fails if the following is true:

Value Description
EAGAIN The weld record could not be allocated. The caller may try again.
EINVAL One or more parameters are not valid.
ENXIO The weld mechanism is not installed.