1178382Sdelphij/* $OpenBSD: atomicio.h,v 1.2 2007/09/07 14:50:44 tobias Exp $ */
2158795Sdelphij
3158795Sdelphij/*
4178382Sdelphij * Copyright (c) 2006 Damien Miller.  All rights reserved.
5158795Sdelphij * Copyright (c) 1995,1999 Theo de Raadt.  All rights reserved.
6158795Sdelphij * All rights reserved.
7158795Sdelphij *
8158795Sdelphij * Redistribution and use in source and binary forms, with or without
9158795Sdelphij * modification, are permitted provided that the following conditions
10158795Sdelphij * are met:
11158795Sdelphij * 1. Redistributions of source code must retain the above copyright
12158795Sdelphij *    notice, this list of conditions and the following disclaimer.
13158795Sdelphij * 2. Redistributions in binary form must reproduce the above copyright
14158795Sdelphij *    notice, this list of conditions and the following disclaimer in the
15158795Sdelphij *    documentation and/or other materials provided with the distribution.
16158795Sdelphij *
17158795Sdelphij * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18158795Sdelphij * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19158795Sdelphij * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20158795Sdelphij * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21158795Sdelphij * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22158795Sdelphij * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23158795Sdelphij * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24158795Sdelphij * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25158795Sdelphij * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26158795Sdelphij * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27158795Sdelphij */
28158795Sdelphij
29178382Sdelphij#ifndef _ATOMICIO_H
30178382Sdelphij#define _ATOMICIO_H
31178382Sdelphij
32158795Sdelphij/*
33158795Sdelphij * Ensure all of data on socket comes through. f==read || f==vwrite
34158795Sdelphij */
35158795Sdelphijsize_t	atomicio(ssize_t (*)(int, void *, size_t), int, void *, size_t);
36158795Sdelphij
37158795Sdelphij#define vwrite (ssize_t (*)(int, void *, size_t))write
38178382Sdelphij
39178382Sdelphij#endif /* _ATOMICIO_H */
40