libdebian-installer
|
00001 /* 00002 * exec.h 00003 * 00004 * Copyright (C) 2003 Bastian Blank <waldi@debian.org> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * $Id$ 00021 */ 00022 00023 #ifndef DEBIAN_INSTALLER__EXEC_H 00024 #define DEBIAN_INSTALLER__EXEC_H 00025 00026 #include <debian-installer/types.h> 00027 00028 #include <sys/types.h> 00029 #include <sys/wait.h> 00030 #include <unistd.h> 00031 00037 di_io_handler 00041 di_exec_io_log; 00042 di_process_handler 00048 di_exec_prepare_chdir, 00054 di_exec_prepare_chroot; 00055 00071 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); 00072 00081 static inline int di_exec (const char *path, const char *const argv[]) 00082 { 00083 return di_exec_full (path, argv, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 00084 } 00085 00102 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); 00103 00113 static inline int di_exec_env (const char *path, const char *const argv[], const char *const envp[]) 00114 { 00115 return di_exec_env_full (path, argv, envp, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 00116 } 00117 00133 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); 00134 00143 static inline int di_exec_path (const char *file, const char *const argv[]) 00144 { 00145 return di_exec_path_full (file, argv, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 00146 } 00147 00162 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); 00163 00171 static inline int di_exec_shell (const char *const cmd) 00172 { 00173 return di_exec_shell_full (cmd, NULL, NULL, NULL, NULL, NULL, NULL, NULL); 00174 } 00175 00183 inline static int di_exec_shell_log (const char *const cmd) 00184 { 00185 return di_exec_shell_full (cmd, di_exec_io_log, NULL, NULL, NULL, NULL, NULL, NULL); 00186 } 00187 00193 int di_exec_mangle_status (int status); 00194 00199 inline static int di_execlog (const char *const cmd) __attribute__ ((deprecated)); 00200 inline static int di_execlog (const char *const cmd) 00201 { 00202 return di_exec_shell_log (cmd); 00203 } 00204 00206 #endif