Revision 9549e764 osdep.c

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
 */

Also available in: Unified diff