new helper: daemonize_descriptors()

descriptor-related parts of daemonize, done right.  As the
result we simplify the locking rules for ->files - we
hold task_lock in *all* cases when we modify ->files.

Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
Al Viro 2012-08-22 18:42:10 -04:00
commit 864bdb3b6c
3 changed files with 8 additions and 3 deletions

View file

@ -519,6 +519,12 @@ struct files_struct init_files = {
.file_lock = __SPIN_LOCK_UNLOCKED(init_task.file_lock),
};
void daemonize_descriptors(void)
{
atomic_inc(&init_files.count);
reset_files_struct(&init_files);
}
/*
* allocate a file descriptor, mark it busy.
*/