aboutsummaryrefslogtreecommitdiff
path: root/inotify_c.c
diff options
context:
space:
mode:
Diffstat (limited to 'inotify_c.c')
-rw-r--r--inotify_c.c63
1 files changed, 0 insertions, 63 deletions
diff --git a/inotify_c.c b/inotify_c.c
index 0521b95..ab8f319 100644
--- a/inotify_c.c
+++ b/inotify_c.c
@@ -9,73 +9,10 @@
#include "Clean.h"
-/**
- * Cast a CleanString to a char*
- * The result should be freed.
- */
-char* clstocs(CleanString* cs) {
- char* s = calloc(CleanStringLength(cs) + 1, 1);
- uint8_t i;
- for (i = 0; i < CleanStringLength(cs); i++)
- s[i] = CleanStringCharacters(cs)[i];
- s[i] = 0;
- return s;
-}
-
/** The empty string, as a CleanString */
static struct {int length; char chars[1]; } empty_string = {0,""};
/**
- * Get the errno. The parameter is ignored, it is just there because ccalls
- * need to have an argument.
- */
-int clean_errno(int ignored) {
- return errno;
-}
-
-/**
- * Initialise an inotify file descriptor and change to NONBLOCK mode.
- */
-int clean_inotify_init(int ignored) {
- int fd;
- fd = inotify_init();
- if (fd < 0)
- return 0;
- fcntl(fd, IN_NONBLOCK);
- return fd;
-}
-
-/**
- * Add a watch on some file.
- *
- * fd The inotify file descriptor
- * fname The file to watch
- * mask A mask of events to watch on
- * re_watch Will be set to the resulting watch descriptor
- * re_fd Will be set to fd (needed for uniqueness)
- */
-void clean_inotify_add_watch(int fd, CleanString* fname_, int mask,
- int *re_watch, int *re_fd) {
- char* fname = clstocs(fname_);
- *re_watch = inotify_add_watch(fd, fname, mask);
- free(fname);
- *re_fd = fd;
-}
-
-/**
- * Remove a watch descriptor.
- *
- * fd The inotify file descriptor
- * watch The watch descriptor to remove
- * re_code Will be set to the return code of inotify_rm_watch
- * re_fd Will be set to fd (needed for uniqueness)
- */
-void clean_inotify_rm_watch(int fd, int watch, int *re_code, int *re_fd) {
- *re_fd = fd;
- *re_code = inotify_rm_watch(fd, watch);
-}
-
-/**
* Poll an inotify file descriptor
*
* fd The inotify file descriptor to poll