[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 79/87: Fix proc_getprocinfo calls
From: |
Samuel Thibault |
Subject: |
[hurd] 79/87: Fix proc_getprocinfo calls |
Date: |
Sun, 09 Nov 2014 11:05:06 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 610c428cf8c9340d955c79cd2daca3ed8657f2b1
Author: Samuel Thibault <address@hidden>
Date: Sun Nov 2 16:00:03 2014 +0100
Fix proc_getprocinfo calls
The deallocation also needs to be fixed.
Also, fetch_procinfo already took care of the conversion.
* exec/elfcore.c (dump_core): Fix procinfoCnt taken from
proc_getprocinfo.
* utils/login.c (check_owned): Likewise.
* libps/procstat.c (merge_procinfo): Remove conversion between bytes and
int, already handled by fetch_procinfo.
---
exec/elfcore.c | 4 ++--
libps/procstat.c | 4 ++--
utils/login.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/exec/elfcore.c b/exec/elfcore.c
index 033604c..ff38a3c 100644
--- a/exec/elfcore.c
+++ b/exec/elfcore.c
@@ -334,7 +334,7 @@ dump_core (task_t task, file_t file, off_t corelimit,
mach_msg_type_number_t num_waits = 0;
char pibuf[offsetof (struct procinfo, threadinfos[2])];
struct procinfo *pi = (void *) &pibuf;
- mach_msg_type_number_t pi_size = sizeof pibuf / sizeof(*(procinfo_t*)0);
+ mach_msg_type_number_t pi_size = sizeof pibuf / sizeof (*(procinfo_t*)0);
memset (&pstatus.data, 0, sizeof pstatus.data);
memset (&psinfo.data, 0, sizeof psinfo.data);
@@ -395,7 +395,7 @@ dump_core (task_t task, file_t file, off_t corelimit,
psinfo.data.pr_wstat = pi->exitstatus;
if ((void *) pi != &pibuf)
- munmap (pi, pi_size);
+ munmap (pi, pi_size * sizeof (*(procinfo_t*) 0));
}
if (err == 0)
{
diff --git a/libps/procstat.c b/libps/procstat.c
index b00c9e4..0d4a565 100644
--- a/libps/procstat.c
+++ b/libps/procstat.c
@@ -192,7 +192,7 @@ merge_procinfo (struct proc_stat *ps, ps_flags_t need,
ps_flags_t have)
return ENOMEM;
}
new_pi = ps->proc_info;
- new_pi_size = ps->proc_info_size / sizeof(*(procinfo_t)0);
+ new_pi_size = ps->proc_info_size;
if (really_need & PSTAT_THREAD_WAITS)
/* We're going to get thread waits info, so make some storage for it too.*/
@@ -240,7 +240,7 @@ merge_procinfo (struct proc_stat *ps, ps_flags_t need,
ps_flags_t have)
else
free (ps->proc_info);
ps->proc_info = new_pi;
- ps->proc_info_size = new_pi_size * sizeof(*(procinfo_t)0);
+ ps->proc_info_size = new_pi_size;
ps->proc_info_vm_alloced = 1;
}
diff --git a/utils/login.c b/utils/login.c
index 40bc3f4..a3e0563 100644
--- a/utils/login.c
+++ b/utils/login.c
@@ -263,7 +263,7 @@ check_owned (process_t proc_server, pid_t pid, int *owned)
char *waits = 0;
mach_msg_type_number_t num_waits = 0;
struct procinfo _pi, *pi = &_pi;
- mach_msg_type_number_t pi_size = sizeof _pi / sizeof(*(procinfo_t)0);
+ mach_msg_type_number_t pi_size = sizeof _pi / sizeof (*(procinfo_t)0);
error_t err =
proc_getprocinfo (proc_server, pid, &flags, (procinfo_t *)&pi, &pi_size,
&waits, &num_waits);
@@ -272,7 +272,7 @@ check_owned (process_t proc_server, pid_t pid, int *owned)
{
*owned = !(pi->state & PI_NOTOWNED);
if (pi != &_pi)
- munmap (pi, pi_size);
+ munmap (pi, pi_size * sizeof (*(procinfo_t)0));
}
return err;
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 45/87: Revert "libpipe: fix calls to pipe_send with no data", (continued)
- [hurd] 45/87: Revert "libpipe: fix calls to pipe_send with no data", Samuel Thibault, 2014/11/09
- [hurd] 57/87: include: detect use-after-free errors using the reference counts, Samuel Thibault, 2014/11/09
- [hurd] 73/87: libdiskfs: remove code counting cache misses, Samuel Thibault, 2014/11/09
- [hurd] 82/87: Fix dead name notification in static binaries, Samuel Thibault, 2014/11/09
- [hurd] 68/87: procfs: implement /proc/filesystems, Samuel Thibault, 2014/11/09
- [hurd] 71/87: procfs: reorganize rootdir.c, Samuel Thibault, 2014/11/09
- [hurd] 78/87: Fix proc_getprocinfo calls, Samuel Thibault, 2014/11/09
- [hurd] 80/87: Fix actual procinfo_t type, Samuel Thibault, 2014/11/09
- [hurd] 83/87: Use a mere weak attribute instead of a weak alias, Samuel Thibault, 2014/11/09
- [hurd] 17/87: include: use unsigned literal in combination with binary not, Samuel Thibault, 2014/11/09
- [hurd] 79/87: Fix proc_getprocinfo calls,
Samuel Thibault <=
- [hurd] 20/87: libdiskfs: avoid implicit integer conversion, Samuel Thibault, 2014/11/09
- [hurd] 67/87: procfs: implement /proc/N/maps, Samuel Thibault, 2014/11/09
- [hurd] 69/87: procfs: do not test whether /hurd/mtab exists, Samuel Thibault, 2014/11/09
- [hurd] 16/87: libnetfs: fix memory leak, Samuel Thibault, 2014/11/09
- [hurd] 13/87: Fix buffer allocation on io_read, Samuel Thibault, 2014/11/09
- [hurd] 77/87: pfinet: fix path in comment, Samuel Thibault, 2014/11/09
- [hurd] 76/87: libports: lock-less reference counting for port_info objects, Samuel Thibault, 2014/11/09
- [hurd] 81/87: Fix unlocking translator list, Samuel Thibault, 2014/11/09
- [hurd] 63/87: Update NEWS file, Samuel Thibault, 2014/11/09
- [hurd] 09/87: Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/hurd, Samuel Thibault, 2014/11/09