]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/common/fork_function.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / common / fork_function.h
index 9076cc5a995aec9ee933669164ac023719a4f375..3a4f2f29c08a274d13c9e92c54a6f5f58a2326f7 100644 (file)
 #include <ostream>
 
 #include <signal.h>
+#ifndef _WIN32
 #include <sys/wait.h>
+#endif
 #include <sys/types.h>
 
 #include "include/ceph_assert.h"
 #include "common/errno.h"
 
+#ifndef _WIN32
 static void _fork_function_dummy_sighandler(int sig) {}
 
 // Run a function post-fork, with a timeout.  Function can return
 // int8_t only due to unix exit code limitations.  Returns -ETIMEDOUT
 // if timeout is reached.
-
 static inline int fork_function(
   int timeout,
   std::ostream& errstr,
@@ -162,3 +164,13 @@ static inline int fork_function(
 fail_exit:
   _exit(EXIT_FAILURE);
 }
+#else
+static inline int fork_function(
+  int timeout,
+  std::ostream& errstr,
+  std::function<int8_t(void)> f)
+{
+  errstr << "Forking is not available on Windows.\n";
+  return -1;
+}
+#endif