svn commit: trunk/busybox: include libbb procps

vodz at busybox.net vodz at busybox.net
Wed Sep 14 16:08:08 UTC 2005


Author: vodz
Date: 2005-09-14 09:08:06 -0700 (Wed, 14 Sep 2005)
New Revision: 11462

Log:
FEATURE->ENABLE_FEATURE loses one for 'top' applet

Modified:
   trunk/busybox/include/libbb.h
   trunk/busybox/libbb/procps.c
   trunk/busybox/procps/Config.in
   trunk/busybox/procps/top.c


Changeset:
Modified: trunk/busybox/include/libbb.h
===================================================================
--- trunk/busybox/include/libbb.h	2005-09-14 15:41:18 UTC (rev 11461)
+++ trunk/busybox/include/libbb.h	2005-09-14 16:08:06 UTC (rev 11462)
@@ -446,7 +446,7 @@
 	char state[4];
 	unsigned long rss;
 	int ppid;
-#ifdef FEATURE_CPU_USAGE_PERCENTAGE
+#ifdef ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 	unsigned pcpu;
 	unsigned pscpu;
 	unsigned long stime, utime;

Modified: trunk/busybox/libbb/procps.c
===================================================================
--- trunk/busybox/libbb/procps.c	2005-09-14 15:41:18 UTC (rev 11461)
+++ trunk/busybox/libbb/procps.c	2005-09-14 16:08:06 UTC (rev 11462)
@@ -72,7 +72,7 @@
 		"%c %d "
 		"%*s %*s %*s %*s "     /* pgrp, session, tty, tpgid */
 		"%*s %*s %*s %*s %*s " /* flags, min_flt, cmin_flt, maj_flt, cmaj_flt */
-#ifdef FEATURE_CPU_USAGE_PERCENTAGE
+#ifdef ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 		"%lu %lu "
 #else
 		"%*s %*s "
@@ -83,12 +83,12 @@
 		"%*s "                 /* vsize */
 		"%ld",
 		curstatus.state, &curstatus.ppid,
-#ifdef FEATURE_CPU_USAGE_PERCENTAGE
+#ifdef ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 		&curstatus.utime, &curstatus.stime,
 #endif
 		&tasknice,
 		&curstatus.rss);
-#ifdef FEATURE_CPU_USAGE_PERCENTAGE
+#ifdef ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 		if(n != 6)
 #else
 		if(n != 4)

Modified: trunk/busybox/procps/Config.in
===================================================================
--- trunk/busybox/procps/Config.in	2005-09-14 15:41:18 UTC (rev 11461)
+++ trunk/busybox/procps/Config.in	2005-09-14 16:08:06 UTC (rev 11462)
@@ -57,7 +57,7 @@
 	  The top program provides a dynamic real-time view of a running
 	  system.
 
-config FEATURE_CPU_USAGE_PERCENTAGE
+config ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 	bool "  Support showing CPU usage percentage (add 2k bytes)"
 	default y
 	depends on CONFIG_TOP

Modified: trunk/busybox/procps/top.c
===================================================================
--- trunk/busybox/procps/top.c	2005-09-14 15:41:18 UTC (rev 11461)
+++ trunk/busybox/procps/top.c	2005-09-14 16:08:06 UTC (rev 11462)
@@ -35,9 +35,9 @@
 #include <sys/ioctl.h>
 #include "busybox.h"
 
-//#define FEATURE_CPU_USAGE_PERCENTAGE  /* + 2k */
+//#define ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE  /* + 2k */
 
-#ifdef FEATURE_CPU_USAGE_PERCENTAGE
+#ifdef ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 #include <time.h>
 #include <sys/time.h>
 #include <fcntl.h>
@@ -62,7 +62,7 @@
     return (int)(Q->rss - P->rss);
 }
 
-#ifdef FEATURE_CPU_USAGE_PERCENTAGE
+#ifdef ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 
 #define sort_depth 3
 static cmp_t sort_function[sort_depth];
@@ -279,7 +279,7 @@
 }
 #else
 static cmp_t sort_function;
-#endif /* FEATURE_CPU_USAGE_PERCENTAGE */
+#endif /* ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE */
 
 /* display generic info (meminfo / loadavg) */
 static unsigned long display_generic(void)
@@ -368,7 +368,7 @@
 	char rss_str_buf[8];
 	unsigned long total_memory = display_generic();
 
-#ifdef FEATURE_CPU_USAGE_PERCENTAGE
+#ifdef ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 	/* what info of the processes is shown */
 	printf("\n\e[7m  PID USER     STATUS   RSS  PPID %%CPU %%MEM COMMAND\e[0m\n");
 #else
@@ -386,7 +386,7 @@
 			sprintf(rss_str_buf, "%6ldM", s->rss/1024);
 		else
 			sprintf(rss_str_buf, "%7ld", s->rss);
-#ifdef FEATURE_CPU_USAGE_PERCENTAGE
+#ifdef ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 		printf("%5d %-8s %s  %s %5d %2d.%d %2u.%u ",
 			s->pid, s->user, s->state, rss_str_buf, s->ppid,
 			s->pcpu/10, s->pcpu%10, pmem/10, pmem%10);
@@ -422,7 +422,7 @@
 	tcsetattr(0, TCSANOW, (void *) &initial_settings);
 #ifdef CONFIG_FEATURE_CLEAN_UP
 	clearmems();
-#ifdef FEATURE_CPU_USAGE_PERCENTAGE
+#ifdef ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 	free(save_history);
 #endif
 #endif /* CONFIG_FEATURE_CLEAN_UP */
@@ -463,7 +463,7 @@
 	/* Default to 25 lines - 5 lines for status */
 	lines = 25 - 5;
 	/* Default CMD format size */
-#ifdef FEATURE_CPU_USAGE_PERCENTAGE
+#ifdef ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 	col = 35 - 6;
 #else
 	col = 35;
@@ -491,7 +491,7 @@
 	get_terminal_width_height(0, &col, &lines);
 	if (lines > 4) {
 	    lines -= 5;
-#ifdef FEATURE_CPU_USAGE_PERCENTAGE
+#ifdef ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 	    col = col - 80 + 35 - 6;
 #else
 	    col = col - 80 + 35;
@@ -499,13 +499,13 @@
 	}
 #endif /* CONFIG_FEATURE_USE_TERMIOS */
 
-#ifdef FEATURE_CPU_USAGE_PERCENTAGE
+#ifdef ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 	sort_function[0] = pcpu_sort;
 	sort_function[1] = mem_sort;
 	sort_function[2] = time_sort;
 #else
 	sort_function = mem_sort;
-#endif /* FEATURE_CPU_USAGE_PERCENTAGE */
+#endif /* ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE */
 
 	while (1) {
 		/* read process IDs & status for all the processes */
@@ -520,7 +520,7 @@
 		if (ntop == 0) {
 		bb_perror_msg_and_die("scandir('/proc')");
 	}
-#ifdef FEATURE_CPU_USAGE_PERCENTAGE
+#ifdef ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 		if(!Hertz) {
 			init_Hertz_value();
 			do_stats();
@@ -531,7 +531,7 @@
 		do_stats();
 #else
 		qsort(top, ntop, sizeof(procps_status_t), (void*)sort_function);
-#endif /* FEATURE_CPU_USAGE_PERCENTAGE */
+#endif /* ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE */
 		opt = lines;
 		if (opt > ntop) {
 			opt = ntop;
@@ -551,7 +551,7 @@
 			if(c == 'q' || c == initial_settings.c_cc[VINTR])
 				return EXIT_SUCCESS;
 			if(c == 'M') {
-#ifdef FEATURE_CPU_USAGE_PERCENTAGE
+#ifdef ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 				sort_function[0] = mem_sort;
 				sort_function[1] = pcpu_sort;
 				sort_function[2] = time_sort;
@@ -559,7 +559,7 @@
 				sort_function = mem_sort;
 #endif
 			}
-#ifdef FEATURE_CPU_USAGE_PERCENTAGE
+#ifdef ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 			if(c == 'P') {
 				sort_function[0] = pcpu_sort;
 				sort_function[1] = mem_sort;
@@ -572,7 +572,7 @@
 			}
 #endif
 			if(c == 'N') {
-#ifdef FEATURE_CPU_USAGE_PERCENTAGE
+#ifdef ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE
 				sort_function[0] = pid_sort;
 #else
 				sort_function = pid_sort;




More information about the busybox-cvs mailing list