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