X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=net%2Ftux%2Fcgi.c;h=e839bf6ddbd6c977065a75b850ecca6e42fddcb2;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=fda4d3825b6312b1b5e30f264f243f776af30ebb;hpb=cee37fe97739d85991964371c1f3a745c00dd236;p=linux-2.6.git diff --git a/net/tux/cgi.c b/net/tux/cgi.c index fda4d3825..e839bf6dd 100644 --- a/net/tux/cgi.c +++ b/net/tux/cgi.c @@ -30,6 +30,8 @@ static int exec_usermode(char *program_path, char *argv[], char *envp[]) { + struct files_struct *files = current->files; + struct fdtable *fdt; int i, err; err = tux_chroot(tux_cgiroot); @@ -41,16 +43,16 @@ static int exec_usermode(char *program_path, char *argv[], char *envp[]) /* Allow execve args to be in kernel space. */ set_fs(KERNEL_DS); - flush_signals(current); - spin_lock_irq(¤t->sighand->siglock); - flush_signal_handlers(current, 1); - spin_unlock_irq(¤t->sighand->siglock); + // TODO: is this RCU-safe? + spin_lock(&files->file_lock); + fdt = files_fdtable(files); + spin_unlock(&files->file_lock); - for (i = 3; i < current->files->max_fds; i++ ) - if (current->files->fd[i]) + for (i = 3; i < fdt->max_fds; i++ ) + if (fdt->fd[i]) tux_close(i); - err = execve(program_path, argv, envp); + err = __exec_usermodehelper(program_path, argv, envp, NULL); if (err < 0) return err; return 0; @@ -73,16 +75,14 @@ static int exec_helper (void * data) int ret; sprintf(current->comm,"doexec - %d", current->pid); -#if CONFIG_SMP +#ifdef CONFIG_SMP if (!tux_cgi_inherit_cpu) { - - cpumask_t cgi_mask, map; - - mask_to_cpumask(tux_cgi_cpu_mask, &cgi_mask); - cpus_and(map, cpu_online_map, cgi_mask); - + cpumask_t map; + + cpus_and(map, cpu_online_map, tux_cgi_cpu_mask); + if (!(cpus_empty(map))) - set_cpus_allowed(current, cgi_mask); + set_cpus_allowed(current, map); else set_cpus_allowed(current, cpu_online_map); } @@ -111,6 +111,9 @@ static int exec_helper (void * data) * CGI application. */ if (param->pipe_fds) { + struct files_struct *files = current->files; + struct fdtable *fdt; + tux_close(1); tux_close(2); tux_close(4); @@ -121,17 +124,12 @@ static int exec_helper (void * data) tux_close(3); tux_close(5); // do not close on exec. -#if 0 - sys_fcntl(0, F_SETFD, 0); - sys_fcntl(1, F_SETFD, 0); - sys_fcntl(2, F_SETFD, 0); -#else - spin_lock(¤t->files->file_lock); - FD_CLR(0, current->files->close_on_exec); - FD_CLR(1, current->files->close_on_exec); - FD_CLR(2, current->files->close_on_exec); - spin_unlock(¤t->files->file_lock); -#endif + spin_lock(&files->file_lock); + fdt = files_fdtable(files); + FD_CLR(0, fdt->close_on_exec); + FD_CLR(1, fdt->close_on_exec); + FD_CLR(2, fdt->close_on_exec); + spin_unlock(&files->file_lock); } ret = exec_usermode(param->command, param->argv, param->envp); if (ret < 0)