{
if (name == NULL) {
RTE_LOG(ERR, EAL, "Action name cannot be NULL\n");
- rte_errno = -EINVAL;
+ rte_errno = EINVAL;
return -1;
}
if (strnlen(name, RTE_MP_MAX_NAME_LEN) == 0) {
RTE_LOG(ERR, EAL, "Length of action name is zero\n");
- rte_errno = -EINVAL;
+ rte_errno = EINVAL;
return -1;
}
if (strnlen(name, RTE_MP_MAX_NAME_LEN) == RTE_MP_MAX_NAME_LEN) {
- rte_errno = -E2BIG;
+ rte_errno = E2BIG;
return -1;
}
return 0;
entry = malloc(sizeof(struct action_entry));
if (entry == NULL) {
- rte_errno = -ENOMEM;
+ rte_errno = ENOMEM;
return -1;
}
strcpy(entry->action_name, name);
pthread_mutex_lock(&mp_mutex_action);
if (find_action_entry_by_name(name) != NULL) {
pthread_mutex_unlock(&mp_mutex_action);
- rte_errno = -EEXIST;
+ rte_errno = EEXIST;
free(entry);
return -1;
}
if (snd < 0) {
rte_errno = errno;
/* Check if it caused by peer process exits */
- if (errno == -ECONNREFUSED) {
+ if (errno == ECONNREFUSED) {
/* We don't unlink the primary's socket here */
if (rte_eal_process_type() == RTE_PROC_PRIMARY)
unlink_socket_by_path(dst_path);
return 0;
}
- if (errno == -ENOBUFS) {
+ if (errno == ENOBUFS) {
RTE_LOG(ERR, EAL, "Peer cannot receive message %s\n",
dst_path);
return 0;
return -1;
}
while ((ent = readdir(mp_dir))) {
+ char path[PATH_MAX];
+
if (fnmatch(mp_filter, ent->d_name, 0) != 0)
continue;
- if (send_msg(ent->d_name, msg, type) < 0)
+ snprintf(path, sizeof(path), "%s/%s", mp_dir_path,
+ ent->d_name);
+ if (send_msg(path, msg, type) < 0)
ret = -1;
}
{
if (msg == NULL) {
RTE_LOG(ERR, EAL, "Msg cannot be NULL\n");
- rte_errno = -EINVAL;
+ rte_errno = EINVAL;
return false;
}
if (msg->len_param > RTE_MP_MAX_PARAM_LEN) {
RTE_LOG(ERR, EAL, "Message data is too long\n");
- rte_errno = -E2BIG;
+ rte_errno = E2BIG;
return false;
}
if (msg->num_fds > RTE_MP_MAX_FD_NUM) {
RTE_LOG(ERR, EAL, "Cannot send more than %d FDs\n",
RTE_MP_MAX_FD_NUM);
- rte_errno = -E2BIG;
+ rte_errno = E2BIG;
return false;
}
exist = find_sync_request(dst, req->name);
if (!exist)
TAILQ_INSERT_TAIL(&sync_requests.requests, &sync_req, next);
- pthread_mutex_unlock(&sync_requests.lock);
if (exist) {
RTE_LOG(ERR, EAL, "A pending request %s:%s\n", dst, req->name);
- rte_errno = -EEXIST;
+ rte_errno = EEXIST;
+ pthread_mutex_unlock(&sync_requests.lock);
return -1;
}
reply->nb_sent++;
- pthread_mutex_lock(&sync_requests.lock);
do {
pthread_cond_timedwait(&sync_req.cond, &sync_requests.lock, ts);
/* Check spurious wakeups */
/* Check if time is out */
if (gettimeofday(&now, NULL) < 0)
break;
- if (now.tv_sec < ts->tv_sec)
+ if (ts->tv_sec < now.tv_sec)
break;
else if (now.tv_sec == ts->tv_sec &&
now.tv_usec * 1000 < ts->tv_nsec)
if (sync_req.reply_received == 0) {
RTE_LOG(ERR, EAL, "Fail to recv reply for request %s:%s\n",
dst, req->name);
- rte_errno = -ETIMEDOUT;
+ rte_errno = ETIMEDOUT;
return -1;
}
if (!tmp) {
RTE_LOG(ERR, EAL, "Fail to alloc reply for request %s:%s\n",
dst, req->name);
- rte_errno = -ENOMEM;
+ rte_errno = ENOMEM;
return -1;
}
memcpy(&tmp[reply->nb_received], &msg, sizeof(msg));
}
while ((ent = readdir(mp_dir))) {
+ char path[PATH_MAX];
+
if (fnmatch(mp_filter, ent->d_name, 0) != 0)
continue;
- if (mp_request_one(ent->d_name, req, reply, &end))
+ snprintf(path, sizeof(path), "%s/%s", mp_dir_path,
+ ent->d_name);
+
+ if (mp_request_one(path, req, reply, &end))
ret = -1;
}
if (peer == NULL) {
RTE_LOG(ERR, EAL, "peer is not specified\n");
- rte_errno = -EINVAL;
+ rte_errno = EINVAL;
return -1;
}