ustcomm_fini_app(&ustcomm_app, 0);
}
+static void do_cmd_force_switch()
+{
+ struct blocked_consumer *bc;
+
+ list_for_each_entry(bc, &blocked_consumers, list) {
+ ltt_force_switch(bc->buf, FORCE_FLUSH);
+ }
+}
+
int process_client_cmd(char *recvbuf, struct ustcomm_source *src)
{
int result;
if(result)
ERR("cannot set UST_DAEMON_SOCKET environment variable");
}
+ else if(nth_token_is(recvbuf, "force_switch", 0) == 1) {
+ do_cmd_force_switch();
+ }
else {
ERR("unable to parse message: %s", recvbuf);
}
return 0;
}
+int ustcmd_force_switch(pid_t pid)
+{
+ int result;
+
+ result = ustcmd_send_cmd("force_switch", pid, NULL);
+ if (result != 1) {
+ return USTCMD_ERR_GEN;
+ }
+
+ return 0;
+}
+
/**
* Sends a given command to a traceable process
*
extern int ustcmd_get_cmsf(struct marker_status **, pid_t);
extern int ustcmd_set_sock_path(const char *, pid_t);
extern int ustcmd_get_sock_path(char **, pid_t);
+extern int ustcmd_force_switch(pid_t);
#endif /* _USTCMD_H */
GET_SUBBUF_NUM,
GET_SOCK_PATH,
SET_SOCK_PATH,
+ FORCE_SWITCH,
UNKNOWN
};
--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\
\
");
}
{ "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 }
};
}
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;