本文整理汇总了C++中do_execve函数的典型用法代码示例。如果您正苦于以下问题:C++ do_execve函数的具体用法?C++ do_execve怎么用?C++ do_execve使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了do_execve函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: open_and_exec
static int open_and_exec(t_shell *shell, t_tree *tree)
{
t_tree *current;
int idx;
int fd_idx;
current = tree;
fd_idx = 0;
while (current->up != NULL)
{
idx = 0;
while (idx != current->up->token)
idx += 1;
if (shell->tk_parsing[idx].f(shell, current, fd_idx++) == -1)
return (-1);
current = current->up;
}
if (do_execve(shell, current->left) == -1)
return (-1);
waiting_all_children(shell);
if (dup2(shell->base_in_out[0], 0) == -1 ||
dup2(shell->base_in_out[1], 1) == -1)
return (-1);
return (0);
}
开发者ID:ubertil,项目名称:my_projects,代码行数:25,代码来源:parser.c
示例2: sys_exec
static uint32_t
sys_exec(uint32_t arg[]) {
const char *name = (const char *)arg[0];
const char **argv = (const char **)arg[1];//kprintf("sys_exec : name=%s argc=%d\n", name, argc);int d;for (d = 0; d < argc; ++d) kprintf("\t#%d: %s\n", d, argv[d]);
const char **envp = (const char **)arg[2];
return do_execve(name, argv, envp);
}
开发者ID:PungiZhang,项目名称:ucore_plus-next,代码行数:7,代码来源:syscall.c
示例3: fork_handler
void fork_handler(t_shell *shell, char **args)
{
pid_t p;
p = fork();
if (p == 0)
{
if (execve(args[0], args, shell->env) == -1)
{
if (shell->env == NULL)
{
my_putstr_err(args[0]);
my_putstr_err(": Command not found.\n");
exit(0);
}
do_execve(shell->env, args);
}
exit(0);
}
else if (p != -1)
{
waitpid(0, &shell->status, 0);
}
else
my_putstr_err("FATAL ERROR : Fork failed\n");
}
开发者ID:ubertil,项目名称:my_projects,代码行数:26,代码来源:fork_handler.c
示例4: sys_execve
static uint32_t
sys_execve(uint32_t arg[]) {
const char *name = (const char *)arg[0];
const char **argv = (const char **)arg[1];
const char **envp = (const char **)arg[2];
return do_execve(name, argv, envp);
}
开发者ID:geraint0923,项目名称:ucore_plus,代码行数:7,代码来源:syscall.c
示例5: real_execve
asmlinkage int real_execve(struct pt_regs *regs)
{
int error;
char * filename;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
lock_kernel();
#endif
filename = getname((char *) regs->ebx);
error = PTR_ERR(filename);
if (IS_ERR(filename))
goto out;
error = do_execve(filename, (char **) regs->ecx, (char **) regs->edx, regs);
if (error == 0) {
#ifdef PT_DTRACE
current->ptrace &= ~PT_DTRACE;
#else
current->flags &= ~PF_DTRACE;
#endif
}
putname(filename);
out:
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
unlock_kernel();
#endif
return error;
}
开发者ID:lb1a,项目名称:avfs,代码行数:28,代码来源:redir.c
示例6: sys_exec
static uint32_t sys_exec(uint32_t arg[])
{
const char *name = (const char *)arg[0];
int argc = (int)arg[1];
const char **argv = (const char **)arg[2];
return do_execve(name, argc, argv);
}
开发者ID:Aresthu,项目名称:ucore_plus,代码行数:7,代码来源:syscall.c
示例7: my_sys_execve
asmlinkage static int my_sys_execve(struct pt_regs regs)
{
char * filename;
int ret;
MOD_INC_USE_COUNT;
lock_execve();
filename = getname((char *)regs.ebx);
if (IS_ERR(filename)) {
ret = PTR_ERR(filename);
goto out;
}
ret = do_execve(filename, (char **)regs.ecx, (char **)regs.edx, ®s);
if (!ret) {
PTRACE_OFF(current);
oprof_output_maps(current);
}
putname(filename);
out:
unlock_execve();
MOD_DEC_USE_COUNT;
return ret;
}
开发者ID:0omega,项目名称:platform_external_oprofile,代码行数:28,代码来源:op_syscalls.c
示例8: DEFINE_SYSCALL
DEFINE_SYSCALL(execve, const char *, filename, char **, argv, char **, envp)
{
/* TODO: Deal with argv/envp == NULL */
/* TODO: Don't destroy things on failure */
log_info("execve(%s, %p, %p)", filename, argv, envp);
/* Copy argv[] and envp[] to startup data */
char *current_startup_base = flip_startup_base();
/* Save filename in startup data area */
int flen = strlen(filename);
memcpy(current_startup_base, filename, flen + 1);
filename = current_startup_base;
current_startup_base += flen + 1;
char *base = current_startup_base;
int argc, env_size;
for (argc = 0; argv[argc]; argc++)
base += strlen(argv[argc]) + 1;
for (env_size = 0; envp[env_size]; env_size++)
base += strlen(envp[env_size]) + 1;
/* TODO: Test if we have enough size to hold the startup data */
char **new_argv = (char **)((uintptr_t)(base + sizeof(void*) - 1) & -sizeof(void*));
char **new_envp = new_argv + argc + 1;
base = current_startup_base;
for (int i = 0; i < argc; i++)
{
new_argv[i] = base;
int len = strlen(argv[i]);
memcpy(base, argv[i], len + 1);
base += len + 1;
}
new_argv[argc] = NULL;
for (int i = 0; i < env_size; i++)
{
new_envp[i] = base;
int len = strlen(envp[i]);
memcpy(base, envp[i], len + 1);
base += len + 1;
}
new_envp[env_size] = NULL;
for (int i = 0; i < argc; i++)
log_info("argv[%d] = \"%s\"", i, new_argv[i]);
for (int i = 0; i < env_size; i++)
log_info("envp[%d] = \"%s\"", i, new_envp[i]);
base = (char *)(new_envp + env_size + 1);
int r = do_execve(filename, argc, new_argv, env_size, new_envp, base, execve_initialize_routine);
if (r < 0) /* Should always be the case */
{
log_warning("execve() failed.");
flip_startup_base();
}
return r;
}
开发者ID:AnXi-TieGuanYin-Tea,项目名称:flinux,代码行数:60,代码来源:exec.c
示例9: sys_exec
static int sys_exec(uint32_t arg[])
{
const char *name = (const char *) arg[0];
size_t len = (size_t) arg[1];
unsigned char *binary = (unsigned char *) arg[2];
size_t size = (size_t) arg[3];
return do_execve(name, len, binary, size);
}
开发者ID:codeyangjun,项目名称:ucore,代码行数:8,代码来源:syscall.c
示例10: sys_execve
asmlinkage int
sys_execve(struct pt_regs* regs)
{
dprintk("sys_execve: %s, %p, %p\n",
regs->gregs[0], regs->gregs[1], regs->gregs[2]);
return do_execve((void*)regs->gregs[0], (void*)regs->gregs[1],
(void*)regs->gregs[2], regs);
}
开发者ID:robacklin,项目名称:uclinux-linux,代码行数:8,代码来源:syscall.c
示例11: sys_exec
static uint32_t sys_exec(uint32_t arg[])
{
const char *name = (const char *)arg[0];
int argc = (int)arg[1];
const char **argv = (const char **)arg[2];
current->arch.forking = 1;
int ret = do_execve(name, argc, argv);
current->arch.forking = 0;
return ret;
}
开发者ID:Aresthu,项目名称:ucore_plus,代码行数:10,代码来源:syscall.c
示例12: kern_execve
/*
* XXX: kern_execve has the astonishing property of not always returning to
* the caller. If sufficiently bad things happen during the call to
* do_execve(), it can end up calling exit1(); as a result, callers must
* avoid doing anything which they might need to undo (e.g., allocating
* memory).
*/
int
kern_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
{
AUDIT_ARG_ARGV(args->begin_argv, args->argc,
args->begin_envv - args->begin_argv);
AUDIT_ARG_ENVV(args->begin_envv, args->envc,
args->endp - args->begin_envv);
return (do_execve(td, args, mac_p));
}
开发者ID:cyrilmagsuci,项目名称:freebsd,代码行数:17,代码来源:kern_exec.c
示例13: kernel_execve
/**
* Exec a user program called by user_main kernel_thread
* Note: we don't need to emulate an interrupt here.
* @param name the name of the process
* @param argv the arguments
*/
int kernel_execve(const char *name, const char **argv)
{
int argc = 0, ret;
while (argv[argc] != NULL) {
argc++;
}
ret = do_execve(name, argc, argv);
kprintf("error with code: %d\n", ret);
return ret;
}
开发者ID:Aresthu,项目名称:ucore_plus,代码行数:16,代码来源:proc.c
示例14: execve1
static int execve1(char *file, char **argv, char **env)
{
int error;
error = do_execve(file, argv, env, ¤t->thread.regs);
if (error == 0){
current->ptrace &= ~PT_DTRACE;
set_cmdline(current_cmd());
}
return(error);
}
开发者ID:12019,项目名称:hg556a_source,代码行数:11,代码来源:exec_kern.c
示例15: sys_execve
/*
* sys_execve() executes a new program.
*/
asmlinkage int sys_execve(struct pt_regs *regs)
{
int error;
char * filename;
error = getname((char *) regs->reg4, &filename);
if (error)
return error;
error = do_execve(filename, (char **) regs->reg5,
(char **) regs->reg6, regs);
putname(filename);
return error;
}
开发者ID:andreiw,项目名称:mkunity,代码行数:16,代码来源:syscall.c
示例16: exec_preemptuser
void exec_preemptuser(void) {
long err;
err = task_files_init(curr_task);
if(err) {
kpanic("task_files_init failed: %s\n", strerror(-err));
}
err = do_execve("/bin/preemptuser", NULL, NULL, 0);
if(err) {
kpanic("do_execve failed: %s\n", strerror(-err));
}
kill_curr_task(0);
}
开发者ID:Fluray,项目名称:sbunix,代码行数:14,代码来源:test_preemption.c
示例17: sys_execve
/*
* sys_execve() executes a new program.
*
* This works due to the alpha calling sequence: the first 6 args
* are gotten from registers, while the rest is on the stack, so
* we get a0-a5 for free, and then magically find "struct pt_regs"
* on the stack for us..
*
* Don't do this at home.
*/
asmlinkage int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
unsigned long a3, unsigned long a4, unsigned long a5,
struct pt_regs regs)
{
int error;
char * filename;
error = getname((char *) a0, &filename);
if (error)
return error;
error = do_execve(filename, (char **) a1, (char **) a2, ®s);
putname(filename);
return error;
}
开发者ID:liexusong,项目名称:linux2.0-comment,代码行数:24,代码来源:process.c
示例18: sys_execve
/*
* sys_execve() executes a new program.
*/
asmlinkage int sys_execve(char *name, char **argv, char **envp,int dummy,...)
{
int error;
char * filename,* sp;
struct pt_regs *regs;
sp = (char *) &dummy;
sp+=8;
regs=(struct pt_regs *)sp;
error = getname(name, &filename);
if (error)
return error;
error = do_execve(filename, argv, envp, regs);
putname(filename);
return error;
}
开发者ID:carlobar,项目名称:uclinux_leon3_UD,代码行数:18,代码来源:process.c
示例19: sys_execve
/* sys_execve() executes a new program.
* This is called indirectly via a small wrapper
*/
asmlinkage int sys_execve(char *filenamei, char **argv, char **envp, struct pt_regs *regs)
{
int error;
char * filename;
lock_kernel();
filename = getname(filenamei);
error = PTR_ERR(filename);
if (IS_ERR(filename))
goto out;
error = do_execve(filename, argv, envp, regs);
putname(filename);
out:
unlock_kernel();
return error;
}
开发者ID:chinnyannieb,项目名称:empeg-hijack,代码行数:19,代码来源:sys_arm.c
示例20: sys_execve
/*
* sys_execve() executes a new program.
*/
asmlinkage int sys_execve(abi64_no_regargs, struct pt_regs regs)
{
int error;
char * filename;
filename = getname((char *) (long)regs.regs[4]);
error = PTR_ERR(filename);
if (IS_ERR(filename))
goto out;
error = do_execve(filename, (char **) (long)regs.regs[5],
(char **) (long)regs.regs[6], ®s);
putname(filename);
out:
return error;
}
开发者ID:iPodLinux,项目名称:linux-2.4.24-ipod,代码行数:19,代码来源:syscall.c
注:本文中的do_execve函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论