diff options
author | Benny Baumann <BenBE@geshi.org> | 2021-02-01 22:24:42 +0100 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2021-05-23 09:22:21 +0200 |
commit | b839987df7f6fc761c96b651a3dfc49eb13e879a (patch) | |
tree | 7853491e9257ce9b1eb938d929e9b357ef7e06da /darwin | |
parent | d74e8b755427ba0c0b7da299b2f1bcdbdc76f62e (diff) |
Rename basenameOffset to cmdlineBasenameOffset
Diffstat (limited to 'darwin')
-rw-r--r-- | darwin/DarwinProcess.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/darwin/DarwinProcess.c b/darwin/DarwinProcess.c index d94203c7..9e55c0fa 100644 --- a/darwin/DarwinProcess.c +++ b/darwin/DarwinProcess.c @@ -101,7 +101,7 @@ bool Process_isThread(const Process* this) { return false; } -static char* DarwinProcess_getCmdLine(const struct kinfo_proc* k, int* basenameOffset) { +static char* DarwinProcess_getCmdLine(const struct kinfo_proc* k, int* cmdlineBasenameOffset) { /* This function is from the old Mac version of htop. Originally from ps? */ int mib[3], argmax, nargs, c = 0; size_t size; @@ -199,7 +199,7 @@ static char* DarwinProcess_getCmdLine(const struct kinfo_proc* k, int* basenameO /* Save where the argv[0] string starts. */ sp = cp; - *basenameOffset = 0; + *cmdlineBasenameOffset = 0; for ( np = NULL; c < nargs && cp < &procargs[size]; cp++ ) { if ( *cp == '\0' ) { c++; @@ -209,8 +209,8 @@ static char* DarwinProcess_getCmdLine(const struct kinfo_proc* k, int* basenameO } /* Note location of current '\0'. */ np = cp; - if (*basenameOffset == 0) { - *basenameOffset = cp - sp; + if (*cmdlineBasenameOffset == 0) { + *cmdlineBasenameOffset = cp - sp; } } } @@ -223,8 +223,8 @@ static char* DarwinProcess_getCmdLine(const struct kinfo_proc* k, int* basenameO /* Empty or unterminated string. */ goto ERROR_B; } - if (*basenameOffset == 0) { - *basenameOffset = np - sp; + if (*cmdlineBasenameOffset == 0) { + *cmdlineBasenameOffset = np - sp; } /* Make a copy of the string. */ @@ -237,10 +237,11 @@ static char* DarwinProcess_getCmdLine(const struct kinfo_proc* k, int* basenameO ERROR_B: free( procargs ); + ERROR_A: - retval = xStrdup(k->kp_proc.p_comm); - *basenameOffset = strlen(retval); + *cmdlineBasenameOffset = -1; + retval = xStrdup(k->kp_proc.p_comm); return retval; } @@ -286,7 +287,7 @@ void DarwinProcess_setFromKInfoProc(Process* proc, const struct kinfo_proc* ps, proc->starttime_ctime = ep->p_starttime.tv_sec; Process_fillStarttimeBuffer(proc); - proc->cmdline = DarwinProcess_getCmdLine(ps, &(proc->basenameOffset)); + proc->cmdline = DarwinProcess_getCmdLine(ps, &proc->cmdlineBasenameOffset); } /* Mutable information */ |