summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2003-04-25 20:32:08 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2003-04-25 20:32:08 +0000
commitb1941bc0b460459bcf7a51d44e73fa82417492d4 (patch)
tree1b5cfd736673a902eb2a7855096d631bd8a9c2df
parent9aa56153bca2e8f5bdb16b9bbc6001858d8dad8a (diff)
backout mquery change, something broke when not combined with a different diff.
-rw-r--r--lib/libc/sys/mquery.c9
-rw-r--r--libexec/ld.so/i386/archdep.h11
-rw-r--r--libexec/ld.so/library_mquery.c15
-rw-r--r--sys/kern/syscalls.master8
-rw-r--r--sys/sys/mman.h4
-rw-r--r--sys/uvm/uvm_mmap.c87
6 files changed, 24 insertions, 110 deletions
diff --git a/lib/libc/sys/mquery.c b/lib/libc/sys/mquery.c
index 92856a2c70a..c58d466ca20 100644
--- a/lib/libc/sys/mquery.c
+++ b/lib/libc/sys/mquery.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mquery.c,v 1.2 2003/04/25 18:30:18 drahn Exp $ */
+/* $OpenBSD: mquery.c,v 1.3 2003/04/25 20:32:07 drahn Exp $ */
/*
* Written by Artur Grabowski <art@openbsd.org> Public Domain
*/
@@ -10,9 +10,8 @@
/*
* This function provides 64-bit offset padding.
*/
-void *
-mquery(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
+int
+mquery(int flags, void **addr, size_t size, int fd, off_t off)
{
- return((void *)(long)__syscall((quad_t)SYS_mquery, addr, len, prot,
- flags, fd, 0, offset));
+ return(__syscall((quad_t)SYS_mquery, flags, addr, size, fd, off));
}
diff --git a/libexec/ld.so/i386/archdep.h b/libexec/ld.so/i386/archdep.h
index 8d2bc4c1b8c..c7d003e2c89 100644
--- a/libexec/ld.so/i386/archdep.h
+++ b/libexec/ld.so/i386/archdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: archdep.h,v 1.5 2003/04/25 18:30:18 drahn Exp $ */
+/* $OpenBSD: archdep.h,v 1.6 2003/04/25 20:32:07 drahn Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -56,15 +56,12 @@ _dl_mmap(void *addr, unsigned int len, unsigned int prot,
flags, fd, 0, offset));
}
-static inline void *
-_dl_mquery(void *addr, unsigned int len, unsigned int prot,
- unsigned int flags, int fd, off_t offset)
+static inline int
+_dl_mquery(int flags, void **addr, size_t size, int fd, off_t off)
{
- return((void *)_dl__syscall((quad_t)SYS_mquery, addr, len, prot,
- flags, fd, 0, offset));
+ return(_dl__syscall((quad_t)SYS_mquery, flags, addr, size, fd, off));
}
-
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 84bf421d046..2a3cb267dd5 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.4 2003/04/25 18:30:18 drahn Exp $ */
+/* $OpenBSD: library_mquery.c,v 1.5 2003/04/25 20:32:07 drahn Exp $ */
/*
* Copyright (c) 2002 Dale Rahn
@@ -445,6 +445,7 @@ 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
@@ -472,13 +473,13 @@ retry:
* adjust the base mapping address to match this free mapping
* and restart the process again.
*/
- ld->start = _dl_mquery(ld->start, ROUND_PG(ld->size), ld->prot,
- flags, fd, foff);
- if (_dl_check_error(ld->start)) {
+ error = _dl_mquery(flags, &ld->start, ROUND_PG(ld->size), fd,
+ foff);
+ if (_dl_check_error(error)) {
ld->start = (void *)(LOFF + ld->moff);
- ld->start = _dl_mquery(ld->start, ROUND_PG(ld->size),
- ld->prot, flags & ~MAP_FIXED, fd, foff);
- if (_dl_check_error(ld->start))
+ error = _dl_mquery(0, &ld->start, ROUND_PG(ld->size),
+ fd, foff);
+ if (_dl_check_error(error))
goto fail;
}
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 6d216318a76..878fcd0010b 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -1,4 +1,4 @@
-; $OpenBSD: syscalls.master,v 1.54 2003/04/25 18:30:18 drahn Exp $
+; $OpenBSD: syscalls.master,v 1.55 2003/04/25 20:32:07 drahn Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -570,7 +570,5 @@
gid_t *sgid); }
284 STD { int sys_setresgid(gid_t rgid, gid_t egid, \
gid_t sgid); }
-285 STD { int sys_omquery(int flags, void **addr, \
- size_t size, int fd, off_t off); }
-286 STD { void *sys_mquery(void *addr, size_t len, int prot, \
- int flags, int fd, long pad, off_t pos); }
+285 STD { int sys_mquery(int flags, void **addr, size_t size, \
+ int fd, off_t off); }
diff --git a/sys/sys/mman.h b/sys/sys/mman.h
index adbe900f950..e4e2e0aca6f 100644
--- a/sys/sys/mman.h
+++ b/sys/sys/mman.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mman.h,v 1.13 2003/04/25 18:30:18 drahn Exp $ */
+/* $OpenBSD: mman.h,v 1.14 2003/04/25 20:32:07 drahn Exp $ */
/* $NetBSD: mman.h,v 1.11 1995/03/26 20:24:23 jtc Exp $ */
/*-
@@ -123,7 +123,7 @@ int munlockall(void);
int madvise(void *, size_t, int);
int mincore(void *, size_t, char *);
int minherit(void *, size_t, int);
-void * mquery(void *, size_t, int, int, int, off_t);
+int mquery(int flags, void **addr, size_t size, int fd, off_t off);
__END_DECLS
#endif /* !_KERNEL */
diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c
index 1a8676a241c..5da4bf71caa 100644
--- a/sys/uvm/uvm_mmap.c
+++ b/sys/uvm/uvm_mmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_mmap.c,v 1.43 2003/04/25 18:30:18 drahn Exp $ */
+/* $OpenBSD: uvm_mmap.c,v 1.44 2003/04/25 20:32:07 drahn Exp $ */
/* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */
/*
@@ -127,92 +127,11 @@ sys_sstk(p, v, retval)
* off: offset within the file
*/
-int
-sys_mquery(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_mquery_args /* {
- syscallarg(caddr_t) addr;
- syscallarg(size_t) len;
- syscallarg(int) prot;
- syscallarg(int) flags;
- syscallarg(int) fd;
- syscallarg(long) pad;
- syscallarg(off_t) pos;
- } */ *uap = v;
- struct file *fp;
- struct uvm_object *uobj;
- voff_t uoff;
- int error;
- vaddr_t vaddr;
- int flags = 0;
- vsize_t size;
- vm_prot_t prot;
- int fd;
-
- vaddr = (vaddr_t) SCARG(uap, addr);
- prot = SCARG(uap, prot) & VM_PROT_ALL;
- size = (vsize_t) SCARG(uap, len);
- fd = SCARG(uap, fd);
-
- if (SCARG(uap, flags) & MAP_FIXED)
- flags |= UVM_FLAG_FIXED;
-
- if (fd >= 0) {
- if ((error = getvnode(p->p_fd, fd, &fp)) != 0)
- return (error);
- uobj = &((struct vnode *)fp->f_data)->v_uvm.u_obj;
- uoff = SCARG(uap, pos);
- } else {
- fp = NULL;
- uobj = NULL;
- uoff = 0;
- }
-
- if (vaddr == 0)
- vaddr = uvm_map_hint(p, prot);
-
- /* prevent a user requested address from falling in heap space */
- if ((vaddr + size > (vaddr_t)p->p_vmspace->vm_daddr) &&
- (vaddr < (vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ)) {
- if (flags & UVM_FLAG_FIXED) {
- error = EINVAL;
- goto done;
- }
- vaddr = round_page((vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ);
- }
-again:
-
- if (uvm_map_findspace(&p->p_vmspace->vm_map, vaddr, size,
- &vaddr, uobj, uoff, 0, flags) == NULL) {
- if (flags & UVM_FLAG_FIXED)
- error = EINVAL;
- else
- error = ENOMEM;
- } else {
- /* prevent a returned address from falling in heap space */
- if ((vaddr + size > (vaddr_t)p->p_vmspace->vm_daddr)
- && (vaddr < (vaddr_t)p->p_vmspace->vm_daddr + MAXDSIZ)) {
- vaddr = round_page((vaddr_t)p->p_vmspace->vm_daddr +
- MAXDSIZ);
- goto again;
- }
- error = 0;
- *retval = (register_t)(vaddr);
- }
-done:
- if (fp != NULL)
- FRELE(fp);
- return (error);
-}
-
/* ARGSUSED */
int
-sys_omquery(struct proc *p, void *v, register_t *retval)
+sys_mquery(struct proc *p, void *v, register_t *retval)
{
- struct sys_omquery_args /* {
+ struct sys_mquery_args /* {
syscallarg(int) flags;
syscallarg(void **) addr;
syscallarg(size_t) size;