]> rtime.felk.cvut.cz Git - frescor/frsh.git/blobdiff - resources/cpucg/mngr/frm_cgcpu.c
forb: added scripts executing dynamic shared libraries
[frescor/frsh.git] / resources / cpucg / mngr / frm_cgcpu.c
index 0ecbf4e7862f3aff303456437d9c499c7f9d1265..a48ec0be7be7ef4e7c192cfead44810cf3218a0d 100644 (file)
@@ -64,6 +64,7 @@
 #include <ul_log.h>
 #include <ul_logreg.h>
 #include <stdio.h>
+#include <frsh_core.h>
 
 UL_LOG_CUST(ulogd_frm_cpucg);
 ul_log_domain_t ulogd_frm_cpucg = {UL_LOGL_DEB, "frm_cpucg"};
@@ -106,7 +107,7 @@ static int cpucg_admtest(struct fres_sa_scenario *scenario, void *priv,
        return 0;
 }
 
-static const struct fres_res_manager frm = {
+static struct fres_res_manager frm = {
        .res_type = FRSH_RT_PROCESSOR,
        .res_id = 0,
        .name = "cgroup",
@@ -126,16 +127,17 @@ usage(void)
        printf("  -l, --loglevel <number>|<domain>=<number>,...\n");
 }
 
-int main(int argc, char *argv[])
+int forb_main(forb_orb orb, int argc, char *argv[])
 {
-       forb_orb orb;
        FILE* fd;
        int ret;
        int  opt;
+       bool opt_daemon = false;
+       char *opt_pidfile = NULL;
 
        ul_logreg_domain(&ulogd_frm_cpucg);
 
-       while ((opt = getopt_long(argc, argv, "l:", &long_opts[0], NULL)) != EOF) {
+       while ((opt = getopt_long(argc, argv, "hl:", &long_opts[0], NULL)) != EOF) {
                switch (opt) {
                        case 'l':
                                ul_log_domain_arg2levels(optarg);
@@ -147,8 +149,6 @@ int main(int argc, char *argv[])
                }
        }
 
-       orb = forb_init(&argc, &argv, "frm_cpucg");
-       if (!orb) error(1, errno, "forb_init");
        
        if (!(fd = fopen("/proc/sys/kernel/sched_rt_period_us", "r"))) {
                error(1, errno, "frm_generic_run");
@@ -170,6 +170,7 @@ int main(int argc, char *argv[])
        }
        fclose(fd);
        
+       frm.res_id = frsh_get_local_cpu_id();
        ret = frm_register_and_run(orb, &frm);
        if (ret != 0) {
                error(1, errno, "frm_generic_run");