aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremie Koenig <jk@jk.fr.eu.org>2010-07-29 04:29:53 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-07-30 01:16:00 +0200
commite7a0632b7b38f635853a08c276dad2fbd395ba92 (patch)
treea8acee261ce62d068e0b07b6ebdcb7e1a4d6055e
parent5a71fb82025d8bbb87a2d0a0851cb4c9cc31e888 (diff)
downloadbusybox-w32-e7a0632b7b38f635853a08c276dad2fbd395ba92.tar.gz
busybox-w32-e7a0632b7b38f635853a08c276dad2fbd395ba92.tar.bz2
busybox-w32-e7a0632b7b38f635853a08c276dad2fbd395ba92.zip
bootchartd: mounting tmpfs is Linux-specific
Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--init/bootchartd.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/init/bootchartd.c b/init/bootchartd.c
index a1c01641b..465a34979 100644
--- a/init/bootchartd.c
+++ b/init/bootchartd.c
@@ -6,7 +6,6 @@
6//config:config BOOTCHARTD 6//config:config BOOTCHARTD
7//config: bool "bootchartd" 7//config: bool "bootchartd"
8//config: default y 8//config: default y
9//config: depends on PLATFORM_LINUX
10//config: help 9//config: help
11//config: bootchartd is commonly used to profile the boot process 10//config: bootchartd is commonly used to profile the boot process
12//config: for the purpose of speeding it up. In this case, it is started 11//config: for the purpose of speeding it up. In this case, it is started
@@ -46,12 +45,15 @@
46#include "libbb.h" 45#include "libbb.h"
47/* After libbb.h, since it needs sys/types.h on some systems */ 46/* After libbb.h, since it needs sys/types.h on some systems */
48#include <sys/utsname.h> 47#include <sys/utsname.h>
49#include <sys/mount.h> 48
50#ifndef MS_SILENT 49#ifdef __linux__
51# define MS_SILENT (1 << 15) 50# include <sys/mount.h>
52#endif 51# ifndef MS_SILENT
53#ifndef MNT_DETACH 52# define MS_SILENT (1 << 15)
54# define MNT_DETACH 0x00000002 53# endif
54# ifndef MNT_DETACH
55# define MNT_DETACH 0x00000002
56# endif
55#endif 57#endif
56 58
57#define BC_VERSION_STR "0.8" 59#define BC_VERSION_STR "0.8"
@@ -175,6 +177,7 @@ static char *make_tempdir(void)
175 char template[] = "/tmp/bootchart.XXXXXX"; 177 char template[] = "/tmp/bootchart.XXXXXX";
176 char *tempdir = xstrdup(mkdtemp(template)); 178 char *tempdir = xstrdup(mkdtemp(template));
177 if (!tempdir) { 179 if (!tempdir) {
180#ifdef __linux__
178 /* /tmp is not writable (happens when we are used as init). 181 /* /tmp is not writable (happens when we are used as init).
179 * Try to mount a tmpfs, them cd and lazily unmount it. 182 * Try to mount a tmpfs, them cd and lazily unmount it.
180 * Since we unmount it at once, we can mount it anywhere. 183 * Since we unmount it at once, we can mount it anywhere.
@@ -192,6 +195,9 @@ static char *make_tempdir(void)
192 if (umount2(try_dir, MNT_DETACH) != 0) { 195 if (umount2(try_dir, MNT_DETACH) != 0) {
193 bb_perror_msg_and_die("can't %smount tmpfs", "un"); 196 bb_perror_msg_and_die("can't %smount tmpfs", "un");
194 } 197 }
198#else
199 bb_perror_msg_and_die("can't create temporary directory");
200#endif
195 } else { 201 } else {
196 xchdir(tempdir); 202 xchdir(tempdir);
197 } 203 }