exec.h
/*
* exec.h
*
* Copyright (C) 2003 Bastian Blank <waldi@debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DEBIAN_INSTALLER__EXEC_H
#define DEBIAN_INSTALLER__EXEC_H
#include <debian-installer/types.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
di_io_handler
di_exec_io_log;
di_process_handler
di_exec_prepare_chdir,
di_exec_prepare_chroot;
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);
static inline int di_exec (const char *path, const char *const argv[])
{
return di_exec_full (path, argv, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}
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);
static inline int di_exec_env (const char *path, const char *const argv[], const char *const envp[])
{
return di_exec_env_full (path, argv, envp, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}
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);
static inline int di_exec_path (const char *file, const char *const argv[])
{
return di_exec_path_full (file, argv, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}
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);
static inline int di_exec_shell (const char *const cmd)
{
return di_exec_shell_full (cmd, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}
inline static int di_exec_shell_log (const char *const cmd)
{
return di_exec_shell_full (cmd, di_exec_io_log, NULL, NULL, NULL, NULL, NULL, NULL);
}
int di_exec_mangle_status (int status);
inline static int di_execlog (const char *const cmd) __attribute__ ((deprecated));
inline static int di_execlog (const char *const cmd)
{
return di_exec_shell_log (cmd);
}
#endif
di_exec
static int di_exec(const char *path, const char *const argv[])
Definition: exec.h:78
di_exec_io_log
di_io_handler di_exec_io_log
Definition: exec.h:38
di_exec_path_full
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
di_exec_shell_log
static int di_exec_shell_log(const char *const cmd)
Definition: exec.h:180
di_exec_shell
static int di_exec_shell(const char *const cmd)
Definition: exec.h:168
di_exec_env
static int di_exec_env(const char *path, const char *const argv[], const char *const envp[])
Definition: exec.h:110
di_exec_shell_full
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
di_exec_env_full
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_exec_prepare_chdir
di_process_handler di_exec_prepare_chdir
Definition: exec.h:45
di_exec_prepare_chroot
di_process_handler di_exec_prepare_chroot
Definition: exec.h:51
di_exec_full
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
di_execlog
static int di_execlog(const char *const cmd) __attribute__((deprecated))
Definition: exec.h:197
di_exec_path
static int di_exec_path(const char *file, const char *const argv[])
Definition: exec.h:140
di_exec_mangle_status
int di_exec_mangle_status(int status)
Definition: exec.c:272
di_process_handler
int di_process_handler(pid_t pid, void *user_data)
Definition: types.h:73
di_io_handler
int di_io_handler(const char *buf, size_t len, void *user_data)
Definition: types.h:66