diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-10-14 11:41:14 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-10-31 13:18:47 +0100 |
commit | 7c2b59c831731c81a8ad2cd2c01dada208218d9c (patch) | |
tree | 8dad6b4a15ade07a88918c9a524553a97e6a36b4 /freebsd/sys/kern/uipc_syscalls.c | |
parent | Use listen() from FreeBSD (diff) | |
download | rtems-libbsd-7c2b59c831731c81a8ad2cd2c01dada208218d9c.tar.bz2 |
Use accept() from FreeBSD
Diffstat (limited to 'freebsd/sys/kern/uipc_syscalls.c')
-rw-r--r-- | freebsd/sys/kern/uipc_syscalls.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/freebsd/sys/kern/uipc_syscalls.c b/freebsd/sys/kern/uipc_syscalls.c index a52de3aa..fbec5462 100644 --- a/freebsd/sys/kern/uipc_syscalls.c +++ b/freebsd/sys/kern/uipc_syscalls.c @@ -401,7 +401,11 @@ listen(int socket, int backlog) } #endif /* __rtems__ */ -#ifndef __rtems__ +#ifdef __rtems__ +static int +kern_accept(struct thread *td, int s, struct sockaddr **name, + socklen_t *namelen, struct file **fp); +#endif /* __rtems__ */ /* * accept1() */ @@ -456,12 +460,40 @@ accept1(td, uap, compat) free(name, M_SONAME); return (error); } +#ifdef __rtems__ +int +accept(int socket, struct sockaddr *__restrict address, + socklen_t *__restrict address_len) +{ + struct thread *td = rtems_bsd_get_curthread_or_null(); + struct accept_args ua = { + .s = socket, + .name = address, + .anamelen = address_len + }; + int error; + + if (td != NULL) { + error = accept1(td, &ua); + } else { + error = ENOMEM; + } + + if (error == 0) { + return td->td_retval[0]; + } else { + rtems_set_errno_and_return_minus_one(error); + } +} +#endif /* __rtems__ */ int kern_accept(struct thread *td, int s, struct sockaddr **name, socklen_t *namelen, struct file **fp) { +#ifndef __rtems__ struct filedesc *fdp; +#endif /* __rtems__ */ struct file *headfp, *nfp = NULL; struct sockaddr *sa = NULL; int error; @@ -478,7 +510,9 @@ kern_accept(struct thread *td, int s, struct sockaddr **name, } AUDIT_ARG_FD(s); +#ifndef __rtems__ fdp = td->td_proc->p_fd; +#endif /* __rtems__ */ error = getsock(fdp, s, &headfp, &fflag); if (error) return (error); @@ -614,6 +648,7 @@ done: return (error); } +#ifndef __rtems__ int accept(td, uap) struct thread *td; |