*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: srpl_rc_init | Section: 9 | Source: OpenBSD | File: srpl_rc_init.9
SRPL_RC_INIT(9) FreeBSD Kernel Developer's Manual SRPL_RC_INIT(9) NAME srpl_rc_init, SRPL_HEAD, SRPL_ENTRY, SRPL_INIT, SRPL_FIRST, SRPL_NEXT, SRPL_FOLLOW, SRPL_FOREACH, SRPL_LEAVE, SRPL_RC_INITIALIZER - singly- linked shared reference pointer list SYNOPSIS #include <sys/srp.h> struct srpl_rc; void srpl_rc_init(struct srpl_rc *rc, void (*ref)(void *, void *), void (*unref)(void *, void *), void *ctx); SRPL_HEAD(HEADNAME, TYPE); SRPL_ENTRY(TYPE); void SRPL_INIT(SRPL_HEAD *sl); void * SRPL_FIRST(struct srp_ref *sr, SRPL_HEAD *sl); void * SRPL_NEXT(struct srp_ref *sr, struct TYPE *listelm, FIELDNAME); void * SRPL_FOLLOW(struct srp_ref *sr, struct TYPE *listelm, FIELDNAME); SRPL_FOREACH(VARNAME, struct srp_ref *sr, SRPL_HEAD *sl, FIELDNAME); void SRPL_LEAVE(struct srp_ref *sr); SRPL_RC_INITIALIZER(void (*ref)(void *, void *), void (*unref)(void *, void *), void *ctx); DESCRIPTION The SRPL list macros build a linked list on top of shared reference pointers. This allows concurrent traversal of a linked list and access to the items on the list. SRP lists are a generic type represented by a SRPL_HEAD. The elements inserted into the list must be structures that contain a SRPL_ENTRY field. Further, the elements must also support reference counting as insertion and removal operations can cause items to be temporarily referenced by multiple SRPs within the list at the same time. srpl_rc_init() initialises the SRP list refcounts rc structure so it can be used to manage the reference counts on elements in the list. The insertion or removal of an element in an SRP list will increment the reference counts on elements within the list via calls to ref. As these references are released by the SRP infrastructure, the reference counts will be decremented by calls to unref. unref is also responsible for freeing the element when the reference count reaches 0. Both ref and unref will be called with ctx as their first argument and a pointer to the element as their second argument. SRPL_INIT() initialises the SRP list sl to an empty state. SRPL_FIRST() accesses the first element in the SRP list sl and holds its reference via sr. SRPL_NEXT() accesses the element in the SRP list after listelm and holds its reference via sr. SRPL_FOLLOW() accesses the element in the SRP list after listelm and swaps the previous reference held via sr for the reference of the newly accessed item. SRPL_FOREACH() creates a loop for traversing the list. Every call to SRPL_FOREACH() must have a corresponding call to SRPL_LEAVE() to release references to the list and its elements. SRPL_LEAVE() releases references to the list and its elements held by previous calls to SRPL_FIRST(), SRPL_NEXT(), SRPL_FOLLOW(), or SRPL_FOREACH(). An srpl_rc declaration can be initialised with the SRPL_RC_INITIALIZER() macro. CONTEXT SRPL_INIT(), SRPL_FIRST(), SRPL_NEXT(), SRPL_FOLLOW(), SRPL_FOREACH(), and SRPL_LEAVE() may be called during autoconf, from process context, or from interrupt context. srpl_rc_init(), may be called during autoconf or from process context. RETURN VALUES SRPL_FIRST(), SRPL_NEXT(), and SRPL_FOLLOW() return a pointer to elements in the SRP list, or NULL if there are no more elements. SEE ALSO SRPL_FIRST_LOCKED(9) HISTORY The srp API was originally written by Jonathan Matthew <[email protected]> and David Gwynne <[email protected]>. The SRP list API first appeared in OpenBSD 5.9. FreeBSD 14.1-RELEASE-p8 November 21, 2016 FreeBSD 14.1-RELEASE-p8

Navigation Options