From mboxrd@z Thu Jan 1 00:00:00 1970 From: Josh Triplett Subject: [PATCH 5/6] fs: Make alloc_fd non-private Date: Thu, 12 Mar 2015 18:40:54 -0700 Message-ID: <5083dceeba618b421c25042c6343080f09f919f8.1426180120.git.josh@joshtriplett.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: Al Viro , Andrew Morton , Andy Lutomirski , Ingo Molnar , Kees Cook , Oleg Nesterov , "Paul E. McKenney" , "H. Peter Anvin" , Rik van Riel , Thomas Gleixner , Thiago Macieira , Michael Kerrisk , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-fsdevel.vger.kernel.org This allows callers to allocate a file descriptor with a defined minimum value, without directly calling the lower-level __alloc_fd. Signed-off-by: Josh Triplett Signed-off-by: Thiago Macieira --- fs/file.c | 2 +- include/linux/file.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/file.c b/fs/file.c index ee738ea..583ba46 100644 --- a/fs/file.c +++ b/fs/file.c @@ -500,7 +500,7 @@ out: return error; } -static int alloc_fd(unsigned start, unsigned flags) +int alloc_fd(unsigned start, unsigned flags) { return __alloc_fd(current->files, start, rlimit(RLIMIT_NOFILE), flags); } diff --git a/include/linux/file.h b/include/linux/file.h index f87d308..d49f3bd 100644 --- a/include/linux/file.h +++ b/include/linux/file.h @@ -65,6 +65,7 @@ extern int replace_fd(unsigned fd, struct file *file, unsigned flags); extern void set_close_on_exec(unsigned int fd, int flag); extern bool get_close_on_exec(unsigned int fd); extern void put_filp(struct file *); +extern int alloc_fd(unsigned start, unsigned flags); extern int get_unused_fd_flags(unsigned flags); extern void put_unused_fd(unsigned int fd); -- 2.1.4