Thread (3 messages) 3 messages, 2 authors, 2024-11-21

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

From: Leo Stone <hidden>
Date: 2024-11-21 01:25:45
Also in: linux-kernel-mentees, linux-kselftest, lkml

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help