commit 3b0ff07af66a812771d8356896661ca94107c594
parent 89f90cbcc38d7e4c1ed9d9e5f9f33afba132ad36
Author: leitner <leitner>
Date: Fri, 26 Sep 2003 12:45:28 +0000
add minit.h
Diffstat:
6 files changed, 32 insertions(+), 19 deletions(-)
diff --git a/byte.h b/byte.h
@@ -11,29 +11,29 @@
/* byte_chr returns the smallest integer i between 0 and len-1
* inclusive such that one[i] equals needle, or len if not found. */
-unsigned int byte_chr(const void* haystack, unsigned int len, char needle) __pure__;
+unsigned long byte_chr(const void* haystack, unsigned long len, char needle) __pure__;
/* byte_rchr returns the largest integer i between 0 and len-1 inclusive
* such that one[i] equals needle, or len if not found. */
-unsigned int byte_rchr(const void* haystack,unsigned int len,char needle) __pure__;
+unsigned long byte_rchr(const void* haystack,unsigned long len,char needle) __pure__;
/* byte_copy copies in[0] to out[0], in[1] to out[1], ... and in[len-1]
* to out[len-1]. */
-void byte_copy(void* out, unsigned int len, const void* in);
+void byte_copy(void* out, unsigned long len, const void* in);
/* byte_copyr copies in[len-1] to out[len-1], in[len-2] to out[len-2],
* ... and in[0] to out[0] */
-void byte_copyr(void* out, unsigned int len, const void* in);
+void byte_copyr(void* out, unsigned long len, const void* in);
/* byte_diff returns negative, 0, or positive, depending on whether the
* string a[0], a[1], ..., a[len-1] is lexicographically smaller
* than, equal to, or greater than the string b[0], b[1], ...,
* b[len-1]. When the strings are different, byte_diff does not read
* bytes past the first difference. */
-int byte_diff(const void* a, unsigned int len, const void* b) __pure__;
+int byte_diff(const void* a, unsigned long len, const void* b) __pure__;
/* byte_zero sets the bytes out[0], out[1], ..., out[len-1] to 0 */
-void byte_zero(void* out, unsigned len);
+void byte_zero(void* out, unsigned long len);
#define byte_equal(s,n,t) (!byte_diff((s),(n),(t)))
diff --git a/byte_copy.c b/byte_copy.c
@@ -2,7 +2,7 @@
/* byte_copy copies in[0] to out[0], in[1] to out[1], ... and in[len-1]
* to out[len-1]. */
-void byte_copy(void* out, unsigned int len, const void* in) {
+void byte_copy(void* out, unsigned long len, const void* in) {
register char* s=out;
register const char* t=in;
register const char* u=t+len;
diff --git a/minit.c b/minit.c
@@ -465,12 +465,12 @@ error:
case 'U':
doupdate=1;
write(outfd,"1",1);
- if (1==poll(&pfd,nfds,5000)) {
- struct process tmp;
- read(infd,&tmp,sizeof tmp);
- tmp.name=strdup(buf+1);
+ if (1==poll(&pfd,nfds,5000)) {
+ struct process tmp;
+ read(infd,&tmp,sizeof tmp);
+ tmp.name=strdup(buf+1);
addprocess(&tmp);
- }
+ }
goto ok;
#endif
case 'r':
diff --git a/minit.h b/minit.h
@@ -0,0 +1,13 @@
+#define MINITROOT "/etc/minit"
+
+static struct process {
+ char *name;
+/* char **argv; */
+ pid_t pid;
+ char respawn;
+ char circular;
+ time_t startedat;
+ int __stdin,__stdout;
+ int logservice;
+} *root;
+
diff --git a/str.h b/str.h
@@ -10,7 +10,7 @@
/* str_copy copies leading bytes from in to out until \0.
* return number of copied bytes. */
-extern unsigned int str_copy(char *out,const char *in);
+extern unsigned long str_copy(char *out,const char *in);
/* str_diff returns negative, 0, or positive, depending on whether the
* string a[0], a[1], ..., a[n]=='\0' is lexicographically smaller than,
@@ -25,21 +25,21 @@ extern int str_diff(const char *a,const char *b) __pure__;
* If the strings are different, str_diffn does not read bytes past the
* first difference. The strings will be considered equal if the first
* limit characters match. */
-extern int str_diffn(const char *a,const char *b,unsigned int limit) __pure__;
+extern int str_diffn(const char *a,const char *b,unsigned long limit) __pure__;
#ifdef __dietlibc__
#include <string.h>
#define str_len(foo) strlen(foo)
#else
/* str_len returns the index of \0 in s */
-extern unsigned int str_len(const char *s) __pure__;
+extern unsigned long str_len(const char *s) __pure__;
#endif
/* str_chr returns the index of the first occurance of needle or \0 in haystack */
-extern unsigned int str_chr(const char *haystack,char needle) __pure__;
+extern unsigned long str_chr(const char *haystack,char needle) __pure__;
/* str_rchr returns the index of the last occurance of needle or \0 in haystack */
-extern unsigned int str_rchr(const char *haystack,char needle) __pure__;
+extern unsigned long str_rchr(const char *haystack,char needle) __pure__;
/* str_start returns 1 if the b is a prefix of a, 0 otherwise */
extern int str_start(const char *a,const char *b) __pure__;
diff --git a/str_len.c b/str_len.c
@@ -2,9 +2,9 @@
#ifdef __dietlibc__
#undef str_len
-unsigned int str_len(const char* in) __attribute__((alias("strlen")));
+unsigned long str_len(const char* in) __attribute__((alias("strlen")));
#else
-unsigned int str_len(const char* in) {
+unsigned long str_len(const char* in) {
register const char* t=in;
for (;;) {
if (!*t) break; ++t;