Tor  0.4.7.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 
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 
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) */
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
process_unix_t * process_unix_new(void)
Definition: process_unix.c:90
bool process_unix_terminate(struct process_t *process)
Definition: process_unix.c:348
struct event * event
Definition: process_unix.c:64
#define STATIC
Definition: testsupport.h:32