tor  0.4.1.0-alpha-dev
Data Structures | Macros | Functions | Variables
process.c File Reference
#include "lib/buf/buffers.h"
#include "lib/net/buffers_net.h"
#include "lib/container/smartlist.h"
#include "lib/log/log.h"
#include "lib/log/util_bug.h"
#include "lib/process/process.h"
#include "lib/process/process_unix.h"
#include "lib/process/process_win32.h"
#include "lib/process/env.h"

Go to the source code of this file.

Data Structures

struct  process_t
 

Functions

const char * process_status_to_string (process_status_t status)
 
const char * process_protocol_to_string (process_protocol_t protocol)
 
void tor_disable_spawning_background_processes (void)
 
void process_init (void)
 
void process_free_all (void)
 
const smartlist_tprocess_get_all_processes (void)
 
process_tprocess_new (const char *command)
 
void process_free_ (process_t *process)
 
process_status_t process_exec (process_t *process)
 
bool process_terminate (process_t *process)
 
process_pid_t process_get_pid (process_t *process)
 
void process_set_stdout_read_callback (process_t *process, process_read_callback_t callback)
 
void process_set_stderr_read_callback (process_t *process, process_read_callback_t callback)
 
void process_set_exit_callback (process_t *process, process_exit_callback_t callback)
 
const char * process_get_command (const process_t *process)
 
void process_set_protocol (process_t *process, process_protocol_t protocol)
 
process_protocol_t process_get_protocol (const process_t *process)
 
void process_set_data (process_t *process, void *data)
 
void * process_get_data (const process_t *process)
 
void process_set_status (process_t *process, process_status_t status)
 
process_status_t process_get_status (const process_t *process)
 
void process_append_argument (process_t *process, const char *argument)
 
const smartlist_tprocess_get_arguments (const process_t *process)
 
char ** process_get_argv (const process_t *process)
 
void process_reset_environment (process_t *process, const smartlist_t *env)
 
void process_set_environment (process_t *process, const char *key, const char *value)
 
process_environment_tprocess_get_environment (const process_t *process)
 
process_unix_tprocess_get_unix_process (const process_t *process)
 
void process_write (process_t *process, const uint8_t *data, size_t size)
 
void process_vprintf (process_t *process, const char *format, va_list args)
 
void process_printf (process_t *process, const char *format,...)
 
void process_notify_event_stdout (process_t *process)
 
void process_notify_event_stderr (process_t *process)
 
void process_notify_event_stdin (process_t *process)
 
void process_notify_event_exit (process_t *process, process_exit_code_t exit_code)
 
 tor_assert (buffer)
 
return process_unix_read_stdout (process, buffer)
 
return process_unix_read_stderr (process, buffer)
 
 MOCK_IMPL (STATIC void, process_write_stdin,(process_t *process, buf_t *buffer))
 
STATIC void process_read_data (process_t *process, buf_t *buffer, process_read_callback_t callback)
 
STATIC void process_read_buffer (process_t *process, buf_t *buffer, process_read_callback_t callback)
 
STATIC void process_read_lines (process_t *process, buf_t *buffer, process_read_callback_t callback)
 

Variables

static smartlist_tprocesses
 
static int may_spawn_background_process = 1
 

Detailed Description

Module for working with other processes.

Definition in file process.c.

Function Documentation

◆ MOCK_IMPL()

MOCK_IMPL ( STATIC  void,
process_write_stdin  ,
(process_t *process, buf_t *buffer)   
)

This function calls the backend function for the given process whenever there is data to be written to the backends' file handles.

Definition at line 676 of file process.c.

◆ process_append_argument()

void process_append_argument ( process_t process,
const char *  argument 
)

Append an argument to the list of arguments in the given process.

Definition at line 419 of file process.c.

References process_t::arguments, smartlist_add(), and tor_assert().

◆ process_exec()

process_status_t process_exec ( process_t process)

Execute the given process. This function executes the given process as a subprocess of Tor. Returns PROCESS_STATUS_RUNNING upon success.

Definition at line 253 of file process.c.

References tor_assert().

◆ process_free_()

void process_free_ ( process_t process)

Deallocate the given process in process.

Definition at line 217 of file process.c.

References process_t::arguments, process_t::command, SMARTLIST_FOREACH, and tor_free.

◆ process_free_all()

void process_free_all ( void  )

Free up all resources that is handled by the Process subsystem. Note that this call does not terminate already running processes.

Definition at line 153 of file process.c.

References processes, and SMARTLIST_FOREACH.

◆ process_get_all_processes()

const smartlist_t* process_get_all_processes ( void  )

Get a list of all processes. This function returns a smartlist of process_t containing all the currently allocated processes.

Definition at line 166 of file process.c.

References processes.

◆ process_get_arguments()

const smartlist_t* process_get_arguments ( const process_t process)

Returns a list of arguments (excluding the command itself) from the given process.

Definition at line 430 of file process.c.

References process_t::arguments, and tor_assert().

◆ process_get_argv()

char** process_get_argv ( const process_t process)

Returns a newly allocated Unix style argument vector. Use tor_free() to deallocate it after use.

Generate a Unix style process argument vector from our process's arguments smartlist_t.

Definition at line 439 of file process.c.

References process_t::arguments, process_t::command, and tor_assert().

◆ process_get_command()

const char* process_get_command ( const process_t process)

Get the current command of the given process.

Definition at line 356 of file process.c.

References process_t::command, and tor_assert().

◆ process_get_data()

void* process_get_data ( const process_t process)

Get the opaque pointer to callback data from the given process. This function allows you get the data you stored with process_set_data() in the different callback functions.

Definition at line 395 of file process.c.

References process_t::data, and tor_assert().

Referenced by managed_proxy_stderr_callback(), and managed_proxy_stdout_callback().

◆ process_get_environment()

process_environment_t* process_get_environment ( const process_t process)

Returns a newly allocated process_environment_t containing the environment variables for the given process.

Definition at line 501 of file process.c.

References process_t::environment, process_environment_make(), and tor_assert().

◆ process_get_pid()

process_pid_t process_get_pid ( process_t process)

Returns the unique process identifier for the given process.

Definition at line 303 of file process.c.

References process_unix_get_pid(), and tor_assert().

◆ process_get_protocol()

process_protocol_t process_get_protocol ( const process_t process)

Get the currently used protocol of the given process.

Definition at line 371 of file process.c.

References process_t::protocol, and tor_assert().

◆ process_get_status()

process_status_t process_get_status ( const process_t process)

Get the status of the given process.

Definition at line 411 of file process.c.

References process_t::status, and tor_assert().

Referenced by process_terminate().

◆ process_get_unix_process()

process_unix_t* process_get_unix_process ( const process_t process)

Get the internal handle for the Unix backend.

Definition at line 510 of file process.c.

References tor_assert(), and process_t::unix_process.

Referenced by process_unix_exec(), process_unix_get_pid(), process_unix_read_stderr(), process_unix_read_stdout(), process_unix_terminate(), and process_unix_write().

◆ process_init()

void process_init ( void  )

Initialize the Process subsystem. This function initializes the Process subsystem's global state. For cleaning up, process_free_all() should be called.

Definition at line 141 of file process.c.

References processes.

◆ process_new()

process_t* process_new ( const char *  command)

Allocate and initialize a new process. This function returns a newly allocated and initialized process data, which can be used to configure and later run a subprocess of Tor. Use the various process_set_*() methods to configure it and run the process using process_exec(). Use command to specify the path to the command to run. You can either specify an absolute path to the command or relative where Tor will use the underlying operating system's functionality for finding the command to run.

Definition at line 180 of file process.c.

References tor_assert().

◆ process_notify_event_exit()

void process_notify_event_exit ( process_t process,
process_exit_code_t  exit_code 
)

This function is called by the Process backend when a given process have terminated. The exit status code is passed in exit_code. We mark the process as no longer running and calls the exit_callback with information about the process termination. The given process is free'd iff the exit_callback returns true.

Definition at line 622 of file process.c.

References tor_assert().

◆ process_notify_event_stderr()

void process_notify_event_stderr ( process_t process)

This function is called by the Process backend when a given process have data that is ready to be read from the child process's standard error handle.

Definition at line 593 of file process.c.

References process_read_data(), process_t::stderr_buffer, process_t::stderr_read_callback, and tor_assert().

Referenced by stderr_read_callback().

◆ process_notify_event_stdin()

void process_notify_event_stdin ( process_t process)

This function is called by the Process backend when a given process is allowed to begin writing data to the standard input of the child process.

Definition at line 609 of file process.c.

References process_t::stdin_buffer, and tor_assert().

Referenced by stdin_write_callback().

◆ process_notify_event_stdout()

void process_notify_event_stdout ( process_t process)

This function is called by the Process backend when a given process have data that is ready to be read from the child process's standard output handle.

Definition at line 576 of file process.c.

References process_read_data(), process_t::stdout_buffer, process_t::stdout_read_callback, and tor_assert().

Referenced by stdout_read_callback().

◆ process_printf()

void process_printf ( process_t process,
const char *  format,
  ... 
)

As tor_snprintf(), but write the data to the given process's standard input.

Definition at line 560 of file process.c.

References process_vprintf(), and tor_assert().

◆ process_protocol_to_string()

const char* process_protocol_to_string ( process_protocol_t  protocol)

Convert a given process protocol in protocol to its string representation.

Definition at line 112 of file process.c.

References PROCESS_PROTOCOL_LINE, and PROCESS_PROTOCOL_RAW.

◆ process_read_buffer()

STATIC void process_read_buffer ( process_t process,
buf_t *  buffer,
process_read_callback_t  callback 
)

This function takes the content of the given buffer and passes it to the given callback function, but ensures that an additional zero byte is added to the end of the data such that the given callback implementation can threat the content as a ASCIIZ string.

Definition at line 721 of file process.c.

◆ process_read_data()

STATIC void process_read_data ( process_t process,
buf_t *  buffer,
process_read_callback_t  callback 
)

This function calls the protocol handlers based on the value of process_get_protocol(process). Currently we call process_read_buffer() for PROCESS_PROTOCOL_RAW and process_read_lines() for PROCESS_PROTOCOL_LINE.

Definition at line 694 of file process.c.

Referenced by process_notify_event_stderr(), and process_notify_event_stdout().

◆ process_read_lines()

STATIC void process_read_lines ( process_t process,
buf_t *  buffer,
process_read_callback_t  callback 
)

This function tries to extract complete lines from the given buffer and calls the given callback function whenever it has a complete line. Before calling callback we remove the trailing "\n" or "\r\n" from the line. If we are unable to extract a complete line we leave the data in the buffer for next call.

Definition at line 748 of file process.c.

◆ process_reset_environment()

void process_reset_environment ( process_t process,
const smartlist_t env 
)

This function clears the internal environment and copies over every string from env as the new environment.

Definition at line 470 of file process.c.

References process_t::environment, SMARTLIST_FOREACH, tor_assert(), and tor_free.

◆ process_set_data()

void process_set_data ( process_t process,
void *  data 
)

Set opague pointer to data. This function allows you to store a pointer to your own data in the given process. Use process_get_data() in the various callback functions to retrieve the data again.

Note that the given process does NOT take ownership of the data and you are responsible for freeing up any resources allocated by the given data.

Definition at line 385 of file process.c.

References process_t::data, and tor_assert().

Referenced by launch_managed_proxy(), and proxy_prepare_for_restart().

◆ process_set_environment()

void process_set_environment ( process_t process,
const char *  key,
const char *  value 
)

Set the given key/value pair as environment variable in the given process.

Definition at line 487 of file process.c.

References process_t::environment, smartlist_add_asprintf(), and tor_assert().

◆ process_set_exit_callback()

void process_set_exit_callback ( process_t process,
process_exit_callback_t  callback 
)

Set the callback function for process exit notification. The callback function will be called every time your child process have terminated.

Definition at line 347 of file process.c.

Referenced by launch_managed_proxy().

◆ process_set_status()

void process_set_status ( process_t process,
process_status_t  status 
)

Set the status of a given process.

Definition at line 403 of file process.c.

◆ process_set_stderr_read_callback()

void process_set_stderr_read_callback ( process_t process,
process_read_callback_t  callback 
)

Set the callback function for output from the child process's standard error handle. This function sets the callback function which is called every time the child process have written output to its standard error file handle.

Use process_set_protocol(process, PROCESS_PROTOCOL_LINE) if you want the callback to only contain complete "\n" or "\r\n" terminated lines.

Definition at line 336 of file process.c.

Referenced by launch_managed_proxy().

◆ process_set_stdout_read_callback()

void process_set_stdout_read_callback ( process_t process,
process_read_callback_t  callback 
)

Set the callback function for output from the child process's standard out handle. This function sets the callback function which is called every time the child process have written output to its standard out file handle.

Use process_set_protocol(process, PROCESS_PROTOCOL_LINE) if you want the callback to only contain complete "\n" or "\r\n" terminated lines.

Definition at line 321 of file process.c.

Referenced by launch_managed_proxy().

◆ process_status_to_string()

const char* process_status_to_string ( process_status_t  status)

Convert a given process status in status to its string representation.

Definition at line 92 of file process.c.

◆ process_terminate()

bool process_terminate ( process_t process)

Terminate the given process. Returns true on success, otherwise false.

Definition at line 284 of file process.c.

References process_get_status(), PROCESS_STATUS_RUNNING, and tor_assert().

Referenced by proxy_prepare_for_restart().

◆ process_vprintf()

void process_vprintf ( process_t process,
const char *  format,
va_list  args 
)

As tor_vsnprintf(), but write the data to the given process's standard input.

Definition at line 543 of file process.c.

References process_write(), tor_assert(), tor_free, and tor_vasprintf().

Referenced by process_printf().

◆ process_write()

void process_write ( process_t process,
const uint8_t *  data,
size_t  size 
)

Write size bytes of data to the given process's standard input.

Definition at line 530 of file process.c.

References buf_add(), process_t::stdin_buffer, and tor_assert().

Referenced by process_vprintf().

◆ tor_assert()

tor_assert ( buffer  )
Initial value:
{
tor_assert(process)
tor_assert(buffer)

This function is called whenever the Process backend have notified us that there is data to be read from its standard out handle. Returns the number of bytes that have been put into the given buffer.

This function is called whenever the Process backend have notified us that there is data to be read from its standard error handle. Returns the number of bytes that have been put into the given buffer.

Referenced by add_cell_ewma(), add_certs_cell_cert_helper(), add_connection_to_closeable_list(), add_laplace_noise(), add_onion_helper_clientauth(), add_transport_to_proxy(), addr_is_a_configured_bridge(), addr_policy_append_reject_addr(), addr_policy_append_reject_addr_list(), addr_policy_append_reject_addr_list_filter(), addr_policy_free_(), address_is_in_virtual_range(), addressmap_register(), alloc_chunk(), assert_all_pending_dns_resolves_ok(), assert_connection_ok(), assert_cpath_layer_ok(), assert_cpath_ok(), assert_identity_keys_ok(), assert_resolve_ok(), assert_unconfigured_count_ok(), assign_onionskin_to_cpuworker(), authority_cert_get_all(), base16_decode(), base16_encode(), base32_decode(), base32_encode(), base64_decode_maxsize(), base64_encode_nopad(), base64_encode_size(), bignum_from_hex(), bridge_get_addr_port(), bridge_get_rsa_id_digest(), bridge_passes_guard_filter(), btc_evtype_better(), bto_find_or_new(), bto_update(), bto_update_bests(), buf_assert_ok(), buf_drain(), buf_extract(), buf_find_pos_of_char(), buf_find_string_offset(), buf_flush_to_fd(), buf_flush_to_tls(), buf_move_all(), buf_peek(), buf_preferred_chunk_size(), cache_failure_intro_lookup(), cache_store_as_client(), cell_ewma_to_circuit(), channel_change_state(), channel_change_state_(), channel_clear_client(), channel_clear_identity_digest(), channel_clear_remote_end(), channel_close_for_error(), channel_close_from_lower_layer(), channel_closed(), channel_describe_transport(), channel_do_open_actions(), channel_dump_transport_statistics(), channel_find_by_global_id(), channel_force_xfree(), channel_free_(), channel_free_list(), channel_get_actual_remote_descr(), channel_get_canonical_remote_descr(), channel_get_cell_handler(), channel_get_for_extend(), channel_get_var_cell_handler(), channel_has_queued_writes(), channel_init(), channel_init_listener(), channel_is_bad_for_new_circs(), channel_is_better(), channel_is_canonical(), channel_is_canonical_is_reliable(), channel_is_client(), channel_is_incoming(), channel_is_local(), channel_is_outgoing(), channel_listener_change_state(), channel_listener_describe_transport(), channel_listener_dump_statistics(), channel_listener_dump_transport_statistics(), channel_listener_force_xfree(), channel_listener_free_list(), channel_listener_mark_for_close(), channel_listener_process_incoming(), channel_listener_queue_incoming(), channel_listener_register(), channel_listener_timestamp_accepted(), channel_listener_timestamp_active(), channel_listener_timestamp_created(), channel_listener_unregister(), channel_mark_bad_for_new_circs(), channel_mark_client(), channel_mark_for_close(), channel_mark_incoming(), channel_mark_local(), channel_mark_outgoing(), channel_mark_remote(), channel_matches_extend_info(), channel_matches_target_addr_for_extend(), channel_next_with_rsa_identity(), channel_notify_flushed(), channel_num_cells_writeable(), channel_num_circuits(), channel_process_cell(), channel_register(), channel_send_destroy(), channel_set_identity_digest(), channel_timestamp_active(), channel_timestamp_client(), channel_timestamp_created(), channel_timestamp_recv(), channel_timestamp_xmit(), channel_tls_common_init(), channel_tls_describe_transport_method(), channel_tls_from_base(), channel_tls_handle_cell(), channel_tls_handle_state_change_on_orconn(), channel_tls_listener_close_method(), channel_tls_listener_describe_transport_method(), channel_tls_process_auth_challenge_cell(), channel_tls_process_authenticate_cell(), channel_tls_process_padding_negotiate_cell(), channel_tls_process_versions_cell(), channel_tls_update_marks(), channel_tls_write_packed_cell_method(), channel_unlink_all_circuits(), channel_unregister(), channel_when_created(), channel_when_last_client(), channel_when_last_xmit(), channel_write_packed_cell(), check_extended_cell(), choose_array_element_by_weight(), choose_guard_selection(), chunk_grow(), circ_state_has_higher_priority(), circpad_machine_sample_delay(), circuit_add_to_origin_circuit_list(), circuit_append_new_exit(), circuit_build_times_calculate_timeout(), circuit_build_times_get_xm(), circuit_build_times_update_alpha(), circuit_change_purpose(), circuit_clear_cell_queue(), circuit_close_all_marked(), circuit_count_pending_on_channel(), circuit_deliver_create_cell(), circuit_detach_stream(), circuit_event_status(), circuit_find_to_cannibalize(), circuit_get_all_pending_on_channel(), circuit_get_best(), circuit_get_by_edge_conn(), circuit_get_next_by_pk_and_purpose(), circuit_get_open_circ_or_launch(), circuit_handle_first_hop(), circuit_init_cpath_crypto(), circuit_is_acceptable(), circuit_receive_relay_cell(), circuit_remove_from_origin_circuit_list(), circuit_send_next_onion_skin(), circuit_set_state(), circuit_truncated(), circuitmux_attached_circuit_direction(), circuitmux_clear_policy(), circuitmux_detach_all_circuits(), circuitmux_find_map_entry(), circuitmux_free_(), circuitmux_get_first_active_circuit(), circuitmux_is_circuit_active(), circuitmux_make_circuit_active(), circuitmux_make_circuit_inactive(), circuitmux_notify_xmit_cells(), circuitmux_notify_xmit_destroy(), circuitmux_num_active_circuits(), circuitmux_num_cells_for_circuit(), circuitmux_num_circuits(), circuitmux_set_num_cells(), circuitmux_set_policy(), client_dns_set_addressmap(), cmp_single_ent_by_version(), command_handle_incoming_channel(), command_process_create_cell(), command_process_var_cell(), command_setup_channel(), command_setup_listener(), compare_tor_addr_to_short_policy(), compare_vote_rs(), compute_num_cpus(), compute_weighted_bandwidths(), config_assign_value(), config_free_(), config_get_assigned_option(), config_line_append(), config_line_prepend(), config_mark_lists_fragile(), config_parse_units(), configure_proxy(), connection_about_to_close_connection(), connection_add_impl(), connection_ap_can_use_exit(), connection_ap_handshake_attach_chosen_circuit(), connection_ap_handshake_attach_circuit(), connection_ap_handshake_process_socks(), connection_ap_handshake_send_resolve(), connection_ap_handshake_socks_got_resolved_cell(), connection_ap_mark_as_pending_circuit_(), connection_ap_mark_as_waiting_for_renddesc(), connection_ap_process_natd(), connection_ap_process_transparent(), connection_buf_add_buf(), connection_check_oos(), connection_control_closed(), connection_control_finished_flushing(), connection_control_process_inbuf(), connection_control_reached_eof(), connection_dir_finished_connecting(), connection_dir_finished_flushing(), connection_dir_process_inbuf(), connection_dirserv_flushed_some(), connection_dns_remove(), connection_edge_end_errno(), connection_edge_finished_connecting(), connection_edge_finished_flushing(), connection_edge_is_rendezvous_stream(), connection_edge_process_inbuf(), connection_edge_send_command(), connection_exit_begin_conn(), connection_expire_held_open(), connection_ext_or_transition(), connection_finished_connecting(), connection_finished_flushing(), connection_flushed_some(), connection_free_minimal(), connection_half_edge_compare_bsearch(), connection_handle_read_impl(), connection_is_reading(), connection_is_writing(), connection_link_connections(), connection_listener_new_for_port(), connection_mark_for_close_(), connection_or_change_state(), connection_or_clear_identity(), connection_or_client_learned_peer_id(), connection_or_client_used(), connection_or_close_normally(), connection_or_compute_authenticate_cell_body(), connection_or_finished_connecting(), connection_or_finished_flushing(), connection_or_get_state_description(), connection_or_is_bad_for_new_circs(), connection_or_launch_v3_or_handshake(), connection_or_nonopen_was_started_here(), connection_or_notify_error(), connection_or_num_cells_writeable(), connection_or_process_inbuf(), connection_or_reached_eof(), connection_or_remove_from_ext_or_id_map(), connection_or_send_auth_challenge_cell(), connection_or_send_certs_cell(), connection_or_send_versions(), connection_or_set_identity_digest(), connection_process_inbuf(), connection_remove(), connection_start_reading_from_linked_conn(), connection_state_is_connecting(), connection_state_is_open(), connection_stop_reading_from_linked_conn(), connection_tls_finish_handshake(), control_event_circuit_status_minor(), control_event_logmsg_pending(), countbytes_close_fn(), countbytes_read_fn(), countbytes_recv_fn(), countbytes_send_fn(), countbytes_write_fn(), countbytes_writev_fn(), cpuworker_cancel_circ_handshake(), cpuworker_onion_handshake_replyfn(), cpuworker_onion_handshake_threadfn(), create_initial_guard_context(), crypto_add_spaces_to_fp(), crypto_cipher_crypt_inplace(), crypto_cipher_decrypt(), crypto_cipher_decrypt_with_iv(), crypto_cipher_encrypt(), crypto_cipher_encrypt_with_iv(), crypto_cipher_new_with_iv_and_bits(), crypto_common_digests(), crypto_dh_compute_secret(), crypto_dh_dup(), crypto_dh_free_(), crypto_dh_generate_public(), crypto_dh_get_bytes(), crypto_dh_get_public(), crypto_dh_handshake(), crypto_dh_init_openssl(), crypto_digest256(), crypto_digest256_new(), crypto_digest512(), crypto_digest512_new(), crypto_digest_add_bytes(), crypto_digest_assign(), crypto_digest_checkpoint(), crypto_digest_dup(), crypto_digest_get_digest(), crypto_digest_restore(), crypto_expand_key_material_rfc5869_sha256(), crypto_expand_key_material_rfc5869_sha256_legacy(), crypto_fast_rng_get_uint(), crypto_fast_rng_get_uint64(), crypto_get_rsa_padding_overhead(), crypto_hmac_sha256(), crypto_mac_sha3_256(), crypto_pk_asn1_decode(), crypto_pk_asn1_decode_private(), crypto_pk_asn1_encode(), crypto_pk_asn1_encode_private(), crypto_pk_cmp_keys(), crypto_pk_keysize(), crypto_pk_num_bits(), crypto_pk_obsolete_private_hybrid_decrypt(), crypto_pk_obsolete_public_hybrid_encrypt(), crypto_pk_private_decrypt(), crypto_pk_private_sign(), crypto_pk_public_encrypt(), crypto_rand_int(), crypto_rand_int_range(), crypto_rand_time_range(), crypto_rand_uint(), crypto_rand_uint64(), crypto_rand_uint64_range(), crypto_rand_unmocked(), crypto_seed_rng(), crypto_set_dh_generator(), crypto_strongest_rand_raw(), crypto_strongest_rand_syscall(), crypto_xof_add_bytes(), crypto_xof_squeeze_bytes(), decode_escaped_string(), decode_hashed_passwords(), dir_split_resource_into_spoolable(), dircollator_add_vote(), dircollator_collate(), dircollator_collate_by_ed25519(), dircollator_get_votes_for_router(), dircollator_n_routers(), directory_get_from_all_authorities(), directory_get_from_hs_dir(), directory_handle_command(), directory_request_fetch_set_hs_ident(), directory_request_new(), directory_request_set_payload(), directory_request_set_rend_query(), directory_request_set_router_purpose(), directory_request_upload_set_hs_ident(), dirserv_add_extrainfo(), dirserv_cache_measured_bw(), dirserv_get_credible_bandwidth_kb(), dirserv_orconn_tls_done(), dirserv_set_router_is_running(), dirserv_set_routerstatus_testing(), dirserv_single_reachability_test(), dirvote_add_signatures_to_pending_consensus(), dirvote_add_vote(), dirvote_get_preferred_voting_intervals(), dns_servers_relaunch_checks(), dnsserv_close_listener(), dnsserv_configure_listener(), do_main_loop(), download_status_increment_attempt(), download_status_increment_failure(), download_status_is_ready_by_sk_in_cl(), download_status_reset_by_sk_in_cl(), dump_desc_fifo_cleanup(), dup_onion_keys(), ed25519_keypair_blind(), ed25519_pubkey_copy(), ed25519_pubkey_eq(), enable_control_logging(), enter_v3_handshake_with_cell(), entry_guard_add_bridge_to_sample(), entry_guard_add_to_sample_impl(), entry_guard_find_node(), entry_guard_has_higher_priority(), entry_guard_obeys_restriction(), entry_guard_pick_for_circuit(), entry_guards_all_primary_guards_are_down(), entry_guards_changed_for_guard_selection(), entry_guards_expand_sample(), entry_guards_note_guard_failure(), entry_guards_note_guard_success(), entry_guards_update_primary(), entry_guards_upgrade_waiting_circuits(), evdns_server_callback(), ewma_alloc_circ_data(), ewma_alloc_cmux_data(), ewma_cmp_cmux(), ewma_free_circ_data(), ewma_free_cmux_data(), ewma_notify_circ_active(), ewma_notify_circ_inactive(), ewma_notify_xmit_cells(), ewma_pick_active_circuit(), exit_policy_is_general_exit_helper(), expand_filename(), extend_cell_parse(), extend_info_addr_is_allowed(), extend_info_dup(), extend_info_from_router(), extended_cell_parse(), extract_shared_random_commits(), fascist_firewall_allows_address_ap(), fascist_firewall_choose_address_base(), fascist_firewall_choose_address_dir_server(), fascist_firewall_choose_address_ipv4h(), fascist_firewall_choose_address_node(), fascist_firewall_choose_address_rs(), fdopen_file(), fetch_v2_desc_by_descid(), find_expiring_intro_point(), find_intro_circuit(), find_intro_point(), find_single_ipv6_orport(), find_start_of_next_router_or_extrainfo(), flush_chunk_tls(), format_iso_time_nospace_usec(), fp_pair_map_assert_ok(), fp_pair_map_entry_hash(), fp_pair_map_free_(), fp_pair_map_get(), fp_pair_map_get_by_digests(), fp_pair_map_isempty(), fp_pair_map_iter_get(), fp_pair_map_iter_init(), fp_pair_map_iter_next(), fp_pair_map_iter_next_rmv(), fp_pair_map_remove(), fp_pair_map_set(), fp_pair_map_set_by_digests(), fp_pair_map_size(), geoip_db_digest(), geoip_load_file(), geoip_note_ns_response(), get_all_auth_client_lines(), get_auth_key_from_cell(), get_bindaddr_for_server_proxy(), get_circuit_with_token(), get_counts(), get_my_roles(), get_next_token(), get_onion_key(), get_parent_directory(), get_random_virtual_addr(), get_sampled_guard_with_id(), get_server_identity_key(), get_tlsclient_identity_key(), get_transport_in_state_by_name(), get_transport_options_for_server_proxy(), get_transport_proxy_ports(), get_unique_circ_id_by_chan(), get_user_homedir(), get_voter(), getinfo_helper_downloads(), getinfo_helper_entry_guards(), guards_update_all(), handle_establish_intro(), handle_getinfo_helper(), handle_hs_exit_conn(), handle_methods_done(), helper_parse_circuit_id_protocol(), hex_digest_nickname_decode(), hibernate_end(), hs_cache_lookup_as_client(), hs_cache_lookup_encoded_as_client(), hs_cache_store_as_client(), hs_circuitmap_remove_circuit(), hs_client_note_connection_attempt_succeeded(), hs_get_time_period_num(), hs_hsdir_requery_period(), hs_ntor_client_rendezvous2_mac_is_good(), hs_pick_hsdir(), init_libevent(), intro_point_should_expire_now(), is_legal_hexdigest(), is_legal_nickname(), keypin_check_and_add_impl(), launch_managed_proxy(), learned_bridge_descriptor(), line_starts_with_str(), line_str_eq(), list_pending_fpsk_downloads(), list_server_status_v1(), mainloop_event_activate(), mainloop_event_new_impl(), mainloop_event_schedule(), make_consensus_method_list(), managed_proxy_exit_callback(), managed_proxy_has_argv(), managed_proxy_severity_parse(), managed_proxy_stderr_callback(), managed_proxy_stdout_callback(), mark_circuit_unusable_for_new_conns(), mark_primary_guards_maybe_reachable(), memarea_alloc(), memarea_assert_ok(), memarea_get_stats(), memarea_strndup(), memoize_protover_summary(), memwipe(), microdesc_check_counts(), microdesc_list_missing_digest256(), MOCK_IMPL(), monitor_owning_controller_process(), move_hs_state(), networkstatus_add_detached_signatures(), networkstatus_check_consensus_signature(), networkstatus_check_required_protocols(), networkstatus_consensus_download_failed(), networkstatus_get_detached_signatures(), networkstatus_verify_bw_weights(), new_route_len(), node_add_to_ed25519_map(), node_free_(), node_get_nickname(), node_get_pref_dirport(), node_get_pref_orport(), node_get_rsa_id_digest(), node_has_hsdir_index(), node_is_possible_guard(), node_remove_from_ed25519_map(), node_supports_ed25519_hs_intro(), node_supports_v3_hsdir(), node_supports_v3_rendezvous_point(), nodelist_add_node_and_family(), nodelist_assert_ok(), nodelist_drop_node(), nodelist_ensure_freshness(), nodelist_set_routerinfo(), ocirc_event_publish(), ocirc_event_subscribe(), onion_next_task(), onion_populate_cpath(), onion_skin_TAP_client_handshake(), onion_skin_TAP_create(), onionskin_answer(), oos_victim_comparator(), options_transition_affects_dirauth_timing(), options_transition_affects_guards(), options_validate(), or_handshake_certs_check_both(), or_state_set(), orconn_event_publish(), orconn_event_subscribe(), parse_config_line_from_str_verbose(), parse_http_time(), parse_log_line(), parse_port_range(), parse_status_line(), parse_version_range(), pathbias_check_probe_response(), pathbias_send_usable_probe(), periodic_event_disable(), periodic_event_dispatch(), periodic_event_enable(), periodic_event_schedule_and_disable(), periodic_event_set_interval(), periodic_timer_disable(), periodic_timer_launch(), periodic_timer_new(), pick_restricted_middle_node(), policies_log_first_redundant_entry(), policies_parse_exit_policy_reject_private(), pop_first_cell_ewma(), port_cfg_line_extract_addrport(), port_cfg_new(), process_append_argument(), process_exec(), process_get_arguments(), process_get_argv(), process_get_command(), process_get_data(), process_get_environment(), process_get_pid(), process_get_protocol(), process_get_status(), process_get_unix_process(), process_new(), process_notify_event_exit(), process_notify_event_stderr(), process_notify_event_stdin(), process_notify_event_stdout(), process_printf(), process_reset_environment(), process_set_data(), process_set_environment(), process_terminate(), process_unix_close_file_descriptors(), process_unix_get_pid(), process_unix_read_handle(), process_unix_read_stderr(), process_unix_read_stdout(), process_unix_setup_handle(), process_unix_start_reading(), process_unix_start_writing(), process_unix_stop_reading(), process_unix_stop_writing(), process_unix_terminate(), process_unix_write(), process_vprintf(), process_write(), proxy_needs_restart(), proxy_prepare_for_restart(), pt_get_extra_info_descriptor_string(), pt_prepare_proxy_list_for_config_read(), pt_stringify_socks_args(), read_to_chunk_tls(), reasonably_live_consensus_is_missing(), register_client_proxy(), register_server_proxy(), remove_all_entry_guards_for_guard_selection(), remove_cell_ewma(), remove_invalid_intro_points(), rend_add_service(), rend_cache_lookup_entry(), rend_cache_lookup_v2_desc_as_dir(), rend_cache_store_v2_desc_as_dir(), rend_cache_store_v2_desc_as_service(), rend_check_authorization(), rend_client_fetch_v2_desc(), rend_client_introcirc_has_opened(), rend_client_introduction_acked(), rend_client_lookup_service_authorization(), rend_client_rendcirc_has_opened(), rend_client_send_establish_rendezvous(), rend_data_free_(), rend_decrypt_introduction_points(), rend_encrypt_v2_intro_points_basic(), rend_encrypt_v2_intro_points_stealth(), rend_get_service_id(), rend_max_intro_circs_per_period(), rend_parse_introduction_points(), rend_service_add_filenames_to_list(), rend_service_desc_has_uploaded(), rend_service_get_by_service_id(), rend_service_intro_established(), rend_service_relaunch_rendezvous(), rend_service_rendezvous_has_opened(), rend_service_set_connection_addr_port(), rep_hist_fill_bandwidth_history(), rep_hist_get_predicted_ports(), rep_hist_load_state(), rep_hist_make_router_pessimal(), rep_hist_note_used_port(), rescan_periodic_events(), reschedule_directory_downloads(), resolve_my_address(), resolved_cell_parse(), router_differences_are_cosmetic(), router_get_all_orports(), router_get_by_descriptor_digest(), router_get_mutable_by_digest(), router_get_my_descriptor(), router_get_networkstatus_v3_sha3_as_signed(), router_get_prim_orport(), router_load_single_router(), router_parse_addr_policy(), router_parse_entry_from_string(), router_parse_list_from_string(), router_purpose_to_string(), router_set_status(), routerinfo_incompatible_with_extrainfo(), routerlist_assert_ok(), routerlist_descriptors_added(), routerlist_find_elt_(), routerlist_insert(), routerlist_insert_old(), routerlist_remove(), routerlist_remove_old(), routerlist_remove_old_cached_routers_with_id(), routerlist_replace(), routerset_contains_bridge(), routerset_equal(), routerset_get_all_nodes(), routerset_subtract_nodes(), routerset_union(), routerstatus_has_changed(), safe_str_client_opts(), safe_str_opts(), safe_timer_diff(), sample_laplace_distribution(), sample_reachable_filtered_entry_guards(), sampled_guards_prune_obsolete_entries(), sampled_guards_update_consensus_presence(), sampled_guards_update_from_consensus(), scale_active_circuits(), scheduler_ev_active(), scheduler_ev_add(), secret_to_key_rfc2440(), select_entry_guard_for_circuit(), set_changed(), set_expiry(), set_options(), set_streams_blocked_on_circ(), short_policy_is_reject_star(), should_use_create_fast_for_circuit(), signed_descriptor_from_routerinfo(), signed_descriptor_get_body_impl(), signed_descriptor_move(), signed_descriptor_reset(), smartlist_add_vasprintf(), smartlist_bsearch_idx(), smartlist_join_strings2(), smartlist_pqueue_assert_ok(), smartlist_pqueue_pop(), smartlist_reverse(), smartlist_string_remove(), spooled_resource_lookup_body(), spooled_resource_lookup_cached_dir(), stderr_read_callback(), stdin_write_callback(), stdout_read_callback(), storage_dir_map_labeled(), storage_dir_read(), string_is_key_value(), sum_up_cell_stats_by_command(), summarize_protover_flags(), switch_id(), threadpool_queue_work_priority(), TO_CONTROL_CONN(), TO_DIR_CONN(), TO_EDGE_CONN(), TO_EWMA_POL_CIRC_DATA(), TO_EWMA_POL_DATA(), TO_LISTENER_CONN(), TO_OR_CIRCUIT(), TO_OR_CONN(), TO_ORIGIN_CIRCUIT(), tor_addr_compare_masked(), tor_addr_copy(), tor_addr_copy_tight(), tor_addr_from_ipv4n(), tor_addr_from_ipv6_bytes(), tor_addr_from_netinfo_addr(), tor_addr_from_sockaddr(), tor_addr_is_internal_(), tor_addr_is_loopback(), tor_addr_is_null(), tor_addr_is_v4(), tor_addr_parse(), tor_addr_parse_mask_ports(), tor_addr_port_lookup(), tor_addr_port_parse(), tor_addr_port_split(), tor_addr_to_in6_assert(), tor_addr_to_mapped_ipv4h(), tor_addr_to_PTR_name(), tor_addr_to_str(), tor_cert_eq(), tor_cert_get_checkable_sig(), tor_cert_sign_impl(), tor_check_dh_key(), tor_compress_process(), tor_compress_state_size(), tor_escape_str_for_pt_args(), tor_getpass(), tor_inet_pton(), tor_libevent_initialize(), tor_lockfile_unlock(), tor_lzma_compress_process(), tor_lzma_compress_state_size(), tor_nss_countbytes_init(), tor_process_monitor_poll_cb(), tor_threadlocal_set(), tor_timegm(), tor_tls_assert_renegotiation_unblocked(), tor_tls_block_renegotiation(), tor_tls_context_decref(), tor_tls_finish_handshake(), tor_tls_free_(), tor_tls_get_buffer_sizes(), tor_tls_get_forced_write_size(), tor_tls_get_n_raw_bytes(), tor_tls_get_pending_bytes(), tor_tls_handshake(), tor_tls_is_server(), tor_tls_server_got_renegotiate(), tor_tls_set_logged_address(), tor_tls_set_renegotiate_callback(), tor_tls_unblock_renegotiation(), tor_tls_used_v1_handshake(), tor_tls_verify(), tor_tls_write(), tor_validate_process_specifier(), tor_version_as_new_as(), tor_version_compare(), tor_version_parse(), tor_version_same_series(), tor_x509_cert_decode(), tor_x509_cert_decode_internal(), tor_x509_cert_dup(), tor_x509_cert_get_der(), tor_zlib_compress_process(), tor_zlib_compress_state_size(), tor_zstd_compress_process(), tor_zstd_compress_state_size(), transport_add(), transport_copy(), update_circuit_on_cmux_(), update_consensus_bootstrap_attempt_downloads(), upload_descriptor_to_all(), validate_transport_socks_arguments(), validate_transports_in_state(), warn_about_relative_paths(), write_escaped_data(), and write_packed_cell().

◆ tor_disable_spawning_background_processes()

void tor_disable_spawning_background_processes ( void  )

Turn off may_spawn_background_process, so that all future calls to tor_spawn_background are guaranteed to fail.

Definition at line 132 of file process.c.

References may_spawn_background_process.

Referenced by options_act().

Variable Documentation

◆ may_spawn_background_process

int may_spawn_background_process = 1
static

Boolean. If true, then Tor may call execve or CreateProcess via tor_spawn_background.

Definition at line 33 of file process.c.

Referenced by tor_disable_spawning_background_processes().

◆ processes

smartlist_t* processes
static

A list of all process_t instances currently allocated.

Definition at line 27 of file process.c.

Referenced by process_free_all(), process_get_all_processes(), and process_init().