svn commit: r272185 - in head/sys: kern sys

Mateusz Guzik mjg at FreeBSD.org
Fri Sep 26 19:48:48 UTC 2014


Author: mjg
Date: Fri Sep 26 19:48:47 2014
New Revision: 272185
URL: http://svnweb.freebsd.org/changeset/base/272185

Log:
  Make do_dup() static and move relevant macros to kern_descrip.c
  
  No functional changes.

Modified:
  head/sys/kern/kern_descrip.c
  head/sys/sys/filedesc.h

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Fri Sep 26 19:13:13 2014	(r272184)
+++ head/sys/kern/kern_descrip.c	Fri Sep 26 19:48:47 2014	(r272185)
@@ -101,6 +101,8 @@ static uma_zone_t file_zone;
 
 static int	closefp(struct filedesc *fdp, int fd, struct file *fp,
 		    struct thread *td, int holdleaders);
+static int	do_dup(struct thread *td, int flags, int old, int new,
+		    register_t *retval);
 static int	fd_first_free(struct filedesc *fdp, int low, int size);
 static int	fd_last_used(struct filedesc *fdp, int size);
 static void	fdgrowtable(struct filedesc *fdp, int nfd);
@@ -109,6 +111,11 @@ static void	fdunused(struct filedesc *fd
 static void	fdused(struct filedesc *fdp, int fd);
 static int	getmaxfd(struct proc *p);
 
+/* Flags for do_dup() */
+#define	DUP_FIXED	0x1	/* Force fixed allocation. */
+#define	DUP_FCNTL	0x2	/* fcntl()-style errors. */
+#define	DUP_CLOEXEC	0x4	/* Atomically set FD_CLOEXEC. */
+
 /*
  * Each process has:
  *
@@ -785,7 +792,7 @@ getmaxfd(struct proc *p)
 /*
  * Common code for dup, dup2, fcntl(F_DUPFD) and fcntl(F_DUP2FD).
  */
-int
+static int
 do_dup(struct thread *td, int flags, int old, int new,
     register_t *retval)
 {

Modified: head/sys/sys/filedesc.h
==============================================================================
--- head/sys/sys/filedesc.h	Fri Sep 26 19:13:13 2014	(r272184)
+++ head/sys/sys/filedesc.h	Fri Sep 26 19:48:47 2014	(r272185)
@@ -109,11 +109,6 @@ struct filedesc_to_leader {
 
 #ifdef _KERNEL
 
-/* Flags for do_dup() */
-#define	DUP_FIXED	0x1	/* Force fixed allocation. */
-#define	DUP_FCNTL	0x2	/* fcntl()-style errors. */
-#define	DUP_CLOEXEC	0x4	/* Atomically set FD_CLOEXEC. */
-
 /* Lock a file descriptor table. */
 #define	FILEDESC_LOCK_INIT(fdp)	sx_init(&(fdp)->fd_sx, "filedesc structure")
 #define	FILEDESC_LOCK_DESTROY(fdp)	sx_destroy(&(fdp)->fd_sx)
@@ -137,8 +132,6 @@ void	filecaps_move(struct filecaps *src,
 void	filecaps_free(struct filecaps *fcaps);
 
 int	closef(struct file *fp, struct thread *td);
-int	do_dup(struct thread *td, int flags, int old, int new,
-	    register_t *retval);
 int	dupfdopen(struct thread *td, struct filedesc *fdp, int dfd, int mode,
 	    int openerror, int *indxp);
 int	falloc(struct thread *td, struct file **resultfp, int *resultfd,


More information about the svn-src-head mailing list