[procps] Re: ps - wchanf option
- From: Jim Warner <james.warner@xxxxxxxxxxx>
- To: procps@xxxxxxxxxxxxx, Jan Rybar <jrybar@xxxxxxxxxx>, Craig Small <csmall@xxxxxxxxxx>
- Date: Fri, 4 Nov 2016 08:39:40 -0500
On 11/03/2016 09:52 AM, Jan Rybar wrote:
I created new merge request with new ps option which I believe is
needed. Can you please take a look at it?
https://gitlab.com/procps-ng/procps/merge_requests/30
If you agree, I will hand over the newlib patch after monday (if needed).
Note: Using new external symbol is a way to not change API, which is
IMHO preferable in this case.
Hi Jan,
Must everything be over-engineered?
Why not go with a simple approach like the following?
Regards,
Jim
diff --git a/proc/wchan.c b/proc/wchan.c
index b4e40fe..eb820e8 100644
--- a/proc/wchan.c
+++ b/proc/wchan.c
@@ -46,11 +46,8 @@ const char * lookup_wchan (int pid) {
// lame ppc64 has a '.' in front of every name
if (*ret=='.') ret++;
- switch (*ret){
- case 's': if(!strncmp(ret, "sys_", 4)) ret += 4; break;
- case 'd': if(!strncmp(ret, "do_", 3)) ret += 3; break;
- case '_': while(*ret=='_') ret++; break;
- default : break;
- }
+ // whacked switch statement leftover, keep 'do_' or 'sys_' prefix
+ if (*ret=='_') ret++;
+
return ret;
}
Other related posts: