goto error;
}
+ if (msg.size == 0) {
+ goto skip_payload;
+ }
+
/* Reserve space for the payload. */
ret = lttng_dynamic_buffer_set_size(&channel->reception_payload.buffer,
channel->reception_payload.buffer.size + msg.size);
goto error;
}
+skip_payload:
/* Receive message fds. */
if (msg.fds != 0) {
ret = lttcomm_recv_payload_fds_unix_sock(channel->socket,
goto end;
}
- sock_path = (char *) zmalloc(LTTNG_PATH_MAX);
+ sock_path = calloc<char>(LTTNG_PATH_MAX);
if (!sock_path) {
goto end;
}
- channel = (lttng_notification_channel *) zmalloc(sizeof(struct lttng_notification_channel));
+ channel = zmalloc<lttng_notification_channel>();
if (!channel) {
goto end;
}
status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
goto end_unlock;
}
- ret = lttng_poll_add(&events, channel->socket, LPOLLIN | LPOLLERR);
+ ret = lttng_poll_add(&events, channel->socket, LPOLLIN);
if (ret < 0) {
status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
goto end_clean_poll;
goto end;
}
- pending_notification = (struct pending_notification *) zmalloc(sizeof(*pending_notification));
+ pending_notification = zmalloc<struct pending_notification>();
if (!pending_notification) {
ret = -1;
goto end;
goto end;
}
- pending_notification = (struct pending_notification *) zmalloc(sizeof(*pending_notification));
+ pending_notification = zmalloc<struct pending_notification>();
if (!pending_notification) {
ret = -1;
goto error;
status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
goto end_unlock;
}
- ret = lttng_poll_add(&events, channel->socket, LPOLLIN | LPOLLERR);
+ ret = lttng_poll_add(&events, channel->socket, LPOLLIN);
if (ret < 0) {
status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
goto end_clean_poll;
.major = LTTNG_NOTIFICATION_CHANNEL_VERSION_MAJOR,
.minor = LTTNG_NOTIFICATION_CHANNEL_VERSION_MINOR,
};
- struct lttng_notification_channel_message msg_header = {
- .type = LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_HANDSHAKE,
- .size = sizeof(handshake),
- .fds = 0,
- };
+ struct lttng_notification_channel_message msg_header;
char send_buffer[sizeof(msg_header) + sizeof(handshake)];
+ msg_header.type = LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_HANDSHAKE;
+ msg_header.size = sizeof(handshake);
+ msg_header.fds = 0;
+
memcpy(send_buffer, &msg_header, sizeof(msg_header));
memcpy(send_buffer + sizeof(msg_header), &handshake, sizeof(handshake));
enum lttng_notification_channel_status status =
LTTNG_NOTIFICATION_CHANNEL_STATUS_OK;
struct lttng_payload payload;
- struct lttng_notification_channel_message cmd_header = {
- .type = (int8_t) type,
- .size =0,
- .fds = 0,
- };
+ struct lttng_notification_channel_message cmd_header;
+
+ cmd_header.type = (int8_t) type;
+ cmd_header.size = 0;
+ cmd_header.fds = 0;
lttng_payload_init(&payload);