Annotation of src/lib/libc/atomic/atomic_and.3, Revision 1.1.62.1
1.1.62.1! pgoyette 1: .\" $NetBSD: atomic_and.3,v 1.2 2018/06/16 08:11:32 dholland Exp $
1.1 ad 2: .\"
3: .\" Copyright (c) 2007 The NetBSD Foundation, Inc.
4: .\" All rights reserved.
5: .\"
6: .\" This code is derived from software contributed to The NetBSD Foundation
7: .\" by Jason R. Thorpe.
8: .\"
9: .\" Redistribution and use in source and binary forms, with or without
10: .\" modification, are permitted provided that the following conditions
11: .\" are met:
12: .\" 1. Redistributions of source code must retain the above copyright
13: .\" notice, this list of conditions and the following disclaimer.
14: .\" 2. Redistributions in binary form must reproduce the above copyright
15: .\" notice, this list of conditions and the following disclaimer in the
16: .\" documentation and/or other materials provided with the distribution.
17: .\"
18: .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19: .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20: .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21: .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22: .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23: .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24: .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25: .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26: .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27: .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28: .\" POSSIBILITY OF SUCH DAMAGE.
29: .\"
30: .Dd April 11, 2007
31: .Dt ATOMIC_AND 3
32: .Os
33: .Sh NAME
34: .Nm atomic_and ,
35: .Nm atomic_and_32 ,
36: .Nm atomic_and_uint ,
37: .Nm atomic_and_ulong ,
38: .Nm atomic_and_64 ,
39: .Nm atomic_and_32_nv ,
40: .Nm atomic_and_uint_nv ,
41: .Nm atomic_and_ulong_nv ,
42: .Nm atomic_and_64_nv
1.1.62.1! pgoyette 43: .Nd atomic bitwise
1.1 ad 44: .Sq and
45: operations
46: .\" .Sh LIBRARY
47: .\" .Lb libc
48: .Sh SYNOPSIS
49: .In sys/atomic.h
50: .Ft void
51: .Fn atomic_and_32 "volatile uint32_t *ptr" "uint32_t bits"
52: .Ft void
53: .Fn atomic_and_uint "volatile unsigned int *ptr" "unsigned int bits"
54: .Ft void
55: .Fn atomic_and_ulong "volatile unsigned long *ptr" "unsigned long bits"
56: .Ft void
57: .Fn atomic_and_64 "volatile uint64_t *ptr" "uint64_t bits"
58: .Ft uint32_t
59: .Fn atomic_and_32_nv "volatile uint32_t *ptr" "uint32_t bits"
60: .Ft unsigned int
61: .Fn atomic_and_uint_nv "volatile unsigned int *ptr" "unsigned int bits"
62: .Ft unsigned long
63: .Fn atomic_and_ulong_nv "volatile unsigned long *ptr" "unsigned long bits"
64: .Ft uint64_t
65: .Fn atomic_and_64_nv "volatile uint64_t *ptr" "uint64_t bits"
66: .Sh DESCRIPTION
67: The
68: .Nm atomic_and
69: family of functions load the value of the variable referenced by
70: .Fa ptr ,
1.1.62.1! pgoyette 71: perform a bitwise
1.1 ad 72: .Sq and
73: with the value
74: .Fa bits ,
75: and store the result back to the variable referenced by
76: .Fa ptr
77: in an atomic fashion.
78: .Pp
79: The
80: .Fn *_nv
81: variants of these functions return the new value.
82: .Pp
83: The 64-bit variants of these functions are available only on platforms
84: that can support atomic 64-bit memory access.
85: Applications can check for the availability of 64-bit atomic memory
86: operations by testing if the pre-processor macro
87: .Dv __HAVE_ATOMIC64_OPS
88: is defined.
89: .Sh SEE ALSO
90: .Xr atomic_ops 3
91: .Sh HISTORY
92: The
93: .Nm atomic_and
94: functions first appeared in
95: .Nx 5.0 .
CVSweb <webmaster@jp.NetBSD.org>