uNetworking / uSockets

Miniscule cross-platform eventing, networking & crypto for async applications
Apache License 2.0
1.29k stars 267 forks source link

Consider `sendto$NOCANCEL` on macOS to avoid EINTR #174

Open Jarred-Sumner opened 2 years ago

Jarred-Sumner commented 2 years ago

darwin has a number of i/o functions that won't return EINTR

This line: https://github.com/uNetworking/uSockets/blob/eab7df550a7ebc631e2adcff8b7364481661e879/src/bsd.c#L67

Could be:

        int ret = sendto$NOCANCEL(fd, packet_buffer->buf[i], packet_buffer->len[i], flags, (struct sockaddr *)&packet_buffer->addr[i], sizeof(struct sockaddr_in));

Though a macro might be nice here so it is less ugly

There are several of these

recvfrom$NOCANCEL
sendto$NOCANCEL
fcntl$NOCANCEL
sendmsg$NOCANCEL
recvmsg$NOCANCEL
connect$NOCANCEL
accept$NOCANCEL
accept4$NOCANCEL
open$NOCANCEL
close$NOCANCEL