Date: Thu, 17 Jul 2003 16:50:55 -0700 (PDT) From: Julian Elischer <julian@elischer.org> To: Jung-uk Kim <jkim@niksun.com> Cc: freebsd-threads@freebsd.org Subject: Re: [PATCH] Re: Threads in top Message-ID: <Pine.BSF.4.21.0307171650300.4588-100000@InterJet.elischer.org> In-Reply-To: <200307171658.40674.jkim@niksun.com>
next in thread | previous in thread | raw e-mail | index | archive | help
checking in with reversed default (not shown by default)
On Thu, 17 Jul 2003, Jung-uk Kim wrote:
> This is revised version of the patch. The previous version was
> made in haste. It's actually one-line-style-change(TM) and
> functionally the same. ;-)
>
> Anyway, can anybody edit man page for this change,
> i.e., src/usr.bin/top/top.local.1? I am a terrible doc writer.
>
> Thanks,
>
> Jung-uk Kim
> --- src/contrib/top/commands.c Thu Jan 24 12:52:26 2002
> +++ src/contrib/top.new/commands.c Thu Jul 17 15:02:32 2003
> @@ -70,6 +70,7 @@
> fputs("\
> d - change number of displays to show\n\
> e - list errors generated by last \"kill\" or \"renice\" command\n\
> +H - toggle the displaying of threads\n\
> i - toggle the displaying of idle processes\n\
> I - same as 'i'\n\
> k - kill processes; send a signal to a list of processes\n\
> --- src/contrib/top/machine.h Thu Jan 24 12:58:42 2002
> +++ src/contrib/top.new/machine.h Thu Jul 17 14:48:19 2003
> @@ -59,6 +59,7 @@
> int idle; /* show idle processes */
> int self; /* show self */
> int system; /* show system processes */
> + int thread; /* show threads */
> int uid; /* only this uid (unless uid == -1) */
> char *command; /* only this command (unless == NULL) */
> };
> --- src/contrib/top/top.c Thu Jan 24 12:55:40 2002
> +++ src/contrib/top.new/top.c Thu Jul 17 15:04:42 2003
> @@ -192,9 +192,9 @@
> fd_set readfds;
>
> #ifdef ORDER
> - static char command_chars[] = "\f qh?en#sdkriIuto";
> + static char command_chars[] = "\f qh?en#sdkriIutHo";
> #else
> - static char command_chars[] = "\f qh?en#sdkriIut";
> + static char command_chars[] = "\f qh?en#sdkriIutH";
> #endif
> /* these defines enumerate the "strchr"s of the commands in command_chars */
> #define CMD_redraw 0
> @@ -214,8 +214,9 @@
> #define CMD_idletog2 13
> #define CMD_user 14
> #define CMD_selftog 15
> +#define CMD_thrtog 16
> #ifdef ORDER
> -#define CMD_order 16
> +#define CMD_order 17
> #endif
>
> /* set the buffer for stdout */
> @@ -245,6 +246,7 @@
> ps.self = -1;
> ps.system = No;
> ps.uid = -1;
> + ps.thread = Yes;
> ps.command = NULL;
>
> /* get preset options from the environment */
> @@ -270,7 +272,7 @@
> optind = 1;
> }
>
> - while ((i = getopt(ac, av, "SIbinquvs:d:U:o:t")) != EOF)
> + while ((i = getopt(ac, av, "SIHbinquvs:d:U:o:t")) != EOF)
> {
> switch(i)
> {
> @@ -364,11 +366,15 @@
> case 't':
> ps.self = (ps.self == -1) ? getpid() : -1;
> break;
> -
> +
> + case 'H':
> + ps.thread = !ps.thread;
> + break;
> +
> default:
> fprintf(stderr, "\
> Top version %s\n\
> -Usage: %s [-ISbinqut] [-d x] [-s x] [-o field] [-U username] [number]\n",
> +Usage: %s [-HISbinqut] [-d x] [-s x] [-o field] [-U username] [number]\n",
> version_string(), myname);
> exit(1);
> }
> @@ -955,6 +961,14 @@
> }
> break;
>
> + case CMD_thrtog:
> + ps.thread = !ps.thread;
> + new_message(MT_standout | MT_delayed,
> + " %sisplaying threads.",
> + ps.thread ? "D" : "Not d");
> + putchar('\r');
> + break;
> +
> #ifdef ORDER
> case CMD_order:
> new_message(MT_standout,
> @@ -979,7 +993,7 @@
> }
> break;
> #endif
> -
> +
> default:
> new_message(MT_standout, " BAD CASE IN SWITCH!");
> putchar('\r');
> --- src/usr.bin/top/machine.c Sun Feb 16 09:09:52 2003
> +++ src/usr.bin/top.new/machine.c Thu Jul 17 14:56:13 2003
> @@ -414,7 +414,8 @@
> int show_command;
>
>
> - pbase = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc);
> + pbase = kvm_getprocs(kd, sel->thread ? KERN_PROC_ALL : KERN_PROC_PROC, 0,
> + &nproc);
> if (nproc > onproc)
> pref = (struct kinfo_proc **) realloc(pref, sizeof(struct kinfo_proc *)
> * (onproc = nproc));
>
> _______________________________________________
> freebsd-threads@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-threads
> To unsubscribe, send any mail to "freebsd-threads-unsubscribe@freebsd.org"
>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0307171650300.4588-100000>
