summaryrefslogtreecommitdiff
path: root/lib/nonblock.c
diff options
context:
space:
mode:
authorDon <don.j.olmstead@gmail.com>2022-03-08 10:44:34 -0800
committerDaniel Stenberg <daniel@haxx.se>2022-03-09 09:13:42 +0100
commit7c44b5195676203ab839d1a11d7cf0886366d589 (patch)
tree351480b40c3a57d0d4b817faf2eeb0a7f168f899 /lib/nonblock.c
parent911714d617c106ed5d553bf003e34ec94ab6a136 (diff)
downloadcurl-7c44b5195676203ab839d1a11d7cf0886366d589.tar.gz
nonblock: restore setsockopt method to curlx_nonblock
The implementation using setsockopt was removed when BeOS support was purged. However this functionality wasn't BeOS specific, it is still used by for example Orbis OS (Playstation 4/5 OS). Closes #8562
Diffstat (limited to 'lib/nonblock.c')
-rw-r--r--lib/nonblock.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/nonblock.c b/lib/nonblock.c
index 92fb22ec2..28f6e7588 100644
--- a/lib/nonblock.c
+++ b/lib/nonblock.c
@@ -73,6 +73,12 @@ int curlx_nonblock(curl_socket_t sockfd, /* operate on this */
long flags = nonblock ? 1L : 0L;
return IoctlSocket(sockfd, FIONBIO, (char *)&flags);
+#elif defined(HAVE_SETSOCKOPT_SO_NONBLOCK)
+
+ /* Orbis OS */
+ long b = nonblock ? 1L : 0L;
+ return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
+
#else
# error "no non-blocking method was found/used/set"
#endif