| 
 |   
| version 1.17.8.3, 2016/08/10 14:19:50 | version 1.17.8.4, 2016/08/10 14:33:23 | 
|---|---|
| Line 316 ioWatchDirLoop(const char *csDir, int (*callback)(cons | Line 316 ioWatchDirLoop(const char *csDir, int (*callback)(cons | 
| #ifndef __linux__ | #ifndef __linux__ | 
| int kq; | int kq; | 
| struct kevent req, chg; | struct kevent req, chg; | 
| #else | |
| int in; | |
| struct inotify_event evt; | |
| #endif | #endif | 
| char wrk[MAXPATHLEN * 2], str[MAXPATHLEN] = { 0 }; | char wrk[MAXPATHLEN * 2], str[MAXPATHLEN] = { 0 }; | 
| Line 325 ioWatchDirLoop(const char *csDir, int (*callback)(cons | Line 328 ioWatchDirLoop(const char *csDir, int (*callback)(cons | 
| strlcpy(str, csDir, MAXPATHLEN); | strlcpy(str, csDir, MAXPATHLEN); | 
| strlcat(str, "/*", MAXPATHLEN); | strlcat(str, "/*", MAXPATHLEN); | 
| #ifndef __linux__ | |
| d = open(csDir, O_RDONLY); | d = open(csDir, O_RDONLY); | 
| if (d == -1) { | if (d == -1) { | 
| LOGERR; | LOGERR; | 
| return -1; | return -1; | 
| } | } | 
| #ifndef __linux__ | |
| kq = kqueue(); | kq = kqueue(); | 
| if (kq == -1) { | if (kq == -1) { | 
| LOGERR; | LOGERR; | 
| Line 340 ioWatchDirLoop(const char *csDir, int (*callback)(cons | Line 343 ioWatchDirLoop(const char *csDir, int (*callback)(cons | 
| } | } | 
| EV_SET(&req, d, EVFILT_VNODE, EV_ADD | EV_CLEAR, NOTE_WRITE, 0, 0); | EV_SET(&req, d, EVFILT_VNODE, EV_ADD | EV_CLEAR, NOTE_WRITE, 0, 0); | 
| #else | |
| in = inotify_init(); | |
| if (in == -1) { | |
| LOGERR; | |
| return -1; | |
| } | |
| d = inotify_add_watch(in, csDir, IN_CREATE | IN_DELETE); | |
| #endif | #endif | 
| if ((n = glob(str, GLOB_NOCHECK, NULL, &g[0]))) { | if ((n = glob(str, GLOB_NOCHECK, NULL, &g[0]))) { | 
| LOGERR; | LOGERR; | 
| close(d); | |
| #ifndef __linux__ | #ifndef __linux__ | 
| close(kq); | close(kq); | 
| close(d); | |
| #else | |
| inotify_rm_watch(in, d); | |
| close(in); | |
| #endif | #endif | 
| return -1; | return -1; | 
| } /*else | } /*else | 
| Line 419 ioWatchDirLoop(const char *csDir, int (*callback)(cons | Line 433 ioWatchDirLoop(const char *csDir, int (*callback)(cons | 
| globfree(&g[0]); | globfree(&g[0]); | 
| #ifndef __linux__ | #ifndef __linux__ | 
| close(kq); | close(kq); | 
| #endif | |
| close(d); | close(d); | 
| #else | |
| inotify_rm_watch(in, d); | |
| close(in); | |
| #endif | |
| return n; | return n; | 
| } | } |