Module Name: src
Committed By: pooka
Date: Mon Jan 14 21:00:17 UTC 2013
Modified Files:
src/lib/librumpuser: rumpuser_dl.c rumpuser_port.h rumpuser_pth.c
rumpuser_sp.c sp_common.c
Log Message:
Support Cygwin as a hypervisor.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/librumpuser/rumpuser_dl.c
cvs rdiff -u -r1.10 -r1.11 src/lib/librumpuser/rumpuser_port.h \
src/lib/librumpuser/rumpuser_pth.c
cvs rdiff -u -r1.50 -r1.51 src/lib/librumpuser/rumpuser_sp.c
cvs rdiff -u -r1.35 -r1.36 src/lib/librumpuser/sp_common.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/librumpuser/rumpuser_dl.c
diff -u src/lib/librumpuser/rumpuser_dl.c:1.11 src/lib/librumpuser/rumpuser_dl.c:1.12
--- src/lib/librumpuser/rumpuser_dl.c:1.11 Tue Dec 11 21:16:22 2012
+++ src/lib/librumpuser/rumpuser_dl.c Mon Jan 14 21:00:16 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpuser_dl.c,v 1.11 2012/12/11 21:16:22 pooka Exp $ */
+/* $NetBSD: rumpuser_dl.c,v 1.12 2013/01/14 21:00:16 pooka Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -33,7 +33,7 @@
#include "rumpuser_port.h"
#if !defined(lint)
-__RCSID("$NetBSD: rumpuser_dl.c,v 1.11 2012/12/11 21:16:22 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_dl.c,v 1.12 2013/01/14 21:00:16 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@@ -44,7 +44,6 @@ __RCSID("$NetBSD: rumpuser_dl.c,v 1.11 2
#include <elf.h>
#include <errno.h>
#include <fcntl.h>
-#include <link.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -55,6 +54,8 @@ __RCSID("$NetBSD: rumpuser_dl.c,v 1.11 2
#if defined(__ELF__) && (defined(__NetBSD__) || defined(__FreeBSD__) \
|| (defined(__sun__) && defined(__svr4__))) || defined(__linux__) \
|| defined(__DragonFly__)
+#include <link.h>
+
static size_t symtabsize = 0, strtabsize = 0;
static size_t symtaboff = 0, strtaboff = 0;
static uint8_t *symtab = NULL;
@@ -485,11 +486,23 @@ rumpuser_dl_bootstrap(rump_modinit_fn do
fprintf(stderr, "Warning, dlinfo() unsupported on host?\n");
}
+/*
+ * "default" implementation for platforms where we don't support
+ * dynamic linking. Assumes that all rump kernel components are
+ * statically linked with the local client.
+ */
+
+extern void *__start_link_set_rump_components;
+extern void *__stop_link_set_rump_components;
void
rumpuser_dl_component_init(int type, rump_component_init_fn compinit)
{
+ void **rc = &__start_link_set_rump_components;
+ void **rc_end = &__stop_link_set_rump_components;
+
+ for (; rc < rc_end; rc++)
+ compinit(*rc, type);
- fprintf(stderr, "Warning, dlinfo() unsupported on host?\n");
}
#endif
Index: src/lib/librumpuser/rumpuser_port.h
diff -u src/lib/librumpuser/rumpuser_port.h:1.10 src/lib/librumpuser/rumpuser_port.h:1.11
--- src/lib/librumpuser/rumpuser_port.h:1.10 Mon Nov 26 20:03:40 2012
+++ src/lib/librumpuser/rumpuser_port.h Mon Jan 14 21:00:16 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpuser_port.h,v 1.10 2012/11/26 20:03:40 pooka Exp $ */
+/* $NetBSD: rumpuser_port.h,v 1.11 2013/01/14 21:00:16 pooka Exp $ */
/*
* Portability header for non-NetBSD platforms.
@@ -51,7 +51,7 @@
/* maybe this should be !__NetBSD__ ? */
#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
- || defined(__DragonFly__)
+ || defined(__DragonFly__) || defined(__CYGWIN__)
#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -103,7 +103,7 @@ posix_memalign(void **ptr, size_t align,
#define _DIAGASSERT(_p_)
#endif
-#if defined(__linux__) || defined(__sun__)
+#if defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
#define SIN_SETLEN(a,b)
#else /* BSD */
#define SIN_SETLEN(_sin_, _len_) _sin_.sin_len = _len_
@@ -138,8 +138,9 @@ posix_memalign(void **ptr, size_t align,
#define __UNCONST(_a_) ((void *)(unsigned long)(const void *)(_a_))
#endif
-#if defined(__linux__) || defined(__sun__)
+#if defined(__linux__) || defined(__sun__) || defined (__CYGWIN__)
#define arc4random() random()
+#define RUMPUSER_USE_RANDOM
#endif
#ifndef __NetBSD_Prereq__
Index: src/lib/librumpuser/rumpuser_pth.c
diff -u src/lib/librumpuser/rumpuser_pth.c:1.10 src/lib/librumpuser/rumpuser_pth.c:1.11
--- src/lib/librumpuser/rumpuser_pth.c:1.10 Mon Nov 26 17:54:51 2012
+++ src/lib/librumpuser/rumpuser_pth.c Mon Jan 14 21:00:16 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpuser_pth.c,v 1.10 2012/11/26 17:54:51 pooka Exp $ */
+/* $NetBSD: rumpuser_pth.c,v 1.11 2013/01/14 21:00:16 pooka Exp $ */
/*
* Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
#include "rumpuser_port.h"
#if !defined(lint)
-__RCSID("$NetBSD: rumpuser_pth.c,v 1.10 2012/11/26 17:54:51 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_pth.c,v 1.11 2013/01/14 21:00:16 pooka Exp $");
#endif /* !lint */
#include <assert.h>
@@ -182,7 +182,7 @@ rumpuser_biothread(void *arg)
void
rumpuser_thrinit(kernel_lockfn lockfn, kernel_unlockfn unlockfn, int threads)
{
-#ifdef __linux__
+#ifdef RUMPUSER_USE_RANDOM
/* XXX: there's no rumpuser_bootstrap, so do this here */
uint32_t rv;
int fd;
Index: src/lib/librumpuser/rumpuser_sp.c
diff -u src/lib/librumpuser/rumpuser_sp.c:1.50 src/lib/librumpuser/rumpuser_sp.c:1.51
--- src/lib/librumpuser/rumpuser_sp.c:1.50 Mon Nov 26 17:55:11 2012
+++ src/lib/librumpuser/rumpuser_sp.c Mon Jan 14 21:00:16 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpuser_sp.c,v 1.50 2012/11/26 17:55:11 pooka Exp $ */
+/* $NetBSD: rumpuser_sp.c,v 1.51 2013/01/14 21:00:16 pooka Exp $ */
/*
* Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved.
@@ -37,7 +37,7 @@
#include "rumpuser_port.h"
#if !defined(lint)
-__RCSID("$NetBSD: rumpuser_sp.c,v 1.50 2012/11/26 17:55:11 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_sp.c,v 1.51 2013/01/14 21:00:16 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@@ -92,7 +92,7 @@ static char banner[MAXBANNER];
/* how to use atomic ops on Linux? */
-#ifdef __linux__
+#if defined(__linux__) || defined(__CYGWIN__)
static pthread_mutex_t discomtx = PTHREAD_MUTEX_INITIALIZER;
static void
Index: src/lib/librumpuser/sp_common.c
diff -u src/lib/librumpuser/sp_common.c:1.35 src/lib/librumpuser/sp_common.c:1.36
--- src/lib/librumpuser/sp_common.c:1.35 Mon Nov 26 16:30:14 2012
+++ src/lib/librumpuser/sp_common.c Mon Jan 14 21:00:16 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: sp_common.c,v 1.35 2012/11/26 16:30:14 pooka Exp $ */
+/* $NetBSD: sp_common.c,v 1.36 2013/01/14 21:00:16 pooka Exp $ */
/*
* Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved.
@@ -665,7 +665,7 @@ unix_parse(const char *addr, struct sock
}
}
strcat(s_un.sun_path, addr);
-#if defined(__linux__) || defined(__sun__)
+#if defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
slen = sizeof(s_un);
#else
s_un.sun_len = SUN_LEN(&s_un);