commit d16595bb7f67b665348fca8b9653a31b8afc5861
parent cf87c88051e0c1d3ac2dbd51a09be5ca004086d1
Author: leitner <leitner>
Date: Fri, 10 Sep 2004 07:14:01 +0000
allow service blacklisting using -servicename
Diffstat:
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/CHANGES b/CHANGES
@@ -17,6 +17,10 @@
This is useful to see which process is looping.
fix bug in msvc killing process group if readpid failed
(Erich Schubert)
+ You can now blacklist services temporarily by passing -servicename on
+ the kernel command line. The first time they are to be started will
+ then be skipped. Use this, for example, to not start the dhcp
+ client when your notebook is not plugged in a network.
0.9.1:
fix embarassing typo in msvc (Gelu G. Lupas)
diff --git a/minit.c b/minit.c
@@ -21,6 +21,8 @@
#include "minit.h"
+char** Argv;
+
#undef printf
extern int printf(const char *format,...);
@@ -282,10 +284,20 @@ int startservice(int service,int pause,int father) {
int depc,i;
deps=split(s,'\n',&depc,0,0);
for (i=0; i<depc; i++) {
- int Service;
+ int Service,blacklisted,j;
if (deps[i][0]=='#') continue;
Service=loadservice(deps[i]);
- if (Service>=0 && root[Service].pid!=1)
+
+#if 1
+ for (j=blacklisted=0; Argv[j]; ++j)
+ if (Argv[j][0]=='-' && !strcmp(Argv[j]+1,deps[i])) {
+ blacklisted=1;
+ ++Argv[j];
+ break;
+ }
+#endif
+
+ if (Service>=0 && root[Service].pid!=1 && !blacklisted)
startservice(Service,0,service);
}
fchdir(dir);
@@ -366,6 +378,8 @@ int main(int argc, char *argv[]) {
history[i]=-1;
#endif
+ Argv=argv;
+
infd=open(MINITROOT "/in",O_RDWR);
outfd=open(MINITROOT "/out",O_RDWR|O_NONBLOCK);