fiss-minit

A standalone service supervisor based on minit
Log | Files | Refs | README | LICENSE

commit 1668d1321b9ff0936072833637832675fadf89d9
parent 2dbd98b5d5a14014de49645331b45a78c9863b77
Author: leitner <leitner>
Date:   Thu, 29 Jan 2004 14:40:45 +0000

#include minit.h and use MINITROOT consistently (Lordy)

Diffstat:
MCHANGES | 1+
Mminit-update.c | 6+++---
Mminit.c | 6+++---
Mminit.h | 3++-
Mmsvc.c | 10++++++----
Mshutdown.c | 7++++---
6 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/CHANGES b/CHANGES @@ -9,6 +9,7 @@ version of itself, preferably (Florian Westphal) also add minit-update program to download state from old minit and upload state to new minit after update (Florian Westphal) + #include minit.h and use MINITROOT consistently (Lordy) 0.9.1: fix embarassing typo in msvc (Gelu G. Lupas) diff --git a/minit-update.c b/minit-update.c @@ -187,10 +187,10 @@ int main(int argc, char **argv) { } else die(USAGE); } - infd=open("/etc/minit/in",O_WRONLY); - outfd=open("/etc/minit/out",O_RDONLY); + infd=open(MINITROOT "/in",O_WRONLY); + outfd=open(MINITROOT "/out",O_RDONLY); - if (infd<0 || outfd<0) die("could not open /etc/minit/in or /etc/minit/out\n"); + if (infd<0 || outfd<0) die("could not open " MINITROOT "/in or " MINITROOT "/out\n"); while (lockf(infd,F_TLOCK,1)) { buffer_puts_strerror("could not acquire lock: "); diff --git a/minit.c b/minit.c @@ -345,8 +345,8 @@ int main(int argc, char *argv[]) { time_t last=time(0); int nfds=1; - infd=open("/etc/minit/in",O_RDWR); - outfd=open("/etc/minit/out",O_RDWR|O_NONBLOCK); + infd=open(MINITROOT "/in",O_RDWR); + outfd=open(MINITROOT "/out",O_RDWR|O_NONBLOCK); if (getpid()==1) { int fd; @@ -371,7 +371,7 @@ int main(int argc, char *argv[]) { } if (infd<0 || outfd<0) { - _puts("minit: could not open /etc/minit/in or /etc/minit/out\n"); + _puts("minit: could not open " MINITROOT "/in or " MINITROOT "/out\n"); sulogin(); nfds=0; } else diff --git a/minit.h b/minit.h @@ -1,5 +1,6 @@ #define MINITROOT "/etc/minit" +#ifndef NOVARS static struct process { char *name; /* char **argv; */ @@ -14,4 +15,4 @@ static struct process { static int infd,outfd; static int maxprocess=-1; static int processalloc; - +#endif diff --git a/msvc.c b/msvc.c @@ -7,6 +7,8 @@ #include "str.h" #include "fmt.h" #include "buffer.h" +#define NOVARS +#include "minit.h" static int infd,outfd; @@ -14,7 +16,7 @@ static char buf[1500]; void addservice(char* service) { char* x; - if (str_start(service,"/etc/minit/")) + if (str_start(service,MINITROOT "/")) service+=11; x=service+str_len(service)-1; while (x>service && *x=='/') { *x=0; --x; } @@ -105,8 +107,8 @@ int main(int argc,char *argv[]) { " -C\tClear; remove service form active list\n\n"); return 0; } - infd=open("/etc/minit/in",O_WRONLY); - outfd=open("/etc/minit/out",O_RDONLY); + infd=open(MINITROOT "/in",O_WRONLY); + outfd=open(MINITROOT "/out",O_RDONLY); if (infd>=0) { while (lockf(infd,F_LOCK,1)) { buffer_putsflush(buffer_2,"could not acquire lock!\n"); @@ -236,7 +238,7 @@ dokill: return ret; } } else { - buffer_putsflush(buffer_2,"could not open /etc/minit/in or /etc/minit/out\n"); + buffer_putsflush(buffer_2,"minit: could not open " MINITROOT "/in or " MINITROOT "/out\n"); return 1; } } diff --git a/shutdown.c b/shutdown.c @@ -41,7 +41,8 @@ static inline int __write2(const char*s) { return write(2,s,str_len(s)); } #define USE_MINIT #ifdef USE_MINIT -#define MINITROOT "/etc/minit" +#define NOVARS +#include "minit.h" #endif extern void opendevconsole(); @@ -129,8 +130,8 @@ int minit_shutdown(int level) { int retval; __write2("Shutting down minit services: \n"); - infd=open("/etc/minit/in", O_WRONLY); - outfd=open("/etc/minit/out", O_RDONLY); + infd=open(MINITROOT "/in", O_WRONLY); + outfd=open(MINITROOT "/out", O_RDONLY); if (infd>=0) { while (lockf(infd, F_TLOCK, 1)) { __write2("could not acquire lock!\n");