Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

insque(3) OSS Library Calls Reference Manual
NAME
insque, remque - Inserts or removes an element in a queue
LIBRARY
G-series native OSS processes: /G/system/sysnn/zosshsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zosshdll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yosshdll |
SYNOPSIS
#include <search.h>
void insque(
void *element,
void *pred);
void remque(
void *element);
PARAMETERS
element Is a pointer to an element to be inserted in or removed from a doubly linked list.
pred Is a pointer to an item in a doubly linked list.
DESCRIPTION
The insque( ) and remque( ) functions insert and remove, respectively, an element in a queue
constructed from a doubly linked list. The calling application must define a structure that will be
the type for all elements in the list. The first two fields of the structure must be pointers to the
same type of structure: the first field points forward to the next element in the queue and the
second field points back to the previous element in the queue. The other fields of the structure
are application-dependent.
The queue can be either circular or linear. A linear queue is terminated at both ends by null
pointers. In a circular queue, the first element points back to the last element as the previous ele-
ment in the queue and the last element points forward to the first element as the next element in
the queue.
The insque( ) function inserts the element pointed to by the element parameter into a queue
immediately after the element pointed to by the pred parameter.
The remque( ) function removes the element pointed to by the element parameter from a queue.
When the element pointed to by element is the last to be removed from the queue, the remque( )
function sets both its forward and backward pointers to element.
For a linear queue, calling this function as insque (&element, NULL), where element is the first
element of the queue, initializes the forward and backward pointers of element to null pointers.
When creating a circular queue, the application must initialize both the forward and backward
pointers of the initial element to that element’s own address.
NOTES
The insque( ) and remque( ) functions can be called by native processes only.
RETURN VALUES
Neither the insque( ) function nor the remque( ) function return a value.
ERRORS
None. These functions do not set errno.
432 Hewlett-Packard Company 527187-017