MCPcopy Index your code
hub / github.com/F-Stack/f-stack / sogetopt

Function sogetopt

freebsd/kern/uipc_socket.c:3221–3395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3219}
3220
3221int
3222sogetopt(struct socket *so, struct sockopt *sopt)
3223{
3224 int error, optval;
3225 struct linger l;
3226 struct timeval tv;
3227#ifdef MAC
3228 struct mac extmac;
3229#endif
3230
3231 CURVNET_SET(so->so_vnet);
3232 error = 0;
3233 if (sopt->sopt_level != SOL_SOCKET) {
3234 if (so->so_proto->pr_ctloutput != NULL)
3235 error = (*so->so_proto->pr_ctloutput)(so, sopt);
3236 else
3237 error = ENOPROTOOPT;
3238 CURVNET_RESTORE();
3239 return (error);
3240 } else {
3241 switch (sopt->sopt_name) {
3242 case SO_ACCEPTFILTER:
3243 error = accept_filt_getopt(so, sopt);
3244 break;
3245
3246 case SO_LINGER:
3247 SOCK_LOCK(so);
3248 l.l_onoff = so->so_options & SO_LINGER;
3249 l.l_linger = so->so_linger;
3250 SOCK_UNLOCK(so);
3251 error = sooptcopyout(sopt, &l, sizeof l);
3252 break;
3253
3254 case SO_USELOOPBACK:
3255 case SO_DONTROUTE:
3256 case SO_DEBUG:
3257 case SO_KEEPALIVE:
3258 case SO_REUSEADDR:
3259 case SO_REUSEPORT:
3260 case SO_REUSEPORT_LB:
3261 case SO_BROADCAST:
3262 case SO_OOBINLINE:
3263 case SO_ACCEPTCONN:
3264 case SO_TIMESTAMP:
3265 case SO_BINTIME:
3266 case SO_NOSIGPIPE:
3267 case SO_NO_DDP:
3268 case SO_NO_OFFLOAD:
3269 optval = so->so_options & sopt->sopt_name;
3270integer:
3271 error = sooptcopyout(sopt, &optval, sizeof optval);
3272 break;
3273
3274 case SO_DOMAIN:
3275 optval = so->so_proto->pr_domain->dom_family;
3276 goto integer;
3277
3278 case SO_TYPE:

Callers 2

kern_getsockoptFunction · 0.85
ng_ksocket_rcvmsgFunction · 0.85

Calls 7

accept_filt_getoptFunction · 0.85
sooptcopyoutFunction · 0.85
sbttotvFunction · 0.85
sooptcopyinFunction · 0.85
mac_getsockopt_labelFunction · 0.85
mac_getsockopt_peerlabelFunction · 0.85
hhook_run_socketFunction · 0.85

Tested by

no test coverage detected