1 // $Id: wrappers-iosock.hc,v 1.3 2005/07/03 12:33:44 ensc Exp $ --*- c -*--
3 // Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; version 2 of the License.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #ifndef H_ENSC_IN_WRAPPERS_H
20 # error wrappers_handler.hc can not be used in this way
25 inline static WRAPPER_DECL bool
26 WsendAll(int fd, void const *ptr_v, size_t len, int *err)
28 register char const *ptr = ptr_v;
32 ssize_t res = TEMP_FAILURE_RETRY(send(fd, ptr, len, MSG_NOSIGNAL));
34 if (err) *err = errno;
38 if (res==0) return false;
46 inline static WRAPPER_DECL void
47 EsendAll(int fd, void const *ptr_v, size_t len)
49 register char const *ptr = ptr_v;
52 ssize_t res = TEMP_FAILURE_RETRY(send(fd, ptr, len, MSG_NOSIGNAL));
53 FatalErrnoError(res==-1, "send()");
61 inline static WRAPPER_DECL bool
62 WrecvAll(int fd, void *ptr_v, size_t len, int *err)
64 register char *ptr = ptr_v;
68 ssize_t res = TEMP_FAILURE_RETRY(recv(fd, ptr, len, MSG_NOSIGNAL));
70 if (err) *err = errno;
74 if (res==0) return false;
82 inline static WRAPPER_DECL bool
83 ErecvAll(int fd, void *ptr_v, size_t len)
85 register char *ptr = ptr_v;
88 ssize_t res = TEMP_FAILURE_RETRY(recv(fd, ptr, len, MSG_NOSIGNAL));
89 FatalErrnoError(res==-1, "recv()");
91 if (res==0) return false;