Package: busybox / 1:1.17.1-8+deb6u11

bootchartd-mounting-tmpfs-is-Linux-specific.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
From e7a0632b7b38f635853a08c276dad2fbd395ba92 Mon Sep 17 00:00:00 2001
From: Jeremie Koenig <jk@jk.fr.eu.org>
Date: Thu, 29 Jul 2010 04:29:53 +0200
Subject: [PATCH 11/12] 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>
---
 init/bootchartd.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/init/bootchartd.c b/init/bootchartd.c
index a1c0164..465a349 100644
--- a/init/bootchartd.c
+++ b/init/bootchartd.c
@@ -6,7 +6,6 @@
 //config:config BOOTCHARTD
 //config:	bool "bootchartd"
 //config:	default y
-//config:	depends on PLATFORM_LINUX
 //config:	help
 //config:	  bootchartd is commonly used to profile the boot process
 //config:	  for the purpose of speeding it up. In this case, it is started
@@ -46,12 +45,15 @@
 #include "libbb.h"
 /* After libbb.h, since it needs sys/types.h on some systems */
 #include <sys/utsname.h>
-#include <sys/mount.h>
-#ifndef MS_SILENT
-# define MS_SILENT      (1 << 15)
-#endif
-#ifndef MNT_DETACH
-# define MNT_DETACH 0x00000002
+
+#ifdef __linux__
+# include <sys/mount.h>
+# ifndef MS_SILENT
+#  define MS_SILENT      (1 << 15)
+# endif
+# ifndef MNT_DETACH
+#  define MNT_DETACH 0x00000002
+# endif
 #endif
 
 #define BC_VERSION_STR "0.8"
@@ -175,6 +177,7 @@ static char *make_tempdir(void)
 	char template[] = "/tmp/bootchart.XXXXXX";
 	char *tempdir = xstrdup(mkdtemp(template));
 	if (!tempdir) {
+#ifdef __linux__
 		/* /tmp is not writable (happens when we are used as init).
 		 * Try to mount a tmpfs, them cd and lazily unmount it.
 		 * Since we unmount it at once, we can mount it anywhere.
@@ -192,6 +195,9 @@ static char *make_tempdir(void)
 		if (umount2(try_dir, MNT_DETACH) != 0) {
 			bb_perror_msg_and_die("can't %smount tmpfs", "un");
 		}
+#else
+		bb_perror_msg_and_die("can't create temporary directory");
+#endif
 	} else {
 		xchdir(tempdir);
 	}
-- 
1.7.1