Date: Tue, 6 Nov 2018 18:46:38 +0000 (UTC) From: Brooks Davis <brooks@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r340199 - in head/sys: compat/freebsd32 compat/linux fs/nfsclient kern sys Message-ID: <201811061846.wA6IkcBn006056@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: brooks Date: Tue Nov 6 18:46:38 2018 New Revision: 340199 URL: https://svnweb.freebsd.org/changeset/base/340199 Log: Use declared types for caddr_t arguments. Leave ptrace(2) alone for the moment as it's defined to take a caddr_t. Reviewed by: kib Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17852 Modified: head/sys/compat/freebsd32/syscalls.master head/sys/compat/linux/linux_socket.c head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/kern/syscalls.master head/sys/kern/uipc_syscalls.c head/sys/sys/syscallsubr.h Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Tue Nov 6 18:26:40 2018 (r340198) +++ head/sys/compat/freebsd32/syscalls.master Tue Nov 6 18:46:38 2018 (r340199) @@ -97,7 +97,7 @@ 20 AUE_GETPID NOPROTO { pid_t getpid(void); } 21 AUE_MOUNT NOPROTO { int mount(const char *type, \ const char *path, \ - int flags, caddr_t data); } + int flags, void *data); } 22 AUE_UMOUNT NOPROTO { int unmount(const char *path, int flags); } 23 AUE_SETUID NOPROTO { int setuid(uid_t uid); } 24 AUE_GETUID NOPROTO { uid_t getuid(void); } @@ -108,14 +108,17 @@ int flags); } 28 AUE_SENDMSG STD { int freebsd32_sendmsg(int s, struct msghdr32 *msg, \ int flags); } -29 AUE_RECVFROM STD { int freebsd32_recvfrom(int s, uint32_t buf, \ - uint32_t len, int flags, uint32_t from, \ +29 AUE_RECVFROM STD { int freebsd32_recvfrom(int s, void *buf, \ + uint32_t len, int flags, \ + struct sockaddr *from, \ uint32_t fromlenaddr); } -30 AUE_ACCEPT NOPROTO { int accept(int s, caddr_t name, \ +30 AUE_ACCEPT NOPROTO { int accept(int s, struct sockaddr *name, \ int *anamelen); } -31 AUE_GETPEERNAME NOPROTO { int getpeername(int fdes, caddr_t asa, \ +31 AUE_GETPEERNAME NOPROTO { int getpeername(int fdes, \ + struct sockaddr *asa, \ int *alen); } -32 AUE_GETSOCKNAME NOPROTO { int getsockname(int fdes, caddr_t asa, \ +32 AUE_GETSOCKNAME NOPROTO { int getsockname(int fdes, \ + struct sockaddr *asa, \ int *alen); } 33 AUE_ACCESS NOPROTO { int access(const char *path, int amode); } 34 AUE_CHFLAGS NOPROTO { int chflags(const char *path, u_long flags); } @@ -130,7 +133,7 @@ 41 AUE_DUP NOPROTO { int dup(u_int fd); } 42 AUE_PIPE COMPAT10 { int freebsd32_pipe(void); } 43 AUE_GETEGID NOPROTO { gid_t getegid(void); } -44 AUE_PROFILE NOPROTO { int profil(caddr_t samples, size_t size, \ +44 AUE_PROFILE NOPROTO { int profil(char *samples, size_t size, \ size_t offset, u_int scale); } 45 AUE_KTRACE NOPROTO { int ktrace(const char *fname, int ops, \ int facs, int pid); } @@ -214,7 +217,8 @@ int prio); } 97 AUE_SOCKET NOPROTO { int socket(int domain, int type, \ int protocol); } -98 AUE_CONNECT NOPROTO { int connect(int s, caddr_t name, \ +98 AUE_CONNECT NOPROTO { int connect(int s, \ + const struct sockaddr *name, \ int namelen); } 99 AUE_NULL OBSOL oaccept 100 AUE_GETPRIORITY NOPROTO { int getpriority(int which, int who); } @@ -222,10 +226,10 @@ 102 AUE_NULL OBSOL orecv 103 AUE_SIGRETURN COMPAT { int freebsd32_sigreturn( \ struct ia32_sigcontext3 *sigcntxp); } -104 AUE_BIND NOPROTO { int bind(int s, caddr_t name, \ +104 AUE_BIND NOPROTO { int bind(int s, const struct sockaddr *name, \ int namelen); } 105 AUE_SETSOCKOPT NOPROTO { int setsockopt(int s, int level, \ - int name, caddr_t val, int valsize); } + int name, const void *val, int valsize); } 106 AUE_LISTEN NOPROTO { int listen(int s, int backlog); } 107 AUE_NULL OBSOL vtimes 108 AUE_O_SIGVEC COMPAT { int freebsd32_sigvec(int signum, \ @@ -246,7 +250,7 @@ 117 AUE_GETRUSAGE STD { int freebsd32_getrusage(int who, \ struct rusage32 *rusage); } 118 AUE_GETSOCKOPT NOPROTO { int getsockopt(int s, int level, \ - int name, caddr_t val, int *avalsize); } + int name, void *val, int *avalsize); } 119 AUE_NULL UNIMPL resuba (BSD/OS 2.x) 120 AUE_READV STD { int freebsd32_readv(int fd, \ struct iovec32 *iovp, u_int iovcnt); } @@ -267,8 +271,9 @@ 130 AUE_FTRUNCATE COMPAT|NOPROTO { int ftruncate(int fd, int length); } 131 AUE_FLOCK NOPROTO { int flock(int fd, int how); } 132 AUE_MKFIFO NOPROTO { int mkfifo(const char *path, mode_t mode); } -133 AUE_SENDTO NOPROTO { int sendto(int s, caddr_t buf, \ - size_t len, int flags, caddr_t to, \ +133 AUE_SENDTO NOPROTO { int sendto(int s, const void *buf, \ + size_t len, int flags, \ + const struct sockaddr *to, \ int tolen); } 134 AUE_SHUTDOWN NOPROTO { int shutdown(int s, int how); } 135 AUE_SOCKETPAIR NOPROTO { int socketpair(int domain, int type, \ @@ -289,7 +294,7 @@ 146 AUE_KILLPG OBSOL killpg 147 AUE_SETSID NOPROTO { int setsid(void); } 148 AUE_QUOTACTL NOPROTO { int quotactl(const char *path, int cmd, \ - int uid, caddr_t arg); } + int uid, void *arg); } 149 AUE_O_QUOTA OBSOL oquota 150 AUE_GETSOCKNAME OBSOL ogetsockname @@ -368,7 +373,7 @@ __setrlimit_args int 196 AUE_GETDIRENTRIES COMPAT11 { int freebsd32_getdirentries(int fd, \ char *buf, u_int count, int32_t *basep); } -197 AUE_MMAP COMPAT6 { caddr_t freebsd32_mmap(caddr_t addr, \ +197 AUE_MMAP COMPAT6 { caddr_t freebsd32_mmap(void *addr, \ size_t len, int prot, int flags, int fd, \ int pad, uint32_t pos1, uint32_t pos2); } 198 AUE_NULL NOPROTO { int nosys(void); } __syscall \ @@ -852,11 +857,12 @@ 469 AUE_NULL UNIMPL __getpath_fromfd 470 AUE_NULL UNIMPL __getpath_fromaddr 471 AUE_SCTP_PEELOFF NOPROTO|NOSTD { int sctp_peeloff(int sd, uint32_t name); } -472 AUE_SCTP_GENERIC_SENDMSG NOPROTO|NOSTD { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, \ - caddr_t to, __socklen_t tolen, \ +472 AUE_SCTP_GENERIC_SENDMSG NOPROTO|NOSTD { int sctp_generic_sendmsg( \ + int sd, void *msg, int mlen, \ + struct sockaddr *to, __socklen_t tolen, \ struct sctp_sndrcvinfo *sinfo, int flags); } 473 AUE_SCTP_GENERIC_SENDMSG_IOV NOPROTO|NOSTD { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, \ - caddr_t to, __socklen_t tolen, \ + struct sockaddr *to, __socklen_t tolen, \ struct sctp_sndrcvinfo *sinfo, int flags); } 474 AUE_SCTP_GENERIC_RECVMSG NOPROTO|NOSTD { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \ struct sockaddr * from, __socklen_t *fromlenaddr, \ @@ -870,7 +876,7 @@ const void *buf, size_t nbyte, \ int pad, \ uint32_t offset1, uint32_t offset2); } -477 AUE_MMAP STD { caddr_t freebsd32_mmap(caddr_t addr, \ +477 AUE_MMAP STD { caddr_t freebsd32_mmap(void *addr, \ size_t len, int prot, int flags, int fd, \ int pad, \ uint32_t pos1, uint32_t pos2); } @@ -891,7 +897,7 @@ 476 AUE_PWRITE STD { ssize_t freebsd32_pwrite(int fd, \ const void *buf, size_t nbyte, \ uint32_t offset1, uint32_t offset2); } -477 AUE_MMAP STD { caddr_t freebsd32_mmap(caddr_t addr, \ +477 AUE_MMAP STD { caddr_t freebsd32_mmap(void *addr, \ size_t len, int prot, int flags, int fd, \ uint32_t pos1, uint32_t pos2); } 478 AUE_LSEEK STD { off_t freebsd32_lseek(int fd, \ @@ -1054,9 +1060,11 @@ uint32_t fcntlrights); } 537 AUE_CAP_FCNTLS_GET NOPROTO { int cap_fcntls_get(int fd, \ uint32_t *fcntlrightsp); } -538 AUE_BINDAT NOPROTO { int bindat(int fd, int s, caddr_t name, \ +538 AUE_BINDAT NOPROTO { int bindat(int fd, int s, \ + const struct sockaddr *name, \ int namelen); } -539 AUE_CONNECTAT NOPROTO { int connectat(int fd, int s, caddr_t name, \ +539 AUE_CONNECTAT NOPROTO { int connectat(int fd, int s, \ + const struct sockaddr *name, \ int namelen); } 540 AUE_CHFLAGSAT NOPROTO { int chflagsat(int fd, const char *path, \ u_long flags, int atflag); } Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Tue Nov 6 18:26:40 2018 (r340198) +++ head/sys/compat/linux/linux_socket.c Tue Nov 6 18:46:38 2018 (r340199) @@ -1520,7 +1520,7 @@ linux_setsockopt(struct thread *td, struct linux_setso int s; int level; int name; - caddr_t val; + const void *val; int valsize; } */ bsd_args; l_timeval linux_tv; @@ -1570,10 +1570,11 @@ linux_setsockopt(struct thread *td, struct linux_setso bsd_args.valsize = args->optlen; if (name == IPV6_NEXTHOP) { - linux_to_bsd_sockaddr((struct sockaddr *)bsd_args.val, - bsd_args.valsize); + linux_to_bsd_sockaddr(__DECONST(struct sockaddr *, + bsd_args.val), bsd_args.valsize); error = sys_setsockopt(td, &bsd_args); - bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.val); + bsd_to_linux_sockaddr(__DECONST(struct sockaddr *, + bsd_args.val)); } else error = sys_setsockopt(td, &bsd_args); Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Tue Nov 6 18:26:40 2018 (r340198) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Tue Nov 6 18:46:38 2018 (r340199) @@ -1238,8 +1238,7 @@ nfs_mount(struct mount *mp) bzero(&hst[hstlen], MNAMELEN - hstlen); args.hostname = hst; /* getsockaddr() call must be after above copyin() calls */ - error = getsockaddr(&nam, (caddr_t)args.addr, - args.addrlen); + error = getsockaddr(&nam, args.addr, args.addrlen); if (error != 0) goto out; } else if (nfs_mount_parse_from(mp->mnt_optnew, Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Tue Nov 6 18:26:40 2018 (r340198) +++ head/sys/kern/syscalls.master Tue Nov 6 18:46:38 2018 (r340199) @@ -207,7 +207,7 @@ _In_z_ const char *type, _In_z_ const char *path, int flags, - _In_opt_ caddr_t data + _In_opt_ void *data ); } ; XXX `path' should have type `const char *' but we're not ready for that. @@ -253,7 +253,7 @@ 29 AUE_RECVFROM STD { int recvfrom( int s, - _Out_writes_bytes_(len) caddr_t buf, + _Out_writes_bytes_(len) void *buf, size_t len, int flags, _Out_writes_bytes_opt_(*fromlenaddr) struct sockaddr *from, @@ -336,7 +336,7 @@ } 44 AUE_PROFILE STD { int profil( - _Out_writes_bytes_(size) caddr_t samples, + _Out_writes_bytes_(size) char *samples, size_t size, size_t offset, u_int scale @@ -398,7 +398,7 @@ int ioctl( int fd, u_long com, - _Inout_opt_ caddr_t data + _Inout_opt_ char *data ); } 55 AUE_REBOOT STD { @@ -630,14 +630,14 @@ 98 AUE_CONNECT STD { int connect( int s, - _In_reads_bytes_(namelen) caddr_t name, + _In_reads_bytes_(namelen) const struct sockaddr *name, int namelen ); } 99 AUE_ACCEPT COMPAT|NOARGS { int accept( int s, - _Out_writes_bytes_opt_(*anamelen) caddr_t name, + _Out_writes_bytes_opt_(*anamelen) struct sockaddr *name, int *anamelen ); } accept accept_args int @@ -650,7 +650,7 @@ 101 AUE_SEND COMPAT { int send( int s, - _In_reads_bytes_(len) caddr_t buf, + _In_reads_bytes_(len) const void *buf, int len, int flags ); @@ -658,7 +658,7 @@ 102 AUE_RECV COMPAT { int recv( int s, - _Out_writes_bytes_(len) caddr_t buf, + _Out_writes_bytes_(len) void *buf, int len, int flags ); @@ -671,7 +671,7 @@ 104 AUE_BIND STD { int bind( int s, - _In_reads_bytes_(namelen) caddr_t name, + _In_reads_bytes_(namelen) const struct sockaddr *name, int namelen ); } @@ -680,7 +680,7 @@ int s, int level, int name, - _In_reads_bytes_opt_(valsize) caddr_t val, + _In_reads_bytes_opt_(valsize) const void *val, int valsize ); } @@ -731,7 +731,7 @@ 114 AUE_SENDMSG COMPAT { int sendmsg( int s, - _In_ caddr_t msg, + _In_ const void *msg, int flags ); } @@ -753,7 +753,7 @@ int s, int level, int name, - _Out_writes_bytes_opt_(*avalsize) caddr_t val, + _Out_writes_bytes_opt_(*avalsize) void *val, _Inout_ int *avalsize ); } @@ -794,10 +794,10 @@ 125 AUE_RECVFROM COMPAT|NOARGS { int recvfrom( int s, - _Out_writes_(len) caddr_t buf, + _Out_writes_(len) void *buf, size_t len, int flags, - _Out_writes_bytes_(*fromlenaddr) caddr_t from, + _Out_writes_bytes_(*fromlenaddr) struct sockaddr *from, _Inout_ int *fromlenaddr ); } recvfrom recvfrom_args int @@ -846,10 +846,10 @@ 133 AUE_SENDTO STD { int sendto( int s, - _In_reads_bytes_(len) caddr_t buf, + _In_reads_bytes_(len) const void *buf, size_t len, int flags, - _In_reads_bytes_opt_(tolen) caddr_t to, + _In_reads_bytes_opt_(tolen) const struct sockaddr *to, int tolen ); } @@ -894,7 +894,7 @@ 141 AUE_GETPEERNAME COMPAT { int getpeername( int fdes, - _Out_writes_bytes_(*alen) caddr_t asa, + _Out_writes_bytes_(*alen) struct sockaddr *asa, _Inout_opt_ int *alen ); } @@ -932,7 +932,7 @@ _In_z_ const char *path, int cmd, int uid, - _In_ caddr_t arg + _In_ void *arg ); } 149 AUE_O_QUOTA COMPAT { @@ -941,7 +941,7 @@ 150 AUE_GETSOCKNAME COMPAT|NOARGS { int getsockname( int fdec, - _Out_writes_bytes_(*alen) caddr_t asa, + _Out_writes_bytes_(*alen) struct sockaddr *asa, _Inout_ int *alen ); } getsockname getsockname_args int @@ -966,7 +966,7 @@ 155 AUE_NFS_SVC NOSTD { int nfssvc( int flag, - _In_ caddr_t argp + _In_ void *argp ); } 156 AUE_GETDIRENTRIES COMPAT { @@ -1171,7 +1171,7 @@ } 197 AUE_MMAP COMPAT6 { caddr_t mmap( - _In_ caddr_t addr, + _In_ void *addr, size_t len, int prot, int flags, @@ -2498,9 +2498,9 @@ 472 AUE_SCTP_GENERIC_SENDMSG NOSTD { int sctp_generic_sendmsg( int sd, - _In_reads_bytes_(mlen) caddr_t msg, + _In_reads_bytes_(mlen) void *msg, int mlen, - _In_reads_bytes_(tolen) caddr_t to, + _In_reads_bytes_(tolen) struct sockaddr *to, __socklen_t tolen, _In_opt_ struct sctp_sndrcvinfo *sinfo, int flags @@ -2511,7 +2511,7 @@ int sd, _In_reads_(iovlen) struct iovec *iov, int iovlen, - _In_reads_bytes_(tolen) caddr_t to, + _In_reads_bytes_(tolen) struct sockaddr *to, __socklen_t tolen, _In_opt_ struct sctp_sndrcvinfo *sinfo, int flags @@ -2546,7 +2546,7 @@ } 477 AUE_MMAP STD { caddr_t mmap( - _In_ caddr_t addr, + _In_ void *addr, size_t len, int prot, int flags, @@ -2967,7 +2967,7 @@ int bindat( int fd, int s, - _In_reads_bytes_(namelen) caddr_t name, + _In_reads_bytes_(namelen) const struct sockaddr *name, int namelen ); } @@ -2975,7 +2975,7 @@ int connectat( int fd, int s, - _In_reads_bytes_(namelen) caddr_t name, + _In_reads_bytes_(namelen) const struct sockaddr *name, int namelen ); } Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Tue Nov 6 18:26:40 2018 (r340198) +++ head/sys/kern/uipc_syscalls.c Tue Nov 6 18:46:38 2018 (r340199) @@ -825,7 +825,7 @@ sys_sendto(struct thread *td, struct sendto_args *uap) struct msghdr msg; struct iovec aiov; - msg.msg_name = uap->to; + msg.msg_name = __DECONST(void *, uap->to); msg.msg_namelen = uap->tolen; msg.msg_iov = &aiov; msg.msg_iovlen = 1; @@ -833,7 +833,7 @@ sys_sendto(struct thread *td, struct sendto_args *uap) #ifdef COMPAT_OLDSOCK msg.msg_flags = 0; #endif - aiov.iov_base = uap->buf; + aiov.iov_base = __DECONST(void *, uap->buf); aiov.iov_len = uap->len; return (sendit(td, uap->s, &msg, uap->flags)); } @@ -849,7 +849,7 @@ osend(struct thread *td, struct osend_args *uap) msg.msg_namelen = 0; msg.msg_iov = &aiov; msg.msg_iovlen = 1; - aiov.iov_base = uap->buf; + aiov.iov_base = __DECONST(void *, uap->buf); aiov.iov_len = uap->len; msg.msg_control = 0; msg.msg_flags = 0; @@ -1225,7 +1225,7 @@ sys_setsockopt(struct thread *td, struct setsockopt_ar } int -kern_setsockopt(struct thread *td, int s, int level, int name, void *val, +kern_setsockopt(struct thread *td, int s, int level, int name, const void *val, enum uio_seg valseg, socklen_t valsize) { struct socket *so; @@ -1241,7 +1241,7 @@ kern_setsockopt(struct thread *td, int s, int level, i sopt.sopt_dir = SOPT_SET; sopt.sopt_level = level; sopt.sopt_name = name; - sopt.sopt_val = val; + sopt.sopt_val = __DECONST(void *, val); sopt.sopt_valsize = valsize; switch (valseg) { case UIO_USERSPACE: @@ -1546,7 +1546,7 @@ sockargs(struct mbuf **mp, char *buf, socklen_t buflen } int -getsockaddr(struct sockaddr **namp, caddr_t uaddr, size_t len) +getsockaddr(struct sockaddr **namp, const struct sockaddr *uaddr, size_t len) { struct sockaddr *sa; int error; Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Tue Nov 6 18:26:40 2018 (r340198) +++ head/sys/sys/syscallsubr.h Tue Nov 6 18:46:38 2018 (r340199) @@ -243,7 +243,7 @@ int kern_setitimer(struct thread *, u_int, struct itim struct itimerval *); int kern_setrlimit(struct thread *, u_int, struct rlimit *); int kern_setsockopt(struct thread *td, int s, int level, int name, - void *optval, enum uio_seg valseg, socklen_t valsize); + const void *optval, enum uio_seg valseg, socklen_t valsize); int kern_settimeofday(struct thread *td, struct timeval *tv, struct timezone *tzp); int kern_shm_open(struct thread *td, const char *userpath, int flags,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811061846.wA6IkcBn006056>