1 /* 2 clsync - file tree sync utility based on inotify/kqueue 3 4 Copyright (C) 2014 Dmitry Yu Okunev <dyokunev@ut.mephi.ru> 0x8E30679C 5 6 This program is free software: you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 21 /* We will use inotify event masks while kqueue in clsync, so it's required to 22 define it: */ 23 #ifndef IN_ISDIR 24 #define IN_ACCESS 0x00000001 /* File was accessed. */ 25 #define IN_MODIFY 0x00000002 /* File was modified. */ 26 #define IN_ATTRIB 0x00000004 /* Metadata changed. */ 27 #define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed. */ 28 #define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed. */ 29 #define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */ 30 #define IN_OPEN 0x00000020 /* File was opened. */ 31 #define IN_MOVED_FROM 0x00000040 /* File was moved from X. */ 32 #define IN_MOVED_TO 0x00000080 /* File was moved to Y. */ 33 #define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */ 34 #define IN_CREATE 0x00000100 /* Subfile was created. */ 35 #define IN_DELETE 0x00000200 /* Subfile was deleted. */ 36 #define IN_DELETE_SELF 0x00000400 /* Self was deleted. */ 37 #define IN_MOVE_SELF 0x00000800 /* Self was moved. */ 38 #define IN_IGNORED 0x00008000 39 #define IN_ISDIR 0x40000000 40 #endif 41 42 extern int kqueue_init(); 43 extern int kqueue_add_watch_dir(struct ctx *ctx_p, struct indexes *indexes_p, const char *const accpath); 44 extern int kqueue_wait(struct ctx *ctx_p, struct indexes *indexes_p, struct timeval *tv_p); 45 extern int kqueue_handle(struct ctx *ctx_p, struct indexes *indexes_p); 46 extern int kqueue_deinit(ctx_t *ctx_p); 47 48