On 14.11.19 19:18, Jan Kiszka wrote:
On 14.11.19 18:55, Lange Norbert wrote:
According to the code in __rtdm_fd_sendmmsg, that’s not what happens, ENOBUFS would be returned instead,
And the amount of sent packets is lost forever.

if (datagrams > 0 && (ret == 0 || ret == -EWOULDBLOCK)) {
/* NOTE: SO_ERROR should be honored for other errors. */
rtdm_fd_put(fd);
return datagrams;
}

IMHO this condition would need to added:
((flags | MSG_DONTWAIT) && ret == -ENOBUFS)

(Recvmmsg possibly similarly, havent checked yet)

sendmmsg was only added to Xenomai 3.1. There might be room for improvements, if not corrections. So, if we do not return the number of sent messages or signal an error where we should not (this is how I read the man page currently), this needs a patch...

The implementation of sendmmsg is wrong when comparing it to the man page and the reference in the kernel (as this is Linux-only):

/* We only return an error if no datagrams were able to be sent */

says the kernel e.g. and does

        if (datagrams != 0)
                return datagrams;

It's also missing to trace on certain exits. Will write a patch.

Jan

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

Reply via email to