DBG("[thread] Thread manage kernel started");
+ /*
+ * This first step of the while is to clean this structure which could free
+ * non NULL pointers so zero it before the loop.
+ */
+ memset(&events, 0, sizeof(events));
+
if (testpoint(thread_manage_kernel)) {
goto error_testpoint;
}
/* Check for data on kernel pipe */
if (pollfd == kernel_poll_pipe[0] && (revents & LPOLLIN)) {
- ret = read(kernel_poll_pipe[0], &tmp, 1);
+ do {
+ ret = read(kernel_poll_pipe[0], &tmp, 1);
+ } while (ret < 0 && errno == EINTR);
+ /*
+ * Ret value is useless here, if this pipe gets any actions an
+ * update is required anyway.
+ */
update_poll_flag = 1;
continue;
} else {
goto error;
} else if (revents & LPOLLIN) {
/* Empty pipe */
- ret = read(apps_cmd_pipe[0], &ust_cmd, sizeof(ust_cmd));
+ do {
+ ret = read(apps_cmd_pipe[0], &ust_cmd, sizeof(ust_cmd));
+ } while (ret < 0 && errno == EINTR);
if (ret < 0 || ret < sizeof(ust_cmd)) {
PERROR("read apps cmd pipe");
goto error;
* at some point in time or wait to the end of the world :)
*/
if (apps_cmd_pipe[1] >= 0) {
- ret = write(apps_cmd_pipe[1], ust_cmd,
- sizeof(struct ust_command));
+ do {
+ ret = write(apps_cmd_pipe[1], ust_cmd,
+ sizeof(struct ust_command));
+ } while (ret < 0 && errno == EINTR);
if (ret < 0) {
PERROR("write apps cmd pipe");
if (errno == EBADF) {