Tor  0.4.7.0-alpha-dev
Macros | Functions
process_unix.h File Reference

Header for process_unix.c. More...

#include "orconfig.h"
#include "lib/malloc/malloc.h"
#include <event2/event.h>

Go to the source code of this file.

Macros

#define process_unix_free(s)    FREE_AND_NULL(process_unix_t, process_unix_free_, (s))
 

Functions

process_unix_tprocess_unix_new (void)
 
void process_unix_free_ (process_unix_t *unix_process)
 
process_status_t process_unix_exec (struct process_t *process)
 
bool process_unix_terminate (struct process_t *process)
 
process_pid_t process_unix_get_pid (struct process_t *process)
 
int process_unix_write (struct process_t *process, buf_t *buffer)
 
int process_unix_read_stdout (struct process_t *process, buf_t *buffer)
 
int process_unix_read_stderr (struct process_t *process, buf_t *buffer)
 

Detailed Description

Header for process_unix.c.

Definition in file process_unix.h.

Function Documentation

◆ process_unix_exec()

process_status_t process_unix_exec ( process_t process)

Executes the given process as a child process of Tor. This function is responsible for setting up the child process and run it. This includes setting up pipes for interprocess communication, initialize the waitpid callbacks, and finally run fork() followed by execve(). Returns PROCESS_STATUS_RUNNING upon success.

Cleanup standard in pipe.

Cleanup standard in pipe.

Cleanup standard out pipe.

Cleanup standard in pipe.

Cleanup standard out pipe.

Cleanup standard error pipe.

Definition at line 131 of file process_unix.c.

◆ process_unix_free_()

void process_unix_free_ ( process_unix_t unix_process)

Deallocates the given unix_process.

Definition at line 104 of file process_unix.c.

◆ process_unix_get_pid()

process_pid_t process_unix_get_pid ( process_t process)

Returns the unique process identifier for the given process.

Definition at line 380 of file process_unix.c.

Referenced by process_get_pid().

◆ process_unix_new()

process_unix_t* process_unix_new ( void  )

Returns a newly allocated process_unix_t.

Definition at line 90 of file process_unix.c.

◆ process_unix_read_stderr()

int process_unix_read_stderr ( process_t process,
buf_t *  buffer 
)

Read data from the given process's standard error and put it into buffer. Returns the number of bytes read.

Definition at line 442 of file process_unix.c.

Referenced by process_read_stderr().

◆ process_unix_read_stdout()

int process_unix_read_stdout ( process_t process,
buf_t *  buffer 
)

Read data from the given process's standard output and put it into buffer. Returns the number of bytes read.

Definition at line 427 of file process_unix.c.

Referenced by process_read_stdout().

◆ process_unix_terminate()

bool process_unix_terminate ( process_t process)

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

Definition at line 348 of file process_unix.c.

◆ process_unix_write()

int process_unix_write ( process_t process,
buf_t *  buffer 
)

Write the given buffer as input to the given process's standard input. Returns the number of bytes written.

Definition at line 391 of file process_unix.c.

Referenced by process_write_stdin().