aboutsummaryrefslogtreecommitdiff
path: root/ninit.h
diff options
context:
space:
mode:
authorKlaatu <[email protected]>2015-05-17 15:33:21 +1200
committerKlaatu <[email protected]>2015-05-17 15:33:21 +1200
commitb0de699679e8f1e39af847ed172d1ba605b4370c (patch)
tree01dac00471d61f727394e508c613b29cff0ceae5 /ninit.h
bulk upload of source
Diffstat (limited to 'ninit.h')
-rw-r--r--ninit.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/ninit.h b/ninit.h
new file mode 100644
index 0000000..4a4bd07
--- /dev/null
+++ b/ninit.h
@@ -0,0 +1,82 @@
+#include "ninitfeatures.h"
+#include "process_defs.h"
+
+#ifndef INIT_NAME_IS_UINT
+#define root_name(J) root[J].name
+#define process_name(P) P->name
+#define alloc_name_set(N) N
+#define process_name_set name
+#define root_names_len (mem.x + mem.a - (void*)root[0].name)
+
+#else
+#define root_name(J) (mem.x + root[J].name)
+#define process_name(P) (mem.x + P->name)
+#define alloc_name_set(N) ((void*)N - mem.x)
+#define process_name_set mem.r
+#define root_names_len (mem.a - root[0].name)
+#endif
+
+#ifdef INIT_PROGRAM
+#include <time.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/poll.h>
+#include <sys/wait.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/reboot.h>
+#include <linux/kd.h>
+#include "initreq.h"
+#endif
+
+#if ((INIT_HISTORY<0) || (INIT_HISTORY>255))
+#error ***** INIT_HISTORY must be between 0 and 255 *****
+#endif
+
+static int infd, outfd;
+static int maxprocess=-1;
+static struct memalloc mem;
+
+#ifdef INIT_PROGRAM
+
+#ifdef INIT_HOME
+static char *initroot = INITROOT;
+static char *initsysdir = INITSYSDIR;
+#else
+#define initroot INITROOT
+#define initsysdir INITSYSDIR
+#endif
+
+#ifdef INIT_BLACK
+static char** Argv;
+#endif
+
+static char do_update;
+static time_t next_cron;
+static uint32t start_time;
+static int initctl = -5;
+static unsigned short *history;
+
+#include "findservice.h"
+#include "addprocess.h"
+#include "t_write.h"
+#include "mmap_alloca.h"
+#include "sighandler.h"
+#include "uid.h"
+
+#ifndef INIT_CHILD_BLOCK
+#define CHILD_BLOCK
+#define CHILD_UNBLOCK
+#else
+#if INIT_SYSTEM
+#define CHILD_BLOCK system_child_block(SIG_BLOCK)
+#define CHILD_UNBLOCK system_child_block(SIG_UNBLOCK)
+#else
+#define CHILD_BLOCK child_block(SIG_BLOCK)
+#define CHILD_UNBLOCK child_block(SIG_UNBLOCK)
+#endif
+#endif
+
+#endif