mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
take close-on-exec logics to fs/file.c, clean it up a bit
... and add cond_resched() there, while we are at it. We can get large latencies as is... Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
723a1d7743
commit
6a6d27de34
3 changed files with 44 additions and 35 deletions
41
fs/exec.c
41
fs/exec.c
|
|
@ -1006,40 +1006,6 @@ no_thread_group:
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* These functions flushes out all traces of the currently running executable
|
||||
* so that a new one can be started
|
||||
*/
|
||||
static void flush_old_files(struct files_struct * files)
|
||||
{
|
||||
long j = -1;
|
||||
struct fdtable *fdt;
|
||||
|
||||
spin_lock(&files->file_lock);
|
||||
for (;;) {
|
||||
unsigned long set, i;
|
||||
|
||||
j++;
|
||||
i = j * BITS_PER_LONG;
|
||||
fdt = files_fdtable(files);
|
||||
if (i >= fdt->max_fds)
|
||||
break;
|
||||
set = fdt->close_on_exec[j];
|
||||
if (!set)
|
||||
continue;
|
||||
fdt->close_on_exec[j] = 0;
|
||||
spin_unlock(&files->file_lock);
|
||||
for ( ; set ; i++,set >>= 1) {
|
||||
if (set & 1) {
|
||||
sys_close(i);
|
||||
}
|
||||
}
|
||||
spin_lock(&files->file_lock);
|
||||
|
||||
}
|
||||
spin_unlock(&files->file_lock);
|
||||
}
|
||||
|
||||
char *get_task_comm(char *buf, struct task_struct *tsk)
|
||||
{
|
||||
/* buf must be at least sizeof(tsk->comm) in size */
|
||||
|
|
@ -1050,6 +1016,11 @@ char *get_task_comm(char *buf, struct task_struct *tsk)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(get_task_comm);
|
||||
|
||||
/*
|
||||
* These functions flushes out all traces of the currently running executable
|
||||
* so that a new one can be started
|
||||
*/
|
||||
|
||||
void set_task_comm(struct task_struct *tsk, char *buf)
|
||||
{
|
||||
task_lock(tsk);
|
||||
|
|
@ -1171,7 +1142,7 @@ void setup_new_exec(struct linux_binprm * bprm)
|
|||
current->self_exec_id++;
|
||||
|
||||
flush_signal_handlers(current, 0);
|
||||
flush_old_files(current->files);
|
||||
do_close_on_exec(current->files);
|
||||
}
|
||||
EXPORT_SYMBOL(setup_new_exec);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue