gsocket: Set SO_NOSIGPIPE on sockets on Darwin
[platform/upstream/glib.git] / gio / kqueue / kqueue-helper.c
index ba5a140..1a95b83 100644 (file)
 static gboolean kh_debug_enabled = FALSE;
 #define KH_W if (kh_debug_enabled) g_warning
 
-G_GNUC_INTERNAL G_LOCK_DEFINE (kqueue_lock);
-
 static GHashTable *subs_hash_table = NULL;
-G_GNUC_INTERNAL G_LOCK_DEFINE (hash_lock);
+G_LOCK_DEFINE_STATIC (hash_lock);
 
 static int kqueue_descriptor = -1;
 static int kqueue_socket_pair[] = {-1, -1};
@@ -512,7 +510,11 @@ _kh_start_watching (kqueue_sub *sub)
   g_assert (sub->filename != NULL);
 
   /* kqueue requires a file descriptor to monitor. Sad but true */
+#if defined (O_EVTONLY)
+  sub->fd = open (sub->filename, O_EVTONLY);
+#else
   sub->fd = open (sub->filename, O_RDONLY);
+#endif
 
   if (sub->fd == -1)
     {