freebsd man page for casuword

Query: casuword

OS: freebsd

Section: 9

Links: freebsd man pages   all man pages

Forums: unix linux community   forum categories

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

CASU(9) 						   BSD Kernel Developer's Manual						   CASU(9)

NAME
casueword, casueword32, casuword, casuword32 -- fetch, compare and store data from user-space
SYNOPSIS
#include <sys/types.h> #include <sys/systm.h> int casueword(volatile u_long *base, u_long oldval, u_long *oldvalp, u_long newval); int casueword32(volatile uint32_t *base, uint32_t oldval, uint32_t *oldvalp, uint32_t newval); u_long casuword(volatile u_long *base, u_long oldval, u_long newval); uint32_t casuword32(volatile uint32_t *base, uint32_t oldval, uint32_t newval);
DESCRIPTION
The casueword functions are designed to perform atomic compare-and-swap operation on the value in the usermode memory of the current process. The casueword routines reads the value from user memory with address base, and compare the value read with oldval. If the values are equal, newval is written to the *base. In case of casueword32() and casueword(), old value is stored into the (kernel-mode) variable pointed by *oldvalp. The userspace value must be naturally aligned. The callers of casuword() and casuword32() functions cannot distinguish between -1 read from userspace and function failure.
RETURN VALUES
The casuword() and casuword32() functions return the data fetched or -1 on failure. The casueword() and casueword32() functions return 0 on success and -1 on failure.
SEE ALSO
atomic(9), fetch(9), store(9)
BSD
October 21, 2014 BSD
Related Man Pages
atomic_cas_8(9f) - opensolaris
atomic_cas_uint(9f) - opensolaris
atomic_cas_uchar(9f) - opensolaris
atomic_cas_ushort(9f) - opensolaris
casueword(9) - freebsd
Similar Topics in the Unix Linux Community
Mac OS X: Based on UNIX - Solid As a Rock
Is UNIX an open source OS ?
Reason for no directory creation date
Is it safe to install x86 Solaris 10 U6 after installed-Linux-and-FreeBSD?
Controlling user input