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