mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
gio-kqueue: use O_EVTONLY on MacOS
MacOS provides the O_EVTONLY flag to open(2) which allow to open a file for monitoring without preventing an unmount of the volume that contains it. https://bugzilla.gnome.org/show_bug.cgi?id=688518
This commit is contained in:
parent
ef8510be09
commit
596f96b08d
@ -21,6 +21,7 @@
|
||||
THE SOFTWARE.
|
||||
*******************************************************************************/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <glib.h>
|
||||
#include <gio/gio.h>
|
||||
#include "kqueue-exclusions.h"
|
||||
@ -38,6 +39,9 @@ static gboolean ke_debug_enabled = FALSE;
|
||||
gboolean
|
||||
_ke_is_excluded (const char *full_path)
|
||||
{
|
||||
#if defined (O_EVTONLY)
|
||||
return FALSE;
|
||||
#else
|
||||
GFile *f = NULL;
|
||||
GMount *mount = NULL;
|
||||
|
||||
@ -57,4 +61,5 @@ _ke_is_excluded (const char *full_path)
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
@ -512,7 +512,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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user