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

Gleb Smirnoff glebius at FreeBSD.org
Fri Jan 13 22:16:43 UTC 2017


Author: glebius
Date: Fri Jan 13 22:16:41 2017
New Revision: 312087
URL: https://svnweb.freebsd.org/changeset/base/312087

Log:
  Remove deprecated fgetsock() and fputsock().

Modified:
  head/sys/kern/kern_descrip.c
  head/sys/sys/file.h
  head/sys/sys/param.h

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Fri Jan 13 21:52:53 2017	(r312086)
+++ head/sys/kern/kern_descrip.c	Fri Jan 13 22:16:41 2017	(r312087)
@@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/resourcevar.h>
 #include <sys/sbuf.h>
 #include <sys/signalvar.h>
-#include <sys/socketvar.h>
 #include <sys/kdb.h>
 #include <sys/stat.h>
 #include <sys/sx.h>
@@ -2840,61 +2839,6 @@ fgetvp_write(struct thread *td, int fd, 
 #endif
 
 /*
- * Like fget() but loads the underlying socket, or returns an error if the
- * descriptor does not represent a socket.
- *
- * We bump the ref count on the returned socket.  XXX Also obtain the SX lock
- * in the future.
- *
- * Note: fgetsock() and fputsock() are deprecated, as consumers should rely
- * on their file descriptor reference to prevent the socket from being free'd
- * during use.
- */
-int
-fgetsock(struct thread *td, int fd, cap_rights_t *rightsp, struct socket **spp,
-    u_int *fflagp)
-{
-	struct file *fp;
-	int error;
-
-	*spp = NULL;
-	if (fflagp != NULL)
-		*fflagp = 0;
-	if ((error = _fget(td, fd, &fp, 0, rightsp, NULL)) != 0)
-		return (error);
-	if (fp->f_type != DTYPE_SOCKET) {
-		error = ENOTSOCK;
-	} else {
-		*spp = fp->f_data;
-		if (fflagp)
-			*fflagp = fp->f_flag;
-		SOCK_LOCK(*spp);
-		soref(*spp);
-		SOCK_UNLOCK(*spp);
-	}
-	fdrop(fp, td);
-
-	return (error);
-}
-
-/*
- * Drop the reference count on the socket and XXX release the SX lock in the
- * future.  The last reference closes the socket.
- *
- * Note: fputsock() is deprecated, see comment for fgetsock().
- */
-void
-fputsock(struct socket *so)
-{
-
-	ACCEPT_LOCK();
-	SOCK_LOCK(so);
-	CURVNET_SET(so->so_vnet);
-	sorele(so);
-	CURVNET_RESTORE();
-}
-
-/*
  * Handle the last reference to a file being closed.
  */
 int

Modified: head/sys/sys/file.h
==============================================================================
--- head/sys/sys/file.h	Fri Jan 13 21:52:53 2017	(r312086)
+++ head/sys/sys/file.h	Fri Jan 13 22:16:41 2017	(r312087)
@@ -50,8 +50,6 @@ struct thread;
 struct uio;
 struct knote;
 struct vnode;
-struct socket;
-
 
 #endif /* _KERNEL */
 
@@ -267,10 +265,6 @@ int fgetvp_read(struct thread *td, int f
 int fgetvp_write(struct thread *td, int fd, cap_rights_t *rightsp,
     struct vnode **vpp);
 
-int fgetsock(struct thread *td, int fd, cap_rights_t *rightsp,
-    struct socket **spp, u_int *fflagp);
-void fputsock(struct socket *sp);
-
 static __inline int
 _fnoop(void)
 {

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Fri Jan 13 21:52:53 2017	(r312086)
+++ head/sys/sys/param.h	Fri Jan 13 22:16:41 2017	(r312087)
@@ -58,7 +58,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1200019	/* Master, propagated to newvers */
+#define __FreeBSD_version 1200020	/* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,


More information about the svn-src-head mailing list