* Due to addition and use of socklen_t, make the socket option and address

arguments passed to accept(), bind(), connect(), getpeername(), getsockname(),
getsockopt(), recvfrom(), sendto() and sendmsg() unsigned, which also elimiates
a few casts.
* Reflect the (now) signedness of msg_iovlen, which necessiates the addition
of a few casts.
This commit is contained in:
kleink 1999-02-10 18:02:28 +00:00
parent b97c99a7d6
commit dfffb2f357
2 changed files with 39 additions and 35 deletions

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.87 1998/12/10 15:09:18 christos Exp $ $NetBSD: syscalls.master,v 1.88 1999/02/10 18:02:28 kleink Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@ -96,13 +96,13 @@
const struct msghdr *msg, int flags); } const struct msghdr *msg, int flags); }
29 STD { ssize_t sys_recvfrom(int s, void *buf, size_t len, \ 29 STD { ssize_t sys_recvfrom(int s, void *buf, size_t len, \
int flags, struct sockaddr *from, \ int flags, struct sockaddr *from, \
int *fromlenaddr); } unsigned int *fromlenaddr); }
30 STD { int sys_accept(int s, struct sockaddr *name, \ 30 STD { int sys_accept(int s, struct sockaddr *name, \
int *anamelen); } unsigned int *anamelen); }
31 STD { int sys_getpeername(int fdes, struct sockaddr *asa, \ 31 STD { int sys_getpeername(int fdes, struct sockaddr *asa, \
int *alen); } unsigned int *alen); }
32 STD { int sys_getsockname(int fdes, struct sockaddr *asa, \ 32 STD { int sys_getsockname(int fdes, struct sockaddr *asa, \
int *alen); } unsigned int *alen); }
33 STD { int sys_access(const char *path, int flags); } 33 STD { int sys_access(const char *path, int flags); }
34 STD { int sys_chflags(const char *path, u_long flags); } 34 STD { int sys_chflags(const char *path, u_long flags); }
35 STD { int sys_fchflags(int fd, u_long flags); } 35 STD { int sys_fchflags(int fd, u_long flags); }
@ -200,7 +200,7 @@
96 STD { int sys_setpriority(int which, int who, int prio); } 96 STD { int sys_setpriority(int which, int who, int prio); }
97 STD { int sys_socket(int domain, int type, int protocol); } 97 STD { int sys_socket(int domain, int type, int protocol); }
98 STD { int sys_connect(int s, const struct sockaddr *name, \ 98 STD { int sys_connect(int s, const struct sockaddr *name, \
int namelen); } unsigned int namelen); }
99 COMPAT_43 { int sys_accept(int s, caddr_t name, \ 99 COMPAT_43 { int sys_accept(int s, caddr_t name, \
int *anamelen); } oaccept int *anamelen); } oaccept
100 STD { int sys_getpriority(int which, int who); } 100 STD { int sys_getpriority(int which, int who); }
@ -211,9 +211,9 @@
103 COMPAT_13 { int sys_sigreturn(struct sigcontext13 *sigcntxp); } \ 103 COMPAT_13 { int sys_sigreturn(struct sigcontext13 *sigcntxp); } \
sigreturn13 sigreturn13
104 STD { int sys_bind(int s, const struct sockaddr *name, \ 104 STD { int sys_bind(int s, const struct sockaddr *name, \
int namelen); } unsigned int namelen); }
105 STD { int sys_setsockopt(int s, int level, int name, \ 105 STD { int sys_setsockopt(int s, int level, int name, \
const void *val, int valsize); } const void *val, unsigned int valsize); }
106 STD { int sys_listen(int s, int backlog); } 106 STD { int sys_listen(int s, int backlog); }
107 OBSOL vtimes 107 OBSOL vtimes
108 COMPAT_43 { int sys_sigvec(int signum, struct sigvec *nsv, \ 108 COMPAT_43 { int sys_sigvec(int signum, struct sigvec *nsv, \
@ -236,7 +236,7 @@
struct timezone *tzp); } struct timezone *tzp); }
117 STD { int sys_getrusage(int who, struct rusage *rusage); } 117 STD { int sys_getrusage(int who, struct rusage *rusage); }
118 STD { int sys_getsockopt(int s, int level, int name, \ 118 STD { int sys_getsockopt(int s, int level, int name, \
void *val, int *avalsize); } void *val, unsigned int *avalsize); }
119 OBSOL resuba 119 OBSOL resuba
120 STD { ssize_t sys_readv(int fd, \ 120 STD { ssize_t sys_readv(int fd, \
const struct iovec *iovp, int iovcnt); } const struct iovec *iovp, int iovcnt); }
@ -259,7 +259,7 @@
132 STD { int sys_mkfifo(const char *path, mode_t mode); } 132 STD { int sys_mkfifo(const char *path, mode_t mode); }
133 STD { ssize_t sys_sendto(int s, const void *buf, \ 133 STD { ssize_t sys_sendto(int s, const void *buf, \
size_t len, int flags, const struct sockaddr *to, \ size_t len, int flags, const struct sockaddr *to, \
int tolen); } unsigned int tolen); }
134 STD { int sys_shutdown(int s, int how); } 134 STD { int sys_shutdown(int s, int how); }
135 STD { int sys_socketpair(int domain, int type, \ 135 STD { int sys_socketpair(int domain, int type, \
int protocol, int *rsv); } int protocol, int *rsv); }

View File

@ -1,4 +1,4 @@
/* $NetBSD: uipc_syscalls.c,v 1.40 1998/12/18 13:18:43 drochner Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.41 1999/02/10 18:02:28 kleink Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1989, 1990, 1993 * Copyright (c) 1982, 1986, 1989, 1990, 1993
@ -115,7 +115,7 @@ sys_bind(p, v, retval)
register struct sys_bind_args /* { register struct sys_bind_args /* {
syscallarg(int) s; syscallarg(int) s;
syscallarg(const struct sockaddr *) name; syscallarg(const struct sockaddr *) name;
syscallarg(int) namelen; syscallarg(unsigned int) namelen;
} */ *uap = v; } */ *uap = v;
struct file *fp; struct file *fp;
struct mbuf *nam; struct mbuf *nam;
@ -160,11 +160,12 @@ sys_accept(p, v, retval)
register struct sys_accept_args /* { register struct sys_accept_args /* {
syscallarg(int) s; syscallarg(int) s;
syscallarg(struct sockaddr *) name; syscallarg(struct sockaddr *) name;
syscallarg(int *) anamelen; syscallarg(unsigned int *) anamelen;
} */ *uap = v; } */ *uap = v;
struct file *fp; struct file *fp;
struct mbuf *nam; struct mbuf *nam;
int namelen, error, s, tmpfd; unsigned int namelen;
int error, s, tmpfd;
register struct socket *so; register struct socket *so;
if (SCARG(uap, name) && (error = copyin((caddr_t)SCARG(uap, anamelen), if (SCARG(uap, name) && (error = copyin((caddr_t)SCARG(uap, anamelen),
@ -221,7 +222,7 @@ sys_accept(p, v, retval)
namelen = nam->m_len; namelen = nam->m_len;
/* SHOULD COPY OUT A CHAIN HERE */ /* SHOULD COPY OUT A CHAIN HERE */
if ((error = copyout(mtod(nam, caddr_t), if ((error = copyout(mtod(nam, caddr_t),
(caddr_t)SCARG(uap, name), (u_int)namelen)) == 0) (caddr_t)SCARG(uap, name), namelen)) == 0)
error = copyout((caddr_t)&namelen, error = copyout((caddr_t)&namelen,
(caddr_t)SCARG(uap, anamelen), (caddr_t)SCARG(uap, anamelen),
sizeof(*SCARG(uap, anamelen))); sizeof(*SCARG(uap, anamelen)));
@ -241,7 +242,7 @@ sys_connect(p, v, retval)
register struct sys_connect_args /* { register struct sys_connect_args /* {
syscallarg(int) s; syscallarg(int) s;
syscallarg(const struct sockaddr *) name; syscallarg(const struct sockaddr *) name;
syscallarg(int) namelen; syscallarg(unsigned int) namelen;
} */ *uap = v; } */ *uap = v;
struct file *fp; struct file *fp;
register struct socket *so; register struct socket *so;
@ -360,7 +361,7 @@ sys_sendto(p, v, retval)
syscallarg(size_t) len; syscallarg(size_t) len;
syscallarg(int) flags; syscallarg(int) flags;
syscallarg(const struct sockaddr *) to; syscallarg(const struct sockaddr *) to;
syscallarg(int) tolen; syscallarg(unsigned int) tolen;
} */ *uap = v; } */ *uap = v;
struct msghdr msg; struct msghdr msg;
struct iovec aiov; struct iovec aiov;
@ -396,14 +397,14 @@ sys_sendmsg(p, v, retval)
error = copyin(SCARG(uap, msg), (caddr_t)&msg, sizeof(msg)); error = copyin(SCARG(uap, msg), (caddr_t)&msg, sizeof(msg));
if (error) if (error)
return (error); return (error);
if (msg.msg_iovlen > UIO_SMALLIOV) { if ((unsigned int)msg.msg_iovlen > UIO_SMALLIOV) {
if (msg.msg_iovlen > IOV_MAX) if ((unsigned int)msg.msg_iovlen > IOV_MAX)
return (EMSGSIZE); return (EMSGSIZE);
MALLOC(iov, struct iovec *, MALLOC(iov, struct iovec *,
sizeof(struct iovec) * msg.msg_iovlen, M_IOV, M_WAITOK); sizeof(struct iovec) * msg.msg_iovlen, M_IOV, M_WAITOK);
} else } else
iov = aiov; iov = aiov;
if (msg.msg_iovlen > 0) { if ((unsigned int)msg.msg_iovlen > 0) {
error = copyin((caddr_t)msg.msg_iov, (caddr_t)iov, error = copyin((caddr_t)msg.msg_iov, (caddr_t)iov,
(size_t)(msg.msg_iovlen * sizeof(struct iovec))); (size_t)(msg.msg_iovlen * sizeof(struct iovec)));
if (error) if (error)
@ -548,7 +549,7 @@ sys_recvfrom(p, v, retval)
syscallarg(size_t) len; syscallarg(size_t) len;
syscallarg(int) flags; syscallarg(int) flags;
syscallarg(struct sockaddr *) from; syscallarg(struct sockaddr *) from;
syscallarg(int *) fromlenaddr; syscallarg(unsigned int *) fromlenaddr;
} */ *uap = v; } */ *uap = v;
struct msghdr msg; struct msghdr msg;
struct iovec aiov; struct iovec aiov;
@ -592,14 +593,14 @@ sys_recvmsg(p, v, retval)
sizeof(msg)); sizeof(msg));
if (error) if (error)
return (error); return (error);
if (msg.msg_iovlen > UIO_SMALLIOV) { if ((unsigned int)msg.msg_iovlen > UIO_SMALLIOV) {
if (msg.msg_iovlen > IOV_MAX) if ((unsigned int)msg.msg_iovlen > IOV_MAX)
return (EMSGSIZE); return (EMSGSIZE);
MALLOC(iov, struct iovec *, MALLOC(iov, struct iovec *,
sizeof(struct iovec) * msg.msg_iovlen, M_IOV, M_WAITOK); sizeof(struct iovec) * msg.msg_iovlen, M_IOV, M_WAITOK);
} else } else
iov = aiov; iov = aiov;
if (msg.msg_iovlen > 0) { if ((unsigned int)msg.msg_iovlen > 0) {
error = copyin((caddr_t)msg.msg_iov, (caddr_t)iov, error = copyin((caddr_t)msg.msg_iov, (caddr_t)iov,
(size_t)(msg.msg_iovlen * sizeof(struct iovec))); (size_t)(msg.msg_iovlen * sizeof(struct iovec)));
if (error) if (error)
@ -810,7 +811,7 @@ sys_setsockopt(p, v, retval)
syscallarg(int) level; syscallarg(int) level;
syscallarg(int) name; syscallarg(int) name;
syscallarg(const void *) val; syscallarg(const void *) val;
syscallarg(int) valsize; syscallarg(unsigned int) valsize;
} */ *uap = v; } */ *uap = v;
struct file *fp; struct file *fp;
struct mbuf *m = NULL; struct mbuf *m = NULL;
@ -823,7 +824,7 @@ sys_setsockopt(p, v, retval)
if (SCARG(uap, val)) { if (SCARG(uap, val)) {
m = m_get(M_WAIT, MT_SOOPTS); m = m_get(M_WAIT, MT_SOOPTS);
error = copyin(SCARG(uap, val), mtod(m, caddr_t), error = copyin(SCARG(uap, val), mtod(m, caddr_t),
(u_int)SCARG(uap, valsize)); SCARG(uap, valsize));
if (error) { if (error) {
(void) m_free(m); (void) m_free(m);
return (error); return (error);
@ -846,11 +847,12 @@ sys_getsockopt(p, v, retval)
syscallarg(int) level; syscallarg(int) level;
syscallarg(int) name; syscallarg(int) name;
syscallarg(void *) val; syscallarg(void *) val;
syscallarg(int *) avalsize; syscallarg(unsigned int *) avalsize;
} */ *uap = v; } */ *uap = v;
struct file *fp; struct file *fp;
struct mbuf *m = NULL; struct mbuf *m = NULL;
int valsize, error; unsigned int valsize;
int error;
if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0) if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0)
return (error); return (error);
@ -867,7 +869,7 @@ sys_getsockopt(p, v, retval)
if (valsize > m->m_len) if (valsize > m->m_len)
valsize = m->m_len; valsize = m->m_len;
error = copyout(mtod(m, caddr_t), SCARG(uap, val), error = copyout(mtod(m, caddr_t), SCARG(uap, val),
(u_int)valsize); valsize);
if (error == 0) if (error == 0)
error = copyout((caddr_t)&valsize, error = copyout((caddr_t)&valsize,
(caddr_t)SCARG(uap, avalsize), sizeof(valsize)); (caddr_t)SCARG(uap, avalsize), sizeof(valsize));
@ -936,12 +938,13 @@ sys_getsockname(p, v, retval)
register struct sys_getsockname_args /* { register struct sys_getsockname_args /* {
syscallarg(int) fdes; syscallarg(int) fdes;
syscallarg(struct sockaddr *) asa; syscallarg(struct sockaddr *) asa;
syscallarg(int *) alen; syscallarg(unsigned int *) alen;
} */ *uap = v; } */ *uap = v;
struct file *fp; struct file *fp;
register struct socket *so; register struct socket *so;
struct mbuf *m; struct mbuf *m;
int len, error; unsigned int len;
int error;
if ((error = getsock(p->p_fd, SCARG(uap, fdes), &fp)) != 0) if ((error = getsock(p->p_fd, SCARG(uap, fdes), &fp)) != 0)
return (error); return (error);
@ -956,7 +959,7 @@ sys_getsockname(p, v, retval)
goto bad; goto bad;
if (len > m->m_len) if (len > m->m_len)
len = m->m_len; len = m->m_len;
error = copyout(mtod(m, caddr_t), (caddr_t)SCARG(uap, asa), (u_int)len); error = copyout(mtod(m, caddr_t), (caddr_t)SCARG(uap, asa), len);
if (error == 0) if (error == 0)
error = copyout((caddr_t)&len, (caddr_t)SCARG(uap, alen), error = copyout((caddr_t)&len, (caddr_t)SCARG(uap, alen),
sizeof(len)); sizeof(len));
@ -978,12 +981,13 @@ sys_getpeername(p, v, retval)
register struct sys_getpeername_args /* { register struct sys_getpeername_args /* {
syscallarg(int) fdes; syscallarg(int) fdes;
syscallarg(struct sockaddr *) asa; syscallarg(struct sockaddr *) asa;
syscallarg(int *) alen; syscallarg(unsigned int *) alen;
} */ *uap = v; } */ *uap = v;
struct file *fp; struct file *fp;
register struct socket *so; register struct socket *so;
struct mbuf *m; struct mbuf *m;
int len, error; unsigned int len;
int error;
if ((error = getsock(p->p_fd, SCARG(uap, fdes), &fp)) != 0) if ((error = getsock(p->p_fd, SCARG(uap, fdes), &fp)) != 0)
return (error); return (error);
@ -1000,7 +1004,7 @@ sys_getpeername(p, v, retval)
goto bad; goto bad;
if (len > m->m_len) if (len > m->m_len)
len = m->m_len; len = m->m_len;
error = copyout(mtod(m, caddr_t), (caddr_t)SCARG(uap, asa), (u_int)len); error = copyout(mtod(m, caddr_t), (caddr_t)SCARG(uap, asa), len);
if (error) if (error)
goto bad; goto bad;
error = copyout((caddr_t)&len, (caddr_t)SCARG(uap, alen), sizeof(len)); error = copyout((caddr_t)&len, (caddr_t)SCARG(uap, alen), sizeof(len));