xref: /onnv-gate/usr/src/cmd/ssh/include/atomicio.h (revision 5087:929c96aa57f2)
10Sstevel@tonic-gate /*
2*5087Sjp161948  * Copyright (c) 2006 Damien Miller.  All rights reserved.
30Sstevel@tonic-gate  * Copyright (c) 1995,1999 Theo de Raadt.  All rights reserved.
40Sstevel@tonic-gate  * All rights reserved.
50Sstevel@tonic-gate  *
60Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
70Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
80Sstevel@tonic-gate  * are met:
90Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
100Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
110Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
120Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
130Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
140Sstevel@tonic-gate  *
150Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
160Sstevel@tonic-gate  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
170Sstevel@tonic-gate  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
180Sstevel@tonic-gate  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
190Sstevel@tonic-gate  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
200Sstevel@tonic-gate  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
210Sstevel@tonic-gate  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
220Sstevel@tonic-gate  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
230Sstevel@tonic-gate  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
240Sstevel@tonic-gate  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
27*5087Sjp161948 #ifndef	_ATOMICIO_H
28*5087Sjp161948 #define	_ATOMICIO_H
29*5087Sjp161948 
30*5087Sjp161948 /*	$OpenBSD: atomicio.h,v 1.4 2001/06/26 06:32:46 itojun Exp $	*/
31*5087Sjp161948 
32*5087Sjp161948 #pragma ident	"%Z%%M%	%I%	%E% SMI"
33*5087Sjp161948 
34*5087Sjp161948 #ifdef __cplusplus
35*5087Sjp161948 extern "C" {
36*5087Sjp161948 #endif
37*5087Sjp161948 
380Sstevel@tonic-gate /*
390Sstevel@tonic-gate  * Ensure all of data on socket comes through. f==read || f==write
400Sstevel@tonic-gate  */
410Sstevel@tonic-gate ssize_t	atomicio(ssize_t (*)(), int, void *, size_t);
420Sstevel@tonic-gate 
43*5087Sjp161948 #define	vwrite (ssize_t (*)(int, void *, size_t))write
44*5087Sjp161948 
45*5087Sjp161948 /*
46*5087Sjp161948  * ensure all of data on socket comes through. f==readv || f==writev
47*5087Sjp161948  */
48*5087Sjp161948 size_t	atomiciov(ssize_t (*)(int, const struct iovec *, int),
49*5087Sjp161948     int, const struct iovec *, int);
50*5087Sjp161948 
510Sstevel@tonic-gate #ifdef __cplusplus
520Sstevel@tonic-gate }
530Sstevel@tonic-gate #endif
540Sstevel@tonic-gate 
550Sstevel@tonic-gate #endif /* _ATOMICIO_H */
56