Statistics
| Branch: | Revision:

root / qemu-os-win32.h @ 45724d6d

History | View | Annotate | Download (2.8 kB)

1 39626c03 Jes Sorensen
/*
2 39626c03 Jes Sorensen
 * win32 specific declarations
3 39626c03 Jes Sorensen
 *
4 39626c03 Jes Sorensen
 * Copyright (c) 2003-2008 Fabrice Bellard
5 39626c03 Jes Sorensen
 * Copyright (c) 2010 Jes Sorensen <Jes.Sorensen@redhat.com>
6 39626c03 Jes Sorensen
 *
7 39626c03 Jes Sorensen
 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 39626c03 Jes Sorensen
 * of this software and associated documentation files (the "Software"), to deal
9 39626c03 Jes Sorensen
 * in the Software without restriction, including without limitation the rights
10 39626c03 Jes Sorensen
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 39626c03 Jes Sorensen
 * copies of the Software, and to permit persons to whom the Software is
12 39626c03 Jes Sorensen
 * furnished to do so, subject to the following conditions:
13 39626c03 Jes Sorensen
 *
14 39626c03 Jes Sorensen
 * The above copyright notice and this permission notice shall be included in
15 39626c03 Jes Sorensen
 * all copies or substantial portions of the Software.
16 39626c03 Jes Sorensen
 *
17 39626c03 Jes Sorensen
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 39626c03 Jes Sorensen
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 39626c03 Jes Sorensen
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 39626c03 Jes Sorensen
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 39626c03 Jes Sorensen
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 39626c03 Jes Sorensen
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 39626c03 Jes Sorensen
 * THE SOFTWARE.
24 39626c03 Jes Sorensen
 */
25 39626c03 Jes Sorensen
26 39626c03 Jes Sorensen
#ifndef QEMU_OS_WIN32_H
27 39626c03 Jes Sorensen
#define QEMU_OS_WIN32_H
28 39626c03 Jes Sorensen
29 082b5557 Blue Swirl
#include <windows.h>
30 082b5557 Blue Swirl
#include <winsock2.h>
31 44a9b356 Paolo Bonzini
#include "main-loop.h"
32 082b5557 Blue Swirl
33 acf126ba Stefan Weil
/* Workaround for older versions of MinGW. */
34 acf126ba Stefan Weil
#ifndef ECONNREFUSED
35 acf126ba Stefan Weil
# define ECONNREFUSED WSAECONNREFUSED
36 acf126ba Stefan Weil
#endif
37 acf126ba Stefan Weil
#ifndef EINPROGRESS
38 acf126ba Stefan Weil
# define EINPROGRESS  WSAEINPROGRESS
39 acf126ba Stefan Weil
#endif
40 acf126ba Stefan Weil
#ifndef EHOSTUNREACH
41 acf126ba Stefan Weil
# define EHOSTUNREACH WSAEHOSTUNREACH
42 acf126ba Stefan Weil
#endif
43 acf126ba Stefan Weil
#ifndef EINTR
44 acf126ba Stefan Weil
# define EINTR        WSAEINTR
45 acf126ba Stefan Weil
#endif
46 acf126ba Stefan Weil
#ifndef EINPROGRESS
47 acf126ba Stefan Weil
# define EINPROGRESS  WSAEINPROGRESS
48 acf126ba Stefan Weil
#endif
49 acf126ba Stefan Weil
#ifndef ENETUNREACH
50 acf126ba Stefan Weil
# define ENETUNREACH  WSAENETUNREACH
51 acf126ba Stefan Weil
#endif
52 acf126ba Stefan Weil
#ifndef ENOTCONN
53 acf126ba Stefan Weil
# define ENOTCONN     WSAENOTCONN
54 acf126ba Stefan Weil
#endif
55 acf126ba Stefan Weil
#ifndef EWOULDBLOCK
56 acf126ba Stefan Weil
# define EWOULDBLOCK  WSAEWOULDBLOCK
57 acf126ba Stefan Weil
#endif
58 acf126ba Stefan Weil
59 5cf6dd51 Stefan Weil
#if defined(_WIN64)
60 5cf6dd51 Stefan Weil
/* On w64, setjmp is implemented by _setjmp which needs a second parameter.
61 5cf6dd51 Stefan Weil
 * If this parameter is NULL, longjump does no stack unwinding.
62 5cf6dd51 Stefan Weil
 * That is what we need for QEMU. Passing the value of register rsp (default)
63 5cf6dd51 Stefan Weil
 * lets longjmp try a stack unwinding which will crash with generated code. */
64 5cf6dd51 Stefan Weil
# undef setjmp
65 5cf6dd51 Stefan Weil
# define setjmp(env) _setjmp(env, NULL)
66 5cf6dd51 Stefan Weil
#endif
67 5cf6dd51 Stefan Weil
68 077030d1 Stefan Weil
/* Declaration of ffs() is missing in MinGW's strings.h. */
69 077030d1 Stefan Weil
int ffs(int i);
70 077030d1 Stefan Weil
71 8d963e6a Jes Sorensen
static inline void os_setup_signal_handling(void) {}
72 eb505be1 Jes Sorensen
static inline void os_daemonize(void) {}
73 eb505be1 Jes Sorensen
static inline void os_setup_post(void) {}
74 6650b710 Stefan Weil
void os_set_line_buffering(void);
75 ce798cf2 Jes Sorensen
static inline void os_set_proc_name(const char *dummy) {}
76 8d963e6a Jes Sorensen
77 5635efc3 Stefan Weil
#if !defined(EPROTONOSUPPORT)
78 5635efc3 Stefan Weil
# define EPROTONOSUPPORT EINVAL
79 5635efc3 Stefan Weil
#endif
80 5635efc3 Stefan Weil
81 dc786bc9 Jes Sorensen
int setenv(const char *name, const char *value, int overwrite);
82 dc786bc9 Jes Sorensen
83 dc786bc9 Jes Sorensen
typedef struct {
84 dc786bc9 Jes Sorensen
    long tv_sec;
85 dc786bc9 Jes Sorensen
    long tv_usec;
86 dc786bc9 Jes Sorensen
} qemu_timeval;
87 dc786bc9 Jes Sorensen
int qemu_gettimeofday(qemu_timeval *tp);
88 dc786bc9 Jes Sorensen
89 39626c03 Jes Sorensen
#endif