Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/uipc_syscalls.c
Show First 20 Lines • Show All 1,380 Lines • ▼ Show 20 Lines | kern_getsockname(struct thread *td, int fd, struct sockaddr **sa, | ||||
AUDIT_ARG_FD(fd); | AUDIT_ARG_FD(fd); | ||||
error = getsock_cap(td, fd, &cap_getsockname_rights, | error = getsock_cap(td, fd, &cap_getsockname_rights, | ||||
&fp, NULL, NULL); | &fp, NULL, NULL); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
so = fp->f_data; | so = fp->f_data; | ||||
*sa = NULL; | *sa = NULL; | ||||
CURVNET_SET(so->so_vnet); | error = sosockaddr(so, sa); | ||||
error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, sa); | |||||
CURVNET_RESTORE(); | |||||
if (error != 0) | if (error != 0) | ||||
goto bad; | goto bad; | ||||
if (*sa == NULL) | if (*sa == NULL) | ||||
len = 0; | len = 0; | ||||
else | else | ||||
len = MIN(*alen, (*sa)->sa_len); | len = MIN(*alen, (*sa)->sa_len); | ||||
*alen = len; | *alen = len; | ||||
#ifdef KTRACE | #ifdef KTRACE | ||||
▲ Show 20 Lines • Show All 233 Lines • Show Last 20 Lines |