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

Function accept1

freebsd/kern/uipc_syscalls.c:272–314  ·  view source on GitHub ↗

* accept1() */

(td, s, uname, anamelen, flags)

Source from the content-addressed store, hash-verified

270 * accept1()
271 */
272static int
273accept1(td, s, uname, anamelen, flags)
274 struct thread *td;
275 int s;
276 struct sockaddr *uname;
277 socklen_t *anamelen;
278 int flags;
279{
280 struct sockaddr *name;
281 socklen_t namelen;
282 struct file *fp;
283 int error;
284
285 if (uname == NULL)
286 return (kern_accept4(td, s, NULL, NULL, flags, NULL));
287
288 error = copyin(anamelen, &namelen, sizeof (namelen));
289 if (error != 0)
290 return (error);
291
292 error = kern_accept4(td, s, &name, &namelen, flags, &fp);
293
294 if (error != 0)
295 return (error);
296
297 if (error == 0 && uname != NULL) {
298#ifdef COMPAT_OLDSOCK
299 if (SV_PROC_FLAG(td->td_proc, SV_AOUT) &&
300 (flags & ACCEPT4_COMPAT) != 0)
301 ((struct osockaddr *)name)->sa_family =
302 name->sa_family;
303#endif
304 error = copyout(name, uname, namelen);
305 }
306 if (error == 0)
307 error = copyout(&namelen, anamelen,
308 sizeof(namelen));
309 if (error != 0)
310 fdclose(td, fp, td->td_retval[0]);
311 fdrop(fp, td);
312 free(name, M_SONAME);
313 return (error);
314}
315
316int
317kern_accept(struct thread *td, int s, struct sockaddr **name,

Callers 3

sys_acceptFunction · 0.85
sys_accept4Function · 0.85
oacceptFunction · 0.85

Calls 5

kern_accept4Function · 0.85
fdcloseFunction · 0.85
freeFunction · 0.70
copyinFunction · 0.50
copyoutFunction · 0.50

Tested by

no test coverage detected