summaryrefslogtreecommitdiffstats
path: root/lib/libproc/proc_util.c
diff options
context:
space:
mode:
authorrpaulo <rpaulo@FreeBSD.org>2010-08-11 17:33:26 +0000
committerrpaulo <rpaulo@FreeBSD.org>2010-08-11 17:33:26 +0000
commitafd44137e854c021c1e26e7a5d261dcf706ee9dc (patch)
tree6df5d79ff9e595481ae54191003939135774e4d9 /lib/libproc/proc_util.c
parent5688dd21e911eab4ec09be1089f77d8d58fff05c (diff)
downloadFreeBSD-src-afd44137e854c021c1e26e7a5d261dcf706ee9dc.zip
FreeBSD-src-afd44137e854c021c1e26e7a5d261dcf706ee9dc.tar.gz
Several fixes for libproc:
o return the correct status in proc_wstatus() o proc_read takes a void * o correctly allocate the objs structure array Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'lib/libproc/proc_util.c')
-rw-r--r--lib/libproc/proc_util.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libproc/proc_util.c b/lib/libproc/proc_util.c
index 9a53977..0ab848d 100644
--- a/lib/libproc/proc_util.c
+++ b/lib/libproc/proc_util.c
@@ -144,15 +144,17 @@ proc_wstatus(struct proc_handle *phdl)
if (phdl == NULL)
return (-1);
- if (waitpid(phdl->pid, &status, WUNTRACED) < 0)
+ if (waitpid(phdl->pid, &status, WUNTRACED) < 0) {
+ warn("waitpid");
return (-1);
+ }
if (WIFSTOPPED(status))
phdl->status = PS_STOP;
if (WIFEXITED(status) || WIFSIGNALED(status))
phdl->status = PS_UNDEAD;
phdl->wstat = status;
- return (status);
+ return (phdl->status);
}
int
@@ -175,7 +177,7 @@ proc_signame(int sig, char *name, size_t namesz)
}
int
-proc_read(struct proc_handle *phdl, char *buf, size_t size, size_t addr)
+proc_read(struct proc_handle *phdl, void *buf, size_t size, size_t addr)
{
struct ptrace_io_desc piod;
@@ -200,7 +202,8 @@ proc_getlwpstatus(struct proc_handle *phdl)
if (phdl == NULL)
return (NULL);
- if (ptrace(PT_LWPINFO, phdl->pid, (caddr_t)&lwpinfo,sizeof(lwpinfo)) < 0)
+ if (ptrace(PT_LWPINFO, phdl->pid, (caddr_t)&lwpinfo,
+ sizeof(lwpinfo)) < 0)
return (NULL);
siginfo = &lwpinfo.pl_siginfo;
if (lwpinfo.pl_event == PL_EVENT_SIGNAL &&
OpenPOWER on IntegriCloud