mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-08-28 17:55:39 +00:00
35 lines
490 B
C
35 lines
490 B
C
#ifdef __linux__
|
|
|
|
#include <sys/inotify.h>
|
|
|
|
int uwsgi_file_monitor_new() {
|
|
|
|
int inotify_fd ;
|
|
|
|
|
|
inotify_fd = inotify_init();
|
|
|
|
if (inotify_fd < 0) {
|
|
uwsgi_error("inotify_init()");
|
|
return -1;
|
|
}
|
|
|
|
return inotify_fd ;
|
|
}
|
|
|
|
int uwsgi_file_monitor_add(int fd, char *what) {
|
|
|
|
int inotify_watch_fd ;
|
|
|
|
inotify_watch_fd = inotify_add_watch(fd, what, IN_ALL_EVENTS);
|
|
|
|
if (inotify_watch_fd < 0) {
|
|
uwsgi_error("inotify_add_watch()");
|
|
return -1;
|
|
}
|
|
|
|
return inotify_watch_fd;
|
|
}
|
|
|
|
#endif
|