Remove deprecated fgetsock() and fputsock().
This commit is contained in:
parent
e2c14d90df
commit
4fce19da8d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=312087
@ -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>
|
||||
@ -2839,61 +2838,6 @@ fgetvp_write(struct thread *td, int fd, cap_rights_t *rightsp,
|
||||
}
|
||||
#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.
|
||||
*/
|
||||
|
@ -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 fd, cap_rights_t *rightsp,
|
||||
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)
|
||||
{
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user