aboutsummaryrefslogtreecommitdiff
path: root/src/lib/process/waitpid.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-06-28 10:53:34 -0400
committerNick Mathewson <nickm@torproject.org>2018-06-28 11:18:13 -0400
commit315e6b59ddb91c19c5102625c6cf0f22b2d6f894 (patch)
tree6b8b4a72d3ebd1292307de21b9acf8c4c3810d35 /src/lib/process/waitpid.h
parentec4eee63561c3f6a8bb0c466f17b92e99f832c5d (diff)
downloadtor-315e6b59ddb91c19c5102625c6cf0f22b2d6f894.tar.gz
tor-315e6b59ddb91c19c5102625c6cf0f22b2d6f894.zip
Extract process-management functionality into a new lib/process
Note that procmon does *not* go here, since procmon needs to integrate with the event loop.
Diffstat (limited to 'src/lib/process/waitpid.h')
-rw-r--r--src/lib/process/waitpid.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/lib/process/waitpid.h b/src/lib/process/waitpid.h
new file mode 100644
index 0000000000..85905da6bf
--- /dev/null
+++ b/src/lib/process/waitpid.h
@@ -0,0 +1,29 @@
+/* Copyright (c) 2011-2018, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file waitpid.h
+ * \brief Headers for waitpid.c
+ **/
+
+#ifndef TOR_WAITPID_H
+#define TOR_WAITPID_H
+
+#ifndef _WIN32
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+/** A callback structure waiting for us to get a SIGCHLD informing us that a
+ * PID has been closed. Created by set_waitpid_callback. Cancelled or cleaned-
+ * up from clear_waitpid_callback(). Do not access outside of the main thread;
+ * do not access from inside a signal handler. */
+typedef struct waitpid_callback_t waitpid_callback_t;
+
+waitpid_callback_t *set_waitpid_callback(pid_t pid,
+ void (*fn)(int, void *), void *arg);
+void clear_waitpid_callback(waitpid_callback_t *ent);
+void notify_pending_waitpid_callbacks(void);
+#endif /* !defined(_WIN32) */
+
+#endif /* !defined(TOR_WAITPID_H) */