Revision 9549e764

b/osdep.c
147 147
#endif /* _WIN32 */
148 148

  
149 149

  
150
#ifdef _WIN32
151
void socket_set_nonblock(int fd)
152
{
153
    unsigned long opt = 1;
154
    ioctlsocket(fd, FIONBIO, &opt);
155
}
156

  
157
int inet_aton(const char *cp, struct in_addr *ia)
158
{
159
    uint32_t addr = inet_addr(cp);
160
    if (addr == 0xffffffff)
161
	return 0;
162
    ia->s_addr = addr;
163
    return 1;
164
}
165

  
166
void qemu_set_cloexec(int fd)
167
{
168
}
169

  
170
#else
171

  
172
void socket_set_nonblock(int fd)
173
{
174
    int f;
175
    f = fcntl(fd, F_GETFL);
176
    fcntl(fd, F_SETFL, f | O_NONBLOCK);
177
}
178

  
179
void qemu_set_cloexec(int fd)
180
{
181
    int f;
182
    f = fcntl(fd, F_GETFD);
183
    fcntl(fd, F_SETFD, f | FD_CLOEXEC);
184
}
185

  
186
#endif
187

  
188 150
/*
189 151
 * Opens a file with FD_CLOEXEC set
190 152
 */
b/oslib-posix.c
29 29
#include "config-host.h"
30 30
#include "sysemu.h"
31 31
#include "trace.h"
32
#include "qemu_socket.h"
32 33

  
33 34
#if !defined(_POSIX_C_SOURCE) || defined(__sun__)
34 35
static void *oom_check(void *ptr)
......
72 73
    trace_qemu_vfree(ptr);
73 74
    free(ptr);
74 75
}
76

  
77
void socket_set_nonblock(int fd)
78
{
79
    int f;
80
    f = fcntl(fd, F_GETFL);
81
    fcntl(fd, F_SETFL, f | O_NONBLOCK);
82
}
83

  
84
void qemu_set_cloexec(int fd)
85
{
86
    int f;
87
    f = fcntl(fd, F_GETFD);
88
    fcntl(fd, F_SETFD, f | FD_CLOEXEC);
89
}
b/oslib-win32.c
29 29
#include "config-host.h"
30 30
#include "sysemu.h"
31 31
#include "trace.h"
32
#include "qemu_socket.h"
32 33

  
33 34
static void *oom_check(void *ptr)
34 35
{
......
71 72
    trace_qemu_vfree(ptr);
72 73
    VirtualFree(ptr, 0, MEM_RELEASE);
73 74
}
75

  
76
void socket_set_nonblock(int fd)
77
{
78
    unsigned long opt = 1;
79
    ioctlsocket(fd, FIONBIO, &opt);
80
}
81

  
82
int inet_aton(const char *cp, struct in_addr *ia)
83
{
84
    uint32_t addr = inet_addr(cp);
85
    if (addr == 0xffffffff) {
86
	return 0;
87
    }
88
    ia->s_addr = addr;
89
    return 1;
90
}
91

  
92
void qemu_set_cloexec(int fd)
93
{
94
}

Also available in: Unified diff