Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/librump/rumpkern Requery syscall handlers during ru...



details:   https://anonhg.NetBSD.org/src/rev/01c924323bdb
branches:  trunk
changeset: 760189:01c924323bdb
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Dec 30 16:46:32 2010 +0000

description:
Requery syscall handlers during rump kernel init.  This fixes
syscalls provided by a rump faction such as rumpvfs when the library
is not linked into the binary, but is dlopen()'d before calling
rump_init().
(it is illegal to dlopen() a faction after rump_init(), but syscalls
maybe be added the usual way with modules)

rump_server(1) -lstuff works now.

diffstat:

 sys/rump/librump/rumpkern/rump.c |  33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)

diffs (54 lines):

diff -r 69c741e31886 -r 01c924323bdb sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c  Thu Dec 30 16:19:39 2010 +0000
+++ b/sys/rump/librump/rumpkern/rump.c  Thu Dec 30 16:46:32 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump.c,v 1.212 2010/12/16 12:38:20 pooka Exp $ */
+/*     $NetBSD: rump.c,v 1.213 2010/12/30 16:46:32 pooka Exp $ */
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.212 2010/12/16 12:38:20 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.213 2010/12/30 16:46:32 pooka Exp $");
 
 #include <sys/systm.h>
 #define ELFSIZE ARCH_ELFSIZE
@@ -440,6 +440,35 @@
        if (initproc == NULL)
                panic("where in the world is initproc?");
 
+       /*
+        * Adjust syscall vector in case factions were dlopen()'d
+        * before calling rump_init().
+        * (modules will handle dynamic syscalls the usual way)
+        *
+        * Note: this will adjust the function vectors of
+        * syscalls which use a funcalias (getpid etc.), but
+        * it makes no difference.
+        */
+       for (i = 0; i < SYS_NSYSENT; i++) {
+               void *sym;
+
+               if (rump_sysent[i].sy_flags & SYCALL_NOSYS ||
+                   *syscallnames[i] == '#' ||
+                   rump_sysent[i].sy_call == sys_nomodule)
+                       continue;
+
+               /* if present, adjust symbol value */
+               sprintf(buf, "rumpns_sys_%s", syscallnames[i]);
+               if ((sym = rumpuser_dl_globalsym(buf)) != NULL
+                   && sym != rump_sysent[i].sy_call) {
+#if 0
+                       rumpuser_dprintf("adjusting %s: %p (old %p)\n",
+                           syscallnames[i], sym, rump_sysent[i].sy_call);
+#endif
+                       rump_sysent[i].sy_call = sym;
+               }
+       }
+
        /* release cpu */
        rump_unschedule();
 



Home | Main Index | Thread Index | Old Index