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

Function sotoxsocket

tools/netstat/inet.c:159–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159int
160sotoxsocket(struct socket *so, struct xsocket *xso)
161{
162 struct protosw proto;
163 struct domain domain;
164
165 bzero(xso, sizeof *xso);
166 xso->xso_len = sizeof *xso;
167 xso->xso_so = (uintptr_t)so;
168 xso->so_type = so->so_type;
169 xso->so_options = so->so_options;
170 xso->so_linger = so->so_linger;
171 xso->so_state = so->so_state;
172 xso->so_pcb = (uintptr_t)so->so_pcb;
173 if (kread((uintptr_t)so->so_proto, &proto, sizeof(proto)) != 0)
174 return (-1);
175 xso->xso_protocol = proto.pr_protocol;
176 if (kread((uintptr_t)proto.pr_domain, &domain, sizeof(domain)) != 0)
177 return (-1);
178 xso->xso_family = domain.dom_family;
179 xso->so_timeo = so->so_timeo;
180 xso->so_error = so->so_error;
181 if ((so->so_options & SO_ACCEPTCONN) != 0) {
182 xso->so_qlen = so->sol_qlen;
183 xso->so_incqlen = so->sol_incqlen;
184 xso->so_qlimit = so->sol_qlimit;
185 } else {
186 sbtoxsockbuf(&so->so_snd, &xso->so_snd);
187 sbtoxsockbuf(&so->so_rcv, &xso->so_rcv);
188 xso->so_oobmark = so->so_oobmark;
189 }
190 return (0);
191}
192#endif
193
194/*

Callers 1

pcblist_kvmFunction · 0.70

Calls 3

bzeroFunction · 0.85
kreadFunction · 0.70
sbtoxsockbufFunction · 0.70

Tested by

no test coverage detected