diff options
Diffstat (limited to 'solaris/SolarisProcessList.c')
-rw-r--r-- | solaris/SolarisProcessList.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/solaris/SolarisProcessList.c b/solaris/SolarisProcessList.c index 15f2f41f..a496f9f5 100644 --- a/solaris/SolarisProcessList.c +++ b/solaris/SolarisProcessList.c @@ -309,6 +309,19 @@ static void SolarisProcessList_updateExe(pid_t pid, Process* proc) { Process_updateExe(proc, target); } +static void SolarisProcessList_updateCwd(pid_t pid, Process* proc) { + char path[32]; + xSnprintf(path, sizeof(path), "/proc/%d/cwd", pid); + + char target[PATH_MAX]; + ssize_t ret = readlink(path, target, sizeof(target) - 1); + if (ret <= 0) + return; + + target[ret] = '\0'; + free_and_xStrdup(&proc->procCwd, target); +} + /* NOTE: the following is a callback function of type proc_walk_f * and MUST conform to the appropriate definition in order * to work. See libproc(3LIB) on a Solaris or Illumos @@ -377,8 +390,13 @@ static int SolarisProcessList_walkproc(psinfo_t* _psinfo, lwpsinfo_t* _lwpsinfo, sproc->zname = SolarisProcessList_readZoneName(spl->kd, sproc); proc->user = UsersTable_getRef(pl->usersTable, proc->st_uid); SolarisProcessList_updateExe(_psinfo->pr_pid, proc); + Process_updateComm(proc, _psinfo->pr_fname); Process_updateCmdline(proc, _psinfo->pr_psargs, 0, 0); + + if (proc->settings->flags & PROCESS_FLAG_CWD) { + SolarisProcessList_updateCwd(_psinfo->pr_pid, proc); + } } // End common code pass 1 |