diff options
author | Damien Miller <djm@mindrot.org> | 2006-04-23 12:06:20 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2006-04-23 12:06:20 +1000 |
commit | 6aa139c41ff22f9c91a934a73013265ea0a64afc (patch) | |
tree | 7df9e369f188628f3331b768752d0e918b7c7c8c /atomicio.h | |
parent | 499a0d5ada82acbf8a5c5d496dbf0b4570dde1af (diff) |
- djm@cvs.openbsd.org 2006/04/16 00:52:55
[atomicio.c atomicio.h]
introduce atomiciov() function that wraps readv/writev to retry
interrupted transfers like atomicio() does for read/write;
feedback deraadt@ dtucker@ stevesk@ ok deraadt@
Diffstat (limited to 'atomicio.h')
-rw-r--r-- | atomicio.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/atomicio.h b/atomicio.h index ddb63ee85..03bf065e2 100644 --- a/atomicio.h +++ b/atomicio.h | |||
@@ -1,6 +1,7 @@ | |||
1 | /* $OpenBSD: atomicio.h,v 1.7 2006/03/25 22:22:42 djm Exp $ */ | 1 | /* $OpenBSD: atomicio.h,v 1.8 2006/04/16 00:52:55 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2006 Damien Miller. All rights reserved. | ||
4 | * Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. | 5 | * Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. |
5 | * All rights reserved. | 6 | * All rights reserved. |
6 | * | 7 | * |
@@ -25,9 +26,24 @@ | |||
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 27 | */ |
27 | 28 | ||
29 | #ifndef _ATOMICIO_H | ||
30 | #define _ATOMICIO_H | ||
31 | |||
32 | #include <sys/types.h> | ||
33 | #include <unistd.h> | ||
34 | #include <sys/uio.h> | ||
35 | |||
28 | /* | 36 | /* |
29 | * Ensure all of data on socket comes through. f==read || f==vwrite | 37 | * Ensure all of data on socket comes through. f==read || f==vwrite |
30 | */ | 38 | */ |
31 | size_t atomicio(ssize_t (*)(int, void *, size_t), int, void *, size_t); | 39 | size_t atomicio(ssize_t (*)(int, void *, size_t), int, void *, size_t); |
32 | 40 | ||
33 | #define vwrite (ssize_t (*)(int, void *, size_t))write | 41 | #define vwrite (ssize_t (*)(int, void *, size_t))write |
42 | |||
43 | /* | ||
44 | * ensure all of data on socket comes through. f==readv || f==writev | ||
45 | */ | ||
46 | size_t atomiciov(ssize_t (*)(int, const struct iovec *, int), | ||
47 | int, const struct iovec *, int); | ||
48 | |||
49 | #endif /* _ATOMICIO_H */ | ||