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

Function sotoxsocket

freebsd/kern/uipc_socket.c:4258–4288  ·  view source on GitHub ↗

* Create an external-format (``xsocket'') structure using the information in * the kernel-format socket structure pointed to by so. This is done to * reduce the spew of irrelevant information over this interface, to isolate * user code from changes in the kernel structure, and potentially to provide * information-hiding if we decide that some of this information should be * hidden from users

Source from the content-addressed store, hash-verified

4256 * hidden from users.
4257 */
4258void
4259sotoxsocket(struct socket *so, struct xsocket *xso)
4260{
4261
4262 bzero(xso, sizeof(*xso));
4263 xso->xso_len = sizeof *xso;
4264 xso->xso_so = (uintptr_t)so;
4265 xso->so_type = so->so_type;
4266 xso->so_options = so->so_options;
4267 xso->so_linger = so->so_linger;
4268 xso->so_state = so->so_state;
4269 xso->so_pcb = (uintptr_t)so->so_pcb;
4270 xso->xso_protocol = so->so_proto->pr_protocol;
4271 xso->xso_family = so->so_proto->pr_domain->dom_family;
4272 xso->so_timeo = so->so_timeo;
4273 xso->so_error = so->so_error;
4274 xso->so_uid = so->so_cred->cr_uid;
4275 xso->so_pgid = so->so_sigio ? so->so_sigio->sio_pgid : 0;
4276 if (SOLISTENING(so)) {
4277 xso->so_qlen = so->sol_qlen;
4278 xso->so_incqlen = so->sol_incqlen;
4279 xso->so_qlimit = so->sol_qlimit;
4280 xso->so_oobmark = 0;
4281 } else {
4282 xso->so_state |= so->so_qstate;
4283 xso->so_qlen = xso->so_incqlen = xso->so_qlimit = 0;
4284 xso->so_oobmark = so->so_oobmark;
4285 sbtoxsockbuf(&so->so_snd, &xso->so_snd);
4286 sbtoxsockbuf(&so->so_rcv, &xso->so_rcv);
4287 }
4288}
4289
4290struct sockbuf *
4291so_sockbuf_rcv(struct socket *so)

Callers 2

unp_pcblistFunction · 0.70
in_pcbtoxinpcbFunction · 0.50

Calls 2

bzeroFunction · 0.85
sbtoxsockbufFunction · 0.70

Tested by

no test coverage detected