From: Pierre-Marc Fournier Date: Mon, 28 Sep 2009 23:45:47 +0000 (-0400) Subject: improve error handling X-Git-Tag: v0.1~115 X-Git-Url: http://git.lttng.org/?p=ust.git;a=commitdiff_plain;h=68ab7a5d576faa16e0da19d0f824785eac215ae9;hp=e7465adb1683ce0201f7e029efb48c7fac2b7b63 improve error handling --- diff --git a/libust/relay.c b/libust/relay.c index 05399b4..3259ade 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 8b459df..2e490b5 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 02abe5d..7d1eb49 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) {