mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-19 12:11:57 +02:00
Merge branch 'wip/lantw/freebsd-kqueue-simple' into 'master'
FreeBSD kqueue file monitor fixes: the simple parts See merge request GNOME/glib!76
This commit is contained in:
commit
e3280675f5
@ -121,7 +121,7 @@ _ke_is_excluded (const char *full_path)
|
|||||||
g_object_unref (f);
|
g_object_unref (f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mount != NULL && (g_mount_can_unmount (mount))) || g_str_has_prefix (full_path, "/mnt/"))
|
if (mount != NULL && (g_str_has_prefix (full_path, "/media/") || g_str_has_prefix (full_path, "/run/media/")))
|
||||||
{
|
{
|
||||||
g_warning ("Excluding %s from kernel notification, falling back to poll", full_path);
|
g_warning ("Excluding %s from kernel notification, falling back to poll", full_path);
|
||||||
if (mount)
|
if (mount)
|
||||||
|
@ -477,7 +477,15 @@ test_create_delete (gconstpointer d)
|
|||||||
* that the monitor will notice a create immediately followed by a
|
* that the monitor will notice a create immediately followed by a
|
||||||
* delete, rather than coalescing them into nothing.
|
* delete, rather than coalescing them into nothing.
|
||||||
*/
|
*/
|
||||||
if (!strcmp (G_OBJECT_TYPE_NAME (data->monitor), "GPollFileMonitor"))
|
/* This test also doesn't work with GKqueueFileMonitor because of
|
||||||
|
* the same reason. Kqueue is able to return a kevent when a file is
|
||||||
|
* created or deleted in a directory. However, the kernel doesn't tell
|
||||||
|
* the program file names, so GKqueueFileMonitor has to calculate the
|
||||||
|
* difference itself. This is usually too slow for rapid file creation
|
||||||
|
* and deletion tests.
|
||||||
|
*/
|
||||||
|
if (strcmp (G_OBJECT_TYPE_NAME (data->monitor), "GPollFileMonitor") == 0 ||
|
||||||
|
strcmp (G_OBJECT_TYPE_NAME (data->monitor), "GKqueueFileMonitor") == 0)
|
||||||
{
|
{
|
||||||
g_test_skip ("skipping test for this GFileMonitor implementation");
|
g_test_skip ("skipping test for this GFileMonitor implementation");
|
||||||
goto skip;
|
goto skip;
|
||||||
|
@ -84,6 +84,19 @@ delete_file_idle (gpointer data)
|
|||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
stop_loop_idle (gpointer data)
|
||||||
|
{
|
||||||
|
MonitorData *d = data;
|
||||||
|
|
||||||
|
g_assert (d->state == 6);
|
||||||
|
|
||||||
|
if (d->loop)
|
||||||
|
g_main_loop_quit (d->loop);
|
||||||
|
|
||||||
|
return G_SOURCE_REMOVE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
changed_cb (GFileMonitor *monitor,
|
changed_cb (GFileMonitor *monitor,
|
||||||
GFile *file,
|
GFile *file,
|
||||||
@ -112,8 +125,7 @@ changed_cb (GFileMonitor *monitor,
|
|||||||
case 5:
|
case 5:
|
||||||
g_assert (event == G_FILE_MONITOR_EVENT_DELETED);
|
g_assert (event == G_FILE_MONITOR_EVENT_DELETED);
|
||||||
d->state = 6;
|
d->state = 6;
|
||||||
if (d->loop)
|
g_idle_add (stop_loop_idle, data);
|
||||||
g_main_loop_quit (d->loop);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user