summaryrefslogtreecommitdiff
path: root/src/bootchart/bootchart.c
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2013-02-14 11:26:05 +0100
committerAuke Kok <auke-jan.h.kok@intel.com>2013-02-14 11:55:23 -0800
commitb823b5e272d07d31c12625a268e8d563289a4db5 (patch)
tree4431fcfb05a2e1de766b9c5dab9ef5301ca23c5c /src/bootchart/bootchart.c
parent1fd961211df69ce672252d543bf4777738647048 (diff)
bootchart: more fixes for bootchart in the initramfs
Diffstat (limited to 'src/bootchart/bootchart.c')
-rw-r--r--src/bootchart/bootchart.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c
index adfaba57b0..e34c08a5eb 100644
--- a/src/bootchart/bootchart.c
+++ b/src/bootchart/bootchart.c
@@ -23,6 +23,7 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/resource.h>
+#include <sys/stat.h>
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
@@ -32,6 +33,7 @@
#include <getopt.h>
#include <limits.h>
#include <errno.h>
+#include <fcntl.h>
#include "bootchart.h"
@@ -51,6 +53,7 @@ double interval;
FILE *of = NULL;
int overrun = 0;
static int exiting = 0;
+int sysfd=-1;
/* graph defaults */
int entropy = 0;
@@ -273,6 +276,9 @@ int main(int argc, char *argv[])
of = fopen(output_file, "w");
}
+ if (sysfd < 0) {
+ sysfd = open("/sys", O_RDONLY);
+ }
/* wait for /proc to become available, discarding samples */
if (!(graph_start > 0.0))
@@ -331,7 +337,6 @@ int main(int argc, char *argv[])
if (ps->smaps)
fclose(ps->smaps);
}
- closedir(proc);
if (!of) {
t = time(NULL);
@@ -350,6 +355,9 @@ int main(int argc, char *argv[])
fprintf(stderr, "bootchartd: Wrote %s\n", output_file);
fclose(of);
+ closedir(proc);
+ close(sysfd);
+
/* nitpic cleanups */
ps = ps_first;
while (ps->next_ps) {