Files
oldlinux-files/docs/MemSavers/init.patch
2024-02-19 00:23:35 -05:00

84 lines
2.3 KiB
Diff

--- /linux-1213-oem/init/main.c Mon Jul 31 15:01:03 1995
+++ linux/init/main.c Fri Aug 4 17:21:40 1995
@@ -34,8 +34,6 @@
extern char etext, end;
extern char *linux_banner;
-static char printbuf[1024];
-
extern int console_loglevel;
extern void init(void);
@@ -108,12 +106,6 @@
static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
static char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", term, NULL, };
-static char * argv_rc[] = { "/bin/sh", NULL };
-static char * envp_rc[] = { "HOME=/", term, NULL };
-
-static char * argv[] = { "-/bin/sh",NULL };
-static char * envp[] = { "HOME=/usr/root", term, NULL };
-
char *get_options(char *str, int *ints)
{
char *cur = str;
@@ -412,21 +404,8 @@
idle();
}
-static int printf(const char *fmt, ...)
-{
- va_list args;
- int i;
-
- va_start(args, fmt);
- write(1,printbuf,i=vsprintf(printbuf, fmt, args));
- va_end(args);
- return i;
-}
-
void init(void)
{
- int pid,i;
-
setup();
sprintf(term, "TERM=con%dx%d", ORIG_VIDEO_COLS, ORIG_VIDEO_LINES);
@@ -452,36 +431,4 @@
execve("/etc/init",argv_init,envp_init);
execve("/bin/init",argv_init,envp_init);
execve("/sbin/init",argv_init,envp_init);
- /* if this fails, fall through to original stuff */
-
- if (!(pid=fork())) {
- close(0);
- if (open("/etc/rc",O_RDONLY,0))
- _exit(1);
- execve("/bin/sh",argv_rc,envp_rc);
- _exit(2);
- }
- if (pid>0)
- while (pid != wait(&i))
- /* nothing */;
- while (1) {
- if ((pid = fork()) < 0) {
- printf("Fork failed in init\n\r");
- continue;
- }
- if (!pid) {
- close(0);close(1);close(2);
- setsid();
- (void) open("/dev/tty1",O_RDWR,0);
- (void) dup(0);
- (void) dup(0);
- _exit(execve("/bin/sh",argv,envp));
- }
- while (1)
- if (pid == wait(&i))
- break;
- printf("\n\rchild %d died with code %04x\n\r",pid,i);
- sync();
- }
- _exit(0);
}