xref: /titanic_44/usr/src/cmd/ssh/include/atomicio.h (revision 90685d2c52744c6540828f16cdd2db815d467e37)
17c478bd9Sstevel@tonic-gate /*
2*90685d2cSjp161948  * Copyright (c) 2006 Damien Miller.  All rights reserved.
37c478bd9Sstevel@tonic-gate  * Copyright (c) 1995,1999 Theo de Raadt.  All rights reserved.
47c478bd9Sstevel@tonic-gate  * All rights reserved.
57c478bd9Sstevel@tonic-gate  *
67c478bd9Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
77c478bd9Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
87c478bd9Sstevel@tonic-gate  * are met:
97c478bd9Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
107c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
117c478bd9Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
127c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
137c478bd9Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
147c478bd9Sstevel@tonic-gate  *
157c478bd9Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
167c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
177c478bd9Sstevel@tonic-gate  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
187c478bd9Sstevel@tonic-gate  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
197c478bd9Sstevel@tonic-gate  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
207c478bd9Sstevel@tonic-gate  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
217c478bd9Sstevel@tonic-gate  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
227c478bd9Sstevel@tonic-gate  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
237c478bd9Sstevel@tonic-gate  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
247c478bd9Sstevel@tonic-gate  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
27*90685d2cSjp161948 #ifndef	_ATOMICIO_H
28*90685d2cSjp161948 #define	_ATOMICIO_H
29*90685d2cSjp161948 
30*90685d2cSjp161948 /*	$OpenBSD: atomicio.h,v 1.4 2001/06/26 06:32:46 itojun Exp $	*/
31*90685d2cSjp161948 
32*90685d2cSjp161948 #pragma ident	"%Z%%M%	%I%	%E% SMI"
33*90685d2cSjp161948 
34*90685d2cSjp161948 #ifdef __cplusplus
35*90685d2cSjp161948 extern "C" {
36*90685d2cSjp161948 #endif
37*90685d2cSjp161948 
387c478bd9Sstevel@tonic-gate /*
397c478bd9Sstevel@tonic-gate  * Ensure all of data on socket comes through. f==read || f==write
407c478bd9Sstevel@tonic-gate  */
417c478bd9Sstevel@tonic-gate ssize_t	atomicio(ssize_t (*)(), int, void *, size_t);
427c478bd9Sstevel@tonic-gate 
43*90685d2cSjp161948 #define	vwrite (ssize_t (*)(int, void *, size_t))write
44*90685d2cSjp161948 
45*90685d2cSjp161948 /*
46*90685d2cSjp161948  * ensure all of data on socket comes through. f==readv || f==writev
47*90685d2cSjp161948  */
48*90685d2cSjp161948 size_t	atomiciov(ssize_t (*)(int, const struct iovec *, int),
49*90685d2cSjp161948     int, const struct iovec *, int);
50*90685d2cSjp161948 
517c478bd9Sstevel@tonic-gate #ifdef __cplusplus
527c478bd9Sstevel@tonic-gate }
537c478bd9Sstevel@tonic-gate #endif
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate #endif /* _ATOMICIO_H */
56