git.annexia.org
/
febootstrap.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ef6f7db
)
febootstrap/helper/init: Mount /proc if not already present.
author
Hilko Bengen
<bengen@hilluzination.de>
Tue, 31 May 2011 22:43:12 +0000
(
00:43
+0200)
committer
Richard W.M. Jones
<rjones@redhat.com>
Wed, 1 Jun 2011 09:35:07 +0000
(10:35 +0100)
helper/init.c
patch
|
blob
|
history
diff --git
a/helper/init.c
b/helper/init.c
index
8690f22
..
514146f
100644
(file)
--- a/
helper/init.c
+++ b/
helper/init.c
@@
-45,6
+45,7
@@
extern long init_module (void *, unsigned long, const char *);
*/
#define verbose 1
*/
#define verbose 1
+static void mount_proc (void);
static void print_uptime (void);
static void insmod (const char *filename);
static void show_directory (const char *dir);
static void print_uptime (void);
static void insmod (const char *filename);
static void show_directory (const char *dir);
@@
-54,6
+55,8
@@
static char line[1024];
int
main ()
{
int
main ()
{
+ mount_proc ();
+
print_uptime ();
fprintf (stderr, "febootstrap: ext2 mini initrd starting up\n");
print_uptime ();
fprintf (stderr, "febootstrap: ext2 mini initrd starting up\n");
@@
-214,6
+217,23
@@
insmod (const char *filename)
}
}
}
}
+/* Mount /proc unless it's mounted already. */
+static void
+mount_proc (void)
+{
+ if (access ("/proc/uptime", R_OK) == -1) {
+ mkdir ("/proc", 0755);
+
+ if (verbose)
+ fprintf (stderr, "febootstrap: mounting /proc\n");
+
+ if (mount ("proc", "/proc", "proc", 0, "") == -1) {
+ perror ("mount: /proc");
+ /* Non-fatal. */
+ }
+ }
+}
+
/* Print contents of /proc/uptime. */
static void
print_uptime (void)
/* Print contents of /proc/uptime. */
static void
print_uptime (void)