Module Name: src Committed By: pooka Date: Thu Dec 30 16:46:32 UTC 2010
Modified Files: src/sys/rump/librump/rumpkern: rump.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.212 -r1.213 src/sys/rump/librump/rumpkern/rump.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/rump/librump/rumpkern/rump.c diff -u src/sys/rump/librump/rumpkern/rump.c:1.212 src/sys/rump/librump/rumpkern/rump.c:1.213 --- src/sys/rump/librump/rumpkern/rump.c:1.212 Thu Dec 16 12:38:20 2010 +++ src/sys/rump/librump/rumpkern/rump.c Thu Dec 30 16:46:32 2010 @@ -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();