summaryrefslogtreecommitdiff
path: root/proc
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1999-07-11 05:32:01 +0000
committerThomas Bushnell <thomas@gnu.org>1999-07-11 05:32:01 +0000
commit787cf415c05ca62623d6e5b0f94ff61c13eb08ad (patch)
tree759e66738de843011588dd4e0ad76e721a9e5fc4 /proc
parent5b1ade980a0f2b0de705c08954baddb816023c4c (diff)
1999-07-09 Thomas Bushnell, BSG <tb@mit.edu>
* info.c (get_string_array): Use mmap instead of vm_allocate. (S_proc_getprocinfo): Likewise. (S_proc_getloginpids): Likewise. * mgt.c (S_proc_getallpids): Likewise. * pgrp.c (S_proc_getsessionpids): Likewise. (S_proc_getsessionpgids): Likewise. (S_proc_getpgrppids): Likewise.
Diffstat (limited to 'proc')
-rw-r--r--proc/ChangeLog10
-rw-r--r--proc/info.c15
-rw-r--r--proc/mgt.c4
-rw-r--r--proc/pgrp.c14
4 files changed, 28 insertions, 15 deletions
diff --git a/proc/ChangeLog b/proc/ChangeLog
index 6cb14769..e874d5a3 100644
--- a/proc/ChangeLog
+++ b/proc/ChangeLog
@@ -3,6 +3,16 @@
* info.c: Add #include <sys/mman.h> for munmap decl.
* mgt.c: Likewise.
+1999-07-09 Thomas Bushnell, BSG <tb@mit.edu>
+
+ * info.c (get_string_array): Use mmap instead of vm_allocate.
+ (S_proc_getprocinfo): Likewise.
+ (S_proc_getloginpids): Likewise.
+ * mgt.c (S_proc_getallpids): Likewise.
+ * pgrp.c (S_proc_getsessionpids): Likewise.
+ (S_proc_getsessionpgids): Likewise.
+ (S_proc_getpgrppids): Likewise.
+
1999-07-03 Thomas Bushnell, BSG <tb@mit.edu>
* info.c (get_string): Use munmap instead of vm_deallocate.
diff --git a/proc/info.c b/proc/info.c
index dd10152c..e847ab78 100644
--- a/proc/info.c
+++ b/proc/info.c
@@ -281,7 +281,9 @@ get_string_array (task_t t,
if (newsize < prev_len + len)
newsize = prev_len + len;
- err = vm_allocate (mach_task_self (), &newbuf, newsize, 1);
+ newbuf = (vm_address_t) mmap (0, newsize, PROT_READ|PROT_WRITE,
+ MAP_ANON, 0, 0);
+ err = (newbuf == -1) ? errno : 0;
if (err)
{
free (string);
@@ -402,7 +404,7 @@ S_proc_getprocinfo (struct proc *callerp,
if (structsize / sizeof (int) > *piarraylen)
{
- vm_allocate (mach_task_self (), (vm_address_t *)piarray, structsize, 1);
+ *piarray = mmap (0, structsize, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
pi_alloced = 1;
}
*piarraylen = structsize / sizeof (int);
@@ -521,8 +523,9 @@ S_proc_getprocinfo (struct proc *callerp,
mach_msg_type_number_t new_len =
round_page (waits_used + desc_len + 1);
- err = vm_allocate (mach_task_self (),
- (vm_address_t *)&new_waits, new_len,1);
+ new_waits = mmap (0, new_len, PROT_READ|PROT_WRITE,
+ MAP_ANON, 0, 0);
+ err = (new_waits == (char *) -1) ? errno : 0;
if (err)
/* Just don't return any more waits information. */
*flags &= ~PI_FETCH_THREAD_WAITS;
@@ -639,8 +642,8 @@ S_proc_getloginpids (struct proc *callerp,
}
if (*npids < new - parray)
- vm_allocate (mach_task_self (), (vm_address_t *) pids,
- (new - parray) * sizeof (pid_t), 1);
+ *pids = mmap (0, (new - parray) * sizeof (pid_t), PROT_READ|PROT_WRITE,
+ MAP_ANON, 0, 0);
*npids = new - parray;
for (i = 0; i < *npids; i++)
(*pids)[i] = parray[i]->p_pid;
diff --git a/proc/mgt.c b/proc/mgt.c
index 581338dc..551885de 100644
--- a/proc/mgt.c
+++ b/proc/mgt.c
@@ -478,8 +478,8 @@ S_proc_getallpids (struct proc *p,
prociterate (count_up, &nprocs);
if (nprocs > *pidslen)
- vm_allocate (mach_task_self (), (vm_address_t *) pids,
- nprocs * sizeof (pid_t), 1);
+ *pids = mmap (0, nprocs * sizeof (pid_t), PROT_READ|PROT_WRITE,
+ MAP_ANON, 0, 0);
loc = *pids;
prociterate (store_pid, &loc);
diff --git a/proc/pgrp.c b/proc/pgrp.c
index 224f7e52..ecd4b6e3 100644
--- a/proc/pgrp.c
+++ b/proc/pgrp.c
@@ -1,5 +1,5 @@
/* Session and process group manipulation
- Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1999 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -174,8 +174,8 @@ S_proc_getsessionpids (struct proc *callerp,
if (count > npids)
/* They didn't all fit */
{
- vm_allocate (mach_task_self (), (vm_address_t *)pids,
- count * sizeof (pid_t), 1);
+ *pids = mmap (0, count * sizeof (pid_t), PROT_READ|PROT_WRITE,
+ MAP_ANON, 0, 0);
pp = *pids;
for (pg = s->s_pgrps; pg; pg = pg->pg_next)
for (p = pg->pg_plist; p; p = p->p_gnext)
@@ -214,8 +214,8 @@ S_proc_getsessionpgids (struct proc *callerp,
if (count > npgids)
/* They didn't all fit. */
{
- vm_allocate (mach_task_self (), (vm_address_t *)pgids,
- count * sizeof (pid_t), 1);
+ *pgids = mmap (0, count * sizeof (pid_t), PROT_READ|PROT_WRITE,
+ MAP_ANON, 0, 0);
pp = *pgids;
for (pg = s->s_pgrps; pg; pg = pg->pg_next)
*pp++ = pg->pg_pgid;
@@ -257,8 +257,8 @@ S_proc_getpgrppids (struct proc *callerp,
if (count > npids)
/* They didn't all fit. */
{
- vm_allocate (mach_task_self (), (vm_address_t *)pids,
- count * sizeof (pid_t), 1);
+ *pids = mmap (0, count * sizeof (pid_t), PROT_READ|PROT_WRITE,
+ MAP_ANON, 0, 0);
pp = *pids;
for (p = pg->pg_plist; p; p = p->p_gnext)
*pp++ = p->p_pid;