Re: [PATCH net-next] selftests: net/psock_lib: Handle EINTR and EAGAIN

From: Leo Stone
Date: Wed Nov 20 2024 - 20:25:58 EST


Willem de Bruijn wrote:
> Did you observe actual issues or is this based on the comment in the
> existing code ("Should really handle EINTR and EAGAIN").

No, this patch was based purely off of the comment, and the examples of
similar code in other selftests, e.g. tools/testing/selftests/bpf/xsk.c:

> static int netlink_recvmsg(int sock, struct msghdr *mhdr, int flags)
> {
> int len;
>
> do {
> len = recvmsg(sock, mhdr, flags);
> } while (len < 0 && (errno == EINTR || errno == EAGAIN));
>
> if (len < 0)
> return -errno;
> return len;
> }

> A simpler approach to dealing with EINTR is to ask glibc to restart
> with sigaction or siginterrupt.
>

If we want to handle it that way, this patch is probably not necessary,
since there is no specific signal I would want to install a handler for.

Thanks for your feedback,
Leo