summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2012-07-11 14:13:22 +0200
committerGravatar Nikias Bassen2012-07-11 14:13:22 +0200
commit6f6484fb4565cb7378f610d736ea8263652f67c5 (patch)
treef4b9eb44f4cc189eaabb6f6fd6dd2b7eefaf3be8
parent13bcf78ee53851d88d561e170cdfcc3ae08e0b1c (diff)
downloadusbmuxd-6f6484fb4565cb7378f610d736ea8263652f67c5.tar.gz
usbmuxd-6f6484fb4565cb7378f610d736ea8263652f67c5.tar.bz2
libusbmuxd: Add function to allow dis-/enabling inotify support (Linux only)
-rw-r--r--libusbmuxd/libusbmuxd.c14
-rw-r--r--libusbmuxd/usbmuxd.h8
2 files changed, 22 insertions, 0 deletions
diff --git a/libusbmuxd/libusbmuxd.c b/libusbmuxd/libusbmuxd.c
index 6417543..956dd90 100644
--- a/libusbmuxd/libusbmuxd.c
+++ b/libusbmuxd/libusbmuxd.c
@@ -417,12 +417,18 @@ static int usbmuxd_listen_poll()
}
#ifdef HAVE_INOTIFY
+static int use_inotify = 1;
+
static int usbmuxd_listen_inotify()
{
int inot_fd;
int watch_d;
int sfd;
+ if (!use_inotify) {
+ return -2;
+ }
+
sfd = connect_usbmuxd_socket();
if (sfd >= 0)
return sfd;
@@ -943,6 +949,14 @@ int usbmuxd_recv(int sfd, char *data, uint32_t len, uint32_t *recv_bytes)
return usbmuxd_recv_timeout(sfd, data, len, recv_bytes, 5000);
}
+void libusbmuxd_set_use_inotify(int set)
+{
+#ifdef HAVE_INOTIFY
+ use_inotify = set;
+#endif
+ return;
+}
+
void libusbmuxd_set_debug_level(int level)
{
libusbmuxd_debug = level;
diff --git a/libusbmuxd/usbmuxd.h b/libusbmuxd/usbmuxd.h
index d0dccef..0f7b862 100644
--- a/libusbmuxd/usbmuxd.h
+++ b/libusbmuxd/usbmuxd.h
@@ -174,6 +174,14 @@ int usbmuxd_recv_timeout(int sfd, char *data, uint32_t len, uint32_t *recv_bytes
*/
int usbmuxd_recv(int sfd, char *data, uint32_t len, uint32_t *recv_bytes);
+/**
+ * Enable or disable the use of inotify extension. Enabled by default.
+ * Use 0 to disable and 1 to enable inotify support.
+ * This only has an effect on linux systems if inotify support has been built
+ * in. Otherwise and on all other platforms this function has no effect.
+ */
+void libusbmuxd_set_use_inotify(int set);
+
void libusbmuxd_set_debug_level(int level);
#ifdef __cplusplus