xref: /freebsd/contrib/netcat/atomicio.h (revision c7c53f7a0355239b6dd9bcb403c7e820fbc9577b)
1c7c53f7aSXin LI /* $OpenBSD: atomicio.h,v 1.2 2007/09/07 14:50:44 tobias Exp $ */
27a997a69SXin LI 
37a997a69SXin LI /*
4c7c53f7aSXin LI  * Copyright (c) 2006 Damien Miller.  All rights reserved.
57a997a69SXin LI  * Copyright (c) 1995,1999 Theo de Raadt.  All rights reserved.
67a997a69SXin LI  * All rights reserved.
77a997a69SXin LI  *
87a997a69SXin LI  * Redistribution and use in source and binary forms, with or without
97a997a69SXin LI  * modification, are permitted provided that the following conditions
107a997a69SXin LI  * are met:
117a997a69SXin LI  * 1. Redistributions of source code must retain the above copyright
127a997a69SXin LI  *    notice, this list of conditions and the following disclaimer.
137a997a69SXin LI  * 2. Redistributions in binary form must reproduce the above copyright
147a997a69SXin LI  *    notice, this list of conditions and the following disclaimer in the
157a997a69SXin LI  *    documentation and/or other materials provided with the distribution.
167a997a69SXin LI  *
177a997a69SXin LI  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
187a997a69SXin LI  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
197a997a69SXin LI  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
207a997a69SXin LI  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
217a997a69SXin LI  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
227a997a69SXin LI  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
237a997a69SXin LI  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
247a997a69SXin LI  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
257a997a69SXin LI  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
267a997a69SXin LI  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
277a997a69SXin LI  */
287a997a69SXin LI 
29c7c53f7aSXin LI #ifndef _ATOMICIO_H
30c7c53f7aSXin LI #define _ATOMICIO_H
31c7c53f7aSXin LI 
327a997a69SXin LI /*
337a997a69SXin LI  * Ensure all of data on socket comes through. f==read || f==vwrite
347a997a69SXin LI  */
357a997a69SXin LI size_t	atomicio(ssize_t (*)(int, void *, size_t), int, void *, size_t);
367a997a69SXin LI 
377a997a69SXin LI #define vwrite (ssize_t (*)(int, void *, size_t))write
38c7c53f7aSXin LI 
39c7c53f7aSXin LI #endif /* _ATOMICIO_H */
40