* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#include "qemu-common.h"
-#include "net.h"
-#include "monitor.h"
-#include "sysemu.h"
-#include "qemu-timer.h"
-#include "qemu-char.h"
-#include "audio/audio.h"
-
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/time.h>
#include <zlib.h>
+/* Needed early for HOST_BSD etc. */
+#include "config-host.h"
+
#ifndef _WIN32
#include <sys/times.h>
#include <sys/wait.h>
#include <dirent.h>
#include <netdb.h>
#include <sys/select.h>
-#ifdef _BSD
+#ifdef HOST_BSD
#include <sys/stat.h>
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
#include <libutil.h>
#else
#include <util.h>
#endif
#endif
-#include "qemu_socket.h"
-
-#if defined(CONFIG_SLIRP)
-#include "libslirp.h"
-#endif
-
#if defined(__OpenBSD__)
#include <util.h>
#endif
#endif
#ifdef _WIN32
+#include <windows.h>
#include <malloc.h>
#include <sys/timeb.h>
#include <mmsystem.h>
#define memalign(align, size) malloc(size)
#endif
+#include "qemu-common.h"
+#include "net.h"
+#include "monitor.h"
+#include "sysemu.h"
+#include "qemu-timer.h"
+#include "qemu-char.h"
+#include "audio/audio.h"
+#include "qemu_socket.h"
+
+#if defined(CONFIG_SLIRP)
+#include "libslirp.h"
+#endif
+
+
static VLANState *first_vlan;
/***********************************************************/
char filename[1024];
/* erase all the files in the directory */
- if ((d = opendir(dir_name)) != 0) {
+ if ((d = opendir(dir_name)) != NULL) {
for(;;) {
de = readdir(d);
if (!de)
}
/* XXX: better tmp dir construction */
- snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%d", getpid());
+ snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%ld", (long)getpid());
if (mkdir(smb_dir, 0700) < 0) {
fprintf(stderr, "qemu: could not create samba server dir '%s'\n", smb_dir);
exit(1);
struct VMChannel {
CharDriverState *hd;
int port;
-} *vmchannels;
+};
static int vmchannel_can_read(void *opaque)
{
struct strbuf sbuf;
int f = 0;
sbuf.maxlen = sizeof(buf);
- sbuf.buf = buf;
+ sbuf.buf = (char *)buf;
size = getmsg(s->fd, NULL, &sbuf, &f) >=0 ? sbuf.len : -1;
#else
size = read(s->fd, buf, sizeof(buf));
return s;
}
-#if defined (_BSD) || defined (__FreeBSD_kernel__)
+#if defined (HOST_BSD) || defined (__FreeBSD_kernel__)
static int tap_open(char *ifname, int ifname_size)
{
int fd;
* Allocate TAP device, returns opened fd.
* Stores dev name in the first arg(must be large enough).
*/
-int tap_alloc(char *dev, size_t dev_size)
+static int tap_alloc(char *dev, size_t dev_size)
{
int tap_fd, if_fd, ppa = -1;
static int ip_fd = 0;
VLANState *vlan;
VLANClientState *vc;
- if (!net_host_check_device(device)) {
- monitor_printf(mon, "invalid host network device %s\n", device);
- return;
- }
-
vlan = qemu_find_vlan(vlan_id);
if (!vlan) {
monitor_printf(mon, "can't find vlan %d\n", vlan_id);
void net_cleanup(void)
{
+#if !defined(_WIN32)
VLANState *vlan;
-#if !defined(_WIN32)
/* close network clients */
for(vlan = first_vlan; vlan != NULL; vlan = vlan->next) {
VLANClientState *vc;