Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/rump_allserver Handle -l which dlopens libs. This i...



details:   https://anonhg.NetBSD.org/src/rev/4e022157041e
branches:  trunk
changeset: 759587:4e022157041e
user:      pooka <pooka%NetBSD.org@localhost>
date:      Mon Dec 13 13:32:25 2010 +0000

description:
Handle -l which dlopens libs.  This is more applicable to rump_server
than rump_allserver.

So if I do:

golem> rump_server unix:///tmp/commsuck
==>
golem> env RUMP_SERVER=unix:///tmp/commsuck rump.modstat
NAME             CLASS      SOURCE     REFS  SIZE     REQUIRES
suser            secmodel   builtin    0     -        -

and:

golem> rump_server -l librumpvfs.so unix:///tmp/commsuck
==>
golem> env RUMP_SERVER=unix:///tmp/commsuck rump.modstat
NAME             CLASS      SOURCE     REFS  SIZE     REQUIRES
suser            secmodel   builtin    0     -        -
wapbl            vfs        builtin    0     -        -

golem> rump_server -l librumpvfs.so -l librumpfs_ffs.so unix:///tmp/commsuck
==>
golem> env RUMP_SERVER=unix:///tmp/commsuck rump.modstat
NAME             CLASS      SOURCE     REFS  SIZE     REQUIRES
ffs              vfs        builtin    0     -        -
suser            secmodel   builtin    0     -        -
wapbl            vfs        builtin    0     -        -

Well, you get the picture...

diffstat:

 usr.bin/rump_allserver/rump_allserver.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r b7a8b019d9ff -r 4e022157041e usr.bin/rump_allserver/rump_allserver.c
--- a/usr.bin/rump_allserver/rump_allserver.c   Mon Dec 13 13:29:15 2010 +0000
+++ b/usr.bin/rump_allserver/rump_allserver.c   Mon Dec 13 13:32:25 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump_allserver.c,v 1.5 2010/12/12 18:33:44 pooka Exp $ */
+/*     $NetBSD: rump_allserver.c,v 1.6 2010/12/13 13:32:25 pooka Exp $ */
 
 /*-
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: rump_allserver.c,v 1.5 2010/12/12 18:33:44 pooka Exp $");
+__RCSID("$NetBSD: rump_allserver.c,v 1.6 2010/12/13 13:32:25 pooka Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -36,6 +36,7 @@
 #include <rump/rump.h>
 #include <rump/rump_syscalls.h>
 
+#include <dlfcn.h>
 #include <err.h>
 #include <errno.h>
 #include <semaphore.h>
@@ -80,8 +81,13 @@
        setprogname(argv[0]);
 
        sflag = 0;
-       while ((ch = getopt(argc, argv, "s")) != -1) {
+       while ((ch = getopt(argc, argv, "l:s")) != -1) {
                switch (ch) {
+               case 'l':
+                       if (dlopen(optarg, RTLD_LAZY|RTLD_GLOBAL) == NULL)
+                               errx(1, "dlopen %s failed: %s",
+                                   optarg, dlerror());
+                       break;
                case 's':
                        sflag = 1;
                        break;



Home | Main Index | Thread Index | Old Index