SMR_PTR_GET(9) | Kernel Developer's Manual | SMR_PTR_GET(9)

# NAME

`SMR_PTR_GET`, `SMR_PTR_GET_LOCKED`, `SMR_PTR_SET_LOCKED` — safe memory reclamation pointer API

# SYNOPSIS

TYPE
`SMR_PTR_GET`(TYPE *pptr);

TYPE
`SMR_PTR_GET_LOCKED`(TYPE *pptr);

void
`SMR_PTR_SET_LOCKED`(TYPE *pptr, TYPE v);

# DESCRIPTION

The SMR_PTR macros are used for accessing SMR-protected pointers.

The macro `SMR_PTR_GET`() reads the pointer referenced by pptr for dereferencing inside SMR read-side critical section.

`SMR_PTR_GET_LOCKED`() reads the pointer referenced by pptr for dereferencing inside writer context.

`SMR_PTR_SET_LOCKED`() writes value v to the pointer referenced by pptr. The operation issues a write-write memory barrier with membar_producer(9) before the pointer write.

# CONTEXT

`SMR_PTR_GET`(), `SMR_PTR_GET_LOCKED`() and `SMR_PTR_SET_LOCKED`() can be called during autoconf, from process context, or from interrupt context.

`SMR_PTR_GET`() can be used from SMR read-side critical section. `SMR_PTR_GET_LOCKED`() and `SMR_PTR_SET_LOCKED`() can be used from writer context.

# SEE ALSO

membar_producer(9), SMR_LIST_INIT(9), smr_read_enter(9)

# HISTORY

The SMR_PTR macros first appeared in OpenBSD 6.5.

July 5, 2019 | Debian