tor  0.4.2.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-2019, The Tor Project, Inc. */
4 /* See LICENSE for licensing information */
5 
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 
21 struct process_t;
22 
23 struct process_unix_t;
24 typedef struct process_unix_t process_unix_t;
25 
27 void 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 
32 bool process_unix_terminate(struct process_t *process);
33 
34 process_pid_t process_unix_get_pid(struct process_t *process);
35 
36 int process_unix_write(struct process_t *process, buf_t *buffer);
37 int process_unix_read_stdout(struct process_t *process, buf_t *buffer);
38 int process_unix_read_stderr(struct process_t *process, buf_t *buffer);
39 
40 #ifdef PROCESS_UNIX_PRIVATE
43 
44 STATIC void stdout_read_callback(evutil_socket_t fd, short event, void *data);
45 STATIC void stderr_read_callback(evutil_socket_t fd, short event, void *data);
46 STATIC void stdin_write_callback(evutil_socket_t fd, short event, void *data);
47 
50 
53 
54 STATIC void process_unix_waitpid_callback(int status, void *data);
55 
56 STATIC void process_unix_setup_handle(process_t *process,
57  process_unix_handle_t *handle,
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) */
STATIC void process_unix_start_reading(process_unix_handle_t *handle)
Definition: process_unix.c:512
void process_unix_free_(process_unix_t *unix_process)
Definition: process_unix.c:104
STATIC void stderr_read_callback(evutil_socket_t fd, short event, void *data)
Definition: process_unix.c:482
STATIC void process_unix_start_writing(process_unix_handle_t *handle)
Definition: process_unix.c:539
Headers for util_malloc.c.
STATIC void stdout_read_callback(evutil_socket_t fd, short event, void *data)
Definition: process_unix.c:466
int process_unix_read_stdout(struct process_t *process, buf_t *buffer)
Definition: process_unix.c:434
bool process_unix_terminate(struct process_t *process)
Definition: process_unix.c:355
process_pid_t process_unix_get_pid(struct process_t *process)
Definition: process_unix.c:387
process_status_t process_unix_exec(struct process_t *process)
Definition: process_unix.c:131
STATIC bool process_unix_close_file_descriptors(process_unix_t *unix_process)
Definition: process_unix.c:654
process_status_t
Definition: process.h:24
STATIC void stdin_write_callback(evutil_socket_t fd, short event, void *data)
Definition: process_unix.c:498
int process_unix_read_stderr(struct process_t *process, buf_t *buffer)
Definition: process_unix.c:449
struct event * event
Definition: process_unix.c:64
STATIC void process_unix_stop_writing(process_unix_handle_t *handle)
Definition: process_unix.c:553
process_unix_t * process_unix_new(void)
Definition: process_unix.c:90
STATIC int process_unix_read_handle(process_t *process, process_unix_handle_t *handle, buf_t *buffer)
Definition: process_unix.c:621
STATIC void process_unix_waitpid_callback(int status, void *data)
Definition: process_unix.c:571
STATIC void process_unix_setup_handle(process_t *process, process_unix_handle_t *handle, short flags, event_callback_fn callback)
Definition: process_unix.c:595
int process_unix_write(struct process_t *process, buf_t *buffer)
Definition: process_unix.c:398
STATIC void process_unix_stop_reading(process_unix_handle_t *handle)
Definition: process_unix.c:524