New API, iwatch_add1() with no preset mask

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2022-12-18 22:21:15 +01:00
1 parent ff5e3219be
commit c586204fc1
2 files changed
+8 -2

No files matched your search

+7 -2
View File
@@ -87,7 +87,7 @@ void iwatch_exit(struct iwatch *iw)
initialized = 0; initialized = 0;
} }
int iwatch_add(struct iwatch *iw, char *file, uint32_t mask) int iwatch_add1(struct iwatch *iw, char *file, uint32_t mask)
{ {
struct iwatch_path *iwp; struct iwatch_path *iwp;
char *path; char *path;
@@ -108,7 +108,7 @@ int iwatch_add(struct iwatch *iw, char *file, uint32_t mask)
return -1; return -1;
} }
wd = inotify_add_watch(iw->fd, path, IWATCH_MASK | mask); wd = inotify_add_watch(iw->fd, path, mask);
if (wd < 0) { if (wd < 0) {
switch (errno) { switch (errno) {
case EEXIST: case EEXIST:
@@ -147,6 +147,11 @@ int iwatch_add(struct iwatch *iw, char *file, uint32_t mask)
return 0; return 0;
} }
int iwatch_add(struct iwatch *iw, char *file, uint32_t mask)
{
return iwatch_add1(iw, file, IWATCH_MASK | mask);
}
int iwatch_del(struct iwatch *iw, struct iwatch_path *iwp) int iwatch_del(struct iwatch *iw, struct iwatch_path *iwp)
{ {
if (!initialized) if (!initialized)
+1
View File
@@ -59,6 +59,7 @@ struct iwatch {
int iwatch_init (struct iwatch *iw); int iwatch_init (struct iwatch *iw);
void iwatch_exit (struct iwatch *iw); void iwatch_exit (struct iwatch *iw);
int iwatch_add1 (struct iwatch *iw, char *file, uint32_t mask);
int iwatch_add (struct iwatch *iw, char *file, uint32_t mask); int iwatch_add (struct iwatch *iw, char *file, uint32_t mask);
int iwatch_del (struct iwatch *iw, struct iwatch_path *iwp); int iwatch_del (struct iwatch *iw, struct iwatch_path *iwp);