if (code >= LTTNG_UST_ERR_NR)
code = LTTNG_UST_ERR;
return ustcomm_readable_code[USTCOMM_CODE_OFFSET(code)];
-
}
/*
ret = connect(fd, (struct sockaddr *) &sun, sizeof(sun));
if (ret < 0) {
/*
- * Don't print message on connect error, because connect
- * is used in normal execution to detect if sessiond is
- * alive.
+ * Don't print message on connect ENOENT error, because
+ * connect is used in normal execution to detect if
+ * sessiond is alive. ENOENT is when the unix socket
+ * file does not exist, and ECONNREFUSED is when the
+ * file exists but no sessiond is listening.
*/
+ if (errno != ECONNREFUSED && errno != ECONNRESET
+ && errno != ENOENT)
+ PERROR("connect");
ret = -errno;
+ if (ret == -ECONNREFUSED || ret == -ECONNRESET)
+ ret = -EPIPE;
goto error_connect;
}
/* Blocking call */
new_fd = accept(sock, (struct sockaddr *) &sun, &len);
if (new_fd < 0) {
- PERROR("accept");
- return -errno;
+ if (errno != ECONNABORTED)
+ PERROR("accept");
+ new_fd = -errno;
+ if (new_fd == -ECONNABORTED)
+ new_fd = -EPIPE;
}
return new_fd;
}
if (ret < 0) {
int shutret;
- if (errno != EPIPE && errno != ECONNRESET)
+ if (errno != EPIPE && errno != ECONNRESET && errno != ECONNREFUSED)
PERROR("recvmsg");
ret = -errno;
+ if (ret == -ECONNRESET || ret == -ECONNREFUSED)
+ ret = -EPIPE;
shutret = shutdown(sock, SHUT_RDWR);
if (shutret)
if (errno != EPIPE && errno != ECONNRESET)
PERROR("sendmsg");
ret = -errno;
+ if (ret == -ECONNRESET)
+ ret = -EPIPE;
shutret = shutdown(sock, SHUT_RDWR);
if (shutret)
if (errno != EPIPE && errno != ECONNRESET) {
PERROR("sendmsg");
}
+ ret = -errno;
+ if (ret == -ECONNRESET)
+ ret = -EPIPE;
}
return ret;
}
if (errno != EPIPE && errno != ECONNRESET) {
PERROR("recvmsg fds");
}
- if (errno == EPIPE || errno == ECONNRESET)
- ret = -errno;
+ ret = -errno;
+ if (ret == -ECONNRESET)
+ ret = -EPIPE;
goto end;
}
if (ret == 0) {
}
return lur->ret_code;
default:
- if (len < 0) {
- /* Transport level error */
- if (errno == EPIPE || errno == ECONNRESET)
- len = -errno;
- return len;
- } else {
+ if (len >= 0) {
ERR("incorrect message size: %zd\n", len);
- return len;
}
+ return len;
}
}