#include "platform_api.h"
+#include "socket.h"
#include <msp/core/systemerror.h>
#include <msp/io/handle_private.h>
#include "sockaddr_private.h"
-#include "socket.h"
#include "socket_private.h"
using namespace std;
{
mode = IO::M_RDWR;
- // TODO use SOCK_CLOEXEC on Linux
+#ifdef __linux__
+ type |= SOCK_CLOEXEC;
+#endif
priv->handle = socket(family_to_sys(af), type, proto);
+#ifndef __linux__
+ set_inherit(false);
+#endif
platform_init();
}