unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] socket: define SOCK_[CLOEXEC,NONBLOCK] on Darwin
@ 2020-07-29 18:06 Aleix Conchillo Flaqué
  2020-07-29 19:08 ` Aleix Conchillo Flaqué
  0 siblings, 1 reply; 2+ messages in thread
From: Aleix Conchillo Flaqué @ 2020-07-29 18:06 UTC (permalink / raw)
  To: guile-devel


[-- Attachment #1.1: Type: text/plain, Size: 147 bytes --]

Hi,

I'm not 100% sure this is correct even though I have found it to be the
solution in other patches on other projects.

Hope this helps,

Aleix

[-- Attachment #1.2: Type: text/html, Size: 824 bytes --]

[-- Attachment #2: 0001-socket-define-SOCK_-CLOEXEC-NONBLOCK-on-Darwin.patch --]
[-- Type: application/octet-stream, Size: 1254 bytes --]

From 054e70d20bc48ed74875dcda6eea755579d80fa0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= <aconchillo@gmail.com>
Date: Wed, 29 Jul 2020 10:58:34 -0700
Subject: [PATCH] socket: define SOCK_[CLOEXEC,NONBLOCK] on Darwin

* libguile/socket.c (scm_init_socket): define SOCK_CLOEXEC and
SOCK_NONBLOCK on Darwin with O_CLOEXEC and O_NONBLOCK respectively.
---
 libguile/socket.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libguile/socket.c b/libguile/socket.c
index 64354f1f1..88ed34077 100644
--- a/libguile/socket.c
+++ b/libguile/socket.c
@@ -34,6 +34,7 @@
 #include <string.h>
 #endif
 #include <unistd.h>
+#include <fcntl.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #ifdef HAVE_UNIX_DOMAIN_SOCKETS
@@ -1660,9 +1661,13 @@ scm_init_socket ()
   /* accept4 flags.  */
 #ifdef SOCK_CLOEXEC
   scm_c_define ("SOCK_CLOEXEC", scm_from_int (SOCK_CLOEXEC));
+#elif defined __MACH__ && defined __APPLE__
+  scm_c_define ("SOCK_CLOEXEC", scm_from_int (O_CLOEXEC));
 #endif
 #ifdef SOCK_NONBLOCK
   scm_c_define ("SOCK_NONBLOCK", scm_from_int (SOCK_NONBLOCK));
+#elif defined __MACH__ && defined __APPLE__
+  scm_c_define ("SOCK_NONBLOCK", scm_from_int (O_NONBLOCK));
 #endif
 
   /* setsockopt level.
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-29 19:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 18:06 [PATCH] socket: define SOCK_[CLOEXEC,NONBLOCK] on Darwin Aleix Conchillo Flaqué
2020-07-29 19:08 ` Aleix Conchillo Flaqué

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).