Config file path. If not provided, perf will check system and default
locations (/etc/perfconfig, $HOME/.perfconfig).
+--base=<PATH>::
+ Base directory path. Each daemon instance is running on top
+ of base directory.
+
All generic options are available also under commands.
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
+#include <errno.h>
#include "builtin.h"
#include "perf.h"
#include "debug.h"
struct daemon {
const char *config;
char *config_real;
+ const char *base_user;
char *base;
FILE *out;
char perf[PATH_MAX];
static void daemon__exit(struct daemon *daemon)
{
free(daemon->config_real);
+ free(daemon->base);
}
static int setup_config(struct daemon *daemon)
{
+ if (daemon->base_user) {
+ daemon->base = strdup(daemon->base_user);
+ if (!daemon->base)
+ return -ENOMEM;
+ }
+
if (daemon->config) {
char *real = realpath(daemon->config, NULL);
OPT_INCR('v', "verbose", &verbose, "be more verbose"),
OPT_STRING(0, "config", &__daemon.config,
"config file", "config file path"),
+ OPT_STRING(0, "base", &__daemon.base_user,
+ "directory", "base directory"),
OPT_END()
};