aboutsummaryrefslogtreecommitdiff
path: root/src/lib/process/env.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/env.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/env.h')
-rw-r--r--src/lib/process/env.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/lib/process/env.h b/src/lib/process/env.h
new file mode 100644
index 0000000000..f22599355d
--- /dev/null
+++ b/src/lib/process/env.h
@@ -0,0 +1,36 @@
+/* Copyright (c) 2003-2004, Roger Dingledine
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef TOR_ENV_H
+#define TOR_ENV_H
+
+char **get_environment(void);
+
+struct smartlist_t;
+
+int environment_variable_names_equal(const char *s1, const char *s2);
+
+/* DOCDOC process_environment_t */
+typedef struct process_environment_t {
+ /** A pointer to a sorted empty-string-terminated sequence of
+ * NUL-terminated strings of the form "NAME=VALUE". */
+ char *windows_environment_block;
+ /** A pointer to a NULL-terminated array of pointers to
+ * NUL-terminated strings of the form "NAME=VALUE". */
+ char **unixoid_environment_block;
+} process_environment_t;
+
+process_environment_t *process_environment_make(struct smartlist_t *env_vars);
+void process_environment_free_(process_environment_t *env);
+#define process_environment_free(env) \
+ FREE_AND_NULL(process_environment_t, process_environment_free_, (env))
+
+struct smartlist_t *get_current_process_environment_variables(void);
+
+void set_environment_variable_in_smartlist(struct smartlist_t *env_vars,
+ const char *new_var,
+ void (*free_old)(void*),
+ int free_p);
+#endif