49
49
#include "qemu_socket.h"
51
int socket_set_cork(int fd, int v)
53
#if defined(SOL_TCP) && defined(TCP_CORK)
54
return setsockopt(fd, SOL_TCP, TCP_CORK, &v, sizeof(v));
51
60
int qemu_madvise(void *addr, size_t len, int advice)
53
62
if (advice == QEMU_MADV_INVALID) {
180
* A variant of send(2) which handles partial write.
182
* Return the number of bytes transferred, which is only
183
* smaller than `count' if there is an error.
185
* This function won't work with non-blocking fd's.
186
* Any of the possibilities with non-bloking fd's is bad:
187
* - return a short write (then name is wrong)
188
* - busy wait adding (errno == EAGAIN) to the loop
190
ssize_t qemu_send_full(int fd, const void *buf, size_t count, int flags)
196
ret = send(fd, buf, count, flags);
198
if (errno == EINTR) {
213
* A variant of recv(2) which handles partial write.
215
* Return the number of bytes transferred, which is only
216
* smaller than `count' if there is an error.
218
* This function won't work with non-blocking fd's.
219
* Any of the possibilities with non-bloking fd's is bad:
220
* - return a short write (then name is wrong)
221
* - busy wait adding (errno == EAGAIN) to the loop
223
ssize_t qemu_recv_full(int fd, void *buf, size_t count, int flags)
229
ret = qemu_recv(fd, buf, count, flags);
231
if (ret < 0 && errno == EINTR) {