'\" te .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH atomic_add 9F "16 Jan 2006" "SunOS 5.11" "Kernel Functions for Drivers" .SH NAME atomic_add, atomic_add_8, atomic_add_char, atomic_add_16, atomic_add_short, atomic_add_32, atomic_add_int, atomic_add_long, atomic_add_64, atomic_add_ptr, atomic_add_8_nv, atomic_add_char_nv, atomic_add_16_nv, atomic_add_short_nv, atomic_add_32_nv, atomic_add_int_nv, atomic_add_long_nv, atomic_add_64_nv, atomic_add_ptr_nv \- atomic add operations .SH SYNOPSIS .LP .nf #include \fBvoid\fR \fBatomic_add_8\fR(\fBvolatile uint8_t *\fR\fItarget\fR, \fBint8_t\fR \fIdelta\fR); .fi .LP .nf \fBvoid\fR \fBatomic_add_char\fR(\fBvolatile uchar_t *\fR\fItarget\fR, \fBsigned char\fR \fIdelta\fR); .fi .LP .nf \fBvoid\fR \fBatomic_add_16\fR(\fBvolatile uint16_t *\fR\fItarget\fR, \fBint16_t\fR \fIdelta\fR); .fi .LP .nf \fBvoid\fR \fBatomic_add_short\fR(\fBvolatile ushort_t *\fR\fItarget\fR, \fBshort\fR \fIdelta\fR); .fi .LP .nf \fBvoid\fR \fBatomic_add_32\fR(\fBvolatile uint32_t *\fR\fItarget\fR, \fBint32_t\fR \fIdelta\fR); .fi .LP .nf \fBvoid\fR \fBatomic_add_int\fR(\fBvolatile uint_t *\fR\fItarget\fR, \fBint\fR \fIdelta\fR); .fi .LP .nf \fBvoid\fR \fBatomic_add_long\fR(\fBvolatile ulong_t *\fR\fItarget\fR, \fBlong\fR \fIdelta\fR); .fi .LP .nf \fBvoid\fR \fBatomic_add_64\fR(\fBvolatile uint64_t *\fR\fItarget\fR, \fBint64_t\fR \fIdelta\fR); .fi .LP .nf \fBvoid\fR \fBatomic_add_ptr\fR(\fBvolatile void *\fR\fItarget\fR, \fBssize_t\fR \fIdelta\fR); .fi .LP .nf \fBuint8_t\fR \fBatomic_add_8_nv\fR(\fBvolatile uint8_t *\fR\fItarget\fR, \fBint8_t\fR \fIdelta\fR); .fi .LP .nf \fBuchar_t\fR \fBatomic_add_char_nv\fR(\fBvolatile uchar_t *\fR\fItarget\fR, \fBsigned char\fR \fIdelta\fR); .fi .LP .nf \fBuint16_t\fR \fBatomic_add_16_nv\fR(\fBvolatile uint16_t *\fR\fItarget\fR, \fBint16_t\fR \fIdelta\fR); .fi .LP .nf \fBushort_t\fR \fBatomic_add_short_nv\fR(\fBvolatile ushort_t *\fR\fItarget\fR, \fBshort\fR\fIdelta\fR); .fi .LP .nf \fBuint32_t\fR \fBatomic_add_32_nv\fR(\fBvolatile uint32_t *\fR\fItarget\fR, \fBint32_t\fR \fIdelta\fR); .fi .LP .nf \fBuint_t\fR \fBatomic_add_int_nv\fR(\fBvolatile uint_t *\fR\fItarget\fR, \fBint\fR \fIdelta\fR); .fi .LP .nf \fBulong_t\fR \fBatomic_add_long_nv\fR(\fBvolatile ulong_t *\fR\fItarget\fR, \fBlong\fR \fIdelta\fR); .fi .LP .nf \fBuint64_t\fR \fBatomic_add_64_nv\fR(\fBvolatile uint64_t *\fR\fItarget\fR, \fBint64_t\fR \fIdelta\fR); .fi .LP .nf \fBvoid *\fR\fBatomic_add_ptr_nv\fR(\fBvolatile void *\fR\fItarget\fR, \fBssize_t\fR \fIdelta\fR); .fi .SH DESCRIPTION .sp .LP These functions enable the addition of \fIdelta\fR to the value stored in \fItarget\fR to occur in an atomic manner. .SH RETURN VALUES .sp .LP The *\fB_nv()\fR variants of these functions return the new value of \fItarget\fR. .SH ERRORS .sp .LP No errors are defined. .SH CONTEXT .sp .LP These functions can be called from user, interrupt, or kernel context. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityCommitted .TE .SH SEE ALSO .sp .LP \fBatomic_and\fR(9F), \fBatomic_bits\fR(9F), \fBatomic_cas\fR(9F), \fBatomic_dec\fR(9F), \fBatomic_inc\fR(9F), \fBatomic_or\fR(9F), \fBatomic_swap\fR(9F), \fBmembar_ops\fR(9F), \fBattributes\fR(5), \fBatomic_ops\fR(3C) .SH NOTES .sp .LP The *\fB_nv()\fR variants are substantially more expensive on some platforms than the versions that do not return values. Do not use them unless you need to know the new value \fBatomically\fR (for example, when decrementing a reference count and checking whether it went to zero).