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