Module Name: src Committed By: pooka Date: Tue Aug 25 13:45:00 UTC 2015
Modified Files: src/lib/librumphijack: hijack.c Log Message: allow mmap() to be called before init runs To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 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/hijack.c diff -u src/lib/librumphijack/hijack.c:1.117 src/lib/librumphijack/hijack.c:1.118 --- src/lib/librumphijack/hijack.c:1.117 Sat Apr 11 12:54:41 2015 +++ src/lib/librumphijack/hijack.c Tue Aug 25 13:45:00 2015 @@ -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 @@ rcinit(void) 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 @@ mmap(void *addr, size_t len, int prot, i 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); }