shqueue.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1996, 1997
* Sleepycat Software. All rights reserved.
*
* @(#)shqueue.h 8.12 (Sleepycat) 9/10/97
* %W% (Sun) %G%
*/
/*
* Copyright (c) 1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#ifndef _SYS_SHQUEUE_H_
#define _SYS_SHQUEUE_H_
/*
* This file defines three types of data structures: lists, tail queues, and
*
* The difference is that this set of macros can be used for structures that
* reside in shared memory that may be mapped at different addresses in each
* process. In most cases, the macros for shared structures exactly mirror
* the normal macros, although the macro calls require an additional type
* parameter, only used by the HEAD and ENTRY macros of the standard macros.
*
* For details on the use of these macros, see the queue(3) manual page.
*/
/*
* Shared list definitions.
*/
#define SH_LIST_HEAD(name) \
struct name { \
}
#define SH_LIST_ENTRY \
struct { \
}
/*
* Shared list functions. Since we use relative offsets for pointers,
* 0 is a valid offset. Therefore, we use -1 to indicate end of list.
* The macros ending in "P" return pointers without checking for end
* of list, the others check for end of list and evaluate to either a
* pointer or NULL.
*/
/*
* Take the element's next pointer and calculate what the corresponding
* Prev pointer should be -- basically it is the negation plus the offset
* of the next field in the structure.
*/
} else \
} while (0)
} else \
} while (0)
} else \
} while (0)
/*
* Shared tail queue definitions.
*/
#define SH_TAILQ_HEAD(name) \
struct name { \
}
#define SH_TAILQ_ENTRY \
struct { \
}
/*
* Shared tail queue functions.
*/
#define SH_TAILQ_LAST(head) \
#define SH_TAILQ_INIT(head) { \
}
} else { \
} \
} while (0)
else \
} while (0)
} else { \
} \
} while (0)
} else { \
} \
} while (0)
/*
* Shared circular queue definitions.
*/
#define SH_CIRCLEQ_HEAD(name) \
struct name { \
}
#define SH_CIRCLEQ_ENTRY \
struct { \
}
/*
* Shared circular queue functions.
*/
#define SH_CIRCLEQ_INIT(head) { \
(head)->scqh_first = 0; \
}
else \
} while (0)
else \
} while (0)
else \
} while (0)
if ((head)->scqh_first == 0) \
else \
} while (0)
else \
else \
} while (0)
#endif /* !_SYS_SHQUEUE_H_ */