Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/kern_sendfile.c
| Show First 20 Lines • Show All 496 Lines • ▼ Show 20 Lines | sendfile_getsock(struct thread *td, int s, struct file **sock_fp, | ||||
| *sock_fp = NULL; | *sock_fp = NULL; | ||||
| *so = NULL; | *so = NULL; | ||||
| /* | /* | ||||
| * The socket must be a stream socket and connected. | * The socket must be a stream socket and connected. | ||||
| */ | */ | ||||
| error = getsock_cap(td, s, cap_rights_init(&rights, CAP_SEND), | error = getsock_cap(td, s, cap_rights_init(&rights, CAP_SEND), | ||||
| sock_fp, NULL); | sock_fp, NULL, NULL); | ||||
| if (error != 0) | if (error != 0) | ||||
| return (error); | return (error); | ||||
| *so = (*sock_fp)->f_data; | *so = (*sock_fp)->f_data; | ||||
| if ((*so)->so_type != SOCK_STREAM) | if ((*so)->so_type != SOCK_STREAM) | ||||
| return (EINVAL); | return (EINVAL); | ||||
| if (((*so)->so_state & SS_ISCONNECTED) == 0) | if (((*so)->so_state & SS_ISCONNECTED) == 0) | ||||
| return (ENOTCONN); | return (ENOTCONN); | ||||
| return (0); | return (0); | ||||
| ▲ Show 20 Lines • Show All 503 Lines • Show Last 20 Lines | |||||