have_inotify="${ac_cv_header_sys_inotify_h}"
AM_CONDITIONAL([HAVE_INOTIFY], [test "x${have_inotify}" = "xyes"])
+have_notify_win32="${have_win32}"
+AC_DEFINE_IF([HAVE_NOTIFY_WIN32],
+ [test "x${have_notify_win32}" = "xyes"],
+ [File monitoring with Windows notification])
+AM_CONDITIONAL([HAVE_NOTIFY_WIN32], [test "x${have_notify_win32}" = "xyes"])
+
+
EFL_CHECK_PATH_MAX
have_poll="yes"
fi
-have_notify_win32="no"
-
-case "$host_os" in
- mingw32ce*)
- ;;
- mingw32*)
- have_notify_win32="yes"
- AC_DEFINE([HAVE_NOTIFY_WIN32], [1], [File monitoring with Windows notification])
- ;;
-esac
-
if ! test "x${have_atfile_source}" = "xno" ; then
AC_CHECK_FUNCS([mkdirat],
[
AC_MSG_RESULT([${have_xattr}])
-# Check for inotify specificity
-have_notify_win32="no"
-EIO_CHECK_NOTIFY_WIN32([have_notify_win32="yes"], [have_notify_win32="no"])
-AM_CONDITIONAL([EIO_HAVE_WINCHANGE], [test "x${have_notify_win32}" = "xyes"])
-
#### End of Eio
lib/ecore_file/ecore_file.c \
lib/ecore_file/ecore_file_download.c \
lib/ecore_file/ecore_file_monitor.c \
-lib/ecore_file/ecore_file_monitor_inotify.c \
-lib/ecore_file/ecore_file_monitor_poll.c \
-lib/ecore_file/ecore_file_monitor_win32.c \
lib/ecore_file/ecore_file_path.c \
lib/ecore_file/ecore_file_private.h
+if HAVE_INOTIFY
+lib_ecore_file_libecore_file_la_SOURCES += \
+lib/ecore_file/ecore_file_monitor_inotify.c
+else
+if HAVE_NOTIFY_WIN32
+lib_ecore_file_libecore_file_la_SOURCES += \
+lib/ecore_file/ecore_file_monitor_win32.c
+else
+lib_ecore_file_libecore_file_la_SOURCES += \
+lib/ecore_file/ecore_file_monitor_poll.c
+endif
+endif
+
lib_ecore_file_libecore_file_la_CPPFLAGS = \
-I$(top_srcdir)/src/lib/eina \
-I$(top_srcdir)/src/lib/eo \
if HAVE_INOTIFY
lib_eio_libeio_la_SOURCES += lib/eio/eio_monitor_inotify.c
else
-if EIO_HAVE_WINCHANGE
+if HAVE_NOTIFY_WIN32
lib_eio_libeio_la_SOURCES += lib/eio/eio_monitor_win32.c
endif
endif
#include "ecore_file_private.h"
-typedef enum {
- ECORE_FILE_MONITOR_TYPE_NONE,
-#ifdef HAVE_SYS_INOTIFY_H
- ECORE_FILE_MONITOR_TYPE_INOTIFY,
-#endif
-#ifdef HAVE_NOTIFY_WIN32
- ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32,
-#endif
-#ifdef HAVE_POLL
- ECORE_FILE_MONITOR_TYPE_POLL
-#endif
-} Ecore_File_Monitor_Type;
-
-static Ecore_File_Monitor_Type monitor_type = ECORE_FILE_MONITOR_TYPE_NONE;
-
int
ecore_file_monitor_init(void)
{
-#ifdef HAVE_SYS_INOTIFY_H
- monitor_type = ECORE_FILE_MONITOR_TYPE_INOTIFY;
- if (ecore_file_monitor_inotify_init())
+ if (ecore_file_monitor_backend_init())
return 1;
-#endif
-#ifdef HAVE_NOTIFY_WIN32
- monitor_type = ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32;
- if (ecore_file_monitor_win32_init())
- return 1;
-#endif
-#ifdef HAVE_POLL
- monitor_type = ECORE_FILE_MONITOR_TYPE_POLL;
- if (ecore_file_monitor_poll_init())
- return 1;
-#endif
- monitor_type = ECORE_FILE_MONITOR_TYPE_NONE;
return 0;
}
void
ecore_file_monitor_shutdown(void)
{
- switch (monitor_type)
- {
- case ECORE_FILE_MONITOR_TYPE_NONE:
- break;
-#ifdef HAVE_SYS_INOTIFY_H
- case ECORE_FILE_MONITOR_TYPE_INOTIFY:
- ecore_file_monitor_inotify_shutdown();
- break;
-#endif
-#ifdef HAVE_NOTIFY_WIN32
- case ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32:
- ecore_file_monitor_win32_shutdown();
- break;
-#endif
-#ifdef HAVE_POLL
- case ECORE_FILE_MONITOR_TYPE_POLL:
- ecore_file_monitor_poll_shutdown();
- break;
-#endif
- }
+ ecore_file_monitor_backend_shutdown();
}
/**
Ecore_File_Monitor_Cb func,
void *data)
{
- if (!path || !*path)
- return NULL;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(path[0] == '\0', NULL);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
- switch (monitor_type)
- {
- case ECORE_FILE_MONITOR_TYPE_NONE:
- return NULL;
-#ifdef HAVE_SYS_INOTIFY_H
- case ECORE_FILE_MONITOR_TYPE_INOTIFY:
- return ecore_file_monitor_inotify_add(path, func, data);
-#endif
-#ifdef HAVE_NOTIFY_WIN32
- case ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32:
- return ecore_file_monitor_win32_add(path, func, data);
-#endif
-#ifdef HAVE_POLL
- case ECORE_FILE_MONITOR_TYPE_POLL:
- return ecore_file_monitor_poll_add(path, func, data);
-#endif
- }
- return NULL;
+ return ecore_file_monitor_backend_add(path, func, data);
}
/**
EAPI void
ecore_file_monitor_del(Ecore_File_Monitor *em)
{
- if (!em)
- return;
-
- switch (monitor_type)
- {
- case ECORE_FILE_MONITOR_TYPE_NONE:
- break;
-#ifdef HAVE_SYS_INOTIFY_H
- case ECORE_FILE_MONITOR_TYPE_INOTIFY:
- ecore_file_monitor_inotify_del(em);
- break;
-#endif
-#ifdef HAVE_NOTIFY_WIN32
- case ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32:
- ecore_file_monitor_win32_del(em);
- break;
-#endif
-#ifdef HAVE_POLL
- case ECORE_FILE_MONITOR_TYPE_POLL:
- ecore_file_monitor_poll_del(em);
- break;
-#endif
- }
+ EINA_SAFETY_ON_NULL_RETURN(em);
+ ecore_file_monitor_backend_del(em);
}
/**
EAPI const char *
ecore_file_monitor_path_get(Ecore_File_Monitor *em)
{
- if (!em)
- return NULL;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(em, NULL);
return em->path;
}
* - Listen to IN_IGNORED, emitted when the watch is removed
*/
-#ifdef HAVE_SYS_INOTIFY_H
-
#include <sys/inotify.h>
#endif
int
-ecore_file_monitor_inotify_init(void)
+ecore_file_monitor_backend_init(void)
{
int fd;
}
int
-ecore_file_monitor_inotify_shutdown(void)
+ecore_file_monitor_backend_shutdown(void)
{
int fd;
while(_monitors)
- ecore_file_monitor_inotify_del(_monitors);
+ ecore_file_monitor_backend_del(_monitors);
if (_fdh)
{
}
Ecore_File_Monitor *
-ecore_file_monitor_inotify_add(const char *path,
+ecore_file_monitor_backend_add(const char *path,
void (*func) (void *data, Ecore_File_Monitor *em,
Ecore_File_Event event,
const char *path),
if (_inotify_fd_pid != getpid())
{
- ecore_file_monitor_inotify_shutdown();
- ecore_file_monitor_inotify_init();
+ ecore_file_monitor_backend_shutdown();
+ ecore_file_monitor_backend_init();
}
em = calloc(1, sizeof(Ecore_File_Monitor_Inotify));
}
void
-ecore_file_monitor_inotify_del(Ecore_File_Monitor *em)
+ecore_file_monitor_backend_del(Ecore_File_Monitor *em)
{
int fd;
if (ECORE_FILE_MONITOR_INOTIFY(em)->wd < 0)
{
INF("inotify_add_watch failed, file was deleted");
- ecore_file_monitor_inotify_del(em);
+ ecore_file_monitor_backend_del(em);
return 0;
}
return 1;
INF("Inotify unmount %s: %s", type, file);
}
#endif
-#endif /* HAVE_SYS_INOTIFY_H */
#include "ecore_file_private.h"
-#ifdef HAVE_POLL
-
/*
* TODO:
* - Implement recursive as an option!
static int _ecore_file_monitor_poll_checking(Ecore_File_Monitor *em, char *name);
int
-ecore_file_monitor_poll_init(void)
+ecore_file_monitor_backend_init(void)
{
return 1;
}
int
-ecore_file_monitor_poll_shutdown(void)
+ecore_file_monitor_backend_shutdown(void)
{
while(_monitors)
- ecore_file_monitor_poll_del(_monitors);
+ ecore_file_monitor_backend_del(_monitors);
if (_timer)
{
}
Ecore_File_Monitor *
-ecore_file_monitor_poll_add(const char *path,
+ecore_file_monitor_backend_add(const char *path,
void (*func) (void *data, Ecore_File_Monitor *em,
Ecore_File_Event event,
const char *path),
}
else
{
- ecore_file_monitor_poll_del(em);
+ ecore_file_monitor_backend_del(em);
return NULL;
}
}
void
-ecore_file_monitor_poll_del(Ecore_File_Monitor *em)
+ecore_file_monitor_backend_del(Ecore_File_Monitor *em)
{
Ecore_File *l;
}
return 0;
}
-#endif
# include <config.h>\r
#endif\r
\r
-#ifdef HAVE_NOTIFY_WIN32\r
-\r
# define WIN32_LEAN_AND_MEAN\r
# include <windows.h>\r
# undef WIN32_LEAN_AND_MEAN\r
}\r
\r
int\r
-ecore_file_monitor_win32_init(void)\r
+ecore_file_monitor_backend_init(void)\r
{\r
return 1;\r
}\r
\r
int\r
-ecore_file_monitor_win32_shutdown(void)\r
+ecore_file_monitor_backend_shutdown(void)\r
{\r
return 1;\r
}\r
\r
Ecore_File_Monitor *\r
-ecore_file_monitor_win32_add(const char *path,\r
+ecore_file_monitor_backend_add(const char *path,\r
void (*func) (void *data, Ecore_File_Monitor *em,\r
Ecore_File_Event event,\r
const char *path),\r
}\r
\r
void\r
-ecore_file_monitor_win32_del(Ecore_File_Monitor *em)\r
+ecore_file_monitor_backend_del(Ecore_File_Monitor *em)\r
{\r
Ecore_File_Monitor_Win32 *m;\r
\r
free(em->path);\r
free(em);\r
}\r
-\r
-#endif\r
Ecore_File *files;
};
-#ifdef HAVE_SYS_INOTIFY_H
-int ecore_file_monitor_inotify_init(void);
-int ecore_file_monitor_inotify_shutdown(void);
-Ecore_File_Monitor *ecore_file_monitor_inotify_add(const char *path,
- void (*func) (void *data,
- Ecore_File_Monitor *ecore_file_monitor,
- Ecore_File_Event event,
- const char *path),
- void *data);
-void ecore_file_monitor_inotify_del(Ecore_File_Monitor *ecore_file_monitor);
-#endif
-
-#ifdef HAVE_NOTIFY_WIN32
-int ecore_file_monitor_win32_init(void);
-int ecore_file_monitor_win32_shutdown(void);
-Ecore_File_Monitor *ecore_file_monitor_win32_add(const char *path,
- void (*func) (void *data,
- Ecore_File_Monitor *ecore_file_monitor,
- Ecore_File_Event event,
- const char *path),
- void *data);
-void ecore_file_monitor_win32_del(Ecore_File_Monitor *ecore_file_monitor);
-#endif
-
-#ifdef HAVE_POLL
-int ecore_file_monitor_poll_init(void);
-int ecore_file_monitor_poll_shutdown(void);
-Ecore_File_Monitor *ecore_file_monitor_poll_add(const char *path,
- void (*func) (void *data,
- Ecore_File_Monitor *ecore_file_monitor,
- Ecore_File_Event event,
- const char *path),
- void *data);
-void ecore_file_monitor_poll_del(Ecore_File_Monitor *ecore_file_monitor);
-
-#endif
+int ecore_file_monitor_backend_init(void);
+int ecore_file_monitor_backend_shutdown(void);
+Ecore_File_Monitor *ecore_file_monitor_backend_add(const char *path,
+ void (*func) (void *data,
+ Ecore_File_Monitor *ecore_file_monitor,
+ Ecore_File_Event event,
+ const char *path),
+ void *data);
+void ecore_file_monitor_backend_del(Ecore_File_Monitor *ecore_file_monitor);
/* ecore_file_path */
void ecore_file_path_init(void);