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

Function sooptcopyout

freebsd/kern/uipc_socket.c:3194–3219  ·  view source on GitHub ↗

* Helper routine for getsockopt. */

Source from the content-addressed store, hash-verified

3192 * Helper routine for getsockopt.
3193 */
3194int
3195sooptcopyout(struct sockopt *sopt, const void *buf, size_t len)
3196{
3197 int error;
3198 size_t valsize;
3199
3200 error = 0;
3201
3202 /*
3203 * Documented get behavior is that we always return a value, possibly
3204 * truncated to fit in the user's buffer. Traditional behavior is
3205 * that we always tell the user precisely how much we copied, rather
3206 * than something useful like the total amount we had available for
3207 * her. Note that this interface is not idempotent; the entire
3208 * answer must be generated ahead of time.
3209 */
3210 valsize = min(len, sopt->sopt_valsize);
3211 sopt->sopt_valsize = valsize;
3212 if (sopt->sopt_val != NULL) {
3213 if (sopt->sopt_td != NULL)
3214 error = copyout(buf, sopt->sopt_val, valsize);
3215 else
3216 bcopy(buf, sopt->sopt_val, valsize);
3217 }
3218 return (error);
3219}
3220
3221int
3222sogetopt(struct socket *so, struct sockopt *sopt)

Callers 15

ip_dummynet_compatFunction · 0.85
get_aqm_parmsFunction · 0.85
get_sched_parmsFunction · 0.85
dummynet_getFunction · 0.85
ipfw_ctlFunction · 0.85
ipfw_nat_get_cfgFunction · 0.85
ipfw_nat_get_logFunction · 0.85
udp_ctloutputFunction · 0.85
sctp_ctloutputFunction · 0.85
ip_ctloutputFunction · 0.85
X_ip_mrouter_setFunction · 0.85
X_ip_mrouter_getFunction · 0.85

Calls 2

minFunction · 0.85
copyoutFunction · 0.50

Tested by

no test coverage detected