GNOME Bugzilla – Bug 737461
Problem directory monitoring was not working anymore
Last modified: 2018-05-24 17:03:31 UTC
Hi, I use the inotify functions from glib (through g_file_monitor_directory) with glib version 2.28. I upgraded to version 2.40 and directory monitoring was not working anymore. Analyzing the problem, it seems to happen because I use an kenel 2.6.34-1 without the inotify_init1. The 2.40 version seems to check only for the presence of inotify_init1, it is not using inotify_init anymore. Although support using both seems possible as you can see bellow: diff -u gio/inotify/inotify-kernel.c_old gio/inotify/inotify-kernel.c --- gio/inotify/inotify-kernel.c_old 2014-09-18 10:54:53.060666721 -0300 +++ gio/inotify/inotify-kernel.c 2014-09-19 17:25:15.638938134 -0300 @@ -196,7 +196,9 @@ initialized = TRUE; +#if defined(HAVE_INOTIFY_INIT1) inotify_instance_fd = inotify_init1 (IN_CLOEXEC); +#endif if (inotify_instance_fd < 0) inotify_instance_fd = inotify_init (); ------------------------------------------------------------------------- diff -u gio/giomodule.c_old gio/giomodule.c --- gio/giomodule.c_old 2014-09-19 16:54:53.747857935 -0300 +++ gio/giomodule.c 2014-09-19 16:56:05.256250125 -0300 @@ -1055,7 +1055,7 @@ /* Initialize types from built-in "modules" */ g_type_ensure (g_null_settings_backend_get_type ()); g_type_ensure (g_memory_settings_backend_get_type ()); -#if defined(HAVE_INOTIFY_INIT1) +#if defined(HAVE_SYS_INOTIFY_H) g_type_ensure (_g_inotify_directory_monitor_get_type ()); g_type_ensure (_g_inotify_file_monitor_get_type ()); #endif ------------------------------------------------------------------------- diff -u configure.ac_old configure.ac --- configure.ac_old 2014-09-18 10:54:52.935673027 -0300 +++ configure.ac 2014-09-19 16:52:08.513194513 -0300 @@ -1668,10 +1668,12 @@ dnl ***************************** dnl ** Check for inotify (GIO) ** dnl ***************************** + inotify_support=no AC_CHECK_HEADERS([sys/inotify.h], [ - AC_CHECK_FUNCS(inotify_init1, [inotify_support=yes], [inotify_support=no]) + inotify_support=yes + AC_CHECK_FUNCS(inotify_init1) ]) AM_CONDITIONAL(HAVE_INOTIFY, [test "$inotify_support" = "yes"]) thanks
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/932.