3 // Copyright (C) 2003 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_VSERVER_DJINNI_SRC_WRAPPERS_IO_H
20 #define H_VSERVER_DJINNI_SRC_WRAPPERS_IO_H
24 #ifdef UTILVSERVER_ENABLE_SOCKET_WRAPPERS
25 inline static UNUSED bool
26 WsendAll(int fd, void const *ptr_v, size_t len)
28 register char const *ptr = ptr_v;
31 size_t res = TEMP_FAILURE_RETRY(send(fd, ptr, len, MSG_NOSIGNAL));
32 if (res==(size_t)-1) {
37 if (res==0) return false;
45 inline static UNUSED void
46 EsendAll(int fd, void const *ptr_v, size_t len)
48 register char const *ptr = ptr_v;
51 size_t res = TEMP_FAILURE_RETRY(send(fd, ptr, len, MSG_NOSIGNAL));
52 FatalErrnoError(res==(size_t)-1, "send()");
60 inline static UNUSED bool
61 WrecvAll(int fd, void *ptr_v, size_t len)
63 register char *ptr = ptr_v;
66 size_t res = TEMP_FAILURE_RETRY(recv(fd, ptr, len, MSG_NOSIGNAL));
67 if (res==(size_t)-1) {
72 if (res==0) return false;
80 inline static UNUSED bool
81 ErecvAll(int fd, void *ptr_v, size_t len)
83 register char *ptr = ptr_v;
86 size_t res = TEMP_FAILURE_RETRY(recv(fd, ptr, len, MSG_NOSIGNAL));
87 FatalErrnoError(res==(size_t)-1, "recv()");
89 if (res==0) return false;
99 inline static UNUSED bool
100 WwriteAll(int fd, void const *ptr_v, size_t len)
102 register char const *ptr = ptr_v;
105 size_t res = TEMP_FAILURE_RETRY(write(fd, ptr, len));
106 if (res==(size_t)-1) {
111 if (res==0) return false;
119 inline static UNUSED void
120 EwriteAll(int fd, void const *ptr_v, size_t len)
122 register char const *ptr = ptr_v;
125 size_t res = TEMP_FAILURE_RETRY(write(fd, ptr, len));
126 FatalErrnoError(res==(size_t)-1, "write()");
134 inline static UNUSED bool
135 WreadAll(int fd, void *ptr_v, size_t len)
137 register char *ptr = ptr_v;
140 size_t res = TEMP_FAILURE_RETRY(read(fd, ptr, len));
141 if (res==(size_t)-1) {
146 if (res==0) return false;
154 inline static UNUSED bool
155 EreadAll(int fd, void *ptr_v, size_t len)
157 register char *ptr = ptr_v;
160 size_t res = TEMP_FAILURE_RETRY(read(fd, ptr, len));
161 FatalErrnoError(res==(size_t)-1, "read()");
163 if (res==0) return false;
172 #endif // H_VSERVER_DJINNI_SRC_WRAPPERS_IO_H