MCPcopy Create free account
hub / github.com/F-Stack/f-stack / kern_shutdown

Function kern_shutdown

freebsd/kern/uipc_syscalls.c:1206–1231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1204}
1205
1206int
1207kern_shutdown(struct thread *td, int s, int how)
1208{
1209 struct socket *so;
1210 struct file *fp;
1211 int error;
1212
1213 AUDIT_ARG_FD(s);
1214 error = getsock_cap(td, s, &cap_shutdown_rights,
1215 &fp, NULL, NULL);
1216 if (error == 0) {
1217 so = fp->f_data;
1218 error = soshutdown(so, how);
1219 /*
1220 * Previous versions did not return ENOTCONN, but 0 in
1221 * case the socket was not connected. Some important
1222 * programs like syslogd up to r279016, 2015-02-19,
1223 * still depend on this behavior.
1224 */
1225 if (error == ENOTCONN &&
1226 td->td_proc->p_osrel < P_OSREL_SHUTDOWN_ENOTCONN)
1227 error = 0;
1228 fdrop(fp, td);
1229 }
1230 return (error);
1231}
1232
1233int
1234sys_setsockopt(struct thread *td, struct setsockopt_args *uap)

Callers 1

sys_shutdownFunction · 0.85

Calls 2

getsock_capFunction · 0.85
soshutdownFunction · 0.85

Tested by

no test coverage detected