summaryrefslogtreecommitdiff
path: root/share/man/man9/SMR_PTR_GET.9
blob: af4ddb0cf75f4ebd8b1d86dbdb930655a6c22115 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
.\"	$OpenBSD: SMR_PTR_GET.9,v 1.3 2019/07/05 04:46:26 dlg Exp $
.\"
.\" Copyright (c) 2019 Visa Hankala
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: July 5 2019 $
.Dt SMR_PTR_GET 9
.Os
.Sh NAME
.Nm SMR_PTR_GET ,
.Nm SMR_PTR_GET_LOCKED ,
.Nm SMR_PTR_SET_LOCKED
.Nd safe memory reclamation pointer API
.Sh SYNOPSIS
.Ft TYPE
.Fn SMR_PTR_GET "TYPE *pptr"
.Ft TYPE
.Fn SMR_PTR_GET_LOCKED "TYPE *pptr"
.Ft void
.Fn SMR_PTR_SET_LOCKED "TYPE *pptr" "TYPE v"
.Sh DESCRIPTION
The SMR_PTR macros are used for accessing SMR-protected pointers.
.Pp
The macro
.Fn SMR_PTR_GET
reads the pointer referenced by
.Fa pptr
for dereferencing inside SMR read-side critical section.
.Pp
.Fn SMR_PTR_GET_LOCKED
reads the pointer referenced by
.Fa pptr
for dereferencing inside writer context.
.Pp
.Fn SMR_PTR_SET_LOCKED
writes value
.Fa v
to the pointer referenced by
.Fa pptr .
The operation issues a write-write memory barrier with
.Xr membar_producer 9
before the pointer write.
.Sh CONTEXT
.Fn SMR_PTR_GET ,
.Fn SMR_PTR_GET_LOCKED
and
.Fn SMR_PTR_SET_LOCKED
can be called during autoconf, from process context, or from interrupt context.
.Pp
.Fn SMR_PTR_GET
can be used from SMR read-side critical section.
.Fn SMR_PTR_GET_LOCKED
and
.Fn SMR_PTR_SET_LOCKED
can be used from writer context.
.Sh SEE ALSO
.Xr membar_producer 9 ,
.Xr SMR_LIST_INIT 9 ,
.Xr smr_read_enter 9
.Sh HISTORY
The SMR_PTR macros first appeared in
.Ox 6.5 .