From 68ab7a5d576faa16e0da19d0f824785eac215ae9 Mon Sep 17 00:00:00 2001 From: Pierre-Marc Fournier Date: Mon, 28 Sep 2009 19:45:47 -0400 Subject: [PATCH] improve error handling --- libust/relay.c | 6 +++++- libustcomm/ustcomm.c | 4 ++-- ustd/ustd.c | 5 ----- 3 files changed, 7 insertions(+), 8 deletions(-) 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) { -- 2.34.1