diff options
author | bde <bde@FreeBSD.org> | 2003-12-25 09:59:02 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2003-12-25 09:59:02 +0000 |
commit | 8ce2b349efc45b33216c6f6f2be111c9c99ad0ba (patch) | |
tree | dc708d1d4bcfada8c385c5b005fa0b34cfa44b76 /sys/compat/linux/linux_socket.c | |
parent | 757e456f2848f3517bfbcf13237c5aeeb88b0cca (diff) | |
download | FreeBSD-src-8ce2b349efc45b33216c6f6f2be111c9c99ad0ba.zip FreeBSD-src-8ce2b349efc45b33216c6f6f2be111c9c99ad0ba.tar.gz |
Quick fix for LINT breakage caused by interface changes in accept(2), etc.
The log message for rev.1.160 of kern/uipc_syscalls.c and associated
changes only claimed to add restrict qualifiers (which have no effect in
the kernel so they probably shouldn't be added), but the following
interface changes were also made:
- caddr_t to `void *' and `struct sockaddr_t *'
- `int *' to `socklen_t *'.
These interface changes are not quite null, and this fix is quick (like
the changes in uipc_syscalls 1.160) because it uses bogus casts instead
of complete bounds-checked conversions.
Things should be fixed better when the conversions can be done without
using the stack gap. linux_check_hdrincl() already uses the stack gap
and is fixed completely though the type mismatches in it were not fatal
(there were only fatal type mismatches from unopaquing pointers to
[o]sockaddr't's -- the difference between accept()'s args and oaccept()'s
args is now non-opaque, but this is not reflected in their args structs).
Diffstat (limited to 'sys/compat/linux/linux_socket.c')
-rw-r--r-- | sys/compat/linux/linux_socket.c | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 2bf1c7e..ddde801 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -405,20 +405,20 @@ static int linux_check_hdrincl(struct thread *td, caddr_t *sg, int s) { struct getsockopt_args /* { - int s; - int level; - int name; - caddr_t val; - int *avalsize; + int s; + int level; + int name; + void * __restrict val; + socklen_t * __restrict avalsize; } */ bsd_args; - int error; - caddr_t val, valsize; - int size_val = sizeof val; - int optval; + void * __restrict val; + socklen_t * __restrict valsize; + int error, optval, size_val; - val = stackgap_alloc(sg, sizeof(int)); - valsize = stackgap_alloc(sg, sizeof(int)); + val = stackgap_alloc(sg, sizeof(size_val)); + valsize = stackgap_alloc(sg, sizeof(socklen_t)); + size_val = sizeof(val); if ((error = copyout(&size_val, valsize, sizeof(size_val)))) return (error); @@ -426,7 +426,7 @@ linux_check_hdrincl(struct thread *td, caddr_t *sg, int s) bsd_args.level = IPPROTO_IP; bsd_args.name = IP_HDRINCL; bsd_args.val = val; - bsd_args.avalsize = (int *)valsize; + bsd_args.avalsize = valsize; if ((error = getsockopt(td, &bsd_args))) return (error); @@ -701,17 +701,17 @@ linux_accept(struct thread *td, struct linux_accept_args *args) { struct linux_accept_args linux_args; struct accept_args /* { - int s; - caddr_t name; - int *anamelen; + int s; + struct sockaddr * __restrict name; + socklen_t * __restrict anamelen; } */ bsd_args; struct close_args /* { int fd; } */ c_args; struct fcntl_args /* { - int fd; - int cmd; - long arg; + int fd; + int cmd; + long arg; } */ f_args; int error; @@ -719,8 +719,9 @@ linux_accept(struct thread *td, struct linux_accept_args *args) return (error); bsd_args.s = linux_args.s; - bsd_args.name = (caddr_t)linux_args.addr; - bsd_args.anamelen = linux_args.namelen; + /* XXX: */ + bsd_args.name = (struct sockaddr * __restrict)linux_args.addr; + bsd_args.anamelen = linux_args.namelen; /* XXX */ error = oaccept(td, &bsd_args); if (error) return (error); @@ -757,9 +758,9 @@ linux_getsockname(struct thread *td, struct linux_getsockname_args *args) { struct linux_getsockname_args linux_args; struct getsockname_args /* { - int fdes; - caddr_t asa; - int *alen; + int fdes; + struct sockaddr * __restrict asa; + socklen_t * __restrict alen; } */ bsd_args; int error; @@ -767,8 +768,9 @@ linux_getsockname(struct thread *td, struct linux_getsockname_args *args) return (error); bsd_args.fdes = linux_args.s; - bsd_args.asa = (caddr_t) linux_args.addr; - bsd_args.alen = linux_args.namelen; + /* XXX: */ + bsd_args.asa = (struct sockaddr * __restrict)linux_args.addr; + bsd_args.alen = linux_args.namelen; /* XXX */ error = ogetsockname(td, &bsd_args); if (error) return (error); @@ -942,12 +944,12 @@ linux_recvfrom(struct thread *td, struct linux_recvfrom_args *args) { struct linux_recvfrom_args linux_args; struct recvfrom_args /* { - int s; - caddr_t buf; - size_t len; - int flags; - caddr_t from; - int *fromlenaddr; + int s; + caddr_t buf; + size_t len; + int flags; + struct sockaddr * __restrict from; + socklen_t * __restrict fromlenaddr; } */ bsd_args; int error; @@ -958,8 +960,9 @@ linux_recvfrom(struct thread *td, struct linux_recvfrom_args *args) bsd_args.buf = linux_args.buf; bsd_args.len = linux_args.len; bsd_args.flags = linux_to_bsd_msg_flags(linux_args.flags); - bsd_args.from = linux_args.from; - bsd_args.fromlenaddr = linux_args.fromlen; + /* XXX: */ + bsd_args.from = (struct sockaddr * __restrict)linux_args.from; + bsd_args.fromlenaddr = linux_args.fromlen; /* XXX */ error = orecvfrom(td, &bsd_args); if (error) return (error); |