[SIGAR-97] implement proc_exe

This commit is contained in:
Doug MacEachern 2008-04-30 03:26:47 +00:00
parent e3f6a1bbd7
commit 57bc553dbf
1 changed files with 33 additions and 1 deletions

View File

@ -442,7 +442,39 @@ int sigar_proc_fd_get(sigar_t *sigar, sigar_pid_t pid,
int sigar_proc_exe_get(sigar_t *sigar, sigar_pid_t pid,
sigar_proc_exe_t *procexe)
{
return SIGAR_ENOTIMPL;
#ifdef __pst_fid /* 11.11+ */
int rc;
struct pst_status status;
if (pstat_getproc(&status, sizeof(status), 0, pid) == -1) {
return errno;
}
rc = pstat_getpathname(procexe->cwd,
sizeof(procexe->cwd),
&status.pst_fid_cdir);
if (rc == -1) {
return errno;
}
rc = pstat_getpathname(procexe->name,
sizeof(procexe->name),
&status.pst_fid_text);
if (rc == -1) {
return errno;
}
rc = pstat_getpathname(procexe->root,
sizeof(procexe->root),
&status.pst_fid_rdir);
if (rc == -1) {
return errno;
}
return SIGAR_OK;
#else
return SIGAR_ENOTIMPL; /* 11.00 */
#endif
}
int sigar_proc_modules_get(sigar_t *sigar, sigar_pid_t pid,