2008-05-25 22:16:34 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2013-11-25 02:21:52 -08:00
|
|
|
#include <errno.h>
|
2011-12-06 14:33:01 -08:00
|
|
|
#include <stdlib.h>
|
2009-01-31 10:33:39 -08:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2010-01-03 13:55:50 -08:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
2012-12-07 03:01:41 -08:00
|
|
|
#include <fcntl.h>
|
2009-01-31 10:33:39 -08:00
|
|
|
|
2005-02-20 04:17:07 -08:00
|
|
|
#include "ecore_file_private.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* TODO:
|
2005-08-27 04:50:50 -07:00
|
|
|
*
|
2007-03-27 11:15:16 -07:00
|
|
|
* - Listen to these events:
|
2005-08-27 04:50:50 -07:00
|
|
|
* IN_ACCESS, IN_ATTRIB, IN_CLOSE_WRITE, IN_CLOSE_NOWRITE, IN_OPEN
|
2007-03-27 11:15:16 -07:00
|
|
|
* - Read all events first, then call the callbacks. This will prevent several
|
|
|
|
* callbacks with the typic save cycle (delete file, new file)
|
2010-11-25 11:08:08 -08:00
|
|
|
* - Listen to IN_IGNORED, emitted when the watch is removed
|
2005-02-20 04:17:07 -08:00
|
|
|
*/
|
|
|
|
|
2012-11-05 13:59:39 -08:00
|
|
|
#include <sys/inotify.h>
|
2007-04-04 04:10:44 -07:00
|
|
|
|
|
|
|
|
2005-02-20 04:17:07 -08:00
|
|
|
typedef struct _Ecore_File_Monitor_Inotify Ecore_File_Monitor_Inotify;
|
|
|
|
|
|
|
|
#define ECORE_FILE_MONITOR_INOTIFY(x) ((Ecore_File_Monitor_Inotify *)(x))
|
|
|
|
|
|
|
|
struct _Ecore_File_Monitor_Inotify
|
|
|
|
{
|
|
|
|
Ecore_File_Monitor monitor;
|
2005-03-29 22:35:12 -08:00
|
|
|
int wd;
|
2005-02-20 04:17:07 -08:00
|
|
|
};
|
|
|
|
|
2005-03-29 22:35:12 -08:00
|
|
|
static Ecore_Fd_Handler *_fdh = NULL;
|
2009-06-17 04:41:12 -07:00
|
|
|
static Ecore_File_Monitor *_monitors = NULL;
|
2011-02-21 22:09:46 -08:00
|
|
|
static pid_t _inotify_fd_pid = -1;
|
2005-02-20 04:17:07 -08:00
|
|
|
|
2010-06-24 09:15:56 -07:00
|
|
|
static Eina_Bool _ecore_file_monitor_inotify_handler(void *data, Ecore_Fd_Handler *fdh);
|
2015-04-23 05:54:20 -07:00
|
|
|
static Eina_List *_ecore_file_monitor_inotify_monitor_find(int wd);
|
2007-03-26 22:36:29 -07:00
|
|
|
static void _ecore_file_monitor_inotify_events(Ecore_File_Monitor *em, char *file, int mask);
|
|
|
|
static int _ecore_file_monitor_inotify_monitor(Ecore_File_Monitor *em, const char *path);
|
2006-09-06 00:10:25 -07:00
|
|
|
#if 0
|
2006-06-07 02:40:24 -07:00
|
|
|
static void _ecore_file_monitor_inotify_print(char *file, int mask);
|
2006-09-06 00:10:25 -07:00
|
|
|
#endif
|
2005-02-20 04:17:07 -08:00
|
|
|
|
2018-02-02 13:59:56 -08:00
|
|
|
static Eina_Bool reseting;
|
2015-04-09 16:52:08 -07:00
|
|
|
static Eina_Hash *monitor_hash;
|
|
|
|
|
2018-02-02 13:59:56 -08:00
|
|
|
static void
|
|
|
|
_ecore_file_monitor_inotify_reset()
|
|
|
|
{
|
|
|
|
Eina_Iterator *it;
|
|
|
|
Ecore_File_Monitor *em;
|
|
|
|
Eina_Hash *h = monitor_hash;
|
|
|
|
monitor_hash = NULL;
|
|
|
|
reseting = 1;
|
|
|
|
ecore_file_monitor_backend_shutdown();
|
|
|
|
ecore_file_monitor_backend_init();
|
|
|
|
it = eina_hash_iterator_data_new(h);
|
|
|
|
EINA_ITERATOR_FOREACH(it, em)
|
|
|
|
_ecore_file_monitor_inotify_monitor(em, em->path);
|
|
|
|
eina_iterator_free(it);
|
|
|
|
eina_hash_free(h);
|
|
|
|
reseting = 0;
|
|
|
|
}
|
|
|
|
|
2005-02-20 04:17:07 -08:00
|
|
|
int
|
2012-12-06 05:38:34 -08:00
|
|
|
ecore_file_monitor_backend_init(void)
|
2005-02-20 04:17:07 -08:00
|
|
|
{
|
2005-03-29 22:35:12 -08:00
|
|
|
int fd;
|
|
|
|
|
2005-08-27 04:50:50 -07:00
|
|
|
fd = inotify_init();
|
2005-03-29 22:35:12 -08:00
|
|
|
if (fd < 0)
|
|
|
|
return 0;
|
2011-04-20 07:15:33 -07:00
|
|
|
|
2017-04-18 16:56:18 -07:00
|
|
|
eina_file_close_on_exec(fd, EINA_TRUE);
|
2012-12-07 03:01:41 -08:00
|
|
|
|
2005-03-29 22:35:12 -08:00
|
|
|
_fdh = ecore_main_fd_handler_add(fd, ECORE_FD_READ, _ecore_file_monitor_inotify_handler,
|
2010-09-30 00:25:06 -07:00
|
|
|
NULL, NULL, NULL);
|
2005-03-29 22:35:12 -08:00
|
|
|
if (!_fdh)
|
|
|
|
{
|
2010-09-30 00:25:06 -07:00
|
|
|
close(fd);
|
|
|
|
return 0;
|
2005-03-29 22:35:12 -08:00
|
|
|
}
|
2005-04-20 02:20:33 -07:00
|
|
|
|
2018-02-02 13:59:56 -08:00
|
|
|
if (!reseting)
|
|
|
|
ecore_fork_reset_callback_add(_ecore_file_monitor_inotify_reset, NULL);
|
2011-02-21 22:09:46 -08:00
|
|
|
_inotify_fd_pid = getpid();
|
2015-04-09 16:52:08 -07:00
|
|
|
monitor_hash = eina_hash_int32_new(NULL);
|
2005-02-20 04:17:07 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-12-06 05:38:34 -08:00
|
|
|
ecore_file_monitor_backend_shutdown(void)
|
2005-02-20 04:17:07 -08:00
|
|
|
{
|
2005-03-29 22:35:12 -08:00
|
|
|
int fd;
|
2005-04-20 02:20:33 -07:00
|
|
|
|
2009-06-17 04:41:12 -07:00
|
|
|
while(_monitors)
|
2012-12-06 05:38:34 -08:00
|
|
|
ecore_file_monitor_backend_del(_monitors);
|
2005-02-20 04:17:07 -08:00
|
|
|
|
2005-03-29 22:35:12 -08:00
|
|
|
if (_fdh)
|
2005-02-20 04:17:07 -08:00
|
|
|
{
|
2010-09-30 00:25:06 -07:00
|
|
|
fd = ecore_main_fd_handler_fd_get(_fdh);
|
|
|
|
ecore_main_fd_handler_del(_fdh);
|
2013-08-05 03:36:24 -07:00
|
|
|
if (fd > -1)
|
|
|
|
close(fd);
|
2005-02-20 04:17:07 -08:00
|
|
|
}
|
2016-05-06 13:12:39 -07:00
|
|
|
eina_hash_free(monitor_hash);
|
|
|
|
monitor_hash = NULL;
|
2011-02-21 22:09:46 -08:00
|
|
|
_inotify_fd_pid = -1;
|
2018-02-02 13:59:56 -08:00
|
|
|
if (!reseting)
|
|
|
|
ecore_fork_reset_callback_del(_ecore_file_monitor_inotify_reset, NULL);
|
2005-02-20 04:17:07 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
Ecore_File_Monitor *
|
2012-12-06 05:38:34 -08:00
|
|
|
ecore_file_monitor_backend_add(const char *path,
|
2010-09-30 00:25:06 -07:00
|
|
|
void (*func) (void *data, Ecore_File_Monitor *em,
|
|
|
|
Ecore_File_Event event,
|
|
|
|
const char *path),
|
|
|
|
void *data)
|
2005-02-20 04:17:07 -08:00
|
|
|
{
|
|
|
|
Ecore_File_Monitor *em;
|
2016-04-21 20:03:25 -07:00
|
|
|
char *path2;
|
|
|
|
size_t len;
|
2005-02-20 04:17:07 -08:00
|
|
|
|
2011-02-21 22:09:46 -08:00
|
|
|
if (_inotify_fd_pid == -1) return NULL;
|
|
|
|
|
|
|
|
if (_inotify_fd_pid != getpid())
|
2018-02-02 13:59:56 -08:00
|
|
|
_ecore_file_monitor_inotify_reset();
|
2011-04-20 07:15:33 -07:00
|
|
|
|
2014-01-08 17:02:26 -08:00
|
|
|
em = (Ecore_File_Monitor *)calloc(1, sizeof(Ecore_File_Monitor_Inotify));
|
2005-02-20 04:17:07 -08:00
|
|
|
if (!em) return NULL;
|
|
|
|
|
|
|
|
em->func = func;
|
|
|
|
em->data = data;
|
|
|
|
|
2016-04-21 20:03:25 -07:00
|
|
|
len = strlen(path);
|
|
|
|
path2 = alloca(len + 1);
|
2016-04-23 07:45:28 -07:00
|
|
|
strcpy(path2, path);
|
2016-04-21 20:03:25 -07:00
|
|
|
if (path2[len - 1] == '/' && strcmp(path2, "/")) path2[len - 1] = 0;
|
|
|
|
em->path = eina_stringshare_add(path2);
|
2005-02-20 04:17:07 -08:00
|
|
|
|
2009-06-17 04:41:12 -07:00
|
|
|
_monitors = ECORE_FILE_MONITOR(eina_inlist_append(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em)));
|
2007-07-03 12:37:18 -07:00
|
|
|
|
2012-10-18 02:11:25 -07:00
|
|
|
if (!_ecore_file_monitor_inotify_monitor(em, em->path))
|
|
|
|
return NULL;
|
2005-02-20 04:17:07 -08:00
|
|
|
|
|
|
|
return em;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-12-06 05:38:34 -08:00
|
|
|
ecore_file_monitor_backend_del(Ecore_File_Monitor *em)
|
2005-02-20 04:17:07 -08:00
|
|
|
{
|
2005-03-29 22:35:12 -08:00
|
|
|
int fd;
|
2005-02-20 04:17:07 -08:00
|
|
|
|
2010-11-22 12:51:20 -08:00
|
|
|
if (_monitors)
|
|
|
|
_monitors = ECORE_FILE_MONITOR(eina_inlist_remove(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em)));
|
2015-04-09 16:52:08 -07:00
|
|
|
if (ECORE_FILE_MONITOR_INOTIFY(em)->wd >= 0)
|
2015-04-23 05:54:20 -07:00
|
|
|
eina_hash_list_remove(monitor_hash, &ECORE_FILE_MONITOR_INOTIFY(em)->wd, em);
|
2005-03-29 22:35:12 -08:00
|
|
|
|
|
|
|
fd = ecore_main_fd_handler_fd_get(_fdh);
|
|
|
|
if (ECORE_FILE_MONITOR_INOTIFY(em)->wd)
|
2005-08-27 04:50:50 -07:00
|
|
|
inotify_rm_watch(fd, ECORE_FILE_MONITOR_INOTIFY(em)->wd);
|
2016-04-21 20:03:25 -07:00
|
|
|
eina_stringshare_del(em->path);
|
2005-02-20 04:17:07 -08:00
|
|
|
free(em);
|
|
|
|
}
|
|
|
|
|
2010-06-24 09:15:56 -07:00
|
|
|
static Eina_Bool
|
2012-11-25 01:55:32 -08:00
|
|
|
_ecore_file_monitor_inotify_handler(void *data EINA_UNUSED, Ecore_Fd_Handler *fdh)
|
2005-02-20 04:17:07 -08:00
|
|
|
{
|
2018-01-14 20:54:01 -08:00
|
|
|
Eina_List *l, *ll, *ll2;
|
2005-03-29 22:35:12 -08:00
|
|
|
Ecore_File_Monitor *em;
|
|
|
|
char buffer[16384];
|
|
|
|
struct inotify_event *event;
|
2013-08-05 03:40:02 -07:00
|
|
|
int i = 0, fd;
|
2005-03-29 22:35:12 -08:00
|
|
|
int event_size;
|
|
|
|
ssize_t size;
|
|
|
|
|
2013-08-05 03:40:02 -07:00
|
|
|
fd = ecore_main_fd_handler_fd_get(fdh);
|
|
|
|
if (fd < 0) return ECORE_CALLBACK_RENEW;
|
|
|
|
|
|
|
|
size = read(fd, buffer, sizeof(buffer));
|
2014-10-27 06:57:53 -07:00
|
|
|
while ((i + (int) sizeof(struct inotify_event)) <= (int) size)
|
2005-02-20 04:17:07 -08:00
|
|
|
{
|
2010-09-30 00:25:06 -07:00
|
|
|
event = (struct inotify_event *)&buffer[i];
|
|
|
|
event_size = sizeof(struct inotify_event) + event->len;
|
2014-10-27 06:57:53 -07:00
|
|
|
if ((event_size + i) > size) break ;
|
2010-09-30 00:25:06 -07:00
|
|
|
i += event_size;
|
2005-02-20 04:17:07 -08:00
|
|
|
|
2015-04-23 05:54:20 -07:00
|
|
|
l = _ecore_file_monitor_inotify_monitor_find(event->wd);
|
2018-01-14 20:54:01 -08:00
|
|
|
EINA_LIST_FOREACH_SAFE(l, ll, ll2, em)
|
2015-04-23 05:54:20 -07:00
|
|
|
_ecore_file_monitor_inotify_events(em, (event->len ? event->name : NULL), event->mask);
|
2005-02-20 04:17:07 -08:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:15:56 -07:00
|
|
|
return ECORE_CALLBACK_RENEW;
|
2005-02-20 04:17:07 -08:00
|
|
|
}
|
|
|
|
|
2015-04-23 05:54:20 -07:00
|
|
|
static Eina_List *
|
2005-03-29 22:35:12 -08:00
|
|
|
_ecore_file_monitor_inotify_monitor_find(int wd)
|
2005-02-20 04:17:07 -08:00
|
|
|
{
|
2015-04-09 16:52:08 -07:00
|
|
|
return eina_hash_find(monitor_hash, &wd);
|
2005-02-20 04:17:07 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-03-29 22:35:12 -08:00
|
|
|
_ecore_file_monitor_inotify_events(Ecore_File_Monitor *em, char *file, int mask)
|
2005-02-20 04:17:07 -08:00
|
|
|
{
|
2005-03-29 22:35:12 -08:00
|
|
|
char buf[PATH_MAX];
|
2005-08-27 04:50:50 -07:00
|
|
|
int isdir;
|
|
|
|
|
2007-03-26 12:30:51 -07:00
|
|
|
if ((file) && (file[0]))
|
2005-03-29 22:35:12 -08:00
|
|
|
snprintf(buf, sizeof(buf), "%s/%s", em->path, file);
|
|
|
|
else
|
2013-12-07 09:32:17 -08:00
|
|
|
{
|
|
|
|
strncpy(buf, em->path, sizeof(buf));
|
|
|
|
buf[PATH_MAX - 1] = 0;
|
|
|
|
}
|
2005-08-27 04:50:50 -07:00
|
|
|
isdir = mask & IN_ISDIR;
|
2005-02-20 04:17:07 -08:00
|
|
|
|
2006-06-07 02:40:24 -07:00
|
|
|
#if 0
|
2010-11-24 13:15:36 -08:00
|
|
|
_ecore_file_monitor_inotify_print(buf, mask);
|
2006-06-07 02:40:24 -07:00
|
|
|
#endif
|
|
|
|
|
2010-11-24 13:15:52 -08:00
|
|
|
if (mask & IN_ATTRIB)
|
|
|
|
{
|
|
|
|
em->func(em->data, em, ECORE_FILE_EVENT_MODIFIED, buf);
|
|
|
|
}
|
|
|
|
if (mask & IN_CLOSE_WRITE)
|
2005-02-20 04:17:07 -08:00
|
|
|
{
|
2010-09-30 00:25:06 -07:00
|
|
|
if (!isdir)
|
2011-03-01 01:57:13 -08:00
|
|
|
em->func(em->data, em, ECORE_FILE_EVENT_CLOSED, buf);
|
2005-02-20 04:17:07 -08:00
|
|
|
}
|
2011-01-18 00:43:27 -08:00
|
|
|
if (mask & IN_MODIFY)
|
|
|
|
{
|
|
|
|
if (!isdir)
|
|
|
|
em->func(em->data, em, ECORE_FILE_EVENT_MODIFIED, buf);
|
|
|
|
}
|
2005-03-29 22:35:12 -08:00
|
|
|
if (mask & IN_MOVED_FROM)
|
2005-02-20 04:17:07 -08:00
|
|
|
{
|
2010-09-30 00:25:06 -07:00
|
|
|
if (isdir)
|
|
|
|
em->func(em->data, em, ECORE_FILE_EVENT_DELETED_DIRECTORY, buf);
|
|
|
|
else
|
|
|
|
em->func(em->data, em, ECORE_FILE_EVENT_DELETED_FILE, buf);
|
2005-02-20 04:17:07 -08:00
|
|
|
}
|
2005-03-29 22:35:12 -08:00
|
|
|
if (mask & IN_MOVED_TO)
|
2005-02-20 04:17:07 -08:00
|
|
|
{
|
2010-09-30 00:25:06 -07:00
|
|
|
if (isdir)
|
|
|
|
em->func(em->data, em, ECORE_FILE_EVENT_CREATED_DIRECTORY, buf);
|
|
|
|
else
|
|
|
|
em->func(em->data, em, ECORE_FILE_EVENT_CREATED_FILE, buf);
|
2005-03-29 22:35:12 -08:00
|
|
|
}
|
2005-08-27 04:50:50 -07:00
|
|
|
if (mask & IN_DELETE)
|
2005-03-29 22:35:12 -08:00
|
|
|
{
|
2010-09-30 00:25:06 -07:00
|
|
|
if (isdir)
|
|
|
|
em->func(em->data, em, ECORE_FILE_EVENT_DELETED_DIRECTORY, buf);
|
|
|
|
else
|
|
|
|
em->func(em->data, em, ECORE_FILE_EVENT_DELETED_FILE, buf);
|
2005-03-29 22:35:12 -08:00
|
|
|
}
|
2005-08-27 04:50:50 -07:00
|
|
|
if (mask & IN_CREATE)
|
2005-03-29 22:35:12 -08:00
|
|
|
{
|
2010-09-30 00:25:06 -07:00
|
|
|
if (isdir)
|
|
|
|
em->func(em->data, em, ECORE_FILE_EVENT_CREATED_DIRECTORY, buf);
|
|
|
|
else
|
|
|
|
em->func(em->data, em, ECORE_FILE_EVENT_CREATED_FILE, buf);
|
2005-03-29 22:35:12 -08:00
|
|
|
}
|
|
|
|
if (mask & IN_DELETE_SELF)
|
|
|
|
{
|
2010-09-30 00:25:06 -07:00
|
|
|
em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path);
|
2005-03-29 22:35:12 -08:00
|
|
|
}
|
2005-08-29 08:15:59 -07:00
|
|
|
if (mask & IN_MOVE_SELF)
|
|
|
|
{
|
2010-09-30 00:25:06 -07:00
|
|
|
/* We just call delete. The dir is gone... */
|
|
|
|
em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path);
|
2005-08-29 08:15:59 -07:00
|
|
|
}
|
2005-03-29 22:35:12 -08:00
|
|
|
if (mask & IN_UNMOUNT)
|
|
|
|
{
|
2010-09-30 00:25:06 -07:00
|
|
|
/* We just call delete. The dir is gone... */
|
|
|
|
em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path);
|
2005-02-20 04:17:07 -08:00
|
|
|
}
|
2007-03-26 22:36:29 -07:00
|
|
|
if (mask & IN_IGNORED)
|
2017-10-03 10:33:14 -07:00
|
|
|
/* The watch is removed. If the file name still exists monitor the new one,
|
|
|
|
* else delete it */
|
|
|
|
_ecore_file_monitor_inotify_monitor(em, em->path);
|
2007-03-26 22:36:29 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_ecore_file_monitor_inotify_monitor(Ecore_File_Monitor *em, const char *path)
|
|
|
|
{
|
2014-10-31 06:15:46 -07:00
|
|
|
int mask = IN_ATTRIB | IN_CLOSE_WRITE | IN_MOVED_FROM | IN_MOVED_TO |
|
|
|
|
IN_DELETE | IN_CREATE | IN_MODIFY | IN_DELETE_SELF | IN_MOVE_SELF |
|
|
|
|
IN_UNMOUNT;
|
2011-04-20 07:15:33 -07:00
|
|
|
|
|
|
|
ECORE_FILE_MONITOR_INOTIFY(em)->wd =
|
2011-01-18 00:43:27 -08:00
|
|
|
inotify_add_watch(ecore_main_fd_handler_fd_get(_fdh), path, mask);
|
2007-03-26 22:36:29 -07:00
|
|
|
if (ECORE_FILE_MONITOR_INOTIFY(em)->wd < 0)
|
|
|
|
{
|
2013-11-25 02:21:52 -08:00
|
|
|
INF("inotify_add_watch failed, %s", strerror(errno));
|
2012-12-06 05:38:34 -08:00
|
|
|
ecore_file_monitor_backend_del(em);
|
2010-09-30 00:25:06 -07:00
|
|
|
return 0;
|
2007-03-26 22:36:29 -07:00
|
|
|
}
|
2015-04-23 05:54:20 -07:00
|
|
|
eina_hash_list_append(monitor_hash, &ECORE_FILE_MONITOR_INOTIFY(em)->wd, em);
|
2007-03-26 22:36:29 -07:00
|
|
|
return 1;
|
2005-02-20 04:17:07 -08:00
|
|
|
}
|
2005-08-27 04:50:50 -07:00
|
|
|
|
2006-09-06 00:10:25 -07:00
|
|
|
#if 0
|
2006-06-07 02:40:24 -07:00
|
|
|
static void
|
|
|
|
_ecore_file_monitor_inotify_print(char *file, int mask)
|
|
|
|
{
|
|
|
|
const char *type;
|
|
|
|
|
|
|
|
if (mask & IN_ISDIR)
|
|
|
|
type = "dir";
|
|
|
|
else
|
|
|
|
type = "file";
|
|
|
|
|
2010-11-24 13:15:20 -08:00
|
|
|
if (mask & IN_ACCESS)
|
|
|
|
INF("Inotify accessed %s: %s", type, file);
|
2006-06-07 02:40:24 -07:00
|
|
|
if (mask & IN_MODIFY)
|
2010-11-24 13:15:20 -08:00
|
|
|
INF("Inotify modified %s: %s", type, file);
|
|
|
|
if (mask & IN_ATTRIB)
|
|
|
|
INF("Inotify attributes %s: %s", type, file);
|
|
|
|
if (mask & IN_CLOSE_WRITE)
|
|
|
|
INF("Inotify close write %s: %s", type, file);
|
|
|
|
if (mask & IN_CLOSE_NOWRITE)
|
|
|
|
INF("Inotify close write %s: %s", type, file);
|
|
|
|
if (mask & IN_OPEN)
|
|
|
|
INF("Inotify open %s: %s", type, file);
|
2006-06-07 02:40:24 -07:00
|
|
|
if (mask & IN_MOVED_FROM)
|
2010-11-24 13:15:20 -08:00
|
|
|
INF("Inotify moved from %s: %s", type, file);
|
2006-06-07 02:40:24 -07:00
|
|
|
if (mask & IN_MOVED_TO)
|
2010-11-24 13:15:20 -08:00
|
|
|
INF("Inotify moved to %s: %s", type, file);
|
2006-06-07 02:40:24 -07:00
|
|
|
if (mask & IN_DELETE)
|
2010-11-24 13:15:20 -08:00
|
|
|
INF("Inotify delete %s: %s", type, file);
|
2006-06-07 02:40:24 -07:00
|
|
|
if (mask & IN_CREATE)
|
2010-11-24 13:15:20 -08:00
|
|
|
INF("Inotify create %s: %s", type, file);
|
2006-06-07 02:40:24 -07:00
|
|
|
if (mask & IN_DELETE_SELF)
|
2010-11-24 13:15:20 -08:00
|
|
|
INF("Inotify delete self %s: %s", type, file);
|
2006-06-07 02:40:24 -07:00
|
|
|
if (mask & IN_MOVE_SELF)
|
2010-11-24 13:15:20 -08:00
|
|
|
INF("Inotify move self %s: %s", type, file);
|
2006-06-07 02:40:24 -07:00
|
|
|
if (mask & IN_UNMOUNT)
|
2010-11-24 13:15:20 -08:00
|
|
|
INF("Inotify unmount %s: %s", type, file);
|
2006-06-07 02:40:24 -07:00
|
|
|
}
|
2006-09-06 00:10:25 -07:00
|
|
|
#endif
|