Source-Changes-HG archive

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

[src/trunk]: src/lib/librumphijack Use NEEDED for librumpclient instead of lo...



details:   https://anonhg.NetBSD.org/src/rev/2354431f69e6
branches:  trunk
changeset: 761444:2354431f69e6
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Jan 27 18:12:19 2011 +0000

description:
Use NEEDED for librumpclient instead of loading it manually.

diffstat:

 lib/librumphijack/Makefile |   5 +++--
 lib/librumphijack/hijack.c |  20 ++++++++------------
 2 files changed, 11 insertions(+), 14 deletions(-)

diffs (71 lines):

diff -r 7a4d1ae3157c -r 2354431f69e6 lib/librumphijack/Makefile
--- a/lib/librumphijack/Makefile        Thu Jan 27 18:05:16 2011 +0000
+++ b/lib/librumphijack/Makefile        Thu Jan 27 18:12:19 2011 +0000
@@ -1,10 +1,11 @@
-#      $NetBSD: Makefile,v 1.5 2011/01/25 12:56:57 pooka Exp $
+#      $NetBSD: Makefile,v 1.6 2011/01/27 18:12:19 pooka Exp $
 #
 
 LIB=           rumphijack
 NOSTATICLIB=   dlfun
 NOPROFILE=     dlfun
-LIBDPLIBS+=    pthread ${.CURDIR}/../libpthread
+LIBDPLIBS+=    pthread         ${.CURDIR}/../libpthread        \
+               rumpclient      ${.CURDIR}/../librumpclient
 MAN=           rumphijack.3
 
 SRCS=          hijack.c
diff -r 7a4d1ae3157c -r 2354431f69e6 lib/librumphijack/hijack.c
--- a/lib/librumphijack/hijack.c        Thu Jan 27 18:05:16 2011 +0000
+++ b/lib/librumphijack/hijack.c        Thu Jan 27 18:12:19 2011 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: hijack.c,v 1.22 2011/01/27 18:05:16 pooka Exp $       */
+/*      $NetBSD: hijack.c,v 1.23 2011/01/27 18:12:19 pooka Exp $       */
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: hijack.c,v 1.22 2011/01/27 18:05:16 pooka Exp $");
+__RCSID("$NetBSD: hijack.c,v 1.23 2011/01/27 18:12:19 pooka Exp $");
 
 #define __ssp_weak_name(fun) _hijack_ ## fun
 
@@ -187,16 +187,10 @@
 static void __attribute__((constructor))
 rcinit(void)
 {
-       void **rumpcdlsym;
-       void *hand;
+       extern void *(*rumpclient_dlsym)(void *, const char *);
        unsigned i, j;
 
-       hand = dlopen("librumpclient.so", RTLD_LAZY|RTLD_GLOBAL);
-       if (!hand)
-               err(1, "cannot open librumpclient.so");
-
-       rumpcdlsym = dlsym(hand, "rumpclient_dlsym");
-       *rumpcdlsym = hijackdlsym;
+       rumpclient_dlsym = hijackdlsym;
        host_fork = dlsym(RTLD_NEXT, "fork");
 
        /*
@@ -215,12 +209,14 @@
                if (j == __arraycount(syscnames))
                        errx(1, "rumphijack error: syscall pos %d missing", i);
 
-               syscalls[i].bs_host = dlsym(hand,syscnames[j].scm_hostname);
+               syscalls[i].bs_host = dlsym(RTLD_NEXT,
+                   syscnames[j].scm_hostname);
                if (syscalls[i].bs_host == NULL)
                        errx(1, "hostcall %s not found missing",
                            syscnames[j].scm_hostname);
 
-               syscalls[i].bs_rump = dlsym(hand,syscnames[j].scm_rumpname);
+               syscalls[i].bs_rump = dlsym(RTLD_NEXT,
+                   syscnames[j].scm_rumpname);
                if (syscalls[i].bs_rump == NULL)
                        errx(1, "rumpcall %s not found missing",
                            syscnames[j].scm_rumpname);



Home | Main Index | Thread Index | Old Index