Lines Matching defs:so
172 struct socket *so;
191 error = socreate(uap->domain, &so, uap->type, uap->protocol);
203 so->so_traffic_mgt_flags |= TRAFFIC_MGT_SO_BACKGROUND;
204 so->so_background_thread = thread;
206 fp->f_data = (caddr_t)so;
238 struct socket *so;
243 error = file_socket(uap->s, &so);
246 if (so == NULL) {
255 error = getsockaddr(so, &sa, uap->name, uap->namelen, TRUE);
257 error = getsockaddr_s(so, &ss, uap->name, uap->namelen, TRUE);
267 if ((error = mac_socket_check_bind(kauth_cred_get(), so, sa)) == 0)
268 error = sobind(so, sa);
270 error = sobind(so, sa);
294 struct socket *so;
297 error = file_socket(uap->s, &so);
300 if (so != NULL)
303 error = mac_socket_check_listen(kauth_cred_get(), so);
305 error = solisten(so, uap->backlog);
308 error = solisten(so, uap->backlog);
342 struct socket *head, *so = NULL;
436 so = TAILQ_FIRST(&head->so_comp);
437 TAILQ_REMOVE(&head->so_comp, so, so_list);
449 if ((error = mac_socket_check_accepted(kauth_cred_get(), so)) != 0) {
450 so->so_state &= ~(SS_NOFDREF | SS_COMP);
451 so->so_head = NULL;
452 soclose(so);
463 if (so->so_filt != NULL && (error = soacceptfilter(so)) != 0) {
480 so->so_state &= ~(SS_NOFDREF | SS_COMP);
481 so->so_head = NULL;
482 soclose(so);
490 fp->f_data = (caddr_t)so;
493 socket_lock(so, 1);
494 so->so_state &= ~SS_COMP;
495 so->so_head = NULL;
496 (void) soacceptlock(so, &sa, 0);
528 if (so->so_flags & SOF_DEFUNCT) {
529 sodefunct(current_proc(), so,
534 socket_unlock(so, 1);
586 struct socket *so;
596 error = file_socket(fd, &so);
599 if (so == NULL) {
608 dgram = (so->so_type == SOCK_DGRAM);
612 error = getsockaddr(so, &sa, uap->name, uap->namelen, !dgram);
614 error = getsockaddr_s(so, &ss, uap->name, uap->namelen, !dgram);
625 if ((error = mac_socket_check_connect(kauth_cred_get(), so, sa)) != 0) {
631 socket_lock(so, 1);
633 if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) {
636 socket_unlock(so, 1);
640 error = soconnectlock(so, sa, 0);
643 if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) {
646 socket_unlock(so, 1);
650 while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
651 if (so->so_proto->pr_getlock != NULL)
652 mutex_held = (*so->so_proto->pr_getlock)(so, 0);
654 mutex_held = so->so_proto->pr_domain->dom_mtx;
655 error = msleep((caddr_t)&so->so_timeo, mutex_held,
657 if ((so->so_state & SS_DRAINING)) {
664 error = so->so_error;
665 so->so_error = 0;
668 so->so_state &= ~SS_ISCONNECTING;
669 socket_unlock(so, 1);
817 struct socket *so;
822 error = file_socket(s, &so);
827 if (so == NULL) {
833 error = getsockaddr(so, &to, mp->msg_name,
836 error = getsockaddr_s(so, &ss, mp->msg_name,
865 !(so->so_state & SS_DEFUNCT) &&
866 (error = mac_socket_check_send(kauth_cred_get(), so, to)) != 0)
871 error = so->so_proto->pr_usrreqs->pru_sosend(so, to, uiop, 0, control,
878 if (error == EPIPE && !(so->so_flags & SOF_NOSIGPIPE))
1116 struct socket *so;
1133 so = (struct socket *)fp->f_data;
1134 if (so == NULL) {
1148 if (!(so->so_state & SS_DEFUNCT) &&
1149 !(so->so_state & SS_ISCONNECTED) &&
1150 (error = mac_socket_check_receive(kauth_cred_get(), so)) != 0)
1160 error = so->so_proto->pr_usrreqs->pru_soreceive(so, &fromsa, uiop,
1555 struct socket *so;
1559 error = file_socket(uap->s, &so);
1562 if (so == NULL) {
1566 error = soshutdown((struct socket *)so, uap->how);
1592 struct socket *so;
1601 error = file_socket(uap->s, &so);
1612 if (so == NULL) {
1617 if ((error = mac_socket_check_setsockopt(kauth_cred_get(), so,
1621 error = sosetopt(so, &sopt);
1647 struct socket *so;
1649 error = file_socket(uap->s, &so);
1668 if (so == NULL) {
1673 if ((error = mac_socket_check_getsockopt(kauth_cred_get(), so,
1677 error = sogetopt((struct socket *)so, &sopt);
1708 struct socket *so;
1714 error = file_socket(uap->fdes, &so);
1720 if (so == NULL) {
1725 socket_lock(so, 1);
1726 error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, &sa);
1728 error = sflt_getsockname(so, &sa);
1732 socket_unlock(so, 1);
1776 struct socket *so;
1782 error = file_socket(uap->fdes, &so);
1785 if (so == NULL) {
1790 socket_lock(so, 1);
1792 if ((so->so_state & (SS_CANTRCVMORE | SS_CANTSENDMORE)) ==
1795 socket_unlock(so, 1);
1800 if ((so->so_state & (SS_ISCONNECTED|SS_ISCONFIRMING)) == 0) {
1801 socket_unlock(so, 1);
1807 socket_unlock(so, 1);
1811 error = (*so->so_proto->pr_usrreqs->pru_peeraddr)(so, &sa);
1813 error = sflt_getpeername(so, &sa);
1817 socket_unlock(so, 1);
1899 getsockaddr(struct socket *so, struct sockaddr **namp, user_addr_t uaddr,
1926 INP_CHECK_SOCKAF(so, AF_INET) &&
1937 getsockaddr_s(struct socket *so, struct sockaddr_storage *ss,
1948 * so the check here is inclusive.
1963 INP_CHECK_SOCKAF(so, AF_INET) &&
2061 struct socket *so;
2102 error = file_socket(uap->s, &so);
2107 if (so == NULL) {
2111 if (so->so_type != SOCK_STREAM) {
2115 if ((so->so_state & SS_ISCONNECTED) == 0) {
2136 error = mac_socket_check_send(context.vc_ucred, so, NULL);
2210 socket_lock(so, 1);
2211 error = sblock(&so->so_snd, M_WAIT);
2213 socket_unlock(so, 1);
2233 xfsize = sbspace(&so->so_snd);
2236 if (so->so_state & SS_CANTSENDMORE) {
2239 } else if ((so->so_state & SS_NBIO)) {
2269 ((so->so_flags & SOF_MULTIPAGES) || sosendjcl_ignore_capab);
2271 socket_unlock(so, 0);
2284 socket_lock(so, 0);
2309 socket_lock(so, 0);
2357 if ((so->so_state & SS_CANTSENDMORE) || so->so_error) {
2358 if (so->so_state & SS_CANTSENDMORE) {
2361 error = so->so_error;
2362 so->so_error = 0;
2373 if (sbspace(&so->so_snd) < (long)so->so_snd.sb_lowat) {
2374 if (so->so_state & SS_NBIO) {
2381 error = sbwait(&so->so_snd);
2402 error = sflt_data_out(so, NULL, &m0, &control, 0);
2417 error = (*so->so_proto->pr_usrreqs->pru_send)(so, 0, m0,
2426 sbunlock(&so->so_snd, 0); /* will unlock socket */
2457 sbunlock(&so->so_snd, 0); /* will unlock socket */