Tor 0.4.9.0-alpha-dev
process_unix.h
Go to the documentation of this file.
1/* Copyright (c) 2003-2004, Roger Dingledine
2 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3 * Copyright (c) 2007-2021, The Tor Project, Inc. */
4/* See LICENSE for licensing information */
5
6/**
7 * \file process_unix.h
8 * \brief Header for process_unix.c
9 **/
10
11#ifndef TOR_PROCESS_UNIX_H
12#define TOR_PROCESS_UNIX_H
13
14#ifndef _WIN32
15
16#include "orconfig.h"
17#include "lib/malloc/malloc.h"
18
19#include <event2/event.h>
20
21struct process_t;
22
23struct process_unix_t;
24typedef struct process_unix_t process_unix_t;
25
27void process_unix_free_(process_unix_t *unix_process);
28#define process_unix_free(s) \
29 FREE_AND_NULL(process_unix_t, process_unix_free_, (s))
30
32bool process_unix_terminate(struct process_t *process);
33
34process_pid_t process_unix_get_pid(struct process_t *process);
35
36int process_unix_write(struct process_t *process, buf_t *buffer);
37int process_unix_read_stdout(struct process_t *process, buf_t *buffer);
38int process_unix_read_stderr(struct process_t *process, buf_t *buffer);
39
40#ifdef PROCESS_UNIX_PRIVATE
43
44STATIC void stdout_read_callback(evutil_socket_t fd, short event, void *data);
45STATIC void stderr_read_callback(evutil_socket_t fd, short event, void *data);
46STATIC void stdin_write_callback(evutil_socket_t fd, short event, void *data);
47
50
53
54STATIC void process_unix_waitpid_callback(int status, void *data);
55
58 short flags,
59 event_callback_fn callback);
62 buf_t *);
64#endif /* defined(PROCESS_UNIX_PRIVATE) */
65
66#endif /* !defined(_WIN32) */
67
68#endif /* !defined(TOR_PROCESS_UNIX_H) */
Headers for util_malloc.c.
process_status_t
Definition: process.h:26
STATIC void stdin_write_callback(evutil_socket_t fd, short event, void *data)
Definition: process_unix.c:491
STATIC void process_unix_setup_handle(process_t *process, process_unix_handle_t *handle, short flags, event_callback_fn callback)
Definition: process_unix.c:588
STATIC void stdout_read_callback(evutil_socket_t fd, short event, void *data)
Definition: process_unix.c:459
STATIC void process_unix_start_writing(process_unix_handle_t *handle)
Definition: process_unix.c:532
STATIC void process_unix_stop_reading(process_unix_handle_t *handle)
Definition: process_unix.c:517
STATIC void stderr_read_callback(evutil_socket_t fd, short event, void *data)
Definition: process_unix.c:475
STATIC void process_unix_waitpid_callback(int status, void *data)
Definition: process_unix.c:564
STATIC void process_unix_start_reading(process_unix_handle_t *handle)
Definition: process_unix.c:505
STATIC int process_unix_read_handle(process_t *process, process_unix_handle_t *handle, buf_t *buffer)
Definition: process_unix.c:614
STATIC void process_unix_stop_writing(process_unix_handle_t *handle)
Definition: process_unix.c:546
STATIC bool process_unix_close_file_descriptors(process_unix_t *unix_process)
Definition: process_unix.c:647
int process_unix_read_stdout(struct process_t *process, buf_t *buffer)
Definition: process_unix.c:427
process_pid_t process_unix_get_pid(struct process_t *process)
Definition: process_unix.c:380
process_status_t process_unix_exec(struct process_t *process)
Definition: process_unix.c:131
int process_unix_read_stderr(struct process_t *process, buf_t *buffer)
Definition: process_unix.c:442
int process_unix_write(struct process_t *process, buf_t *buffer)
Definition: process_unix.c:391
void process_unix_free_(process_unix_t *unix_process)
Definition: process_unix.c:104
bool process_unix_terminate(struct process_t *process)
Definition: process_unix.c:348
process_unix_t * process_unix_new(void)
Definition: process_unix.c:90
struct event * event
Definition: process_unix.c:64
#define STATIC
Definition: testsupport.h:32