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