libdebian-installer
exec.h
1 /*
2  * exec.h
3  *
4  * Copyright (C) 2003 Bastian Blank <waldi@debian.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef DEBIAN_INSTALLER__EXEC_H
21 #define DEBIAN_INSTALLER__EXEC_H
22 
23 #include <debian-installer/types.h>
24 
25 #include <sys/types.h>
26 #include <sys/wait.h>
27 #include <unistd.h>
28 
52 
68 int di_exec_full (const char *path, const char *const argv[], di_io_handler *stdout_handler, di_io_handler *stderr_handler, void *io_user_data, di_process_handler *parent_prepare_handler, void *parent_prepare_user_data, di_process_handler *child_prepare_handler, void *child_prepare_user_data);
69 
78 static inline int di_exec (const char *path, const char *const argv[])
79 {
80  return di_exec_full (path, argv, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
81 }
82 
99 int di_exec_env_full (const char *path, const char *const argv[], const char *const envp[], di_io_handler *stdout_handler, di_io_handler *stderr_handler, void *io_user_data, di_process_handler *parent_prepare_handler, void *parent_prepare_user_data, di_process_handler *child_prepare_handler, void *child_prepare_user_data);
100 
110 static inline int di_exec_env (const char *path, const char *const argv[], const char *const envp[])
111 {
112  return di_exec_env_full (path, argv, envp, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
113 }
114 
130 int di_exec_path_full (const char *file, const char *const argv[], di_io_handler *stdout_handler, di_io_handler *stderr_handler, void *io_user_data, di_process_handler *parent_prepare_handler, void *parent_prepare_user_data, di_process_handler *child_prepare_handler, void *child_prepare_user_data);
131 
140 static inline int di_exec_path (const char *file, const char *const argv[])
141 {
142  return di_exec_path_full (file, argv, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
143 }
144 
159 int di_exec_shell_full (const char *const cmd, di_io_handler *stdout_handler, di_io_handler *stderr_handler, void *io_user_data, di_process_handler *parent_prepare_handler, void *parent_prepare_user_data, di_process_handler *child_prepare_handler, void *child_prepare_user_data);
160 
168 static inline int di_exec_shell (const char *const cmd)
169 {
170  return di_exec_shell_full (cmd, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
171 }
172 
180 inline static int di_exec_shell_log (const char *const cmd)
181 {
182  return di_exec_shell_full (cmd, di_exec_io_log, NULL, NULL, NULL, NULL, NULL, NULL);
183 }
184 
190 int di_exec_mangle_status (int status);
191 
196 inline static int di_execlog (const char *const cmd) __attribute__ ((deprecated));
197 inline static int di_execlog (const char *const cmd)
198 {
199  return di_exec_shell_log (cmd);
200 }
201 
203 #endif
static int di_exec(const char *path, const char *const argv[])
Definition: exec.h:78
di_io_handler di_exec_io_log
Definition: exec.h:38
int di_exec_path_full(const char *file, const char *const argv[], di_io_handler *stdout_handler, di_io_handler *stderr_handler, void *io_user_data, di_process_handler *parent_prepare_handler, void *parent_prepare_user_data, di_process_handler *child_prepare_handler, void *child_prepare_user_data)
Definition: exec.c:237
static int di_exec_shell_log(const char *const cmd)
Definition: exec.h:180
static int di_exec_shell(const char *const cmd)
Definition: exec.h:168
static int di_exec_env(const char *path, const char *const argv[], const char *const envp[])
Definition: exec.h:110
int di_exec_shell_full(const char *const cmd, di_io_handler *stdout_handler, di_io_handler *stderr_handler, void *io_user_data, di_process_handler *parent_prepare_handler, void *parent_prepare_user_data, di_process_handler *child_prepare_handler, void *child_prepare_user_data)
Definition: exec.c:242
int di_exec_env_full(const char *path, const char *const argv[], const char *const envp[], di_io_handler *stdout_handler, di_io_handler *stderr_handler, void *io_user_data, di_process_handler *parent_prepare_handler, void *parent_prepare_user_data, di_process_handler *child_prepare_handler, void *child_prepare_user_data)
Definition: exec.c:232
di_process_handler di_exec_prepare_chdir
Definition: exec.h:45
di_process_handler di_exec_prepare_chroot
Definition: exec.h:51
int di_exec_full(const char *path, const char *const argv[], di_io_handler *stdout_handler, di_io_handler *stderr_handler, void *io_user_data, di_process_handler *parent_prepare_handler, void *parent_prepare_user_data, di_process_handler *child_prepare_handler, void *child_prepare_user_data)
Definition: exec.c:227
static int di_execlog(const char *const cmd) __attribute__((deprecated))
Definition: exec.h:197
static int di_exec_path(const char *file, const char *const argv[])
Definition: exec.h:140
int di_exec_mangle_status(int status)
Definition: exec.c:272
int di_process_handler(pid_t pid, void *user_data)
Definition: types.h:73
int di_io_handler(const char *buf, size_t len, void *user_data)
Definition: types.h:66