diff options
Diffstat (limited to 'fs/file.c')
-rw-r--r-- | fs/file.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -599,11 +599,18 @@ EXPORT_SYMBOL(put_unused_fd); | |||
599 | * | 599 | * |
600 | * It should never happen - if we allow dup2() do it, _really_ bad things | 600 | * It should never happen - if we allow dup2() do it, _really_ bad things |
601 | * will follow. | 601 | * will follow. |
602 | * | ||
603 | * NOTE: __fd_install() variant is really, really low-level; don't | ||
604 | * use it unless you are forced to by truly lousy API shoved down | ||
605 | * your throat. 'files' *MUST* be either current->files or obtained | ||
606 | * by get_files_struct(current) done by whoever had given it to you, | ||
607 | * or really bad things will happen. Normally you want to use | ||
608 | * fd_install() instead. | ||
602 | */ | 609 | */ |
603 | 610 | ||
604 | void fd_install(unsigned int fd, struct file *file) | 611 | void __fd_install(struct files_struct *files, unsigned int fd, |
612 | struct file *file) | ||
605 | { | 613 | { |
606 | struct files_struct *files = current->files; | ||
607 | struct fdtable *fdt; | 614 | struct fdtable *fdt; |
608 | spin_lock(&files->file_lock); | 615 | spin_lock(&files->file_lock); |
609 | fdt = files_fdtable(files); | 616 | fdt = files_fdtable(files); |
@@ -612,4 +619,9 @@ void fd_install(unsigned int fd, struct file *file) | |||
612 | spin_unlock(&files->file_lock); | 619 | spin_unlock(&files->file_lock); |
613 | } | 620 | } |
614 | 621 | ||
622 | void fd_install(unsigned int fd, struct file *file) | ||
623 | { | ||
624 | __fd_install(current->files, fd, file); | ||
625 | } | ||
626 | |||
615 | EXPORT_SYMBOL(fd_install); | 627 | EXPORT_SYMBOL(fd_install); |