Why Nostr? What is Njump?
2025-04-21 20:26:04

Harry Sintonen on Nostr: DId you know that some BSDs would return 0 if called recvmsg() for non-blocking UDP ...

DId you know that some BSDs would return 0 if called recvmsg() for non-blocking UDP socket with all iov_len totalling to 0? No-one says this is incorrect return value, but Linux does return -1 EAGAIN in this case. It's a subtle difference but it can cause trouble if your code assumes certain behaviour.

netbsd kernel code responsible for returning 0 in this case: https://github.com/NetBSD/src/blob/68fd9ef50c0ab993c10e4f19cfa2a1f4dbb10802/sys/kern/uipc_socket.c#L578

#netbsd #linux
Author Public Key
npub1q2dlxhrrazeq2ezqps9txhlr799ud3j07m3m58q32fcm6pfm06xqf7d56p