Commit 5f14ea8a authored by Jan Kiszka's avatar Jan Kiszka
Browse files

cobalt/posix/mqueue: Avoid returning internal EADV as error

In contrast to real RTDM devices, message queues have no fallback path
to Linux in userspace. Thus, EADV is neither needed nor detected by
libcobalt. Avoid leaking it from RTDM to the mq syscall interface.

Fixes: 2db562ad

 ("cobalt: switch hand over status to -EADV for non-RTDM fd")
Signed-off-by: Jan Kiszka's avatarJan Kiszka <>
parent 1b89f045
......@@ -374,7 +374,10 @@ static int mq_open(int uqd, const char *name, int oflags,
static inline int mq_close(mqd_t fd)
return rtdm_fd_close(fd, COBALT_MQD_MAGIC);
int err;
err = rtdm_fd_close(fd, COBALT_MQD_MAGIC);
return err == -EADV ? -EBADF : err;
static inline int mq_unlink(const char *name)
......@@ -736,8 +739,8 @@ static inline struct cobalt_mqd *cobalt_mqd_get(mqd_t ufd)
fd = rtdm_fd_get(ufd, COBALT_MQD_MAGIC);
if (IS_ERR(fd)) {
int err = PTR_ERR(fd);
if (err == -EBADF && cobalt_current_process() == NULL)
err = -EPERM;
if (err == -EADV)
err = cobalt_current_process() ? -EBADF : -EPERM;
return ERR_PTR(err);
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