Commit ad33f01e authored by Federico Vaga's avatar Federico Vaga

sw:lib: add new error code

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent c0093881
......@@ -45,6 +45,7 @@ static char *trtl_error_str[] = {
"Error while reading HMQ messages",
"Failed to send synchronous message",
"Failed to receive synchronous message",
"Failed to receive synchronous message: poll error",
"Failed to receive synchronous message: timeout",
"Failed to receive synchronous message: invalid sync id",
NULL,
......@@ -1099,11 +1100,16 @@ int trtl_msg_sync(struct trtl_dev *trtl,
errno = ETRTL_MSG_SYNC_FAILED_RECV_TIMEOUT;
return -1;
}
if ((p.revents & POLLERR) || !(p.revents & POLLIN)) {
if ((p.revents & POLLERR)) {
errno = ETRTL_MSG_SYNC_FAILED_RECV_POLLERR;
return -1;
}
if (!(p.revents & POLLIN)) {
errno = ETRTL_MSG_SYNC_FAILED_RECV;
return -1;
}
/* read the answer */
ret = trtl_msg_async_recv(wdesc->trtl_sync, idx_cpu, idx_hmq, msg_r, 1);
if (ret < 0)
......
......@@ -63,6 +63,8 @@ enum trtl_error_number {
ETRTL_MSG_SYNC_FAILED_RECV, /**< Receive sync message failure */
ETRTL_MSG_SYNC_FAILED_RECV_TIMEOUT, /**< Receive sync message failure:
timeout */
ETRTL_MSG_SYNC_FAILED_RECV_POLLERR, /**< Receive sync message failure */
ETRTL_MSG_SYNC_FAILED_INVAL, /**< Receive sync message failure:
invalid */
__ETRTL_MAX,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment