From: Pierre-Marc Fournier Date: Mon, 28 Sep 2009 23:45:47 +0000 (-0400) Subject: improve error handling X-Git-Tag: v1.9.1~891 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=68ab7a5d576faa16e0da19d0f824785eac215ae9;p=lttng-ust.git improve error handling --- diff --git a/libust/relay.c b/libust/relay.c index 05399b4a..3259adee 100644 --- a/libust/relay.c +++ b/libust/relay.c @@ -101,7 +101,11 @@ static int relay_alloc_buf(struct rchan_buf *buf, size_t *size) *size = PAGE_ALIGN(*size); result = buf->shmid = shmget(getpid(), *size, IPC_CREAT | IPC_EXCL | 0700); - if(buf->shmid == -1) { + if(result == -1 && errno == EINVAL) { + ERR("shmget() returned EINVAL; maybe /proc/sys/kernel/shmmax should be increased."); + return -1; + } + else if(result == -1) { PERROR("shmget"); return -1; } diff --git a/libustcomm/ustcomm.c b/libustcomm/ustcomm.c index 8b459df3..2e490b56 100644 --- a/libustcomm/ustcomm.c +++ b/libustcomm/ustcomm.c @@ -406,7 +406,7 @@ int ustcomm_send_request(struct ustcomm_connection *conn, const char *req, char result = send(conn->fd, req, strlen(req), MSG_NOSIGNAL); if(result == -1) { - if(errno != ECONNRESET) + if(errno != EPIPE) PERROR("send"); return -1; } @@ -506,7 +506,7 @@ int ustcomm_init_app(pid_t pid, struct ustcomm_app *handle) handle->server.listen_fd = init_named_socket(name, &(handle->server.socketpath)); if(handle->server.listen_fd < 0) { - ERR("error initializing named socket"); + ERR("Error initializing named socket (%s). Check that directory exists and that it is writable.", name); goto free_name; } free(name); diff --git a/ustd/ustd.c b/ustd/ustd.c index 02abe5da..7d1eb49c 100644 --- a/ustd/ustd.c +++ b/ustd/ustd.c @@ -112,11 +112,6 @@ int get_subbuffer(struct buffer_info *buf) retval = -1; goto end; } - else if(result == 0) { - DBG("app died while being traced"); - retval = GET_SUBBUF_DIED; - goto end; - } result = sscanf(received_msg, "%as %ld", &rep_code, &buf->consumed_old); if(result != 2 && result != 1) {