Source-Changes-HG archive

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

[src/trunk]: src/lib/librumphijack allow mmap() to be called before init runs



details:   https://anonhg.NetBSD.org/src/rev/6a64e2e05d24
branches:  trunk
changeset: 810321:6a64e2e05d24
user:      pooka <pooka%NetBSD.org@localhost>
date:      Tue Aug 25 13:45:00 2015 +0000

description:
allow mmap() to be called before init runs

diffstat:

 lib/librumphijack/hijack.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r 6dbdf950bb0c -r 6a64e2e05d24 lib/librumphijack/hijack.c
--- a/lib/librumphijack/hijack.c        Tue Aug 25 13:13:54 2015 +0000
+++ b/lib/librumphijack/hijack.c        Tue Aug 25 13:45:00 2015 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: hijack.c,v 1.117 2015/04/11 12:54:41 riastradh Exp $  */
+/*      $NetBSD: hijack.c,v 1.118 2015/08/25 13:45:00 pooka Exp $      */
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -34,7 +34,7 @@
 #include <rump/rumpuser_port.h>
 
 #if !defined(lint)
-__RCSID("$NetBSD: hijack.c,v 1.117 2015/04/11 12:54:41 riastradh Exp $");
+__RCSID("$NetBSD: hijack.c,v 1.118 2015/08/25 13:45:00 pooka Exp $");
 #endif
 
 #include <sys/param.h>
@@ -885,7 +885,8 @@
 
        host_fork = dlsym(RTLD_NEXT, "fork");
        host_daemon = dlsym(RTLD_NEXT, "daemon");
-       host_mmap = dlsym(RTLD_NEXT, "mmap");
+       if (host_mmap == NULL)
+               host_mmap = dlsym(RTLD_NEXT, "mmap");
 
        /*
         * In theory cannot print anything during lookups because
@@ -2233,6 +2234,9 @@
                errno = ENOSYS;
                return MAP_FAILED;
        }
+       if (__predict_false(host_mmap == NULL)) {
+               host_mmap = dlsym(RTLD_NEXT, "mmap");
+       }
        return host_mmap(addr, len, prot, flags, fd, offset);
 }
 



Home | Main Index | Thread Index | Old Index