diff options
-rw-r--r-- | solaris/ProcessField.h | 2 | ||||
-rw-r--r-- | solaris/SolarisProcess.c | 4 | ||||
-rw-r--r-- | solaris/SolarisProcessList.c | 20 |
3 files changed, 21 insertions, 5 deletions
diff --git a/solaris/ProcessField.h b/solaris/ProcessField.h index eb9f1577..6af48772 100644 --- a/solaris/ProcessField.h +++ b/solaris/ProcessField.h @@ -16,6 +16,8 @@ in the source distribution for its full text. POOLID = 104, \ CONTID = 105, \ LWPID = 106, \ + \ + DUMMY_BUMP_FIELD = PROC_EXE, \ // End of list diff --git a/solaris/SolarisProcess.c b/solaris/SolarisProcess.c index 688d98ca..e49569e9 100644 --- a/solaris/SolarisProcess.c +++ b/solaris/SolarisProcess.c @@ -46,7 +46,9 @@ const ProcessFieldData Process_fields[LAST_PROCESSFIELD] = { [TIME] = { .name = "TIME", .title = " TIME+ ", .description = "Total time the process has spent in user and system time", .flags = 0, .defaultSortDesc = true, }, [NLWP] = { .name = "NLWP", .title = "NLWP ", .description = "Number of threads in the process", .flags = 0, }, [TGID] = { .name = "TGID", .title = "TGID", .description = "Thread group ID (i.e. process ID)", .flags = 0, .pidColumn = true, }, - [ZONEID] = { .name = "ZONEID", .title = "ZNID", .description = "Zone ID", .flags = 0, .pidColumn = true, }, + [PROC_COMM] = { .name = "COMM", .title = "COMM ", .description = "comm string of the process", .flags = 0, }, + [PROC_EXE] = { .name = "EXE", .title = "EXE ", .description = "Basename of exe of the process", .flags = 0, }, + [ZONEID] = { .name = "ZONEID", .title = "ZONEID", .description = "Zone ID", .flags = 0, .pidColumn = true, }, [ZONE] = { .name = "ZONE", .title = "ZONE ", .description = "Zone name", .flags = 0, }, [PROJID] = { .name = "PROJID", .title = "PRJID", .description = "Project ID", .flags = 0, .pidColumn = true, }, [TASKID] = { .name = "TASKID", .title = "TSKID", .description = "Task ID", .flags = 0, .pidColumn = true, }, diff --git a/solaris/SolarisProcessList.c b/solaris/SolarisProcessList.c index b3c4e114..15f2f41f 100644 --- a/solaris/SolarisProcessList.c +++ b/solaris/SolarisProcessList.c @@ -296,6 +296,19 @@ void ProcessList_delete(ProcessList* pl) { free(spl); } +static void SolarisProcessList_updateExe(pid_t pid, Process* proc) { + char path[32]; + xSnprintf(path, sizeof(path), "/proc/%d/path/a.out", pid); + + char target[PATH_MAX]; + ssize_t ret = readlink(path, target, sizeof(target) - 1); + if (ret <= 0) + return; + + target[ret] = '\0'; + Process_updateExe(proc, 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 @@ -363,8 +376,9 @@ static int SolarisProcessList_walkproc(psinfo_t* _psinfo, lwpsinfo_t* _lwpsinfo, sproc->zoneid = _psinfo->pr_zoneid; sproc->zname = SolarisProcessList_readZoneName(spl->kd, sproc); proc->user = UsersTable_getRef(pl->usersTable, proc->st_uid); - proc->cmdline = xStrdup(_psinfo->pr_fname); - proc->mergedCommand.cmdlineChanged = true; + SolarisProcessList_updateExe(_psinfo->pr_pid, proc); + Process_updateComm(proc, _psinfo->pr_fname); + Process_updateCmdline(proc, _psinfo->pr_psargs, 0, 0); } // End common code pass 1 @@ -406,13 +420,11 @@ static int SolarisProcessList_walkproc(psinfo_t* _psinfo, lwpsinfo_t* _lwpsinfo, proc->time = _lwpsinfo->pr_time.tv_sec; if (!preExisting) { // Tasks done only for NEW LWPs proc->isUserlandThread = true; - proc->cmdlineBasenameEnd = -1; proc->ppid = _psinfo->pr_pid * 1024; proc->tgid = _psinfo->pr_pid * 1024; sproc->realppid = _psinfo->pr_pid; sproc->realtgid = _psinfo->pr_pid; proc->starttime_ctime = _lwpsinfo->pr_start.tv_sec; - proc->mergedCommand.cmdlineChanged = true; } // Top-level process only gets this for the representative LWP |