Module Name:    src
Committed By:   pooka
Date:           Thu Jan 27 18:12:19 UTC 2011

Modified Files:
        src/lib/librumphijack: Makefile hijack.c

Log Message:
Use NEEDED for librumpclient instead of loading it manually.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/librumphijack/Makefile
cvs rdiff -u -r1.22 -r1.23 src/lib/librumphijack/hijack.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/librumphijack/Makefile
diff -u src/lib/librumphijack/Makefile:1.5 src/lib/librumphijack/Makefile:1.6
--- src/lib/librumphijack/Makefile:1.5	Tue Jan 25 12:56:57 2011
+++ src/lib/librumphijack/Makefile	Thu Jan 27 18:12:19 2011
@@ -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

Index: src/lib/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.22 src/lib/librumphijack/hijack.c:1.23
--- src/lib/librumphijack/hijack.c:1.22	Thu Jan 27 18:05:16 2011
+++ src/lib/librumphijack/hijack.c	Thu Jan 27 18:12:19 2011
@@ -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);

Reply via email to