Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/librumpuser Support Cygwin as a hypervisor.



details:   https://anonhg.NetBSD.org/src/rev/76ff2778e938
branches:  trunk
changeset: 784011:76ff2778e938
user:      pooka <pooka%NetBSD.org@localhost>
date:      Mon Jan 14 21:00:16 2013 +0000

description:
Support Cygwin as a hypervisor.

diffstat:

 lib/librumpuser/rumpuser_dl.c   |  21 +++++++++++++++++----
 lib/librumpuser/rumpuser_port.h |   9 +++++----
 lib/librumpuser/rumpuser_pth.c  |   6 +++---
 lib/librumpuser/rumpuser_sp.c   |   6 +++---
 lib/librumpuser/sp_common.c     |   4 ++--
 5 files changed, 30 insertions(+), 16 deletions(-)

diffs (170 lines):

diff -r be6dbf00e9ad -r 76ff2778e938 lib/librumpuser/rumpuser_dl.c
--- a/lib/librumpuser/rumpuser_dl.c     Mon Jan 14 20:30:00 2013 +0000
+++ b/lib/librumpuser/rumpuser_dl.c     Mon Jan 14 21:00:16 2013 +0000
@@ -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 @@
 #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 @@
 #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 @@
        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;
 
-       fprintf(stderr, "Warning, dlinfo() unsupported on host?\n");
+       for (; rc < rc_end; rc++)
+               compinit(*rc, type);
+
 }
 #endif
 
diff -r be6dbf00e9ad -r 76ff2778e938 lib/librumpuser/rumpuser_port.h
--- a/lib/librumpuser/rumpuser_port.h   Mon Jan 14 20:30:00 2013 +0000
+++ b/lib/librumpuser/rumpuser_port.h   Mon Jan 14 21:00:16 2013 +0000
@@ -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 @@
 #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 @@
 #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__
diff -r be6dbf00e9ad -r 76ff2778e938 lib/librumpuser/rumpuser_pth.c
--- a/lib/librumpuser/rumpuser_pth.c    Mon Jan 14 20:30:00 2013 +0000
+++ b/lib/librumpuser/rumpuser_pth.c    Mon Jan 14 21:00:16 2013 +0000
@@ -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 @@
 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;
diff -r be6dbf00e9ad -r 76ff2778e938 lib/librumpuser/rumpuser_sp.c
--- a/lib/librumpuser/rumpuser_sp.c     Mon Jan 14 20:30:00 2013 +0000
+++ b/lib/librumpuser/rumpuser_sp.c     Mon Jan 14 21:00:16 2013 +0000
@@ -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 @@
 
 
 /* how to use atomic ops on Linux? */
-#ifdef __linux__
+#if defined(__linux__) || defined(__CYGWIN__)
 static pthread_mutex_t discomtx = PTHREAD_MUTEX_INITIALIZER;
 
 static void
diff -r be6dbf00e9ad -r 76ff2778e938 lib/librumpuser/sp_common.c
--- a/lib/librumpuser/sp_common.c       Mon Jan 14 20:30:00 2013 +0000
+++ b/lib/librumpuser/sp_common.c       Mon Jan 14 21:00:16 2013 +0000
@@ -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 @@
                }
        }
        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);



Home | Main Index | Thread Index | Old Index