convert some [left behind] compat code to use new sockopt API
This commit is contained in:
parent
c3d5fdb471
commit
772d60cfb9
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sunos_misc.c,v 1.160 2008/06/24 11:18:15 ad Exp $ */
|
||||
/* $NetBSD: sunos_misc.c,v 1.161 2008/08/07 20:15:32 plunky Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -50,7 +50,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sunos_misc.c,v 1.160 2008/06/24 11:18:15 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sunos_misc.c,v 1.161 2008/08/07 20:15:32 plunky Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_nfsserver.h"
|
||||
|
@ -536,8 +536,8 @@ sunos_sys_mctl(struct lwp *l, const struct sunos_sys_mctl_args *uap, register_t
|
|||
int
|
||||
sunos_sys_setsockopt(struct lwp *l, const struct sunos_sys_setsockopt_args *uap, register_t *retval)
|
||||
{
|
||||
struct sockopt sopt;
|
||||
struct socket *so;
|
||||
struct mbuf *m = NULL;
|
||||
int name = SCARG(uap, name);
|
||||
int error;
|
||||
|
||||
|
@ -546,10 +546,11 @@ sunos_sys_setsockopt(struct lwp *l, const struct sunos_sys_setsockopt_args *uap,
|
|||
return (error);
|
||||
#define SO_DONTLINGER (~SO_LINGER)
|
||||
if (name == SO_DONTLINGER) {
|
||||
m = m_get(M_WAIT, MT_SOOPTS);
|
||||
mtod(m, struct linger *)->l_onoff = 0;
|
||||
m->m_len = sizeof(struct linger);
|
||||
error = sosetopt(so, SCARG(uap, level), SO_LINGER, m);
|
||||
struct linger lg;
|
||||
|
||||
lg.l_onoff = 0;
|
||||
error = so_setsockopt(l, so, SCARG(uap, level), SO_LINGER,
|
||||
&lg, sizeof(lg));
|
||||
goto out;
|
||||
}
|
||||
if (SCARG(uap, level) == IPPROTO_IP) {
|
||||
|
@ -574,17 +575,14 @@ sunos_sys_setsockopt(struct lwp *l, const struct sunos_sys_setsockopt_args *uap,
|
|||
error = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
sockopt_init(&sopt, SCARG(uap, level), name, SCARG(uap, valsize));
|
||||
if (SCARG(uap, val)) {
|
||||
m = m_get(M_WAIT, MT_SOOPTS);
|
||||
error = copyin(SCARG(uap, val), mtod(m, void *),
|
||||
error = copyin(SCARG(uap, val), sopt.sopt_data,
|
||||
(u_int)SCARG(uap, valsize));
|
||||
if (error) {
|
||||
(void) m_free(m);
|
||||
goto out;
|
||||
}
|
||||
m->m_len = SCARG(uap, valsize);
|
||||
}
|
||||
error = sosetopt(so, SCARG(uap, level), name, m);
|
||||
if (error == 0)
|
||||
error = sosetopt(so, &sopt);
|
||||
sockopt_destroy(&sopt);
|
||||
out:
|
||||
fd_putfile(SCARG(uap, s));
|
||||
return (error);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sunos32_misc.c,v 1.61 2008/06/24 11:18:15 ad Exp $ */
|
||||
/* $NetBSD: sunos32_misc.c,v 1.62 2008/08/07 20:15:32 plunky Exp $ */
|
||||
/* from :NetBSD: sunos_misc.c,v 1.107 2000/12/01 19:25:10 jdolecek Exp */
|
||||
|
||||
/*
|
||||
|
@ -77,7 +77,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sunos32_misc.c,v 1.61 2008/06/24 11:18:15 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sunos32_misc.c,v 1.62 2008/08/07 20:15:32 plunky Exp $");
|
||||
|
||||
#define COMPAT_SUNOS 1
|
||||
|
||||
|
@ -806,8 +806,8 @@ sunos32_sys_setsockopt(struct lwp *l, const struct sunos32_sys_setsockopt_args *
|
|||
syscallarg(netbsd32_caddr_t) val;
|
||||
syscallarg(int) valsize;
|
||||
} */
|
||||
struct sockopt sopt;
|
||||
struct socket *so;
|
||||
struct mbuf *m = NULL;
|
||||
int name = SCARG(uap, name);
|
||||
int error;
|
||||
|
||||
|
@ -816,10 +816,11 @@ sunos32_sys_setsockopt(struct lwp *l, const struct sunos32_sys_setsockopt_args *
|
|||
return (error);
|
||||
#define SO_DONTLINGER (~SO_LINGER)
|
||||
if (name == SO_DONTLINGER) {
|
||||
m = m_get(M_WAIT, MT_SOOPTS);
|
||||
mtod(m, struct linger *)->l_onoff = 0;
|
||||
m->m_len = sizeof(struct linger);
|
||||
error = sosetopt(so, SCARG(uap, level), SO_LINGER, m);
|
||||
struct linger lg;
|
||||
|
||||
lg.l_onoff = 0;
|
||||
error = so_setsockopt(l, so, SCARG(uap, level), SO_LINGER,
|
||||
&lg, sizeof(lg));
|
||||
goto out;
|
||||
}
|
||||
if (SCARG(uap, level) == IPPROTO_IP) {
|
||||
|
@ -844,17 +845,14 @@ sunos32_sys_setsockopt(struct lwp *l, const struct sunos32_sys_setsockopt_args *
|
|||
error = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
sockopt_init(&sopt, SCARG(uap, level), name, SCARG(uap, valsize));
|
||||
if (SCARG_P32(uap, val)) {
|
||||
m = m_get(M_WAIT, MT_SOOPTS);
|
||||
error = copyin(SCARG_P32(uap, val), mtod(m, void *),
|
||||
error = copyin(SCARG_P32(uap, val), sopt.sopt_data,
|
||||
(u_int)SCARG(uap, valsize));
|
||||
if (error) {
|
||||
(void) m_free(m);
|
||||
goto out;
|
||||
}
|
||||
m->m_len = SCARG(uap, valsize);
|
||||
}
|
||||
error = sosetopt(so, SCARG(uap, level), name, m);
|
||||
if (error == 0)
|
||||
error = sosetopt(so, &sopt);
|
||||
sockopt_destroy(&sopt);
|
||||
out:
|
||||
fd_putfile(SCARG(uap, s));
|
||||
return (error);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ultrix_misc.c,v 1.113 2008/06/24 11:18:15 ad Exp $ */
|
||||
/* $NetBSD: ultrix_misc.c,v 1.114 2008/08/07 20:15:32 plunky Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1997 Jonathan Stone (hereinafter referred to as the author)
|
||||
|
@ -76,7 +76,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ultrix_misc.c,v 1.113 2008/06/24 11:18:15 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ultrix_misc.c,v 1.114 2008/08/07 20:15:32 plunky Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_nfsserver.h"
|
||||
|
@ -346,8 +346,8 @@ ultrix_sys_mmap(struct lwp *l, const struct ultrix_sys_mmap_args *uap, register_
|
|||
int
|
||||
ultrix_sys_setsockopt(struct lwp *l, const struct ultrix_sys_setsockopt_args *uap, register_t *retval)
|
||||
{
|
||||
struct sockopt sopt;
|
||||
struct socket *so;
|
||||
struct mbuf *m = NULL;
|
||||
int error;
|
||||
struct sys_setsockopt_args ap;
|
||||
|
||||
|
@ -362,10 +362,12 @@ ultrix_sys_setsockopt(struct lwp *l, const struct ultrix_sys_setsockopt_args *ua
|
|||
return error;
|
||||
#define SO_DONTLINGER (~SO_LINGER)
|
||||
if (SCARG(&ap, name) == SO_DONTLINGER) {
|
||||
m = m_get(M_WAIT, MT_SOOPTS);
|
||||
mtod(m, struct linger *)->l_onoff = 0;
|
||||
m->m_len = sizeof(struct linger);
|
||||
error = sosetopt(so, SCARG(&ap, level), SO_LINGER, m);
|
||||
struct linger lg;
|
||||
|
||||
lg.l_onoff = 0;
|
||||
error = so_setsockopt(l, so, SCARG(&ap, level), SO_LINGER,
|
||||
&lg, sizeof(lg));
|
||||
goto out;
|
||||
}
|
||||
if (SCARG(&ap, level) == IPPROTO_IP) {
|
||||
#define EMUL_IP_MULTICAST_IF 2
|
||||
|
@ -390,17 +392,15 @@ ultrix_sys_setsockopt(struct lwp *l, const struct ultrix_sys_setsockopt_args *ua
|
|||
error = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
sockopt_init(&sopt, SCARG(&ap, level), SCARG(&ap, name),
|
||||
SCARG(&ap, valsize));
|
||||
if (SCARG(&ap, val)) {
|
||||
m = m_get(M_WAIT, MT_SOOPTS);
|
||||
error = copyin(SCARG(&ap, val), mtod(m, void *),
|
||||
error = copyin(SCARG(&ap, val), sopt.sopt_data,
|
||||
(u_int)SCARG(&ap, valsize));
|
||||
if (error) {
|
||||
(void) m_free(m);
|
||||
goto out;
|
||||
}
|
||||
m->m_len = SCARG(&ap, valsize);
|
||||
}
|
||||
error = sosetopt(so, SCARG(&ap, level), SCARG(&ap, name), m);
|
||||
if (error = 0)
|
||||
error = sosetopt(so, &sopt);
|
||||
sockopt_destroy(&sopt);
|
||||
out:
|
||||
fd_putfile(SCARG(uap, s));
|
||||
return error;
|
||||
|
|
Loading…
Reference in New Issue