New API, iwatch_add1() with no preset mask

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2022-12-18 22:21:15 +01:00
parent ff5e3219be
commit c586204fc1
2 changed files with 8 additions and 2 deletions
+7 -2
View File
@@ -87,7 +87,7 @@ void iwatch_exit(struct iwatch *iw)
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;
char *path;
@@ -108,7 +108,7 @@ int iwatch_add(struct iwatch *iw, char *file, uint32_t mask)
return -1;
}
wd = inotify_add_watch(iw->fd, path, IWATCH_MASK | mask);
wd = inotify_add_watch(iw->fd, path, mask);
if (wd < 0) {
switch (errno) {
case EEXIST:
@@ -147,6 +147,11 @@ int iwatch_add(struct iwatch *iw, char *file, uint32_t mask)
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)
{
if (!initialized)
+1
View File
@@ -59,6 +59,7 @@ struct iwatch {
int iwatch_init (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_del (struct iwatch *iw, struct iwatch_path *iwp);