Skip to content

Commit cab0515

Browse files
author
Al Viro
committed
move close_range(2) into fs/file.c, fold __close_range() into it
We never had callers for __close_range() except for close_range(2) itself. Nothing of that sort has appeared in four years and if any users do show up, we can always separate those suckers again. Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 1fa4ffd commit cab0515

File tree

3 files changed

+4
-20
lines changed

3 files changed

+4
-20
lines changed

fs/file.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,16 +713,18 @@ static inline void __range_close(struct files_struct *files, unsigned int fd,
713713
}
714714

715715
/**
716-
* __close_range() - Close all file descriptors in a given range.
716+
* sys_close_range() - Close all file descriptors in a given range.
717717
*
718718
* @fd: starting file descriptor to close
719719
* @max_fd: last file descriptor to close
720720
* @flags: CLOSE_RANGE flags.
721721
*
722722
* This closes a range of file descriptors. All file descriptors
723723
* from @fd up to and including @max_fd are closed.
724+
* Currently, errors to close a given file descriptor are ignored.
724725
*/
725-
int __close_range(unsigned fd, unsigned max_fd, unsigned int flags)
726+
SYSCALL_DEFINE3(close_range, unsigned int, fd, unsigned int, max_fd,
727+
unsigned int, flags)
726728
{
727729
struct task_struct *me = current;
728730
struct files_struct *cur_fds = me->files, *fds = NULL;

fs/open.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,23 +1574,6 @@ SYSCALL_DEFINE1(close, unsigned int, fd)
15741574
return retval;
15751575
}
15761576

1577-
/**
1578-
* sys_close_range() - Close all file descriptors in a given range.
1579-
*
1580-
* @fd: starting file descriptor to close
1581-
* @max_fd: last file descriptor to close
1582-
* @flags: reserved for future extensions
1583-
*
1584-
* This closes a range of file descriptors. All file descriptors
1585-
* from @fd up to and including @max_fd are closed.
1586-
* Currently, errors to close a given file descriptor are ignored.
1587-
*/
1588-
SYSCALL_DEFINE3(close_range, unsigned int, fd, unsigned int, max_fd,
1589-
unsigned int, flags)
1590-
{
1591-
return __close_range(fd, max_fd, flags);
1592-
}
1593-
15941577
/*
15951578
* This routine simulates a hangup on the tty, to arrange that users
15961579
* are given clean terminals at login time.

include/linux/fdtable.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ int iterate_fd(struct files_struct *, unsigned,
111111
const void *);
112112

113113
extern int close_fd(unsigned int fd);
114-
extern int __close_range(unsigned int fd, unsigned int max_fd, unsigned int flags);
115114
extern struct file *file_close_fd(unsigned int fd);
116115

117116
extern struct kmem_cache *files_cachep;

0 commit comments

Comments
 (0)