#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>
#include <getopt.h>
#include <limits.h>
#include <errno.h>
+#include <fcntl.h>
#include "bootchart.h"
FILE *of = NULL;
int overrun = 0;
static int exiting = 0;
+int sysfd=-1;
/* graph defaults */
int entropy = 0;
int main(int argc, char *argv[])
{
+ _cleanup_free_ char *build = NULL;
struct sigaction sig;
struct ps_struct *ps;
char output_file[PATH_MAX];
of = fopen(output_file, "w");
}
+ if (sysfd < 0) {
+ sysfd = open("/sys", O_RDONLY);
+ }
+
+ if (!build) {
+ parse_env_file("/etc/os-release", NEWLINE,
+ "PRETTY_NAME", &build,
+ NULL);
+ }
/* wait for /proc to become available, discarding samples */
if (!(graph_start > 0.0))
if (ps->smaps)
fclose(ps->smaps);
}
- closedir(proc);
if (!of) {
t = time(NULL);
exit (EXIT_FAILURE);
}
- svg_do();
+ svg_do(build);
fprintf(stderr, "bootchartd: Wrote %s\n", output_file);
fclose(of);
+ closedir(proc);
+ close(sysfd);
+
/* nitpic cleanups */
ps = ps_first;
while (ps->next_ps) {