Revision dc786bc9

b/m68k-semi.c
33 33
#define SEMIHOSTING_HEAP_SIZE (128 * 1024 * 1024)
34 34
#else
35 35
#include "qemu-common.h"
36
#include "sysemu.h"
37 36
#include "gdbstub.h"
38 37
#include "softmmu-semi.h"
39 38
#endif
39
#include "sysemu.h"
40 40

  
41 41
#define HOSTED_EXIT  0
42 42
#define HOSTED_INIT_SIM 1
b/osdep.c
111 111
    return 0;
112 112
}
113 113

  
114
#ifdef _WIN32
115

  
116
/* mingw32 needs ffs for compilations without optimization. */
117
int ffs(int i)
118
{
119
    /* Use gcc's builtin ffs. */
120
    return __builtin_ffs(i);
121
}
122

  
123
/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosec units */
124
#define _W32_FT_OFFSET (116444736000000000ULL)
125

  
126
int qemu_gettimeofday(qemu_timeval *tp)
127
{
128
  union {
129
    unsigned long long ns100; /*time since 1 Jan 1601 in 100ns units */
130
    FILETIME ft;
131
  }  _now;
132

  
133
  if(tp)
134
    {
135
      GetSystemTimeAsFileTime (&_now.ft);
136
      tp->tv_usec=(long)((_now.ns100 / 10ULL) % 1000000ULL );
137
      tp->tv_sec= (long)((_now.ns100 - _W32_FT_OFFSET) / 10000000ULL);
138
    }
139
  /* Always return 0 as per Open Group Base Specifications Issue 6.
140
     Do not set errno on error.  */
141
  return 0;
142
}
143
#endif /* _WIN32 */
144

  
145 114

  
146 115
/*
147 116
 * Opens a file with FD_CLOEXEC set
b/osdep.h
127 127

  
128 128
int qemu_create_pidfile(const char *filename);
129 129

  
130
#ifdef _WIN32
131
int ffs(int i);
132

  
133
int setenv(const char *name, const char *value, int overwrite);
134

  
135
typedef struct {
136
    long tv_sec;
137
    long tv_usec;
138
} qemu_timeval;
139
int qemu_gettimeofday(qemu_timeval *tp);
140
#else
141
typedef struct timeval qemu_timeval;
142
#define qemu_gettimeofday(tp) gettimeofday(tp, NULL);
143
#endif /* !_WIN32 */
144

  
145 130
#endif
b/oslib-win32.c
92 92
void qemu_set_cloexec(int fd)
93 93
{
94 94
}
95

  
96
/* mingw32 needs ffs for compilations without optimization. */
97
int ffs(int i)
98
{
99
    /* Use gcc's builtin ffs. */
100
    return __builtin_ffs(i);
101
}
102

  
103
/* Offset between 1/1/1601 and 1/1/1970 in 100 nanosec units */
104
#define _W32_FT_OFFSET (116444736000000000ULL)
105

  
106
int qemu_gettimeofday(qemu_timeval *tp)
107
{
108
  union {
109
    unsigned long long ns100; /*time since 1 Jan 1601 in 100ns units */
110
    FILETIME ft;
111
  }  _now;
112

  
113
  if(tp) {
114
      GetSystemTimeAsFileTime (&_now.ft);
115
      tp->tv_usec=(long)((_now.ns100 / 10ULL) % 1000000ULL );
116
      tp->tv_sec= (long)((_now.ns100 - _W32_FT_OFFSET) / 10000000ULL);
117
  }
118
  /* Always return 0 as per Open Group Base Specifications Issue 6.
119
     Do not set errno on error.  */
120
  return 0;
121
}
b/posix-aio-compat.c
24 24

  
25 25
#include "qemu-queue.h"
26 26
#include "osdep.h"
27
#include "sysemu.h"
27 28
#include "qemu-common.h"
28 29
#include "trace.h"
29 30
#include "block_int.h"
b/qemu-common.h
170 170
#define qemu_isascii(c)		isascii((unsigned char)(c))
171 171
#define qemu_toascii(c)		toascii((unsigned char)(c))
172 172

  
173
#ifdef _WIN32
174
/* ffs() in oslib-win32.c for WIN32, strings.h for the rest of the world */
175
int ffs(int i);
176
#endif
177

  
173 178
void *qemu_malloc(size_t size);
174 179
void *qemu_realloc(void *ptr, size_t size);
175 180
void *qemu_mallocz(size_t size);
b/qemu-img.c
24 24
#include "qemu-common.h"
25 25
#include "qemu-option.h"
26 26
#include "osdep.h"
27
#include "sysemu.h"
27 28
#include "block_int.h"
28 29
#include <stdio.h>
29 30

  
b/qemu-os-posix.h
36 36
void os_daemonize(void);
37 37
void os_setup_post(void);
38 38

  
39
typedef struct timeval qemu_timeval;
40
#define qemu_gettimeofday(tp) gettimeofday(tp, NULL)
41

  
39 42
#endif
b/qemu-os-win32.h
52 52
# define EPROTONOSUPPORT EINVAL
53 53
#endif
54 54

  
55
int setenv(const char *name, const char *value, int overwrite);
56

  
57
typedef struct {
58
    long tv_sec;
59
    long tv_usec;
60
} qemu_timeval;
61
int qemu_gettimeofday(qemu_timeval *tp);
62

  
55 63
#endif
b/qemu-tool.c
15 15
#include "monitor.h"
16 16
#include "qemu-timer.h"
17 17
#include "qemu-log.h"
18
#include "sysemu.h"
18 19

  
19 20
#include <sys/time.h>
20 21

  

Also available in: Unified diff