Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Nov 2008 01:53:46 GMT
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 152340 for review
Message-ID:  <200811020153.mA21rkeD071582@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=152340

Change 152340 by peter@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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811020153.mA21rkeD071582>