1*330f45acSmbalmer /* $OpenBSD: atomicio.h,v 1.1 2008/06/09 21:06:10 mbalmer Exp $ */ 2*330f45acSmbalmer 3*330f45acSmbalmer /* 4*330f45acSmbalmer * Copyright (c) 2006 Damien Miller. All rights reserved. 5*330f45acSmbalmer * Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. 6*330f45acSmbalmer * All rights reserved. 7*330f45acSmbalmer * 8*330f45acSmbalmer * Redistribution and use in source and binary forms, with or without 9*330f45acSmbalmer * modification, are permitted provided that the following conditions 10*330f45acSmbalmer * are met: 11*330f45acSmbalmer * 1. Redistributions of source code must retain the above copyright 12*330f45acSmbalmer * notice, this list of conditions and the following disclaimer. 13*330f45acSmbalmer * 2. Redistributions in binary form must reproduce the above copyright 14*330f45acSmbalmer * notice, this list of conditions and the following disclaimer in the 15*330f45acSmbalmer * documentation and/or other materials provided with the distribution. 16*330f45acSmbalmer * 17*330f45acSmbalmer * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18*330f45acSmbalmer * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19*330f45acSmbalmer * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20*330f45acSmbalmer * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21*330f45acSmbalmer * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22*330f45acSmbalmer * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23*330f45acSmbalmer * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24*330f45acSmbalmer * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25*330f45acSmbalmer * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26*330f45acSmbalmer * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27*330f45acSmbalmer */ 28*330f45acSmbalmer 29*330f45acSmbalmer #ifndef _ATOMICIO_H 30*330f45acSmbalmer #define _ATOMICIO_H 31*330f45acSmbalmer 32*330f45acSmbalmer /* 33*330f45acSmbalmer * Ensure all of data on socket comes through. f==read || f==vwrite 34*330f45acSmbalmer */ 35*330f45acSmbalmer size_t atomicio(ssize_t (*)(int, void *, size_t), int, void *, size_t); 36*330f45acSmbalmer 37*330f45acSmbalmer #define vwrite (ssize_t (*)(int, void *, size_t))write 38*330f45acSmbalmer 39*330f45acSmbalmer /* 40*330f45acSmbalmer * ensure all of data on socket comes through. f==readv || f==writev 41*330f45acSmbalmer */ 42*330f45acSmbalmer size_t atomiciov(ssize_t (*)(int, const struct iovec *, int), 43*330f45acSmbalmer int, const struct iovec *, int); 44*330f45acSmbalmer 45*330f45acSmbalmer #endif /* _ATOMICIO_H */ 46