uipc_socket.c (243999) | uipc_socket.c (247667) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993 3 * The Regents of the University of California. 4 * Copyright (c) 2004 The FreeBSD Foundation 5 * Copyright (c) 2004-2008 Robert N. M. Watson 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 87 unchanged lines hidden (view full) --- 96 * NOTE: With regard to VNETs the general rule is that callers do not set 97 * curvnet. Exceptions to this rule include soabort(), sodisconnect(), 98 * sofree() (and with that sorele(), sotryfree()), as well as sonewconn() 99 * and sorflush(), which are usually called from a pre-set VNET context. 100 * sopoll() currently does not need a VNET context to be set. 101 */ 102 103#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993 3 * The Regents of the University of California. 4 * Copyright (c) 2004 The FreeBSD Foundation 5 * Copyright (c) 2004-2008 Robert N. M. Watson 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 87 unchanged lines hidden (view full) --- 96 * NOTE: With regard to VNETs the general rule is that callers do not set 97 * curvnet. Exceptions to this rule include soabort(), sodisconnect(), 98 * sofree() (and with that sorele(), sotryfree()), as well as sonewconn() 99 * and sorflush(), which are usually called from a pre-set VNET context. 100 * sopoll() currently does not need a VNET context to be set. 101 */ 102 103#include <sys/cdefs.h> |
104__FBSDID("$FreeBSD: head/sys/kern/uipc_socket.c 243999 2012-12-07 22:30:30Z pjd $"); | 104__FBSDID("$FreeBSD: head/sys/kern/uipc_socket.c 247667 2013-03-02 21:11:30Z pjd $"); |
105 106#include "opt_inet.h" 107#include "opt_inet6.h" 108#include "opt_zero.h" 109#include "opt_compat.h" 110 111#include <sys/param.h> 112#include <sys/systm.h> --- 497 unchanged lines hidden (view full) --- 610int 611sobind(struct socket *so, struct sockaddr *nam, struct thread *td) 612{ 613 int error; 614 615 CURVNET_SET(so->so_vnet); 616 error = (*so->so_proto->pr_usrreqs->pru_bind)(so, nam, td); 617 CURVNET_RESTORE(); | 105 106#include "opt_inet.h" 107#include "opt_inet6.h" 108#include "opt_zero.h" 109#include "opt_compat.h" 110 111#include <sys/param.h> 112#include <sys/systm.h> --- 497 unchanged lines hidden (view full) --- 610int 611sobind(struct socket *so, struct sockaddr *nam, struct thread *td) 612{ 613 int error; 614 615 CURVNET_SET(so->so_vnet); 616 error = (*so->so_proto->pr_usrreqs->pru_bind)(so, nam, td); 617 CURVNET_RESTORE(); |
618 return error; | 618 return (error); |
619} 620 | 619} 620 |
621int 622sobindat(int fd, struct socket *so, struct sockaddr *nam, struct thread *td) 623{ 624 int error; 625 626 CURVNET_SET(so->so_vnet); 627 error = (*so->so_proto->pr_usrreqs->pru_bindat)(fd, so, nam, td); 628 CURVNET_RESTORE(); 629 return (error); 630} 631 |
|
621/* 622 * solisten() transitions a socket from a non-listening state to a listening 623 * state, but can also be used to update the listen queue depth on an 624 * existing listen socket. The protocol will call back into the sockets 625 * layer using solisten_proto_check() and solisten_proto() to check and set 626 * socket-layer listen state. Call backs are used so that the protocol can 627 * acquire both protocol and socket layer locks in whatever order is required 628 * by the protocol. --- 4 unchanged lines hidden (view full) --- 633int 634solisten(struct socket *so, int backlog, struct thread *td) 635{ 636 int error; 637 638 CURVNET_SET(so->so_vnet); 639 error = (*so->so_proto->pr_usrreqs->pru_listen)(so, backlog, td); 640 CURVNET_RESTORE(); | 632/* 633 * solisten() transitions a socket from a non-listening state to a listening 634 * state, but can also be used to update the listen queue depth on an 635 * existing listen socket. The protocol will call back into the sockets 636 * layer using solisten_proto_check() and solisten_proto() to check and set 637 * socket-layer listen state. Call backs are used so that the protocol can 638 * acquire both protocol and socket layer locks in whatever order is required 639 * by the protocol. --- 4 unchanged lines hidden (view full) --- 644int 645solisten(struct socket *so, int backlog, struct thread *td) 646{ 647 int error; 648 649 CURVNET_SET(so->so_vnet); 650 error = (*so->so_proto->pr_usrreqs->pru_listen)(so, backlog, td); 651 CURVNET_RESTORE(); |
641 return error; | 652 return (error); |
642} 643 644int 645solisten_proto_check(struct socket *so) 646{ 647 648 SOCK_LOCK_ASSERT(so); 649 --- 241 unchanged lines hidden (view full) --- 891 error = (*so->so_proto->pr_usrreqs->pru_accept)(so, nam); 892 CURVNET_RESTORE(); 893 return (error); 894} 895 896int 897soconnect(struct socket *so, struct sockaddr *nam, struct thread *td) 898{ | 653} 654 655int 656solisten_proto_check(struct socket *so) 657{ 658 659 SOCK_LOCK_ASSERT(so); 660 --- 241 unchanged lines hidden (view full) --- 902 error = (*so->so_proto->pr_usrreqs->pru_accept)(so, nam); 903 CURVNET_RESTORE(); 904 return (error); 905} 906 907int 908soconnect(struct socket *so, struct sockaddr *nam, struct thread *td) 909{ |
910 911 return (soconnectat(AT_FDCWD, so, nam, td)); 912} 913 914int 915soconnectat(int fd, struct socket *so, struct sockaddr *nam, struct thread *td) 916{ |
|
899 int error; 900 901 if (so->so_options & SO_ACCEPTCONN) 902 return (EOPNOTSUPP); 903 904 CURVNET_SET(so->so_vnet); 905 /* 906 * If protocol is connection-based, can only connect once. --- 5 unchanged lines hidden (view full) --- 912 (error = sodisconnect(so)))) { 913 error = EISCONN; 914 } else { 915 /* 916 * Prevent accumulated error from previous connection from 917 * biting us. 918 */ 919 so->so_error = 0; | 917 int error; 918 919 if (so->so_options & SO_ACCEPTCONN) 920 return (EOPNOTSUPP); 921 922 CURVNET_SET(so->so_vnet); 923 /* 924 * If protocol is connection-based, can only connect once. --- 5 unchanged lines hidden (view full) --- 930 (error = sodisconnect(so)))) { 931 error = EISCONN; 932 } else { 933 /* 934 * Prevent accumulated error from previous connection from 935 * biting us. 936 */ 937 so->so_error = 0; |
920 error = (*so->so_proto->pr_usrreqs->pru_connect)(so, nam, td); | 938 if (fd == AT_FDCWD) { 939 error = (*so->so_proto->pr_usrreqs->pru_connect)(so, 940 nam, td); 941 } else { 942 error = (*so->so_proto->pr_usrreqs->pru_connectat)(fd, 943 so, nam, td); 944 } |
921 } 922 CURVNET_RESTORE(); 923 924 return (error); 925} 926 927int 928soconnect2(struct socket *so1, struct socket *so2) --- 2207 unchanged lines hidden (view full) --- 3136int 3137pru_bind_notsupp(struct socket *so, struct sockaddr *nam, struct thread *td) 3138{ 3139 3140 return EOPNOTSUPP; 3141} 3142 3143int | 945 } 946 CURVNET_RESTORE(); 947 948 return (error); 949} 950 951int 952soconnect2(struct socket *so1, struct socket *so2) --- 2207 unchanged lines hidden (view full) --- 3160int 3161pru_bind_notsupp(struct socket *so, struct sockaddr *nam, struct thread *td) 3162{ 3163 3164 return EOPNOTSUPP; 3165} 3166 3167int |
3168pru_bindat_notsupp(int fd, struct socket *so, struct sockaddr *nam, 3169 struct thread *td) 3170{ 3171 3172 return EOPNOTSUPP; 3173} 3174 3175int |
|
3144pru_connect_notsupp(struct socket *so, struct sockaddr *nam, struct thread *td) 3145{ 3146 3147 return EOPNOTSUPP; 3148} 3149 3150int | 3176pru_connect_notsupp(struct socket *so, struct sockaddr *nam, struct thread *td) 3177{ 3178 3179 return EOPNOTSUPP; 3180} 3181 3182int |
3183pru_connectat_notsupp(int fd, struct socket *so, struct sockaddr *nam, 3184 struct thread *td) 3185{ 3186 3187 return EOPNOTSUPP; 3188} 3189 3190int |
|
3151pru_connect2_notsupp(struct socket *so1, struct socket *so2) 3152{ 3153 3154 return EOPNOTSUPP; 3155} 3156 3157int 3158pru_control_notsupp(struct socket *so, u_long cmd, caddr_t data, --- 557 unchanged lines hidden --- | 3191pru_connect2_notsupp(struct socket *so1, struct socket *so2) 3192{ 3193 3194 return EOPNOTSUPP; 3195} 3196 3197int 3198pru_control_notsupp(struct socket *so, u_long cmd, caddr_t data, --- 557 unchanged lines hidden --- |