summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1999-07-03 23:48:40 +0000
committerThomas Bushnell <thomas@gnu.org>1999-07-03 23:48:40 +0000
commit9db1a6bef5a0f7d3a0ed80a1367649bbaae02e2a (patch)
tree62ade79aeb6624ee462840b6fdd4a26383aa9bbe
parent7bacbba638af0771383ad039f635261ebb177e2e (diff)
1999-07-03 Thomas Bushnell, BSG <tb@mit.edu>
* core.c (core_dump_task): Use munmap instead of vm_deallocate, when it's from our own task. * elfcore.c: Likewise. * exec.c (load_section): Likewise. (map): Likewise. (close_exec_stream): Likewise. (finish_mapping): Likewise. (load): Likewise. (do_exec): Likewise. (S_exec_setexecdata): Likewise. * hashexec.c (check_hashbang): Likewise. * main.c (deadboot): Likewise.
-rw-r--r--exec/ChangeLog15
-rw-r--r--exec/core.c4
-rw-r--r--exec/elfcore.c2
-rw-r--r--exec/exec.c50
-rw-r--r--exec/hashexec.c13
-rw-r--r--exec/main.c16
6 files changed, 46 insertions, 54 deletions
diff --git a/exec/ChangeLog b/exec/ChangeLog
index 2c4aec36..a0cd4d43 100644
--- a/exec/ChangeLog
+++ b/exec/ChangeLog
@@ -1,3 +1,18 @@
+1999-07-03 Thomas Bushnell, BSG <tb@mit.edu>
+
+ * core.c (core_dump_task): Use munmap instead of vm_deallocate,
+ when it's from our own task.
+ * elfcore.c: Likewise.
+ * exec.c (load_section): Likewise.
+ (map): Likewise.
+ (close_exec_stream): Likewise.
+ (finish_mapping): Likewise.
+ (load): Likewise.
+ (do_exec): Likewise.
+ (S_exec_setexecdata): Likewise.
+ * hashexec.c (check_hashbang): Likewise.
+ * main.c (deadboot): Likewise.
+
1999-06-04 Roland McGrath <roland@baalperazim.frob.com>
* exec.c (map): Fix mapping calls to use F->__offset consistently
diff --git a/exec/core.c b/exec/core.c
index 6d685a23..f79b6b08 100644
--- a/exec/core.c
+++ b/exec/core.c
@@ -1,5 +1,5 @@
/* GNU Hurd standard core server.
- Copyright (C) 1992 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1999 Free Software Foundation, Inc.
Written by Roland McGrath.
This file is part of the GNU Hurd.
@@ -172,7 +172,7 @@ core_dump_task (mach_port_t coreserver,
goto lose;
err = bfd_set_section_contents (bfd, sec, data, 0,
bfd_section_size (bfd, sec));
- vm_deallocate (mach_task_self (), data, bfd_section_size (bfd, sec));
+ munmap ((caddr_t) data, bfd_section_size (bfd, sec));
if (err)
goto bfdlose;
}
diff --git a/exec/elfcore.c b/exec/elfcore.c
index 4388a135..523973d8 100644
--- a/exec/elfcore.c
+++ b/exec/elfcore.c
@@ -94,7 +94,7 @@
goto lose;
err = bfd_set_section_contents (bfd, sec, data, 0,
bfd_section_size (bfd, sec));
- vm_deallocate (mach_task_self (), data, bfd_section_size (bfd, sec));
+ munmap ((caddr_t) data, bfd_section_size (bfd, sec));
if (err)
goto bfdlose;
}
diff --git a/exec/exec.c b/exec/exec.c
index 9beece9d..cbe202c7 100644
--- a/exec/exec.c
+++ b/exec/exec.c
@@ -231,7 +231,7 @@ load_section (void *section, struct execdata *u)
off);
u->error = vm_write (u->task, mapstart + (size - off),
page, vm_page_size);
- vm_deallocate (mach_task_self (), page, vm_page_size);
+ munmap ((caddr_t) page, vm_page_size);
}
}
/* Reset the current protections to the desired state. */
@@ -277,7 +277,7 @@ load_section (void *section, struct execdata *u)
else
write_to_task (mapstart, size, vm_prot,
(vm_address_t) buf);
- vm_deallocate (mach_task_self (), (vm_address_t) buf, size);
+ munmap (buf, size);
}
}
if (u->error)
@@ -357,7 +357,7 @@ load_section (void *section, struct execdata *u)
u->error = vm_protect (u->task, overlap_page, size,
0, vm_prot);
}
- vm_deallocate (mach_task_self (), ourpage, size);
+ munmap ((caddr_t) ourpage, size);
if (u->error)
goto maplose;
}
@@ -420,7 +420,7 @@ load_section (void *section, struct execdata *u)
u->error = vm_write (u->task, overlap_page, ourpage, size);
if (! u->error && !(vm_prot & VM_PROT_WRITE))
u->error = vm_protect (u->task, overlap_page, size, 0, vm_prot);
- vm_deallocate (mach_task_self (), ourpage, size);
+ munmap ((caddr_t) ourpage, size);
}
}
}
@@ -456,8 +456,7 @@ map (struct execdata *e, off_t posn, size_t len)
{
/* The data was returned out of line. Discard the old buffer. */
if (f->__bufsize != 0)
- vm_deallocate (mach_task_self (),
- (vm_address_t) f->__buffer, f->__bufsize);
+ munmap (f->__buffer, f->__bufsize);
f->__buffer = buffer;
f->__bufsize = round_page (nread);
}
@@ -470,8 +469,7 @@ map (struct execdata *e, off_t posn, size_t len)
{
/* Deallocate the old mapping area. */
if (f->__buffer != NULL)
- vm_deallocate (mach_task_self (), (vm_address_t) f->__buffer,
- f->__bufsize);
+ munmap ((vm_address_t) f->__buffer, f->__bufsize);
f->__buffer = NULL;
/* Make sure our mapping is page-aligned in the file. */
@@ -525,8 +523,7 @@ close_exec_stream (void *cookie)
struct execdata *e = cookie;
if (e->stream.__buffer != NULL)
- vm_deallocate (mach_task_self (), (vm_address_t) e->stream.__buffer,
- e->stream.__bufsize);
+ munmap (e->stream.__buffer, e->stream.__bufsize);
return 0;
}
@@ -813,7 +810,7 @@ finish_mapping (struct execdata *e)
e->cntl->conch_status = USER_HAS_NOT_CONCH;
spin_unlock (&e->cntl->lock);
}
- vm_deallocate (mach_task_self (), (vm_address_t) e->cntl, vm_page_size);
+ munmap (e->cntl, vm_page_size);
e->cntl = NULL;
}
if (e->filemap != MACH_PORT_NULL)
@@ -925,7 +922,7 @@ load (task_t usertask, struct execdata *e)
/* Force it to be paged in. */
(void) *(volatile int *) a;
- vm_deallocate (mach_task_self (), myaddr, mysize);
+ munmap ((caddr_t) myaddr, mysize);
}
}
@@ -1590,8 +1587,7 @@ do_exec (file_t file,
thread_terminate (threads[i]);
mach_port_deallocate (mach_task_self (), threads[i]);
}
- vm_deallocate (mach_task_self (),
- (vm_address_t) threads, nthreads * sizeof (thread_t));
+ munmap ((caddr_t) threads, nthreads * sizeof (thread_t));
/* Deallocate the entire virtual address space of the task. */
@@ -1718,17 +1714,13 @@ do_exec (file_t file,
/* Clean up */
if (euids != euidbuf)
- vm_deallocate (mach_task_self (), (vm_address_t) euids,
- neuids * sizeof (uid_t));
+ munmap (euids, neuids * sizeof (uid_t));
if (egids != egidbuf)
- vm_deallocate (mach_task_self (), (vm_address_t) egids,
- negids * sizeof (uid_t));
+ munmap (egids, negids * sizeof (uid_t));
if (auids != auidbuf)
- vm_deallocate (mach_task_self (), (vm_address_t) auids,
- nauids * sizeof (uid_t));
+ munmap (auids, nauids * sizeof (uid_t));
if (agids != agidbuf)
- vm_deallocate (mach_task_self (), (vm_address_t) agids,
- nagids * sizeof (uid_t));
+ munmap (agids, nagids * sizeof (uid_t));
}
}
@@ -1839,13 +1831,9 @@ do_exec (file_t file,
portarray, and we are not saving those pointers in BOOT for later
transfer, deallocate the original space now. */
if (intarray_dealloc)
- vm_deallocate (mach_task_self (),
- (vm_address_t) intarray,
- nints * sizeof intarray[0]);
+ munmap (intarray, nints * sizeof intarray[0]);
if (!portarray_copy)
- vm_deallocate (mach_task_self (),
- (vm_address_t) portarray,
- nports * sizeof portarray[0]);
+ munmap (portarray, nports * sizeof portarray[0]);
}
return e.error;
@@ -1992,16 +1980,14 @@ S_exec_setexecdata (struct trivfs_protid *protid,
mach_msg_type_number_t i;
for (i = 0; i < std_nports; ++i)
mach_port_deallocate (mach_task_self (), std_ports[i]);
- vm_deallocate (mach_task_self (), (vm_address_t)std_ports,
- std_nports * sizeof (mach_port_t));
+ munmap (std_ports, std_nports * sizeof (mach_port_t));
}
std_ports = ports;
std_nports = nports;
if (std_ints)
- vm_deallocate (mach_task_self (), (vm_address_t)std_ints,
- std_nints * sizeof (int));
+ munmap (std_ints, std_nints * sizeof (int));
std_ints = ints;
std_nints = nints;
diff --git a/exec/hashexec.c b/exec/hashexec.c
index 9f7a8e43..dabd7c00 100644
--- a/exec/hashexec.c
+++ b/exec/hashexec.c
@@ -408,21 +408,18 @@ check_hashbang (struct execdata *e,
task_resume (oldtask); /* Our caller suspended it. */
mach_port_deallocate (mach_task_self (), oldtask);
if (! argv_copy)
- vm_deallocate (mach_task_self (), (vm_address_t) argv, argvlen);
+ munmap (argv, argvlen);
if (! envp_copy)
- vm_deallocate (mach_task_self (), (vm_address_t) envp, envplen);
+ munmap (envp, envplen);
for (i = 0; i < dtablesize; ++i)
mach_port_deallocate (mach_task_self (), dtable[i]);
if (! dtable_copy)
- vm_deallocate (mach_task_self (), (vm_address_t) dtable,
- dtablesize * sizeof *dtable);
+ munmap (dtable, dtablesize * sizeof *dtable);
for (i = 0; i < nports; ++i)
mach_port_deallocate (mach_task_self (), portarray[i]);
if (! portarray_copy)
- vm_deallocate (mach_task_self (), (vm_address_t) portarray,
- nports * sizeof *portarray);
+ munmap (portarray, nports * sizeof *portarray);
if (! intarray_copy)
- vm_deallocate (mach_task_self (), (vm_address_t) intarray,
- nints * sizeof *intarray);
+ munmap (intarray, nints * sizeof *intarray);
}
}
diff --git a/exec/main.c b/exec/main.c
index d52e8817..3a9ce2c8 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -1,6 +1,6 @@
/* GNU Hurd standard exec server, main program and server mechanics.
- Copyright (C) 1992, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+ Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
Written by Roland McGrath.
This file is part of the GNU Hurd.
@@ -75,21 +75,15 @@ deadboot (void *p)
struct bootinfo *boot = p;
size_t i;
- vm_deallocate (mach_task_self (),
- (vm_address_t) boot->argv, boot->argvlen);
- vm_deallocate (mach_task_self (),
- (vm_address_t) boot->envp, boot->envplen);
+ munmap (boot->argv, boot->argvlen);
+ munmap (boot->envp, boot->envplen);
for (i = 0; i < boot->dtablesize; ++i)
mach_port_deallocate (mach_task_self (), boot->dtable[i]);
for (i = 0; i < boot->nports; ++i)
mach_port_deallocate (mach_task_self (), boot->portarray[i]);
- vm_deallocate (mach_task_self (),
- (vm_address_t) boot->portarray,
- boot->nports * sizeof (mach_port_t));
- vm_deallocate (mach_task_self (),
- (vm_address_t) boot->intarray,
- boot->nints * sizeof (int));
+ munmap (boot->portarray, boot->nports * sizeof (mach_port_t));
+ munmap (boot->intarray, boot->nints * sizeof (int));
/* See if we are going away and this was the last thing keeping us up. */
if (ports_count_class (trivfs_cntl_portclasses[0]) == 0)