1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#ifndef QEMU_OS_WIN32_H
27#define QEMU_OS_WIN32_H
28
29#include <winsock2.h>
30#include <windows.h>
31#include <ws2tcpip.h>
32
33#if defined(_WIN64)
34
35
36
37
38# undef setjmp
39# define setjmp(env) _setjmp(env, NULL)
40#endif
41
42
43
44
45
46#define sigjmp_buf jmp_buf
47#define sigsetjmp(env, savemask) setjmp(env)
48#define siglongjmp(env, val) longjmp(env, val)
49
50
51#ifndef CONFIG_LOCALTIME_R
52#undef gmtime_r
53struct tm *gmtime_r(const time_t *timep, struct tm *result);
54#undef localtime_r
55struct tm *localtime_r(const time_t *timep, struct tm *result);
56#endif
57
58static inline void os_setup_signal_handling(void) {}
59static inline void os_daemonize(void) {}
60static inline void os_setup_post(void) {}
61void os_set_line_buffering(void);
62static inline void os_set_proc_name(const char *dummy) {}
63
64int getpagesize(void);
65
66#if !defined(EPROTONOSUPPORT)
67# define EPROTONOSUPPORT EINVAL
68#endif
69
70int setenv(const char *name, const char *value, int overwrite);
71
72typedef struct {
73 long tv_sec;
74 long tv_usec;
75} qemu_timeval;
76int qemu_gettimeofday(qemu_timeval *tp);
77
78static inline bool is_daemonized(void)
79{
80 return false;
81}
82
83static inline int os_mlock(void)
84{
85 return -ENOSYS;
86}
87
88#define fsync _commit
89
90#if !defined(lseek)
91# define lseek _lseeki64
92#endif
93
94int qemu_ftruncate64(int, int64_t);
95
96#if !defined(ftruncate)
97# define ftruncate qemu_ftruncate64
98#endif
99
100static inline char *realpath(const char *path, char *resolved_path)
101{
102 _fullpath(resolved_path, path, _MAX_PATH);
103 return resolved_path;
104}
105
106
107
108
109
110
111
112
113
114static inline void qemu_flockfile(FILE *f)
115{
116}
117
118static inline void qemu_funlockfile(FILE *f)
119{
120}
121
122
123
124
125
126#undef connect
127#define connect qemu_connect_wrap
128int qemu_connect_wrap(int sockfd, const struct sockaddr *addr,
129 socklen_t addrlen);
130
131#undef listen
132#define listen qemu_listen_wrap
133int qemu_listen_wrap(int sockfd, int backlog);
134
135#undef bind
136#define bind qemu_bind_wrap
137int qemu_bind_wrap(int sockfd, const struct sockaddr *addr,
138 socklen_t addrlen);
139
140#undef socket
141#define socket qemu_socket_wrap
142int qemu_socket_wrap(int domain, int type, int protocol);
143
144#undef accept
145#define accept qemu_accept_wrap
146int qemu_accept_wrap(int sockfd, struct sockaddr *addr,
147 socklen_t *addrlen);
148
149#undef shutdown
150#define shutdown qemu_shutdown_wrap
151int qemu_shutdown_wrap(int sockfd, int how);
152
153#undef ioctlsocket
154#define ioctlsocket qemu_ioctlsocket_wrap
155int qemu_ioctlsocket_wrap(int fd, int req, void *val);
156
157#undef closesocket
158#define closesocket qemu_closesocket_wrap
159int qemu_closesocket_wrap(int fd);
160
161#undef getsockopt
162#define getsockopt qemu_getsockopt_wrap
163int qemu_getsockopt_wrap(int sockfd, int level, int optname,
164 void *optval, socklen_t *optlen);
165
166#undef setsockopt
167#define setsockopt qemu_setsockopt_wrap
168int qemu_setsockopt_wrap(int sockfd, int level, int optname,
169 const void *optval, socklen_t optlen);
170
171#undef getpeername
172#define getpeername qemu_getpeername_wrap
173int qemu_getpeername_wrap(int sockfd, struct sockaddr *addr,
174 socklen_t *addrlen);
175
176#undef getsockname
177#define getsockname qemu_getsockname_wrap
178int qemu_getsockname_wrap(int sockfd, struct sockaddr *addr,
179 socklen_t *addrlen);
180
181#undef send
182#define send qemu_send_wrap
183ssize_t qemu_send_wrap(int sockfd, const void *buf, size_t len, int flags);
184
185#undef sendto
186#define sendto qemu_sendto_wrap
187ssize_t qemu_sendto_wrap(int sockfd, const void *buf, size_t len, int flags,
188 const struct sockaddr *addr, socklen_t addrlen);
189
190#undef recv
191#define recv qemu_recv_wrap
192ssize_t qemu_recv_wrap(int sockfd, void *buf, size_t len, int flags);
193
194#undef recvfrom
195#define recvfrom qemu_recvfrom_wrap
196ssize_t qemu_recvfrom_wrap(int sockfd, void *buf, size_t len, int flags,
197 struct sockaddr *addr, socklen_t *addrlen);
198
199#endif
200