projects
/
lttngtop.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
missing enable syscalls in create session
[lttngtop.git]
/
src
/
lttng-live-comm.c
diff --git
a/src/lttng-live-comm.c
b/src/lttng-live-comm.c
index 15a3dd2f62ff1971190de83efb398b44c5ba43c1..c51aed53f3696e6f2bd84321a304aaa2b49d65e8 100644
(file)
--- a/
src/lttng-live-comm.c
+++ b/
src/lttng-live-comm.c
@@
-128,7
+128,7
@@
int lttng_live_establish_connection(struct lttng_live_ctx *ctx)
ret_len = send(ctx->control_sock, &cmd, sizeof(cmd), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
ret_len = send(ctx->control_sock, &cmd, sizeof(cmd), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error sending cmd\n
");
+
perror("[error] Error sending cmd
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-138,7
+138,7
@@
int lttng_live_establish_connection(struct lttng_live_ctx *ctx)
ret_len = send(ctx->control_sock, &connect, sizeof(connect), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
ret_len = send(ctx->control_sock, &connect, sizeof(connect), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error sending version\
n");
+
perror("[error] Error sending versio
n");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-147,8
+147,13
@@
int lttng_live_establish_connection(struct lttng_live_ctx *ctx)
do {
ret_len = recv(ctx->control_sock, &connect, sizeof(connect), 0);
} while (ret_len < 0 && errno == EINTR);
do {
ret_len = recv(ctx->control_sock, &connect, sizeof(connect), 0);
} while (ret_len < 0 && errno == EINTR);
+ if (ret_len == 0) {
+ fprintf(stderr, "[error] Remote side has closed connection\n");
+ ret = -1;
+ goto error;
+ }
if (ret_len < 0) {
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error receiving version\
n");
+
perror("[error] Error receiving versio
n");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-250,7
+255,7
@@
int lttng_live_list_sessions(struct lttng_live_ctx *ctx, const char *path)
ret_len = send(ctx->control_sock, &cmd, sizeof(cmd), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
ret_len = send(ctx->control_sock, &cmd, sizeof(cmd), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error sending cmd\n
");
+
perror("[error] Error sending cmd
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-259,8
+264,13
@@
int lttng_live_list_sessions(struct lttng_live_ctx *ctx, const char *path)
do {
ret_len = recv(ctx->control_sock, &list, sizeof(list), 0);
} while (ret_len < 0 && errno == EINTR);
do {
ret_len = recv(ctx->control_sock, &list, sizeof(list), 0);
} while (ret_len < 0 && errno == EINTR);
+ if (ret_len == 0) {
+ fprintf(stderr, "[error] Remote side has closed connection\n");
+ ret = -1;
+ goto error;
+ }
if (ret_len < 0) {
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error receiving session list\n
");
+
perror("[error] Error receiving session list
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-271,8
+281,13
@@
int lttng_live_list_sessions(struct lttng_live_ctx *ctx, const char *path)
do {
ret_len = recv(ctx->control_sock, &lsession, sizeof(lsession), 0);
} while (ret_len < 0 && errno == EINTR);
do {
ret_len = recv(ctx->control_sock, &lsession, sizeof(lsession), 0);
} while (ret_len < 0 && errno == EINTR);
+ if (ret_len == 0) {
+ fprintf(stderr, "[error] Remote side has closed connection\n");
+ ret = -1;
+ goto error;
+ }
if (ret_len < 0) {
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error receiving session\
n");
+
perror("[error] Error receiving sessio
n");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-359,7
+374,7
@@
int lttng_live_attach_session(struct lttng_live_ctx *ctx, uint64_t id)
ret_len = send(ctx->control_sock, &cmd, sizeof(cmd), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
ret_len = send(ctx->control_sock, &cmd, sizeof(cmd), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error sending cmd\n
");
+
perror("[error] Error sending cmd
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-369,7
+384,7
@@
int lttng_live_attach_session(struct lttng_live_ctx *ctx, uint64_t id)
ret_len = send(ctx->control_sock, &rq, sizeof(rq), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
ret_len = send(ctx->control_sock, &rq, sizeof(rq), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error sending attach request\n
");
+
perror("[error] Error sending attach request
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-378,8
+393,13
@@
int lttng_live_attach_session(struct lttng_live_ctx *ctx, uint64_t id)
do {
ret_len = recv(ctx->control_sock, &rp, sizeof(rp), 0);
} while (ret_len < 0 && errno == EINTR);
do {
ret_len = recv(ctx->control_sock, &rp, sizeof(rp), 0);
} while (ret_len < 0 && errno == EINTR);
+ if (ret_len == 0) {
+ fprintf(stderr, "[error] Remote side has closed connection\n");
+ ret = -1;
+ goto error;
+ }
if (ret_len < 0) {
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error receiving attach response\n
");
+
perror("[error] Error receiving attach response
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-392,7
+412,7
@@
int lttng_live_attach_session(struct lttng_live_ctx *ctx, uint64_t id)
ret = -LTTNG_VIEWER_ATTACH_UNK;
goto end;
case LTTNG_VIEWER_ATTACH_ALREADY:
ret = -LTTNG_VIEWER_ATTACH_UNK;
goto end;
case LTTNG_VIEWER_ATTACH_ALREADY:
- fprintf(stderr, "[error]
Already a viewer attached
\n");
+ fprintf(stderr, "[error]
There is already a viewer attached to this session
\n");
ret = -1;
goto end;
case LTTNG_VIEWER_ATTACH_NOT_LIVE:
ret = -1;
goto end;
case LTTNG_VIEWER_ATTACH_NOT_LIVE:
@@
-432,8
+452,13
@@
int lttng_live_attach_session(struct lttng_live_ctx *ctx, uint64_t id)
do {
ret_len = recv(ctx->control_sock, &stream, sizeof(stream), 0);
} while (ret_len < 0 && errno == EINTR);
do {
ret_len = recv(ctx->control_sock, &stream, sizeof(stream), 0);
} while (ret_len < 0 && errno == EINTR);
+ if (ret_len == 0) {
+ fprintf(stderr, "[error] Remote side has closed connection\n");
+ ret = -1;
+ goto error;
+ }
if (ret_len < 0) {
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error receiving stream\n
");
+
perror("[error] Error receiving stream
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-559,7
+584,7
@@
int get_data_packet(struct lttng_live_ctx *ctx,
ret_len = send(ctx->control_sock, &cmd, sizeof(cmd), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
ret_len = send(ctx->control_sock, &cmd, sizeof(cmd), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error sending cmd\n
");
+
perror("[error] Error sending cmd
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-569,7
+594,7
@@
int get_data_packet(struct lttng_live_ctx *ctx,
ret_len = send(ctx->control_sock, &rq, sizeof(rq), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
ret_len = send(ctx->control_sock, &rq, sizeof(rq), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error sending get_data_packet request\n
");
+
perror("[error] Error sending get_data_packet request
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-578,8
+603,13
@@
int get_data_packet(struct lttng_live_ctx *ctx,
do {
ret_len = recv(ctx->control_sock, &rp, sizeof(rp), 0);
} while (ret_len < 0 && errno == EINTR);
do {
ret_len = recv(ctx->control_sock, &rp, sizeof(rp), 0);
} while (ret_len < 0 && errno == EINTR);
+ if (ret_len == 0) {
+ fprintf(stderr, "[error] Remote side has closed connection\n");
+ ret = -1;
+ goto error;
+ }
if (ret_len < 0) {
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error receiving data response\n
");
+
perror("[error] Error receiving data response
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-645,8
+675,7
@@
int get_data_packet(struct lttng_live_ctx *ctx,
/* unmap old base */
ret = munmap_align(pos->base_mma);
if (ret) {
/* unmap old base */
ret = munmap_align(pos->base_mma);
if (ret) {
- fprintf(stderr, "[error] Unable to unmap old base: %s.\n",
- strerror(errno));
+ perror("[error] Unable to unmap old base");
ret = -1;
goto error;
}
ret = -1;
goto error;
}
@@
-656,8
+685,7
@@
int get_data_packet(struct lttng_live_ctx *ctx,
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (pos->base_mma == MAP_FAILED) {
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (pos->base_mma == MAP_FAILED) {
- fprintf(stderr, "[error] mmap error %s.\n",
- strerror(errno));
+ perror("[error] mmap error");
pos->base_mma = NULL;
ret = -1;
goto error;
pos->base_mma = NULL;
ret = -1;
goto error;
@@
-673,8
+701,13
@@
int get_data_packet(struct lttng_live_ctx *ctx,
mmap_align_addr(pos->base_mma), len,
MSG_WAITALL);
} while (ret_len < 0 && errno == EINTR);
mmap_align_addr(pos->base_mma), len,
MSG_WAITALL);
} while (ret_len < 0 && errno == EINTR);
+ if (ret_len == 0) {
+ fprintf(stderr, "[error] Remote side has closed connection\n");
+ ret = -1;
+ goto error;
+ }
if (ret_len < 0) {
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error receiving trace packet\n
");
+
perror("[error] Error receiving trace packet
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-713,7
+746,7
@@
int get_new_metadata(struct lttng_live_ctx *ctx,
ret_len = send(ctx->control_sock, &cmd, sizeof(cmd), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
ret_len = send(ctx->control_sock, &cmd, sizeof(cmd), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error sending cmd\n
");
+
perror("[error] Error sending cmd
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-723,7
+756,7
@@
int get_new_metadata(struct lttng_live_ctx *ctx,
ret_len = send(ctx->control_sock, &rq, sizeof(rq), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
ret_len = send(ctx->control_sock, &rq, sizeof(rq), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error sending get_metadata request\n
");
+
perror("[error] Error sending get_metadata request
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-732,8
+765,13
@@
int get_new_metadata(struct lttng_live_ctx *ctx,
do {
ret_len = recv(ctx->control_sock, &rp, sizeof(rp), 0);
} while (ret_len < 0 && errno == EINTR);
do {
ret_len = recv(ctx->control_sock, &rp, sizeof(rp), 0);
} while (ret_len < 0 && errno == EINTR);
+ if (ret_len == 0) {
+ fprintf(stderr, "[error] Remote side has closed connection\n");
+ ret = -1;
+ goto error;
+ }
if (ret_len < 0) {
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error receiving metadata response\n
");
+
perror("[error] Error receiving metadata response
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-773,8
+811,14
@@
int get_new_metadata(struct lttng_live_ctx *ctx,
do {
ret_len = recv(ctx->control_sock, data, len, MSG_WAITALL);
} while (ret_len < 0 && errno == EINTR);
do {
ret_len = recv(ctx->control_sock, data, len, MSG_WAITALL);
} while (ret_len < 0 && errno == EINTR);
+ if (ret_len == 0) {
+ fprintf(stderr, "[error] Remote side has closed connection\n");
+ ret = -1;
+ free(data);
+ goto error;
+ }
if (ret_len < 0) {
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error receiving trace packet\n
");
+
perror("[error] Error receiving trace packet
");
ret = ret_len;
free(data);
goto error;
ret = ret_len;
free(data);
goto error;
@@
-829,7
+873,7
@@
retry:
ret_len = send(ctx->control_sock, &cmd, sizeof(cmd), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
ret_len = send(ctx->control_sock, &cmd, sizeof(cmd), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error sending cmd\n
");
+
perror("[error] Error sending cmd
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-839,7
+883,7
@@
retry:
ret_len = send(ctx->control_sock, &rq, sizeof(rq), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
ret_len = send(ctx->control_sock, &rq, sizeof(rq), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error sending get_next_index request\n
");
+
perror("[error] Error sending get_next_index request
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-848,8
+892,13
@@
retry:
do {
ret_len = recv(ctx->control_sock, &rp, sizeof(rp), 0);
} while (ret_len < 0 && errno == EINTR);
do {
ret_len = recv(ctx->control_sock, &rp, sizeof(rp), 0);
} while (ret_len < 0 && errno == EINTR);
+ if (ret_len == 0) {
+ fprintf(stderr, "[error] Remote side has closed connection\n");
+ ret = -1;
+ goto error;
+ }
if (ret_len < 0) {
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error receiving index response\n
");
+
perror("[error] Error receiving index response
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-1066,7
+1115,7
@@
int lttng_live_create_viewer_session(struct lttng_live_ctx *ctx)
ret_len = send(ctx->control_sock, &cmd, sizeof(cmd), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
ret_len = send(ctx->control_sock, &cmd, sizeof(cmd), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error sending cmd\n
");
+
perror("[error] Error sending cmd
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-1075,8
+1124,13
@@
int lttng_live_create_viewer_session(struct lttng_live_ctx *ctx)
do {
ret_len = recv(ctx->control_sock, &resp, sizeof(resp), 0);
} while (ret_len < 0 && errno == EINTR);
do {
ret_len = recv(ctx->control_sock, &resp, sizeof(resp), 0);
} while (ret_len < 0 && errno == EINTR);
+ if (ret_len == 0) {
+ fprintf(stderr, "[error] Remote side has closed connection\n");
+ ret = -1;
+ goto error;
+ }
if (ret_len < 0) {
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error receiving create session reply\n
");
+
perror("[error] Error receiving create session reply
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-1211,7
+1265,7
@@
int lttng_live_get_new_streams(struct lttng_live_ctx *ctx, uint64_t id)
ret_len = send(ctx->control_sock, &cmd, sizeof(cmd), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
ret_len = send(ctx->control_sock, &cmd, sizeof(cmd), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error sending cmd\n
");
+
perror("[error] Error sending cmd
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-1221,7
+1275,7
@@
int lttng_live_get_new_streams(struct lttng_live_ctx *ctx, uint64_t id)
ret_len = send(ctx->control_sock, &rq, sizeof(rq), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
ret_len = send(ctx->control_sock, &rq, sizeof(rq), 0);
} while (ret_len < 0 && errno == EINTR);
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error sending get_new_streams request\n
");
+
perror("[error] Error sending get_new_streams request
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-1230,8
+1284,13
@@
int lttng_live_get_new_streams(struct lttng_live_ctx *ctx, uint64_t id)
do {
ret_len = recv(ctx->control_sock, &rp, sizeof(rp), 0);
} while (ret_len < 0 && errno == EINTR);
do {
ret_len = recv(ctx->control_sock, &rp, sizeof(rp), 0);
} while (ret_len < 0 && errno == EINTR);
+ if (ret_len == 0) {
+ fprintf(stderr, "[error] Remote side has closed connection\n");
+ ret = -1;
+ goto error;
+ }
if (ret_len < 0) {
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error receiving get_new_streams response\n
");
+
perror("[error] Error receiving get_new_streams response
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
@@
-1276,8
+1335,13
@@
int lttng_live_get_new_streams(struct lttng_live_ctx *ctx, uint64_t id)
do {
ret_len = recv(ctx->control_sock, &stream, sizeof(stream), 0);
} while (ret_len < 0 && errno == EINTR);
do {
ret_len = recv(ctx->control_sock, &stream, sizeof(stream), 0);
} while (ret_len < 0 && errno == EINTR);
+ if (ret_len == 0) {
+ fprintf(stderr, "[error] Remote side has closed connection\n");
+ ret = -1;
+ goto error;
+ }
if (ret_len < 0) {
if (ret_len < 0) {
-
fprintf(stderr, "[error] Error receiving stream\n
");
+
perror("[error] Error receiving stream
");
ret = ret_len;
goto error;
}
ret = ret_len;
goto error;
}
This page took
0.028761 seconds
and
4
git commands to generate.