| 486 | } |
| 487 | |
| 488 | static int |
| 489 | uipc_accept(struct socket *so, struct sockaddr **nam) |
| 490 | { |
| 491 | struct unpcb *unp, *unp2; |
| 492 | const struct sockaddr *sa; |
| 493 | |
| 494 | /* |
| 495 | * Pass back name of connected socket, if it was bound and we are |
| 496 | * still connected (our peer may have closed already!). |
| 497 | */ |
| 498 | unp = sotounpcb(so); |
| 499 | KASSERT(unp != NULL, ("uipc_accept: unp == NULL")); |
| 500 | |
| 501 | *nam = malloc(sizeof(struct sockaddr_un), M_SONAME, M_WAITOK); |
| 502 | UNP_PCB_LOCK(unp); |
| 503 | unp2 = unp_pcb_lock_peer(unp); |
| 504 | if (unp2 != NULL && unp2->unp_addr != NULL) |
| 505 | sa = (struct sockaddr *)unp2->unp_addr; |
| 506 | else |
| 507 | sa = &sun_noname; |
| 508 | bcopy(sa, *nam, sa->sa_len); |
| 509 | if (unp2 != NULL) |
| 510 | unp_pcb_unlock_pair(unp, unp2); |
| 511 | else |
| 512 | UNP_PCB_UNLOCK(unp); |
| 513 | return (0); |
| 514 | } |
| 515 | |
| 516 | static int |
| 517 | uipc_attach(struct socket *so, int proto, struct thread *td) |
nothing calls this directly
no test coverage detected