PERFORCE change 152340 for review

Peter Wemm peter at FreeBSD.org
Sat Nov 1 18:53:46 PDT 2008


http://perforce.freebsd.org/chv.cgi?CH=152340

Change 152340 by peter at peter_overcee on 2008/11/02 01:53:27

	Grr.  make 'ps -axH' show the kthread names like top(1) does.

Affected files ...

.. //depot/projects/hammer/bin/ps/print.c#18 edit

Differences ...

==== //depot/projects/hammer/bin/ps/print.c#18 (text+ko) ====

@@ -125,8 +125,10 @@
 	VAR *v;
 	int left;
 	char *cp, *vis_env, *vis_args;
+	int flag;
 
 	v = ve->var;
+	flag = k->ki_p->ki_flag;
 	if (cflag) {
 		/* If it is the last field, then don't pad */
 		if (STAILQ_NEXT(ve, next_ve) == NULL) {
@@ -137,6 +139,17 @@
 			(void)printf("%-*s", v->width, k->ki_p->ki_comm);
 		return;
 	}
+	if (showthreads && (k->ki_p->ki_flag & P_SYSTEM) != 0 && k->ki_p->ki_pid != 1) {
+		/* If it is the last field, then don't pad */
+		char *kth;
+		asprintf(&kth, "{%s}", k->ki_p->ki_ocomm);
+		if (STAILQ_NEXT(ve, next_ve) == NULL)
+			(void)printf("%s", kth);
+		else
+			(void)printf("%-*s", v->width, kth);
+		free(kth);
+		return;
+	}
 	if ((vis_args = malloc(strlen(k->ki_args) * 4 + 1)) == NULL)
 		errx(1, "malloc failed");
 	strvis(vis_args, k->ki_args, VIS_TAB | VIS_NL | VIS_NOSLASH);


More information about the p4-projects mailing list