Consolidate patches into the sources of top, which were imported from
authorSimon Schubert <corecode@dragonflybsd.org>
Wed, 15 Feb 2006 12:54:36 +0000 (12:54 +0000)
committerSimon Schubert <corecode@dragonflybsd.org>
Wed, 15 Feb 2006 12:54:36 +0000 (12:54 +0000)
FreeBSD and are not pristine anyways.

contrib/top/commands.c
contrib/top/machine.h
contrib/top/patches/commands.c.patch [deleted file]
contrib/top/patches/machine.h.patch [deleted file]
contrib/top/patches/top.X.patch [deleted file]
contrib/top/patches/top.c.patch [deleted file]
contrib/top/patches/top.h.patch [deleted file]
contrib/top/top.X
contrib/top/top.c
contrib/top/top.h
usr.bin/top/Makefile

index 7c7610a..48d7c81 100644 (file)
@@ -9,7 +9,7 @@
  *  Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University
  *
  * $FreeBSD: src/contrib/top/commands.c,v 1.4.6.1 2002/08/11 17:09:25 dwmalone Exp $
- * $DragonFly: src/contrib/top/commands.c,v 1.2 2003/06/17 04:24:07 dillon Exp $
+ * $DragonFly: src/contrib/top/commands.c,v 1.3 2006/02/15 12:54:36 corecode Exp $
  */
 
 /*
@@ -31,8 +31,6 @@
 #include "boolean.h"
 #include "utils.h"
 
-extern int  errno;
-
 extern char *copyright;
 
 /* imported from screen.c */
@@ -73,11 +71,14 @@ d       - change number of displays to show\n\
 e       - list errors generated by last \"kill\" or \"renice\" command\n\
 i       - toggle the displaying of idle processes\n\
 I       - same as 'i'\n\
+O      - only display threads\n\
+T      - toggle the displaying of threads\n\
+S      - toggle the displaying of system processes\n\
 k       - kill processes; send a signal to a list of processes\n\
 n or #  - change number of processes to display\n", stdout);
 #ifdef ORDER
        fputs("\
-o       - specify sort order (pri, size, res, cpu, time)\n", stdout);
+o       - specify sort order (pri, size, res, cpu, time, thr)\n", stdout);
 #endif
        fputs("\
 r       - renice a process\n\
index 5a16be4..a6bd646 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * $FreeBSD: src/contrib/top/machine.h,v 1.4.6.1 2002/08/11 17:09:25 dwmalone Exp $
- * $DragonFly: src/contrib/top/machine.h,v 1.2 2003/06/17 04:24:07 dillon Exp $
+ * $DragonFly: src/contrib/top/machine.h,v 1.3 2006/02/15 12:54:36 corecode Exp $
  */
 
 /*
@@ -60,6 +60,8 @@ struct process_select
     int idle;          /* show idle processes */
     int self;          /* show self */
     int system;                /* show system processes */
+    int threads;       /* show threads */
+    int only_threads;  /* show only threads */
     int uid;           /* only this uid (unless uid == -1) */
     char *command;     /* only this command (unless == NULL) */
 };
diff --git a/contrib/top/patches/commands.c.patch b/contrib/top/patches/commands.c.patch
deleted file mode 100644 (file)
index a4ec0d7..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-Index: commands.c
-===================================================================
-RCS file: /cvs/DragonFly/src/contrib/top/commands.c,v
-retrieving revision 1.2
-diff -u -p -u -r1.2 commands.c
---- commands.c 17 Jun 2003 04:24:07 -0000      1.2
-+++ commands.c 4 Jun 2004 11:37:12 -0000
-@@ -31,8 +31,6 @@
- #include "boolean.h"
- #include "utils.h"
--extern int  errno;
--
- extern char *copyright;
- /* imported from screen.c */
-@@ -73,11 +73,14 @@ d       - change number of displays to s
- e       - list errors generated by last \"kill\" or \"renice\" command\n\
- i       - toggle the displaying of idle processes\n\
- I       - same as 'i'\n\
-+O     - only display threads\n\
-+T     - toggle the displaying of threads\n\
-+S     - toggle the displaying of system processes\n\
- k       - kill processes; send a signal to a list of processes\n\
- n or #  - change number of processes to display\n", stdout);
- #ifdef ORDER
-       fputs("\
--o       - specify sort order (pri, size, res, cpu, time)\n", stdout);
-+o       - specify sort order (pri, size, res, cpu, time, thr)\n", stdout);
- #endif
-       fputs("\
- r       - renice a process\n\
diff --git a/contrib/top/patches/machine.h.patch b/contrib/top/patches/machine.h.patch
deleted file mode 100644 (file)
index ba52bd4..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-Index: machine.h
-===================================================================
-RCS file: /cvs/DragonFly/src/contrib/top/machine.h,v
-retrieving revision 1.2
-diff -u -p -u -r1.2 machine.h
---- machine.h  17 Jun 2003 04:24:07 -0000      1.2
-+++ machine.h  4 Jun 2004 11:46:13 -0000
-@@ -60,6 +60,8 @@ struct process_select
-     int idle;         /* show idle processes */
-     int self;         /* show self */
-     int system;               /* show system processes */
-+    int threads;      /* show threads */
-+      int only_threads;       /* show only threads */
-     int uid;          /* only this uid (unless uid == -1) */
-     char *command;    /* only this command (unless == NULL) */
- };
diff --git a/contrib/top/patches/top.X.patch b/contrib/top/patches/top.X.patch
deleted file mode 100644 (file)
index e698f62..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-Index: top.X
-===================================================================
-RCS file: /cvs/DragonFly/src/contrib/top/top.X,v
-retrieving revision 1.2
-diff -u -p -u -r1.2 top.X
---- top.X      17 Jun 2003 04:24:07 -0000      1.2
-+++ top.X      4 Jun 2004 12:16:39 -0000
-@@ -65,6 +65,14 @@ terminal.
- Show system processes in the display.  Normally, system processes such as
- the pager and the swapper are not shown.  This option makes them visible.
- .TP
-+.B \-T
-+Show kernel threads in the display.  Normally, kernel threads such as
-+the pagedaemon and bufdaemon are not shown.  This option makes them
-+visible.
-+.TP
-+.B \-O
-+Show only kernel threads.
-+.TP
- .B \-b
- Use \*(lqbatch\*(rq mode.  In this mode, all input from the terminal is
- ignored.  Interrupt characters (such as ^C and ^\e) still have an effect.
-@@ -203,6 +211,15 @@ Redraw the screen.
- Display a summary of the commands (help screen).  Version information
- is included in this display.
- .TP
-+.B S
-+Display system processes.
-+.TP
-+.B T
-+Display kernel threads, such as bufdaemon and pagedaemon.
-+.TP
-+.B O
-+Toggle displaying of only kernel threads.
-+.TP
- .B q
- Quit
- .IR top.
diff --git a/contrib/top/patches/top.c.patch b/contrib/top/patches/top.c.patch
deleted file mode 100644 (file)
index 2c293bd..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-Index: top.c
-===================================================================
-RCS file: /cvs/DragonFly/src/contrib/top/top.c,v
-retrieving revision 1.2
-diff -u -p -u -r1.2 top.c
---- top.c      17 Jun 2003 04:24:07 -0000      1.2
-+++ top.c      4 Jun 2004 12:09:22 -0000
-@@ -193,9 +193,9 @@ char *argv[];
-     fd_set readfds;
- #ifdef ORDER
--    static char command_chars[] = "\f qh?en#sdkriIuto";
-+    static char command_chars[] = "\f qh?en#sdkriIutTOSo";
- #else
--    static char command_chars[] = "\f qh?en#sdkriIut";
-+    static char command_chars[] = "\f qh?en#sdkriIutTOSO";
- #endif
- /* these defines enumerate the "strchr"s of the commands in command_chars */
- #define CMD_redraw    0
-@@ -215,8 +215,11 @@ char *argv[];
- #define CMD_idletog2    13
- #define CMD_user      14
- #define CMD_selftog   15
-+#define CMD_threads   16
-+#define CMD_othreads  17
-+#define CMD_system    18
- #ifdef ORDER
--#define CMD_order       16
-+#define CMD_order       19
- #endif
-     /* set the buffer for stdout */
-@@ -245,6 +248,8 @@ char *argv[];
-     ps.idle    = Yes;
-     ps.self    = -1;
-     ps.system  = No;
-+    ps.threads = No;
-+      ps.only_threads = No;
-     ps.uid     = -1;
-     ps.command = NULL;
-@@ -271,7 +276,7 @@ char *argv[];
-           optind = 1;
-       }
--      while ((i = getopt(ac, av, "SIbinquvs:d:U:o:t")) != EOF)
-+      while ((i = getopt(ac, av, "SITONbinquvs:d:U:o:t")) != EOF)
-       {
-           switch(i)
-           {
-@@ -301,6 +306,14 @@ char *argv[];
-               ps.idle = !ps.idle;
-               break;
-+                case 'O':
-+              ps.only_threads = !ps.only_threads; /* only threads */
-+              break;
-+      
-+            case 'T':
-+              ps.threads = !ps.threads;       /* show threads */
-+          break;
-+
-             case 'i':                 /* go interactive regardless */
-               interactive = Yes;
-               break;
-@@ -928,6 +941,31 @@ restart:
-                               putchar('\r');
-                               break;
-+                          case CMD_threads:
-+                              ps.threads = !ps.threads;
-+                              new_message(MT_standout | MT_delayed,
-+                                 " %sisplaying threads.",
-+                                 ps.threads ? "D" : "Not d");
-+                              putchar('\r');
-+                              break;
-+
-+                              case CMD_othreads:
-+                                      ps.only_threads = !ps.only_threads;
-+                                      new_message(MT_standout | MT_delayed,
-+                                      ps.only_threads ?
-+                                        "Only displaying threads." :
-+                                        "Displaying threads and processes.");
-+                              putchar('\r');
-+                              break;
-+
-+                          case CMD_system:
-+                              ps.system = !ps.system;
-+                              new_message(MT_standout | MT_delayed,
-+                                 " %sisplaying system processes.",
-+                                 ps.system ? "D" : "Not d");
-+                              putchar('\r');
-+                              break;
-+
-                           case CMD_user:
-                               new_message(MT_standout,
-                                   "Username to show: ");
diff --git a/contrib/top/patches/top.h.patch b/contrib/top/patches/top.h.patch
deleted file mode 100644 (file)
index f3a00c0..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-$DragonFly: src/contrib/top/patches/Attic/top.h.patch,v 1.1 2004/05/29 05:11:15 hmp Exp $
-Index: contrib/top/top.h
-===================================================================
-RCS file: /cvs/src/contrib/top/top.h,v
-retrieving revision 1.1
-diff -p -u -r1.1 top.h
---- contrib/top/top.h  17 Jun 2003 02:47:20 -0000      1.1
-+++ contrib/top/top.h  29 May 2004 02:21:56 -0000
-@@ -16,6 +16,8 @@
- /* Log base 2 of 1024 is 10 (2^10 == 1024) */
- #define LOG1024               10
-+extern int screen_width;
-+
- char *itoa();
- char *itoa7();
index bf539ff..b752345 100644 (file)
@@ -1,7 +1,7 @@
 .\" NOTE:  changes to the manual page for "top" should be made in the
 .\"        file "top.X" and NOT in the file "top.1".
 .\" $FreeBSD: src/contrib/top/top.X,v 1.6.6.2 2002/08/11 17:09:25 dwmalone Exp $
-.\" $DragonFly: src/contrib/top/top.X,v 1.2 2003/06/17 04:24:07 dillon Exp $
+.\" $DragonFly: src/contrib/top/top.X,v 1.3 2006/02/15 12:54:36 corecode Exp $
 .nr N %topn%
 .nr D %delay%
 .TH TOP 1 Local
@@ -65,6 +65,14 @@ terminal.
 Show system processes in the display.  Normally, system processes such as
 the pager and the swapper are not shown.  This option makes them visible.
 .TP
+.B \-T
+Show kernel threads in the display.  Normally, kernel threads such as
+the pagedaemon and bufdaemon are not shown.  This option makes them
+visible.
+.TP
+.B \-O
+Show only kernel threads.
+.TP
 .B \-b
 Use \*(lqbatch\*(rq mode.  In this mode, all input from the terminal is
 ignored.  Interrupt characters (such as ^C and ^\e) still have an effect.
@@ -203,6 +211,15 @@ Redraw the screen.
 Display a summary of the commands (help screen).  Version information
 is included in this display.
 .TP
+.B S
+Display system processes.
+.TP
+.B T
+Display kernel threads, such as bufdaemon and pagedaemon.
+.TP
+.B O
+Toggle displaying of only kernel threads.
+.TP
 .B q
 Quit
 .IR top.
index 25aaafb..44cbca7 100644 (file)
@@ -14,7 +14,7 @@ char *copyright =
  *  Copyright (c) 1996, William LeFebvre, Group sys Consulting
  *
  * $FreeBSD: src/contrib/top/top.c,v 1.4.6.5 2002/08/11 17:09:25 dwmalone Exp $
- * $DragonFly: src/contrib/top/top.c,v 1.2 2003/06/17 04:24:07 dillon Exp $
+ * $DragonFly: src/contrib/top/top.c,v 1.3 2006/02/15 12:54:36 corecode Exp $
  */
 
 /*
@@ -193,9 +193,9 @@ char *argv[];
     fd_set readfds;
 
 #ifdef ORDER
-    static char command_chars[] = "\f qh?en#sdkriIuto";
+    static char command_chars[] = "\f qh?en#sdkriIutTOSo";
 #else
-    static char command_chars[] = "\f qh?en#sdkriIut";
+    static char command_chars[] = "\f qh?en#sdkriIutTOSO";
 #endif
 /* these defines enumerate the "strchr"s of the commands in command_chars */
 #define CMD_redraw     0
@@ -215,8 +215,11 @@ char *argv[];
 #define CMD_idletog2    13
 #define CMD_user       14
 #define CMD_selftog    15
+#define CMD_threads    16
+#define CMD_othreads   17
+#define CMD_system     18
 #ifdef ORDER
-#define CMD_order       16
+#define CMD_order       19
 #endif
 
     /* set the buffer for stdout */
@@ -245,6 +248,8 @@ char *argv[];
     ps.idle    = Yes;
     ps.self    = -1;
     ps.system  = No;
+    ps.threads = No;
+    ps.only_threads = No;
     ps.uid     = -1;
     ps.command = NULL;
 
@@ -271,7 +276,7 @@ char *argv[];
            optind = 1;
        }
 
-       while ((i = getopt(ac, av, "SIbinquvs:d:U:o:t")) != EOF)
+       while ((i = getopt(ac, av, "SITONbinquvs:d:U:o:t")) != EOF)
        {
            switch(i)
            {
@@ -301,6 +306,14 @@ char *argv[];
                ps.idle = !ps.idle;
                break;
 
+             case 'O':
+               ps.only_threads = !ps.only_threads; /* only threads */
+               break;
+
+             case 'T':
+               ps.threads = !ps.threads;       /* show threads */
+               break;
+
              case 'i':                 /* go interactive regardless */
                interactive = Yes;
                break;
@@ -928,6 +941,31 @@ restart:
                                putchar('\r');
                                break;
 
+                           case CMD_threads:
+                               ps.threads = !ps.threads;
+                               new_message(MT_standout | MT_delayed,
+                                  " %sisplaying threads.",
+                                  ps.threads ? "D" : "Not d");
+                               putchar('\r');
+                               break;
+
+                               case CMD_othreads:
+                                       ps.only_threads = !ps.only_threads;
+                                       new_message(MT_standout | MT_delayed,
+                                       ps.only_threads ?
+                                         "Only displaying threads." :
+                                         "Displaying threads and processes.");
+                               putchar('\r');
+                               break;
+
+                           case CMD_system:
+                               ps.system = !ps.system;
+                               new_message(MT_standout | MT_delayed,
+                                  " %sisplaying system processes.",
+                                  ps.system ? "D" : "Not d");
+                               putchar('\r');
+                               break;
+
                            case CMD_user:
                                new_message(MT_standout,
                                    "Username to show: ");
index aeed136..c0b48e7 100644 (file)
@@ -16,6 +16,8 @@
 /* Log base 2 of 1024 is 10 (2^10 == 1024) */
 #define LOG1024                10
 
+extern int screen_width;
+
 char *itoa();
 char *itoa7();
 
index cc4021d..abf586b 100644 (file)
@@ -1,5 +1,5 @@
 # $FreeBSD: src/usr.bin/top/Makefile,v 1.5.6.2 2002/08/11 17:09:54 dwmalone Exp $
-# $DragonFly: src/usr.bin/top/Makefile,v 1.6 2004/11/18 14:35:08 joerg Exp $
+# $DragonFly: src/usr.bin/top/Makefile,v 1.7 2006/02/15 12:54:36 corecode Exp $
 PROG=  top
 
 TOPDIR=        ${.CURDIR}/../../contrib/top
@@ -17,10 +17,7 @@ CFLAGS+= -DHAVE_GETOPT -DHAVE_STRERROR -I${.CURDIR} -I${.OBJDIR} \
 CFLAGS+= -D"Table_size=${TOP_TABLE_SIZE}"
 .endif
 
-CONTRIBDIR=    ${TOPDIR}
-PATCHES!=       echo ${TOPDIR}/patches/*.patch
-
-SRCS=  ${PATCHES} commands.c display.c machine.c screen.c top.c \
+SRCS=  commands.c display.c machine.c screen.c top.c \
        username.c utils.c version.c top.local.h
 
 CLEANFILES+= top.local.h top.x top.1