CONFIG_* defines

Bernhard Fischer rep.nop at aon.at
Tue Sep 6 16:36:38 UTC 2005


On Tue, Sep 06, 2005 at 04:18:28PM +0400, Vladimir N. Oleynik wrote:
>Rob,
>
>>> The Busybox has an old problem.
>>> after any usage make config, may be change FEATURE_* only
>>> 1) recompiling applets/* always, but may be not require
>>> 2) do not recompile applets, used this feature
>
>> Our makefile dependencies suck.
>
>Not.
>Our makefile have errors:
>
>1)
>.depend have
>$(wildcard $TOPDIR/config/file.h)
>but must
>$(wildcard $TOPDIR/include/config/file.h)
>
>2)
>The include/config/MARKER: dependece don`t call always
>for update include/config/*
>
>3)
>include/config/feature/ ... bla-bla is unstandardization

regarding that 3). Can you please explain that a little bit?


We could just move the CONFIG_* namespace to something different,
for example BUSYBOX_APPLET_* and BUSYBOX_APPLET_*_{FOO,BAZ,...}
I know that the cons -- several patches in the bugtracker may not apply
cleanly any more etc. -- were already brought up..

Just as an example, i'm attaching an applet runlevel(8). The only thing
which would need to be touched would be bbconfig for it to allow
BUSYBOX_* along the by then old/legacy CONFIG_* entries in .config.

PS:
thanks for applying the typo fix for libunarchive, vodz.
-------------- next part --------------
diff -X excl -rduNp busybox.oorig/include/applets.h busybox/include/applets.h
--- busybox.oorig/include/applets.h	2005-09-02 13:35:45.000000000 +0200
+++ busybox/include/applets.h	2005-09-06 18:17:18.847231527 +0200
@@ -546,6 +546,9 @@
 #ifdef CONFIG_RUN_PARTS
 	APPLET_ODDNAME("run-parts", run_parts_main, _BB_DIR_BIN, _BB_SUID_NEVER, run_parts)
 #endif
+#if BUSYBOX_APPLET_RUNLEVEL
+	APPLET(runlevel, runlevel_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
+#endif
 #ifdef CONFIG_RX
 	APPLET(rx, rx_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
 #endif
diff -X excl -rduNp busybox.oorig/include/usage.h busybox/include/usage.h
--- busybox.oorig/include/usage.h	2005-09-02 13:35:45.000000000 +0200
+++ busybox/include/usage.h	2005-09-06 18:16:45.876499050 +0200
@@ -2337,6 +2337,18 @@
 	"\t-a ARG\tPass ARG as an argument for every program invoked\n" \
 	"\t-u MASK\tSet the umask to MASK before executing every program"
 
+#if BUSYBOX_APPLET_RUNLEVEL
+#define runlevel_trivial_usage \
+	"[utmp]"
+#define runlevel_full_usage \
+	"Find the current and previous system runlevel.\n\n" \
+	"If no utmp file exists or if no runlevel record can be found,\n" \
+	"runlevel prints \"unknown\""
+#define runlevel_example_usage \
+	"$ runlevel /var/run/utmp\n" \
+	"N 2"
+#endif
+
 #define rx_trivial_usage \
 	"FILE"
 #define rx_full_usage \
diff -X excl -rduNp busybox.oorig/miscutils/Config.in busybox/miscutils/Config.in
--- busybox.oorig/miscutils/Config.in	2005-09-02 13:35:45.000000000 +0200
+++ busybox/miscutils/Config.in	2005-09-06 17:51:07.257797225 +0200
@@ -208,6 +208,12 @@ config CONFIG_MT
 	  to advance or rewind a tape past a specified number of archive
 	  files on the tape.
 
+config BUSYBOX_APPLET_RUNLEVEL
+        bool "runlevel"
+	default n
+	help
+ 	  find the current and previous system runlevel.
+
 config CONFIG_RX
         bool "rx"
 	default n
diff -X excl -rduNp busybox.oorig/miscutils/Makefile.in busybox/miscutils/Makefile.in
--- busybox.oorig/miscutils/Makefile.in	2005-09-02 13:35:45.000000000 +0200
+++ busybox/miscutils/Makefile.in	2005-09-06 17:50:35.334935363 +0200
@@ -36,6 +36,7 @@ MISCUTILS-$(CONFIG_LAST)        += last.
 MISCUTILS-$(CONFIG_MAKEDEVS)    += makedevs.o
 MISCUTILS-$(CONFIG_MOUNTPOINT)	+= mountpoint.o
 MISCUTILS-$(CONFIG_MT)          += mt.o
+MISCUTILS-$(BUSYBOX_APPLET_RUNLEVEL) += runlevel.o
 MISCUTILS-$(CONFIG_RX)          += rx.o
 MISCUTILS-$(CONFIG_SETSID)      += setsid.o
 MISCUTILS-$(CONFIG_STRINGS)     += strings.o
diff -X excl -rduNp busybox.oorig/miscutils/runlevel.c busybox/miscutils/runlevel.c
--- busybox.oorig/miscutils/runlevel.c	1970-01-01 01:00:00.000000000 +0100
+++ busybox/miscutils/runlevel.c	2005-09-06 17:56:38.863809169 +0200
@@ -0,0 +1,44 @@
+/*
+ * runlevel	Prints out the previous and the current runlevel.
+ *
+ * Version:	@(#)runlevel  1.20  16-Apr-1997  MvS
+ *
+ *		This file is part of the sysvinit suite,
+ *		Copyright 1991-1997 Miquel van Smoorenburg.
+ *
+ *		This program is free software; you can redistribute it and/or
+ *		modify it under the terms of the GNU General Public License
+ *		as published by the Free Software Foundation; either version
+ *		2 of the License, or (at your option) any later version.
+ */
+
+#include <stdio.h>
+#include <utmp.h>
+#include <time.h>
+#include <stdlib.h>
+
+#include "busybox.h"
+
+int runlevel_main(int argc, char *argv[])
+{
+  struct utmp *ut;
+  char prev;
+
+  if (argc > 1) utmpname(argv[1]);
+
+  setutent();
+  while ((ut = getutent()) != NULL) {
+	if (ut->ut_type == RUN_LVL) {
+		prev = ut->ut_pid / 256;
+		if (prev == 0) prev = 'N';
+		printf("%c %c\n", prev, ut->ut_pid % 256);
+		endutent();
+		exit(0);
+	}
+  }
+
+  printf("unknown\n");
+  endutent();
+  return(1);
+}
+


More information about the busybox mailing list