summaryrefslogtreecommitdiffstats
path: root/rtemsbsd/rtems
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-10-14 12:53:43 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-10-31 13:18:47 +0100
commitac78dd2440d17142f47163b663d58436f72d3aab (patch)
tree8fad02035396dade573880a2586715ad1eeca7c9 /rtemsbsd/rtems
parentUse accept() from FreeBSD (diff)
downloadrtems-libbsd-ac78dd2440d17142f47163b663d58436f72d3aab.tar.bz2
Use getsockopt() and setsockopt() from FreeBSD
Diffstat (limited to 'rtemsbsd/rtems')
-rw-r--r--rtemsbsd/rtems/rtems-bsd-syscalls.c134
1 files changed, 0 insertions, 134 deletions
diff --git a/rtemsbsd/rtems/rtems-bsd-syscalls.c b/rtemsbsd/rtems/rtems-bsd-syscalls.c
index 0669a70e..cf457122 100644
--- a/rtemsbsd/rtems/rtems-bsd-syscalls.c
+++ b/rtemsbsd/rtems/rtems-bsd-syscalls.c
@@ -620,140 +620,6 @@ done2:
}
int
-kern_setsockopt(td, s, level, name, val, valseg, valsize)
- struct thread *td;
- int s;
- int level;
- int name;
- void *val;
- enum uio_seg valseg;
- socklen_t valsize;
-{
- int error;
- struct socket *so;
- struct sockopt sopt;
-
- if (val == NULL && valsize != 0)
- return (EFAULT);
- if ((int)valsize < 0)
- return (EINVAL);
-
- sopt.sopt_dir = SOPT_SET;
- sopt.sopt_level = level;
- sopt.sopt_name = name;
- sopt.sopt_val = val;
- sopt.sopt_valsize = valsize;
- switch (valseg) {
- case UIO_USERSPACE:
- sopt.sopt_td = td;
- break;
- case UIO_SYSSPACE:
- sopt.sopt_td = NULL;
- break;
- default:
- panic("kern_setsockopt called with bad valseg");
- }
-
- if ((so = rtems_bsdnet_fdToSocket (s)) == NULL) {
- error = EBADF;
- return error;
- }
- CURVNET_SET(so->so_vnet);
- error = sosetopt(so, &sopt);
- CURVNET_RESTORE();
- return(error);
-}
-
-int
-setsockopt (int s, int level, int name, const void *val, socklen_t valsize)
-{
- struct thread *td;
- int error;
-
- td = curthread;
- error = kern_setsockopt(td, s, level, name, val, UIO_USERSPACE, valsize);
- if( error == 0 )
- {
- return error;
- }
- errno = error;
- return -1;
-}
-
-int
-kern_getsockopt(td, s, level, name, val, valseg, valsize)
- struct thread *td;
- int s;
- int level;
- int name;
- void *val;
- enum uio_seg valseg;
- socklen_t *valsize;
-{
- int error;
- struct socket *so;
- struct sockopt sopt;
-
- if (val == NULL)
- *valsize = 0;
- if ((int)*valsize < 0)
- return (EINVAL);
-
- sopt.sopt_dir = SOPT_GET;
- sopt.sopt_level = level;
- sopt.sopt_name = name;
- sopt.sopt_val = val;
- sopt.sopt_valsize = (size_t)*valsize; /* checked non-negative above */
- switch (valseg) {
- case UIO_USERSPACE:
- sopt.sopt_td = td;
- break;
- case UIO_SYSSPACE:
- sopt.sopt_td = NULL;
- break;
- default:
- panic("kern_getsockopt called with bad valseg");
- }
-
- if ((so = rtems_bsdnet_fdToSocket (s)) == NULL) {
- error = EBADF;
- return error;
- }
- CURVNET_SET(so->so_vnet);
- error = sogetopt(so, &sopt);
- CURVNET_RESTORE();
- *valsize = sopt.sopt_valsize;
- return (error);
-}
-
-int
-getsockopt (int s, int level, int name, void *val, socklen_t *avalsize)
-{
- struct thread *td;
- socklen_t valsize;
- int error = 0;
-
- td = curthread;
- if (val) {
- error = copyin(avalsize, &valsize, sizeof (valsize));
- }
-
- if( error == 0 )
- {
- error = kern_getsockopt(td, s, level, name, val, UIO_USERSPACE, &valsize);
-
- if (error == 0)
- error = copyout(&valsize, avalsize, sizeof (valsize));
- }
- if( error == 0 )
- {
- return error;
- }
- errno = error;
- return -1;
-}
-
-int
kern_getpeername(struct thread *td, int fd, struct sockaddr **sa,
socklen_t *alen)
{