Changes malloc to zmalloc
[ust.git] / ustctl / ustctl.c
index 50e0d012abff05ff861e0c1f9a9fe4546804975d..d29097567aed1b93143c5f22c66a391f0992833b 100644 (file)
@@ -22,8 +22,7 @@
 #include <stdlib.h>
 #include <fcntl.h>
 
-#include "ustcomm.h"
-#include "ustcmd.h"
+#include "ust/ustcmd.h"
 #include "usterr.h"
 
 enum command {
@@ -42,6 +41,7 @@ enum command {
        GET_SUBBUF_NUM,
        GET_SOCK_PATH,
        SET_SOCK_PATH,
+       FORCE_SWITCH,
        UNKNOWN
 };
 
@@ -73,6 +73,7 @@ Commands:\n\
     --enable-marker \"CHANNEL/MARKER\"\tEnable a marker\n\
     --disable-marker \"CHANNEL/MARKER\"\tDisable a marker\n\
     --list-markers\t\t\tList the markers of the process, their\n\t\t\t\t\t  state and format string\n\
+    --force-switch\t\t\tForce a subbuffer switch\n\
 \
 ");
 }
@@ -103,6 +104,7 @@ int parse_opts_long(int argc, char **argv, struct ust_opts *opts)
                        { "get-subbuf-num", 1, 0, GET_SUBBUF_NUM },
                        { "get-sock-path", 0, 0, GET_SOCK_PATH },
                        { "set-sock-path", 1, 0, SET_SOCK_PATH },
+                       { "force-switch", 0, 0, FORCE_SWITCH },
                        { 0, 0, 0, 0 }
                };
 
@@ -145,7 +147,7 @@ int parse_opts_long(int argc, char **argv, struct ust_opts *opts)
        if (argc - optind > 0 && opts->cmd != GET_ONLINE_PIDS) {
                int i;
                int pididx=0;
-               opts->pids = malloc((argc-optind+1) * sizeof(pid_t));
+               opts->pids = zmalloc((argc-optind+1) * sizeof(pid_t));
 
                for(i=optind; i<argc; i++) {
                        /* don't take any chances, use a long long */
@@ -332,6 +334,13 @@ int main(int argc, char *argv[])
                                }
                                break;
 
+                       case FORCE_SWITCH:
+                               result = ustcmd_force_switch(*pidit);
+                               if (result) {
+                                       ERR("error while trying to force switch for PID %u\n", (unsigned int) *pidit);
+                               }
+                               break;
+
                        default:
                                ERR("unknown command\n");
                        break;
This page took 0.024625 seconds and 4 git commands to generate.