tor/src/lib/process/env.h
Nick Mathewson 315e6b59dd 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.
2018-06-28 11:18:13 -04:00

36 lines
1.3 KiB
C

/* 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