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

Function kern_setsockopt

freebsd/kern/uipc_syscalls.c:1241–1280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1239}
1240
1241int
1242kern_setsockopt(struct thread *td, int s, int level, int name, const void *val,
1243 enum uio_seg valseg, socklen_t valsize)
1244{
1245 struct socket *so;
1246 struct file *fp;
1247 struct sockopt sopt;
1248 int error;
1249
1250 if (val == NULL && valsize != 0)
1251 return (EFAULT);
1252 if ((int)valsize < 0)
1253 return (EINVAL);
1254
1255 sopt.sopt_dir = SOPT_SET;
1256 sopt.sopt_level = level;
1257 sopt.sopt_name = name;
1258 sopt.sopt_val = __DECONST(void *, val);
1259 sopt.sopt_valsize = valsize;
1260 switch (valseg) {
1261 case UIO_USERSPACE:
1262 sopt.sopt_td = td;
1263 break;
1264 case UIO_SYSSPACE:
1265 sopt.sopt_td = NULL;
1266 break;
1267 default:
1268 panic("kern_setsockopt called with bad valseg");
1269 }
1270
1271 AUDIT_ARG_FD(s);
1272 error = getsock_cap(td, s, &cap_setsockopt_rights,
1273 &fp, NULL, NULL);
1274 if (error == 0) {
1275 so = fp->f_data;
1276 error = sosetopt(so, &sopt);
1277 fdrop(fp, td);
1278 }
1279 return(error);
1280}
1281
1282int
1283sys_getsockopt(struct thread *td, struct getsockopt_args *uap)

Callers 3

sys_setsockoptFunction · 0.85
ff_setsockoptFunction · 0.85
ff_setsockopt_freebsdFunction · 0.85

Calls 3

getsock_capFunction · 0.85
sosetoptFunction · 0.85
panicFunction · 0.70

Tested by

no test coverage detected