Skip to content

Commit

Permalink
linux: don't use uv__nonblock_ioctl() on sparc
Browse files Browse the repository at this point in the history
uv__nonblock_fcntl() and uv__nonblock_ioctl() do not commute when
O_NDELAY is not equal to O_NONBLOCK.  Case in point: linux/sparc32
and linux/sparc64, where O_NDELAY is O_NONBLOCK + another bit.

Libuv uses uv__nonblock_fcntl() directly sometimes so ensure that it
commutes with uv__nonblock().

Fixes: #1830
  • Loading branch information
bnoordhuis committed May 3, 2018
1 parent ff167ea commit 38ecd51
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/unix/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,18 @@ struct uv__stream_queued_fds_s {
#define uv__nonblock uv__nonblock_fcntl
#endif

/* On Linux, uv__nonblock_fcntl() and uv__nonblock_ioctl() do not commute
* when O_NDELAY is not equal to O_NONBLOCK. Case in point: linux/sparc32
* and linux/sparc64, where O_NDELAY is O_NONBLOCK + another bit.
*
* Libuv uses uv__nonblock_fcntl() directly sometimes so ensure that it
* commutes with uv__nonblock().
*/
#if defined(__linux__) && O_NDELAY != O_NONBLOCK
#undef uv__nonblock
#define uv__nonblock uv__nonblock_fcntl
#endif

/* core */
int uv__cloexec_ioctl(int fd, int set);
int uv__cloexec_fcntl(int fd, int set);
Expand Down

0 comments on commit 38ecd51

Please sign in to comment.