Fixed rebooting when init runs as /linuxrc

-Erik
This commit is contained in:
Erik Andersen 2000-02-23 22:49:58 +00:00
parent dc75a739ac
commit 5b911ddd57
4 changed files with 17 additions and 8 deletions

View File

@ -11,12 +11,13 @@
* Fixed "du" so it gives the same answers as GNU "du" (busybox du used * Fixed "du" so it gives the same answers as GNU "du" (busybox du used
to count hard-linked files more then once). Many thanks to to count hard-linked files more then once). Many thanks to
Friedrich Vedder <fwv@myrtle.lahn.de> for the fix. Friedrich Vedder <fwv@myrtle.lahn.de> for the fix.
* Removed /proc dependancies for init and free (while maintaining exactly * Removed /proc dependancies for init and free (while maintaining
the same functionality). /proc takes up 90k of kernel space, so it is exactly the same functionality). /proc takes up 90k of kernel
nice to avoid using it at all costs. space, so it is nice to avoid using it at all costs.
* init no longer tries to mount /proc (unless there is less the 1 meg free). * init no longer tries to mount /proc (unless there is less the 1 meg
Use of /proc (or not) is policy that should be set up in /etc/fstab (or free). Use of /proc (or not) is policy that should be set up in
in hardcoded scripts), not in init. /etc/fstab (or in hardcoded scripts), not in init.
* Fixed rebooting when init runs as an initrd.
-Erik Andersen -Erik Andersen

View File

@ -59,9 +59,13 @@ static int doRemount = FALSE;
extern const char mtab_file[]; /* Defined in utility.c */ extern const char mtab_file[]; /* Defined in utility.c */
/* These functions are here because the getmntent functions do not appear /* These functions are here because the getmntent functions do not appear
* to be re-entrant, which leads to all sorts of problems when we try to * to be re-entrant, which leads to all sorts of problems when we try to
* use them recursively - randolph * use them recursively - randolph
*
* TODO: Perhaps switch to using Glibc's getmntent_r
* -Erik
*/ */
void mtab_read(void) void mtab_read(void)
{ {

View File

@ -59,9 +59,13 @@ static int doRemount = FALSE;
extern const char mtab_file[]; /* Defined in utility.c */ extern const char mtab_file[]; /* Defined in utility.c */
/* These functions are here because the getmntent functions do not appear /* These functions are here because the getmntent functions do not appear
* to be re-entrant, which leads to all sorts of problems when we try to * to be re-entrant, which leads to all sorts of problems when we try to
* use them recursively - randolph * use them recursively - randolph
*
* TODO: Perhaps switch to using Glibc's getmntent_r
* -Erik
*/ */
void mtab_read(void) void mtab_read(void)
{ {

View File

@ -1193,7 +1193,7 @@ extern pid_t findInitPid()
for (init_pid = 1; init_pid < 65536; init_pid++) { for (init_pid = 1; init_pid < 65536; init_pid++) {
FILE *status; FILE *status;
sprintf(filename, "/proc/%d/status", init_pid); sprintf(filename, "/proc/%d/cmdline", init_pid);
status = fopen(filename, "r"); status = fopen(filename, "r");
if (!status) { if (!status) {
continue; continue;
@ -1201,7 +1201,7 @@ extern pid_t findInitPid()
fgets(buffer, 256, status); fgets(buffer, 256, status);
fclose(status); fclose(status);
if ((strstr(buffer, "init\n") != NULL)) { if ((strstr(buffer, "init") != NULL)) {
return init_pid; return init_pid;
} }
} }