• Home
  • Raw
  • Download

Lines Matching full:so

73 extern int sctp_sosend(struct socket *so, struct sockaddr *addr, struct uio *uio,
78 extern int sctp_attach(struct socket *so, int proto, uint32_t vrf_id);
79 extern int sctpconn_attach(struct socket *so, int proto, uint32_t vrf_id);
137 void socantrcvmore_locked(struct socket *so) in socantrcvmore_locked() argument
139 SOCKBUF_LOCK_ASSERT(&so->so_rcv); in socantrcvmore_locked()
140 so->so_rcv.sb_state |= SBS_CANTRCVMORE; in socantrcvmore_locked()
141 sorwakeup_locked(so); in socantrcvmore_locked()
144 void socantrcvmore(struct socket *so) in socantrcvmore() argument
146 SOCKBUF_LOCK(&so->so_rcv); in socantrcvmore()
147 socantrcvmore_locked(so); in socantrcvmore()
151 socantsendmore_locked(struct socket *so) in socantsendmore_locked() argument
153 SOCKBUF_LOCK_ASSERT(&so->so_snd); in socantsendmore_locked()
154 so->so_snd.sb_state |= SBS_CANTSENDMORE; in socantsendmore_locked()
155 sowwakeup_locked(so); in socantsendmore_locked()
159 socantsendmore(struct socket *so) in socantsendmore() argument
161 SOCKBUF_LOCK(&so->so_snd); in socantsendmore()
162 socantsendmore_locked(so); in socantsendmore()
205 struct socket *so; in soalloc() local
213 * __Userspace__ TODO : Make sure so is properly deallocated in soalloc()
217 so = (struct socket *)malloc(sizeof(struct socket)); in soalloc()
219 if (so == NULL) { in soalloc()
222 memset(so, 0, sizeof(struct socket)); in soalloc()
225 SOCKBUF_LOCK_INIT(&so->so_snd, "so_snd"); in soalloc()
226 SOCKBUF_LOCK_INIT(&so->so_rcv, "so_rcv"); in soalloc()
227 SOCKBUF_COND_INIT(&so->so_snd); in soalloc()
228 SOCKBUF_COND_INIT(&so->so_rcv); in soalloc()
229 SOCK_COND_INIT(so); /* timeo_cond */ in soalloc()
233 TAILQ_INIT(&so->so_aiojobq); in soalloc()
234 return (so); in soalloc()
238 sodealloc(struct socket *so) in sodealloc() argument
241 KASSERT(so->so_count == 0, ("sodealloc(): so_count %d", so->so_count)); in sodealloc()
242 KASSERT(so->so_pcb == NULL, ("sodealloc(): so_pcb != NULL")); in sodealloc()
244 SOCKBUF_COND_DESTROY(&so->so_snd); in sodealloc()
245 SOCKBUF_COND_DESTROY(&so->so_rcv); in sodealloc()
247 SOCK_COND_DESTROY(so); in sodealloc()
249 SOCKBUF_LOCK_DESTROY(&so->so_snd); in sodealloc()
250 SOCKBUF_LOCK_DESTROY(&so->so_rcv); in sodealloc()
252 free(so); in sodealloc()
259 sofree(struct socket *so) in sofree() argument
264 SOCK_LOCK_ASSERT(so); in sofree()
268 if (so->so_count != 0 || in sofree()
269 (so->so_state & SS_PROTOREF) || (so->so_qstate & SQ_COMP)) { in sofree()
270 SOCK_UNLOCK(so); in sofree()
274 head = so->so_head; in sofree()
276 KASSERT((so->so_qstate & SQ_COMP) != 0 || in sofree()
277 (so->so_qstate & SQ_INCOMP) != 0, in sofree()
280 KASSERT((so->so_qstate & SQ_COMP) == 0 || in sofree()
281 (so->so_qstate & SQ_INCOMP) == 0, in sofree()
282 ("sofree: so->so_qstate is SQ_COMP and also SQ_INCOMP")); in sofree()
283 TAILQ_REMOVE(&head->so_incomp, so, so_list); in sofree()
285 so->so_qstate &= ~SQ_INCOMP; in sofree()
286 so->so_head = NULL; in sofree()
288 KASSERT((so->so_qstate & SQ_COMP) == 0 && in sofree()
289 (so->so_qstate & SQ_INCOMP) == 0, in sofree()
291 so->so_qstate & SQ_COMP, so->so_qstate & SQ_INCOMP)); in sofree()
292 if (so->so_options & SCTP_SO_ACCEPTCONN) { in sofree()
293 KASSERT((TAILQ_EMPTY(&so->so_comp)), ("sofree: so_comp populated")); in sofree()
294 KASSERT((TAILQ_EMPTY(&so->so_incomp)), ("sofree: so_comp populated")); in sofree()
296 SOCK_UNLOCK(so); in sofree()
298 sctp_close(so); /* was... sctp_detach(so); */ in sofree()
313 sodealloc(so); in sofree()
320 soabort(struct socket *so) in soabort() argument
327 inp = (struct sctp_inpcb *)so->so_pcb; in soabort()
329 sctp6_abort(so); in soabort()
332 sctp_abort(so); in soabort()
336 sctp_abort(so); in soabort()
339 SOCK_LOCK(so); in soabort()
340 sofree(so); in soabort()
348 soisconnecting(struct socket *so) in soisconnecting() argument
351 SOCK_LOCK(so); in soisconnecting()
352 so->so_state &= ~(SS_ISCONNECTED|SS_ISDISCONNECTING); in soisconnecting()
353 so->so_state |= SS_ISCONNECTING; in soisconnecting()
354 SOCK_UNLOCK(so); in soisconnecting()
361 soisdisconnecting(struct socket *so) in soisdisconnecting() argument
365 * Note: This code assumes that SOCK_LOCK(so) and in soisdisconnecting()
366 * SOCKBUF_LOCK(&so->so_rcv) are the same. in soisdisconnecting()
368 SOCKBUF_LOCK(&so->so_rcv); in soisdisconnecting()
369 so->so_state &= ~SS_ISCONNECTING; in soisdisconnecting()
370 so->so_state |= SS_ISDISCONNECTING; in soisdisconnecting()
371 so->so_rcv.sb_state |= SBS_CANTRCVMORE; in soisdisconnecting()
372 sorwakeup_locked(so); in soisdisconnecting()
373 SOCKBUF_LOCK(&so->so_snd); in soisdisconnecting()
374 so->so_snd.sb_state |= SBS_CANTSENDMORE; in soisdisconnecting()
375 sowwakeup_locked(so); in soisdisconnecting()
376 wakeup("dummy",so); in soisdisconnecting()
378 /* wakeup(&so->so_timeo); */ in soisdisconnecting()
390 * modify wakeup so it can distinguish between iterator identifier and
394 wakeup(void *ident, struct socket *so) in wakeup() argument
396 SOCK_LOCK(so); in wakeup()
398 WakeAllConditionVariable(&(so)->timeo_cond); in wakeup()
400 pthread_cond_broadcast(&(so)->timeo_cond); in wakeup()
402 SOCK_UNLOCK(so); in wakeup()
417 head is so->so_head, which is back pointer to listen socket in wakeup_one()
434 soisconnected(struct socket *so) in soisconnected() argument
439 SOCK_LOCK(so); in soisconnected()
440 so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING); in soisconnected()
441 so->so_state |= SS_ISCONNECTED; in soisconnected()
442 head = so->so_head; in soisconnected()
443 if (head != NULL && (so->so_qstate & SQ_INCOMP)) { in soisconnected()
444 SOCK_UNLOCK(so); in soisconnected()
445 TAILQ_REMOVE(&head->so_incomp, so, so_list); in soisconnected()
447 so->so_qstate &= ~SQ_INCOMP; in soisconnected()
448 TAILQ_INSERT_TAIL(&head->so_comp, so, so_list); in soisconnected()
450 so->so_qstate |= SQ_COMP; in soisconnected()
456 SOCK_UNLOCK(so); in soisconnected()
458 wakeup(&so->so_timeo, so); in soisconnected()
459 sorwakeup(so); in soisconnected()
460 sowwakeup(so); in soisconnected()
469 struct socket *so; in sonewconn() local
481 so = soalloc(); in sonewconn()
482 if (so == NULL) in sonewconn()
484 so->so_head = head; in sonewconn()
485 so->so_type = head->so_type; in sonewconn()
486 so->so_options = head->so_options &~ SCTP_SO_ACCEPTCONN; in sonewconn()
487 so->so_linger = head->so_linger; in sonewconn()
488 so->so_state = head->so_state | SS_NOFDREF; in sonewconn()
489 so->so_dom = head->so_dom; in sonewconn()
492 mac_create_socket_from_socket(head, so); in sonewconn()
495 if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat)) { in sonewconn()
496 sodealloc(so); in sonewconn()
502 if (sctp_attach(so, IPPROTO_SCTP, SCTP_DEFAULT_VRFID)) { in sonewconn()
503 sodealloc(so); in sonewconn()
510 if (sctp6_attach(so, IPPROTO_SCTP, SCTP_DEFAULT_VRFID)) { in sonewconn()
511 sodealloc(so); in sonewconn()
517 if (sctpconn_attach(so, IPPROTO_SCTP, SCTP_DEFAULT_VRFID)) { in sonewconn()
518 sodealloc(so); in sonewconn()
523 sodealloc(so); in sonewconn()
527 so->so_rcv.sb_lowat = head->so_rcv.sb_lowat; in sonewconn()
528 so->so_snd.sb_lowat = head->so_snd.sb_lowat; in sonewconn()
529 so->so_rcv.sb_timeo = head->so_rcv.sb_timeo; in sonewconn()
530 so->so_snd.sb_timeo = head->so_snd.sb_timeo; in sonewconn()
531 so->so_rcv.sb_flags |= head->so_rcv.sb_flags & SB_AUTOSIZE; in sonewconn()
532 so->so_snd.sb_flags |= head->so_snd.sb_flags & SB_AUTOSIZE; in sonewconn()
533 so->so_state |= connstatus; in sonewconn()
536 TAILQ_INSERT_TAIL(&head->so_comp, so, so_list); in sonewconn()
537 so->so_qstate |= SQ_COMP; in sonewconn()
558 TAILQ_INSERT_TAIL(&head->so_incomp, so, so_list); in sonewconn()
559 so->so_qstate |= SQ_INCOMP; in sonewconn()
567 return (so); in sonewconn()
721 usrsctp_getsockopt(struct socket *so, int level, int option_name,
772 userspace_sctp_sendmsg(struct socket *so, in userspace_sctp_sendmsg() argument
827 errno = sctp_lower_sosend(so, to, &auio, NULL, NULL, 0, sinfo); in userspace_sctp_sendmsg()
837 usrsctp_sendv(struct socket *so, in usrsctp_sendv() argument
853 if (so == NULL) { in usrsctp_sendv()
943 errno = sctp_lower_sosend(so, to, &auio, NULL, NULL, flags, use_sinfo ? &sinfo : NULL); in usrsctp_sendv()
946 *assoc_id = usrsctp_getassocid(so, to); in usrsctp_sendv()
956 userspace_sctp_sendmbuf(struct socket *so, in userspace_sctp_sendmbuf() argument
997 error = sctp_lower_sosend(so, to, NULL/*uio*/, in userspace_sctp_sendmbuf()
1024 userspace_sctp_recvmsg(struct socket *so, in userspace_sctp_recvmsg() argument
1064 error = sctp_sorecvmsg(so, &auio, (struct mbuf **)NULL, in userspace_sctp_recvmsg()
1111 usrsctp_recvv(struct socket *so, in usrsctp_recvv() argument
1132 if (so == NULL) { in usrsctp_recvv()
1158 errno = sctp_sorecvmsg(so, &auio, (struct mbuf **)NULL, in usrsctp_recvv()
1177 inp = (struct sctp_inpcb *)so->so_pcb; in usrsctp_recvv()
1272 struct socket *so; in socreate() local
1285 so = soalloc(); in socreate()
1286 if (so == NULL) { in socreate()
1297 TAILQ_INIT(&so->so_incomp); in socreate()
1298 TAILQ_INIT(&so->so_comp); in socreate()
1299 so->so_type = type; in socreate()
1300 so->so_count = 1; in socreate()
1301 so->so_dom = dom; in socreate()
1310 error = sctp_attach(so, proto, SCTP_DEFAULT_VRFID); in socreate()
1315 error = sctp6_attach(so, proto, SCTP_DEFAULT_VRFID); in socreate()
1319 error = sctpconn_attach(so, proto, SCTP_DEFAULT_VRFID); in socreate()
1326 KASSERT(so->so_count == 1, ("socreate: so_count %d", so->so_count)); in socreate()
1327 so->so_count = 0; in socreate()
1328 sodealloc(so); in socreate()
1331 *aso = so; in socreate()
1346 struct socket *so; in socreate() local
1367 so = soalloc(); in socreate()
1368 if (so == NULL) in socreate()
1371 TAILQ_INIT(&so->so_incomp); in socreate()
1372 TAILQ_INIT(&so->so_comp); in socreate()
1373 so->so_type = type; in socreate()
1374 so->so_cred = crhold(cred); in socreate()
1375 so->so_proto = prp; in socreate()
1377 mac_create_socket(cred, so); in socreate()
1379 knlist_init(&so->so_rcv.sb_sel.si_note, SOCKBUF_MTX(&so->so_rcv), in socreate()
1381 knlist_init(&so->so_snd.sb_sel.si_note, SOCKBUF_MTX(&so->so_snd), in socreate()
1383 so->so_count = 1; in socreate()
1388 error = (*prp->pr_usrreqs->pru_attach)(so, proto, td); in socreate()
1390 KASSERT(so->so_count == 1, ("socreate: so_count %d", in socreate()
1391 so->so_count)); in socreate()
1392 so->so_count = 0; in socreate()
1393 sodealloc(so); in socreate()
1396 *aso = so; in socreate()
1411 struct socket *so = NULL; in userspace_socket() local
1413 errno = socreate(domain, &so, type, protocol); in userspace_socket()
1420 * We are returning struct socket *so. in userspace_socket()
1422 return (so); in userspace_socket()
1433 struct socket *so; in usrsctp_socket() local
1448 errno = socreate(domain, &so, type, protocol); in usrsctp_socket()
1455 * We are returning struct socket *so. in usrsctp_socket()
1457 register_recv_cb(so, receive_cb); in usrsctp_socket()
1458 register_send_cb(so, sb_threshold, send_cb); in usrsctp_socket()
1459 register_ulp_info(so, ulp_info); in usrsctp_socket()
1460 return (so); in usrsctp_socket()
1471 * Allot mbufs to a sockbuf. Attempt to scale mbmax so that mbcnt doesn't
1475 sbreserve_locked(struct sockbuf *sb, u_long cc, struct socket *so) in sbreserve_locked() argument
1486 sbreserve(struct sockbuf *sb, u_long cc, struct socket *so) in sbreserve() argument
1491 error = sbreserve_locked(sb, cc, so); in sbreserve()
1498 soreserve(struct socket *so, u_long sndcc, u_long rcvcc) in soreserve() argument
1500 SOCKBUF_LOCK(&so->so_snd); in soreserve()
1501 SOCKBUF_LOCK(&so->so_rcv); in soreserve()
1502 so->so_snd.sb_hiwat = (uint32_t)sndcc; in soreserve()
1503 so->so_rcv.sb_hiwat = (uint32_t)rcvcc; in soreserve()
1505 if (sbreserve_locked(&so->so_snd, sndcc, so) == 0) { in soreserve()
1508 if (sbreserve_locked(&so->so_rcv, rcvcc, so) == 0) { in soreserve()
1511 if (so->so_rcv.sb_lowat == 0) in soreserve()
1512 so->so_rcv.sb_lowat = 1; in soreserve()
1513 if (so->so_snd.sb_lowat == 0) in soreserve()
1514 so->so_snd.sb_lowat = MCLBYTES; in soreserve()
1515 if (so->so_snd.sb_lowat > (int)so->so_snd.sb_hiwat) in soreserve()
1516 so->so_snd.sb_lowat = (int)so->so_snd.sb_hiwat; in soreserve()
1517 SOCKBUF_UNLOCK(&so->so_rcv); in soreserve()
1518 SOCKBUF_UNLOCK(&so->so_snd); in soreserve()
1522 SOCKBUF_UNLOCK(&so->so_rcv); in soreserve()
1523 SOCKBUF_UNLOCK(&so->so_snd); in soreserve()
1528 soreserve(struct socket *so, u_long sndcc, u_long rcvcc) in soreserve() argument
1532 SOCKBUF_LOCK(&so->so_snd); in soreserve()
1533 SOCKBUF_LOCK(&so->so_rcv); in soreserve()
1534 if (sbreserve_locked(&so->so_snd, sndcc, so, td) == 0) in soreserve()
1536 if (sbreserve_locked(&so->so_rcv, rcvcc, so, td) == 0) in soreserve()
1538 if (so->so_rcv.sb_lowat == 0) in soreserve()
1539 so->so_rcv.sb_lowat = 1; in soreserve()
1540 if (so->so_snd.sb_lowat == 0) in soreserve()
1541 so->so_snd.sb_lowat = MCLBYTES; in soreserve()
1542 if (so->so_snd.sb_lowat > so->so_snd.sb_hiwat) in soreserve()
1543 so->so_snd.sb_lowat = so->so_snd.sb_hiwat; in soreserve()
1544 SOCKBUF_UNLOCK(&so->so_rcv); in soreserve()
1545 SOCKBUF_UNLOCK(&so->so_snd); in soreserve()
1548 sbrelease_locked(&so->so_snd, so); in soreserve()
1550 SOCKBUF_UNLOCK(&so->so_rcv); in soreserve()
1551 SOCKBUF_UNLOCK(&so->so_snd); in soreserve()
1566 sowakeup(struct socket *so, struct sockbuf *sb) in sowakeup() argument
1596 sowakeup(struct socket *so, struct sockbuf *sb) in sowakeup() argument
1609 if ((so->so_state & SS_ASYNC) && so->so_sigio != NULL) in sowakeup()
1610 pgsigio(&so->so_sigio, SIGIO, 0); in sowakeup()
1612 (*so->so_upcall)(so, so->so_upcallarg, M_NOWAIT); in sowakeup()
1614 aio_swake(so, sb); in sowakeup()
1626 sobind(struct socket *so, struct sockaddr *nam) in sobind() argument
1631 return (sctp_bind(so, nam)); in sobind()
1635 return (sctp6_bind(so, nam, NULL)); in sobind()
1638 return (sctpconn_bind(so, nam)); in sobind()
1649 usrsctp_bind(struct socket *so, struct sockaddr *name, int namelen) in usrsctp_bind() argument
1653 if (so == NULL) { in usrsctp_bind()
1660 errno = sobind(so, sa); in usrsctp_bind()
1670 userspace_bind(struct socket *so, struct sockaddr *name, int namelen) in userspace_bind() argument
1672 return (usrsctp_bind(so, name, namelen)); in userspace_bind()
1680 solisten(struct socket *so, int backlog) in solisten() argument
1682 if (so == NULL) { in solisten()
1685 return (sctp_listen(so, backlog, NULL)); in solisten()
1691 solisten_proto_check(struct socket *so) in solisten_proto_check() argument
1694 SOCK_LOCK_ASSERT(so); in solisten_proto_check()
1696 if (so->so_state & (SS_ISCONNECTED | SS_ISCONNECTING | in solisten_proto_check()
1705 solisten_proto(struct socket *so, int backlog) in solisten_proto() argument
1708 SOCK_LOCK_ASSERT(so); in solisten_proto()
1712 so->so_qlimit = backlog; in solisten_proto()
1713 so->so_options |= SCTP_SO_ACCEPTCONN; in solisten_proto()
1724 usrsctp_listen(struct socket *so, int backlog) in usrsctp_listen() argument
1726 errno = solisten(so, backlog); in usrsctp_listen()
1735 userspace_listen(struct socket *so, int backlog) in userspace_listen() argument
1737 return (usrsctp_listen(so, backlog)); in userspace_listen()
1745 soaccept(struct socket *so, struct sockaddr **nam) in soaccept() argument
1749 SOCK_LOCK(so); in soaccept()
1750 KASSERT((so->so_state & SS_NOFDREF) != 0, ("soaccept: !NOFDREF")); in soaccept()
1751 so->so_state &= ~SS_NOFDREF; in soaccept()
1752 SOCK_UNLOCK(so); in soaccept()
1753 error = sctp_accept(so, nam); in soaccept()
1767 struct socket *so = NULL; in user_accept() local
1809 so = TAILQ_FIRST(&head->so_comp); in user_accept()
1810 KASSERT(!(so->so_qstate & SQ_INCOMP), ("accept1: so SQ_INCOMP")); in user_accept()
1811 KASSERT(so->so_qstate & SQ_COMP, ("accept1: so not SQ_COMP")); in user_accept()
1818 SOCK_LOCK(so); /* soref() and so_state update */ in user_accept()
1819 soref(so); /* file descriptor reference */ in user_accept()
1821 TAILQ_REMOVE(&head->so_comp, so, so_list); in user_accept()
1823 so->so_state |= (head->so_state & SS_NBIO); in user_accept()
1824 so->so_qstate &= ~SQ_COMP; in user_accept()
1825 so->so_head = NULL; in user_accept()
1826 SOCK_UNLOCK(so); in user_accept()
1835 error = soaccept(so, &sa); in user_accept()
1890 *ptr_accept_ret_sock = so; in user_accept()
1903 accept1(struct socket *so, struct sockaddr *aname, socklen_t *anamelen, struct socket **ptr_accept_… in accept1() argument
1909 if (so == NULL) { in accept1()
1913 return (user_accept(so, NULL, NULL, ptr_accept_ret_sock)); in accept1()
1920 error = user_accept(so, &name, &namelen, ptr_accept_ret_sock); in accept1()
1946 usrsctp_accept(struct socket *so, struct sockaddr *aname, socklen_t *anamelen) in usrsctp_accept() argument
1950 errno = accept1(so, aname, anamelen, &accept_return_sock); in usrsctp_accept()
1959 userspace_accept(struct socket *so, struct sockaddr *aname, socklen_t *anamelen) in userspace_accept() argument
1961 return (usrsctp_accept(so, aname, anamelen)); in userspace_accept()
1967 struct socket *so; in usrsctp_peeloff() local
1972 if ((so = sonewconn(head, SS_ISCONNECTED)) == NULL) { in usrsctp_peeloff()
1976 SOCK_LOCK(so); in usrsctp_peeloff()
1977 soref(so); in usrsctp_peeloff()
1978 TAILQ_REMOVE(&head->so_comp, so, so_list); in usrsctp_peeloff()
1980 so->so_state |= (head->so_state & SS_NBIO); in usrsctp_peeloff()
1981 so->so_qstate &= ~SQ_COMP; in usrsctp_peeloff()
1982 so->so_head = NULL; in usrsctp_peeloff()
1983 SOCK_UNLOCK(so); in usrsctp_peeloff()
1985 if ((errno = sctp_do_peeloff(head, so, id)) != 0) { in usrsctp_peeloff()
1986 so->so_count = 0; in usrsctp_peeloff()
1987 sodealloc(so); in usrsctp_peeloff()
1990 return (so); in usrsctp_peeloff()
1994 sodisconnect(struct socket *so) in sodisconnect() argument
1998 if ((so->so_state & SS_ISCONNECTED) == 0) in sodisconnect()
2000 if (so->so_state & SS_ISDISCONNECTING) in sodisconnect()
2002 error = sctp_disconnect(so); in sodisconnect()
2007 usrsctp_set_non_blocking(struct socket *so, int onoff) in usrsctp_set_non_blocking() argument
2009 if (so == NULL) { in usrsctp_set_non_blocking()
2013 SOCK_LOCK(so); in usrsctp_set_non_blocking()
2015 so->so_state |= SS_NBIO; in usrsctp_set_non_blocking()
2017 so->so_state &= ~SS_NBIO; in usrsctp_set_non_blocking()
2019 SOCK_UNLOCK(so); in usrsctp_set_non_blocking()
2024 usrsctp_get_non_blocking(struct socket *so) in usrsctp_get_non_blocking() argument
2028 if (so == NULL) { in usrsctp_get_non_blocking()
2032 SOCK_LOCK(so); in usrsctp_get_non_blocking()
2033 if (so->so_state & SS_NBIO) { in usrsctp_get_non_blocking()
2038 SOCK_UNLOCK(so); in usrsctp_get_non_blocking()
2043 soconnect(struct socket *so, struct sockaddr *nam) in soconnect() argument
2047 if (so->so_options & SCTP_SO_ACCEPTCONN) in soconnect()
2054 if (so->so_state & (SS_ISCONNECTED|SS_ISCONNECTING) && (error = sodisconnect(so))) { in soconnect()
2061 so->so_error = 0; in soconnect()
2065 error = sctp_connect(so, nam); in soconnect()
2070 error = sctp6_connect(so, nam); in soconnect()
2074 error = sctpconn_connect(so, nam); in soconnect()
2086 int user_connect(struct socket *so, struct sockaddr *sa) argument
2091 if (so == NULL) {
2095 if (so->so_state & SS_ISCONNECTING) {
2100 error = soconnect(so, sa);
2104 if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) {
2109 SOCK_LOCK(so);
2110 while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
2112 if (SleepConditionVariableCS(SOCK_COND(so), SOCK_MTX(so), INFINITE))
2117 error = pthread_cond_wait(SOCK_COND(so), SOCK_MTX(so));
2131 error = so->so_error;
2132 so->so_error = 0;
2134 SOCK_UNLOCK(so);
2138 so->so_state &= ~SS_ISCONNECTING;
2149 int usrsctp_connect(struct socket *so, struct sockaddr *name, int namelen) argument
2157 errno = user_connect(so, sa);
2166 int userspace_connect(struct socket *so, struct sockaddr *name, int namelen) argument
2168 return (usrsctp_connect(so, name, namelen));
2174 usrsctp_close(struct socket *so) { argument
2175 if (so != NULL) {
2176 if (so->so_options & SCTP_SO_ACCEPTCONN) {
2180 while ((sp = TAILQ_FIRST(&so->so_comp)) != NULL) {
2181 TAILQ_REMOVE(&so->so_comp, sp, so_list);
2182 so->so_qlen--;
2192 SOCK_LOCK(so);
2193 sorele(so);
2198 userspace_close(struct socket *so) argument
2200 usrsctp_close(so);
2204 usrsctp_shutdown(struct socket *so, int how) argument
2210 if (so == NULL) {
2214 sctp_flush(so, how);
2216 socantrcvmore(so);
2218 errno = sctp_shutdown(so);
2229 userspace_shutdown(struct socket *so, int how) argument
2231 return (usrsctp_shutdown(so, how));
2271 sctp_setopt(struct socket *so, int optname, void *optval, size_t optsize, void *p);
2274 usrsctp_setsockopt(struct socket *so, int level, int option_name, argument
2277 if (so == NULL) {
2297 sbreserve(&so->so_rcv, (u_long)*buf_size, so);
2313 sbreserve(&so->so_snd, (u_long)*buf_size, so);
2325 so->so_linger = l->l_linger;
2327 so->so_options |= SCTP_SO_LINGER;
2329 so->so_options &= ~SCTP_SO_LINGER;
2339 errno = sctp_setopt(so, option_name, (void *) option_value, (size_t)option_len, NULL);
2352 userspace_setsockopt(struct socket *so, int level, int option_name, argument
2355 return (usrsctp_setsockopt(so, level, option_name, option_value, option_len));
2360 sctp_getopt(struct socket *so, int optname, void *optval, size_t *optsize,
2364 usrsctp_getsockopt(struct socket *so, int level, int option_name, argument
2367 if (so == NULL) {
2386 *buf_size = so->so_rcv.sb_hiwat;;
2399 *buf_size = so->so_snd.sb_hiwat;
2412 l->l_linger = so->so_linger;
2413 if (so->so_options & SCTP_SO_LINGER) {
2430 *intval = so->so_error;
2444 errno = sctp_getopt(so, option_name, option_value, &len, NULL);
2459 userspace_getsockopt(struct socket *so, int level, int option_name, argument
2462 return (usrsctp_getsockopt(so, level, option_name, option_value, option_len));
2466 usrsctp_opt_info(struct socket *so, sctp_assoc_t id, int opt, void *arg, socklen_t *size) argument
2577 return (usrsctp_getsockopt(so, IPPROTO_SCTP, opt, arg, size));
2581 usrsctp_set_ulpinfo(struct socket *so, void *ulp_info) argument
2583 return (register_ulp_info(so, ulp_info));
2588 usrsctp_get_ulpinfo(struct socket *so, void **pulp_info) argument
2590 return (retrieve_ulp_info(so, pulp_info));
2594 usrsctp_bindx(struct socket *so, struct sockaddr *addrs, int addrcnt, int flags) argument
2721 if (usrsctp_setsockopt(so, IPPROTO_SCTP, flags, gaddrs, (socklen_t)argsz) != 0) {
2766 if (usrsctp_setsockopt(so, IPPROTO_SCTP, flags, gaddrs, (socklen_t)argsz) != 0) {
2778 usrsctp_connectx(struct socket *so, argument
2865 ret = usrsctp_setsockopt(so, IPPROTO_SCTP, SCTP_CONNECT_X, (void *)buf, (socklen_t)len);
2878 usrsctp_getpaddrs(struct socket *so, sctp_assoc_t id, struct sockaddr **raddrs) argument
2893 if (usrsctp_getsockopt(so, IPPROTO_SCTP, SCTP_GET_REMOTE_ADDR_SIZE, &asoc, &opt_len) != 0) {
2905 if (usrsctp_getsockopt(so, IPPROTO_SCTP, SCTP_GET_PEER_ADDRESSES, addrs, &opt_len) != 0) {
2954 usrsctp_getladdrs(struct socket *so, sctp_assoc_t id, struct sockaddr **raddrs) argument
2969 …if (usrsctp_getsockopt(so, IPPROTO_SCTP, SCTP_GET_LOCAL_ADDR_SIZE, &size_of_addresses, &opt_len) !…
2987 if (usrsctp_getsockopt(so, IPPROTO_SCTP, SCTP_GET_LOCAL_ADDRESSES, addrs, &opt_len) != 0) {
3552 usrsctp_get_events(struct socket *so) argument
3556 if (so == NULL) {
3561 SOCK_LOCK(so);
3562 if (soreadable(so)) {
3565 if (sowriteable(so)) {
3568 if (so->so_error) {
3571 SOCK_UNLOCK(so);
3577 usrsctp_set_upcall(struct socket *so, void (*upcall)(struct socket *, void *, int), void *arg) argument
3579 if (so == NULL) {
3584 SOCK_LOCK(so);
3585 so->so_upcall = upcall;
3586 so->so_upcallarg = arg;
3587 so->so_snd.sb_flags |= SB_UPCALL;
3588 so->so_rcv.sb_flags |= SB_UPCALL;
3589 SOCK_UNLOCK(so);