1.\" $NetBSD: atomic_dec.3,v 1.1 2008/06/23 10:22:40 ad Exp $ 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_DEC 3 32.Os 33.Sh NAME 34.Nm atomic_dec , 35.Nm atomic_dec_32 , 36.Nm atomic_dec_uint , 37.Nm atomic_dec_ulong , 38.Nm atomic_dec_ptr , 39.Nm atomic_dec_64 , 40.Nm atomic_dec_32_nv , 41.Nm atomic_dec_uint_nv , 42.Nm atomic_dec_ulong_nv , 43.Nm atomic_dec_ptr_nv , 44.Nm atomic_dec_64_nv 45.Nd atomic decrement operations 46.\" .Sh LIBRARY 47.\" .Lb libc 48.Sh SYNOPSIS 49.In sys/atomic.h 50.Ft void 51.Fn atomic_dec_32 "volatile uint32_t *ptr" 52.Ft void 53.Fn atomic_dec_uint "volatile unsigned int *ptr" 54.Ft void 55.Fn atomic_dec_ulong "volatile unsigned long *ptr" 56.Ft void 57.Fn atomic_dec_ptr "volatile void *ptr" 58.Ft void 59.Fn atomic_dec_64 "volatile uint64_t *ptr" 60.Ft uint32_t 61.Fn atomic_dec_32_nv "volatile uint32_t *ptr" 62.Ft unsigned int 63.Fn atomic_dec_uint_nv "volatile unsigned int *ptr" 64.Ft unsigned long 65.Fn atomic_dec_ulong_nv "volatile unsigned long *ptr" 66.Ft void * 67.Fn atomic_dec_ptr_nv "volatile void *ptr" 68.Ft uint64_t 69.Fn atomic_dec_64_nv "volatile uint64_t *ptr" 70.Sh DESCRIPTION 71The 72.Nm atomic_dec 73family of functions decrement 74.Pq by one 75the variable referenced by 76.Fa ptr 77in an atomic fashion. 78.Pp 79The 80.Fn *_nv 81variants of these functions return the new value. 82.Pp 83The 64-bit variants of these functions are available only on platforms 84that can support atomic 64-bit memory access. 85Applications can check for the availability of 64-bit atomic memory 86operations by testing if the pre-processor macro 87.Dv __HAVE_ATOMIC64_OPS 88is defined. 89.Sh SEE ALSO 90.Xr atomic_ops 3 91.Sh HISTORY 92The 93.Nm atomic_dec 94functions first appeared in 95.Nx 5.0 . 96