diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2003-04-25 18:30:19 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2003-04-25 18:30:19 +0000 |
commit | 8841d81531b38e0ec365213db0159742de302e6a (patch) | |
tree | 347da186972c9f7b017672935e5023ef3390cb6d /libexec | |
parent | a5d055cd3e7192e8ab92e3d23f447d6e7e92855e (diff) |
change mquery() function call signature to be the same a mmap(). It
needs the prot/flags info and passing the addresses via arg/return allows
it to be traced via ktrace better than an in/out paramter.
This adds a new mquery syscall and renames the old one to omquery.
New kernel _MUST_ be built and installed before building ld.so with this change.
ok millert@ tedu@
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/ld.so/i386/archdep.h | 11 | ||||
-rw-r--r-- | libexec/ld.so/library_mquery.c | 15 |
2 files changed, 14 insertions, 12 deletions
diff --git a/libexec/ld.so/i386/archdep.h b/libexec/ld.so/i386/archdep.h index 6efcf183cc9..8d2bc4c1b8c 100644 --- a/libexec/ld.so/i386/archdep.h +++ b/libexec/ld.so/i386/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.4 2003/04/17 03:40:49 drahn Exp $ */ +/* $OpenBSD: archdep.h,v 1.5 2003/04/25 18:30:18 drahn Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -56,12 +56,15 @@ _dl_mmap(void *addr, unsigned int len, unsigned int prot, flags, fd, 0, offset)); } -static inline int -_dl_mquery(int flags, void **addr, size_t size, int fd, off_t off) +static inline void * +_dl_mquery(void *addr, unsigned int len, unsigned int prot, + unsigned int flags, int fd, off_t offset) { - return(_dl__syscall((quad_t)SYS_mquery, flags, addr, size, fd, off)); + return((void *)_dl__syscall((quad_t)SYS_mquery, addr, len, prot, + flags, fd, 0, offset)); } + static inline void RELOC_REL(Elf32_Rel *r, const Elf32_Sym *s, Elf32_Addr *p, unsigned long v) { diff --git a/libexec/ld.so/library_mquery.c b/libexec/ld.so/library_mquery.c index cec2fa9c366..84bf421d046 100644 --- a/libexec/ld.so/library_mquery.c +++ b/libexec/ld.so/library_mquery.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library_mquery.c,v 1.3 2003/04/21 14:35:50 drahn Exp $ */ +/* $OpenBSD: library_mquery.c,v 1.4 2003/04/25 18:30:18 drahn Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -445,7 +445,6 @@ retry: for (ld = lowld; ld != NULL; ld = ld->next) { off_t foff; int fd, flags; - int error; /* * We don't want to provide the fd/off hint for anything @@ -473,13 +472,13 @@ retry: * adjust the base mapping address to match this free mapping * and restart the process again. */ - error = _dl_mquery(flags, &ld->start, ROUND_PG(ld->size), fd, - foff); - if (_dl_check_error(error)) { + ld->start = _dl_mquery(ld->start, ROUND_PG(ld->size), ld->prot, + flags, fd, foff); + if (_dl_check_error(ld->start)) { ld->start = (void *)(LOFF + ld->moff); - error = _dl_mquery(0, &ld->start, ROUND_PG(ld->size), - fd, foff); - if (_dl_check_error(error)) + ld->start = _dl_mquery(ld->start, ROUND_PG(ld->size), + ld->prot, flags & ~MAP_FIXED, fd, foff); + if (_dl_check_error(ld->start)) goto fail; } |