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

Function sooptcopyin

freebsd/kern/uipc_socket.c:2945–2966  ·  view source on GitHub ↗

* Perhaps this routine, and sooptcopyout(), below, ought to come in an * additional variant to handle the case where the option value needs to be * some kind of integer, but not a specific size. In addition to their use * here, these functions are also called by the protocol-level pr_ctloutput() * routines. */

Source from the content-addressed store, hash-verified

2943 * routines.
2944 */
2945int
2946sooptcopyin(struct sockopt *sopt, void *buf, size_t len, size_t minlen)
2947{
2948 size_t valsize;
2949
2950 /*
2951 * If the user gives us more than we wanted, we ignore it, but if we
2952 * don't get the minimum length the caller wants, we return EINVAL.
2953 * On success, sopt->sopt_valsize is set to however much we actually
2954 * retrieved.
2955 */
2956 if ((valsize = sopt->sopt_valsize) < minlen)
2957 return EINVAL;
2958 if (valsize > len)
2959 sopt->sopt_valsize = valsize = len;
2960
2961 if (sopt->sopt_td != NULL)
2962 return (copyin(sopt->sopt_val, buf, valsize));
2963
2964 bcopy(sopt->sopt_val, buf, valsize);
2965 return (0);
2966}
2967
2968/*
2969 * Kernel version of setsockopt(2).

Callers 15

ip_dummynet_compatFunction · 0.85
get_aqm_parmsFunction · 0.85
get_sched_parmsFunction · 0.85
dummynet_getFunction · 0.85
ip_dn_ctlFunction · 0.85
ipfw_ctl3Function · 0.85
ipfw_ctlFunction · 0.85
ipfw_nat_cfgFunction · 0.85
ipfw_nat_delFunction · 0.85
udp_ctloutputFunction · 0.85
sctp_ctloutputFunction · 0.85
ip_ctloutputFunction · 0.85

Calls 1

copyinFunction · 0.50

Tested by

no test coverage detected