op_pk_ici_set()
Abstract
Creates an association between a packet and an ICI by storing the specified ICI pointer in the packet. This implicitly replaces any previous associations the packet may have had with other ICIs.
Syntax
op_pk_ici_set (pkptr, iciptr)
| Argument | Type | Description |
|---|---|---|
pkptr |
Packet* |
pointer to the packet-of-interest [A pointer to a packet can be obtained from many KPs, including op_pk_create_fmt(), op_pk_copy(), op_pk_get(), op_subq_pk_access(), and `op_subq_pk_remove().] |
iciptr |
Ici* |
pointer to the ICI-of-interest [A pointer to an ICI can be obtained from two KPs: op_ici_create() returns a pointer to a newly allocated ICI (in an ICI-sending process), and op_intrpt_ici() returns a pointer to an ICI associated with an incoming interrupt (in an ICI-receiving process).] |
Return Type
void
No return value.
Example
/* Obtain the packet and ici that just arrived. */
pkptr = op_pk_get (0);
iciptr = op_intrpt_ici ();
/* Set the ICI pointer in the packet. */
op_pk_ici_set (pkptr, iciptr);
/* Enqueue the packet for servicing. */
op_subq_pk_insert (0, pkptr, OPC_QPOS_TAIL);
Details
The initial value for the ICI pointer in a newly created packet is OPC_NIL. ICI pointers that are associated with packets via this KP remain within the packet until overwritten by another call to op_pk_ici_set(), even if the ICI is destroyed. Also, destroying a packet does not automatically destroy an ICI associated with that packet since it is possible that the ICI may be referenced for other purposes.
By convention, a packet’s association with an ICI can be annulled by assigning the ICI pointer OPC_NIL when calling this KP.
Purpose
Provides a mechanism to create an association between a packet and an ICI by installing the ICI’s address in the packet. This is particularly useful when a packet and an ICI arrive with the same interrupt, but the packet must wait to be serviced. Before the packet is enqueued, the ICI pointer can be set in the packet and retrieved with the KP op_pk_ici_get() when service is to begin.
Errors
- Program Abort: Segmentation violation. (due to an invalid packet pointer or malformed packet)
- Program Abort: Packet pointer is NIL.
- Program Abort: Packet pointer references destroyed packet.
- Program Abort: Packet pointer references unowned packet (
<pk_id>).
Reference
- Use the KP op_ici_create() to create an ICI
- Use the KP op_intrpt_ici() to obtain the ICI pointer associated with the current interrupt
- Use the KP op_ici_destroy() to deallocate an ICI that has been processed
- Use the KP op_pk_ici_get() to obtain the ICI pointer in the packet