From: "Aleix Conchillo Flaqué" <aconchillo@gmail.com>
To: guile-devel <guile-devel@gnu.org>
Subject: [PATCH] socket: define SOCK_[CLOEXEC,NONBLOCK] on Darwin
Date: Wed, 29 Jul 2020 11:06:13 -0700 [thread overview]
Message-ID: <CA+XASoVMcEVNc3uKnSQ9mWtccn_6xLKcx+5vOhvq_4FjuWohkQ@mail.gmail.com> (raw)
[-- 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
next reply other threads:[~2020-07-29 18:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-29 18:06 Aleix Conchillo Flaqué [this message]
2020-07-29 19:08 ` [PATCH] socket: define SOCK_[CLOEXEC,NONBLOCK] on Darwin Aleix Conchillo Flaqué
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+XASoVMcEVNc3uKnSQ9mWtccn_6xLKcx+5vOhvq_4FjuWohkQ@mail.gmail.com \
--to=aconchillo@gmail.com \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).