Maybe SOCK_SEQPACKET is not faster than SOCK_STREAM per se, I don't
know, but streams force us to re-bufferize the data that we receive in
excess, leading to many useless data copies.
#endif
} else {
master_socket_ = socket(AF_UNIX,
- SOCK_STREAM
-#ifdef SOCK_CLOEXEC
- | SOCK_CLOEXEC /* MacOSX does not have it */
+#ifdef __APPLE__
+ SOCK_STREAM, /* Mac OSX does not have AF_UNIX + SOCK_SEQPACKET, even if that's faster*/
+#else
+ SOCK_SEQPACKET,
#endif
- ,
0);
xbt_assert(master_socket_ != -1, "Cannot create the master socket: %s", strerror(errno));
if (pid == 0) { // Child
int sock = socket(AF_UNIX,
- SOCK_STREAM
-#ifdef SOCK_CLOEXEC
- | SOCK_CLOEXEC /* MacOSX does not have it */
+#ifdef __APPLE__
+ SOCK_STREAM, /* Mac OSX does not have AF_UNIX + SOCK_SEQPACKET, even if that's faster*/
+#else
+ SOCK_SEQPACKET,
#endif
- ,
0);
struct sockaddr_un addr = {};
// Create an AF_UNIX socketpair used for exchanging messages between the model-checker process (ancestor)
// and the application process (child)
int sockets[2];
- xbt_assert(socketpair(AF_UNIX, SOCK_STREAM, 0, sockets) != -1, "Could not create socketpair: %s", strerror(errno));
+ xbt_assert(socketpair(AF_UNIX,
+#ifdef __APPLE__
+ SOCK_STREAM, /* Mac OSX does not have AF_UNIX + SOCK_SEQPACKET, even if that's faster*/
+#else
+ SOCK_SEQPACKET,
+#endif
+ 0, sockets) != -1,
+ "Could not create socketpair: %s", strerror(errno));
pid_ = fork();
xbt_assert(pid_ >= 0, "Could not fork application process");