From db09228b1e9d410ca6378e03fc1d0a398317fa5e Mon Sep 17 00:00:00 2001
From: Pekka Enberg <penberg@cloudius-systems.com>
Date: Thu, 10 Apr 2014 09:41:45 +0300
Subject: [PATCH] libc: Add inotify stubs

This patch adds inotify API stubs. The lack of inotify prevents booting
an application under OSv completely.

  https://github.com/cloudius-systems/capstan/issues/65

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
---
 libc/build.mk   |  1 +
 libc/inotify.cc | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)
 create mode 100644 libc/inotify.cc

diff --git a/libc/build.mk b/libc/build.mk
index e906e4e76..c298ac30c 100644
--- a/libc/build.mk
+++ b/libc/build.mk
@@ -645,3 +645,4 @@ libc += mount.o
 libc += eventfd.o
 libc += timerfd.o
 libc += shm.o
+libc += inotify.o
diff --git a/libc/inotify.cc b/libc/inotify.cc
new file mode 100644
index 000000000..5c2fdc01d
--- /dev/null
+++ b/libc/inotify.cc
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2014 Cloudius Systems, Ltd.
+ *
+ * This work is open source software, licensed under the terms of the
+ * BSD license as described in the LICENSE file in the top-level directory.
+ */
+
+#include <api/sys/inotify.h>
+#include <osv/stubbing.hh>
+#include "libc.hh"
+
+int inotify_init()
+{
+    WARN_STUBBED();
+
+    return libc_error(EMFILE);
+}
+
+int inotify_init1(int flags)
+{
+    WARN_STUBBED();
+
+    return libc_error(EMFILE);
+}
+
+int inotify_add_watch(int fd, const char *pathname, uint32_t mask)
+{
+    WARN_STUBBED();
+
+    return libc_error(EINVAL);
+}
+
+int inotify_rm_watch(int fd, int wd)
+{
+    WARN_STUBBED();
+
+    return libc_error(EINVAL);
+}
-- 
GitLab