1.\" $OpenBSD: atomic_inc_int.9,v 1.6 2014/02/13 12:05:05 dlg Exp $ 2.\" 3.\" Copyright (c) 2014 David Gwynne <dlg@openbsd.org> 4.\" All rights reserved. 5.\" 6.\" Permission to use, copy, modify, and distribute this software for any 7.\" purpose with or without fee is hereby granted, provided that the above 8.\" copyright notice and this permission notice appear in all copies. 9.\" 10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" 18.Dd $Mdocdate: February 13 2014 $ 19.Dt ATOMIC_INC_INT 9 20.Os 21.Sh NAME 22.Nm atomic_inc_int , 23.Nm atomic_inc_int_nv , 24.Nm atomic_inc_long , 25.Nm atomic_inc_long_nv 26.Nd atomic increment operations 27.Sh SYNOPSIS 28.In sys/atomic.h 29.Ft void 30.Fn atomic_inc_int "volatile unsigned int *p" 31.Ft unsigned int 32.Fn atomic_inc_int_nv "volatile unsigned int *p" 33.Ft void 34.Fn atomic_inc_long "volatile unsigned long *p " 35.Ft unsigned long 36.Fn atomic_inc_long_nv "volatile unsigned long *p" 37.Sh DESCRIPTION 38The atomic_inc set of functions provide an interface for atomically 39performing increment and increment-and-fetch operations with respect 40to interrupts and multiple processors in the system. 41.Pp 42The value referenced by the pointer 43.Fa p 44is incremented by 1. 45.Sh CONTEXT 46.Fn atomic_inc_int , 47.Fn atomic_inc_int_nv , 48.Fn atomic_inc_long , 49and 50.Fn atomic_inc_long_nv 51can all be called during autoconf, from process context, or from interrupt context. 52.Sh RETURN VALUES 53.Nm atomic_inc_int 54and 55.Nm atomic_inc_long 56perform the increment without returning any knowledge of the value at 57.Fa p . 58.Pp 59.Nm atomic_inc_int_nv 60and 61.Nm atomic_inc_long_nv 62return the value at 63.Fa p 64after the increment was performed. 65.Sh SEE ALSO 66.Xr atomic_add_int 9 , 67.Xr atomic_dec_int 9 68.Sh HISTORY 69The atomic_inc functions first appeared in 70.Nx 5.0 71and 72.Ox 5.5 . 73