mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-27 16:39:08 +00:00
More caddr_t removal, in conjunction with copy{in,out}(9) this time.
Also clean up some egregious casts and incorrect use of sizeof.
This commit is contained in:
parent
73ba057ccc
commit
4b7ef73d71
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=111797
@ -387,7 +387,7 @@ linux_setrlimit(td, uap)
|
||||
return EINVAL;
|
||||
|
||||
if ((error =
|
||||
copyin((caddr_t)uap->rlim, (caddr_t)&rlim, sizeof (struct rlimit))))
|
||||
copyin(uap->rlim, &rlim, sizeof (struct rlimit))))
|
||||
return (error);
|
||||
return dosetrlimit(td, which, &rlim);
|
||||
}
|
||||
@ -412,6 +412,6 @@ linux_getrlimit(td, uap)
|
||||
if (which == -1)
|
||||
return EINVAL;
|
||||
|
||||
return (copyout((caddr_t)&td->td_proc->p_rlimit[which],
|
||||
(caddr_t)uap->rlim, sizeof (struct rlimit)));
|
||||
return (copyout(&td->td_proc->p_rlimit[which],
|
||||
uap->rlim, sizeof (struct rlimit)));
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ linux_llseek(struct thread *td, struct linux_llseek_args *args)
|
||||
if ((error = lseek(td, &bsd_args)))
|
||||
return error;
|
||||
|
||||
if ((error = copyout(td->td_retval, (caddr_t)args->res, sizeof (off_t))))
|
||||
if ((error = copyout(td->td_retval, args->res, sizeof (off_t))))
|
||||
return error;
|
||||
|
||||
td->td_retval[0] = 0;
|
||||
@ -980,7 +980,7 @@ fcntl_common(struct thread *td, struct linux_fcntl64_args *args)
|
||||
return (kern_fcntl(td, args->fd, F_SETFL, arg));
|
||||
|
||||
case LINUX_F_GETLK:
|
||||
error = copyin((caddr_t)args->arg, &linux_flock,
|
||||
error = copyin((void *)args->arg, &linux_flock,
|
||||
sizeof(linux_flock));
|
||||
if (error)
|
||||
return (error);
|
||||
@ -989,11 +989,11 @@ fcntl_common(struct thread *td, struct linux_fcntl64_args *args)
|
||||
if (error)
|
||||
return (error);
|
||||
bsd_to_linux_flock(&bsd_flock, &linux_flock);
|
||||
return (copyout(&linux_flock, (caddr_t)args->arg,
|
||||
return (copyout(&linux_flock, (void *)args->arg,
|
||||
sizeof(linux_flock)));
|
||||
|
||||
case LINUX_F_SETLK:
|
||||
error = copyin((caddr_t)args->arg, &linux_flock,
|
||||
error = copyin((void *)args->arg, &linux_flock,
|
||||
sizeof(linux_flock));
|
||||
if (error)
|
||||
return (error);
|
||||
@ -1002,7 +1002,7 @@ fcntl_common(struct thread *td, struct linux_fcntl64_args *args)
|
||||
(intptr_t)&bsd_flock));
|
||||
|
||||
case LINUX_F_SETLKW:
|
||||
error = copyin((caddr_t)args->arg, &linux_flock,
|
||||
error = copyin((void *)args->arg, &linux_flock,
|
||||
sizeof(linux_flock));
|
||||
if (error)
|
||||
return (error);
|
||||
@ -1065,7 +1065,7 @@ linux_fcntl64(struct thread *td, struct linux_fcntl64_args *args)
|
||||
|
||||
switch (args->cmd) {
|
||||
case LINUX_F_GETLK64:
|
||||
error = copyin((caddr_t)args->arg, &linux_flock,
|
||||
error = copyin((void *)args->arg, &linux_flock,
|
||||
sizeof(linux_flock));
|
||||
if (error)
|
||||
return (error);
|
||||
@ -1074,11 +1074,11 @@ linux_fcntl64(struct thread *td, struct linux_fcntl64_args *args)
|
||||
if (error)
|
||||
return (error);
|
||||
bsd_to_linux_flock64(&bsd_flock, &linux_flock);
|
||||
return (copyout(&linux_flock, (caddr_t)args->arg,
|
||||
sizeof(linux_flock)));
|
||||
return (copyout(&linux_flock, (void *)args->arg,
|
||||
sizeof(linux_flock)));
|
||||
|
||||
case LINUX_F_SETLK64:
|
||||
error = copyin((caddr_t)args->arg, &linux_flock,
|
||||
error = copyin((void *)args->arg, &linux_flock,
|
||||
sizeof(linux_flock));
|
||||
if (error)
|
||||
return (error);
|
||||
@ -1087,7 +1087,7 @@ linux_fcntl64(struct thread *td, struct linux_fcntl64_args *args)
|
||||
(intptr_t)&bsd_flock));
|
||||
|
||||
case LINUX_F_SETLKW64:
|
||||
error = copyin((caddr_t)args->arg, &linux_flock,
|
||||
error = copyin((void *)args->arg, &linux_flock,
|
||||
sizeof(linux_flock));
|
||||
if (error)
|
||||
return (error);
|
||||
|
@ -123,7 +123,7 @@ linux_ioctl_disk(struct thread *td, struct linux_ioctl_args *args)
|
||||
fdrop(fp, td);
|
||||
if (error)
|
||||
return (error);
|
||||
return (copyout(&(dl.d_secperunit), (caddr_t)args->arg,
|
||||
return (copyout(&(dl.d_secperunit), (void *)args->arg,
|
||||
sizeof(dl.d_secperunit)));
|
||||
}
|
||||
fdrop(fp, td);
|
||||
@ -571,11 +571,11 @@ linux_ioctl_termio(struct thread *td, struct linux_ioctl_args *args)
|
||||
if (error)
|
||||
break;
|
||||
bsd_to_linux_termios(&bios, &lios);
|
||||
error = copyout(&lios, (caddr_t)args->arg, sizeof(lios));
|
||||
error = copyout(&lios, (void *)args->arg, sizeof(lios));
|
||||
break;
|
||||
|
||||
case LINUX_TCSETS:
|
||||
error = copyin((caddr_t)args->arg, &lios, sizeof(lios));
|
||||
error = copyin((void *)args->arg, &lios, sizeof(lios));
|
||||
if (error)
|
||||
break;
|
||||
linux_to_bsd_termios(&lios, &bios);
|
||||
@ -584,7 +584,7 @@ linux_ioctl_termio(struct thread *td, struct linux_ioctl_args *args)
|
||||
break;
|
||||
|
||||
case LINUX_TCSETSW:
|
||||
error = copyin((caddr_t)args->arg, &lios, sizeof(lios));
|
||||
error = copyin((void *)args->arg, &lios, sizeof(lios));
|
||||
if (error)
|
||||
break;
|
||||
linux_to_bsd_termios(&lios, &bios);
|
||||
@ -593,7 +593,7 @@ linux_ioctl_termio(struct thread *td, struct linux_ioctl_args *args)
|
||||
break;
|
||||
|
||||
case LINUX_TCSETSF:
|
||||
error = copyin((caddr_t)args->arg, &lios, sizeof(lios));
|
||||
error = copyin((void *)args->arg, &lios, sizeof(lios));
|
||||
if (error)
|
||||
break;
|
||||
linux_to_bsd_termios(&lios, &bios);
|
||||
@ -607,11 +607,11 @@ linux_ioctl_termio(struct thread *td, struct linux_ioctl_args *args)
|
||||
if (error)
|
||||
break;
|
||||
bsd_to_linux_termio(&bios, &lio);
|
||||
error = (copyout(&lio, (caddr_t)args->arg, sizeof(lio)));
|
||||
error = (copyout(&lio, (void *)args->arg, sizeof(lio)));
|
||||
break;
|
||||
|
||||
case LINUX_TCSETA:
|
||||
error = copyin((caddr_t)args->arg, &lio, sizeof(lio));
|
||||
error = copyin((void *)args->arg, &lio, sizeof(lio));
|
||||
if (error)
|
||||
break;
|
||||
linux_to_bsd_termio(&lio, &bios);
|
||||
@ -620,7 +620,7 @@ linux_ioctl_termio(struct thread *td, struct linux_ioctl_args *args)
|
||||
break;
|
||||
|
||||
case LINUX_TCSETAW:
|
||||
error = copyin((caddr_t)args->arg, &lio, sizeof(lio));
|
||||
error = copyin((void *)args->arg, &lio, sizeof(lio));
|
||||
if (error)
|
||||
break;
|
||||
linux_to_bsd_termio(&lio, &bios);
|
||||
@ -629,7 +629,7 @@ linux_ioctl_termio(struct thread *td, struct linux_ioctl_args *args)
|
||||
break;
|
||||
|
||||
case LINUX_TCSETAF:
|
||||
error = copyin((caddr_t)args->arg, &lio, sizeof(lio));
|
||||
error = copyin((void *)args->arg, &lio, sizeof(lio));
|
||||
if (error)
|
||||
break;
|
||||
linux_to_bsd_termio(&lio, &bios);
|
||||
@ -773,13 +773,13 @@ linux_ioctl_termio(struct thread *td, struct linux_ioctl_args *args)
|
||||
lss.type = LINUX_PORT_16550A;
|
||||
lss.flags = 0;
|
||||
lss.close_delay = 0;
|
||||
error = copyout(&lss, (caddr_t)args->arg, sizeof(lss));
|
||||
error = copyout(&lss, (void *)args->arg, sizeof(lss));
|
||||
break;
|
||||
}
|
||||
|
||||
case LINUX_TIOCSSERIAL: {
|
||||
struct linux_serial_struct lss;
|
||||
error = copyin((caddr_t)args->arg, &lss, sizeof(lss));
|
||||
error = copyin((void *)args->arg, &lss, sizeof(lss));
|
||||
if (error)
|
||||
break;
|
||||
/* XXX - It really helps to have an implementation that
|
||||
@ -843,7 +843,7 @@ linux_ioctl_termio(struct thread *td, struct linux_ioctl_args *args)
|
||||
fdrop(fp, td);
|
||||
return (EINVAL);
|
||||
}
|
||||
error = (copyout(&linux_line, (caddr_t)args->arg, sizeof(int)));
|
||||
error = (copyout(&linux_line, (void *)args->arg, sizeof(int)));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1319,7 +1319,7 @@ linux_ioctl_cdrom(struct thread *td, struct linux_ioctl_args *args)
|
||||
if (!error) {
|
||||
lth.cdth_trk0 = th.starting_track;
|
||||
lth.cdth_trk1 = th.ending_track;
|
||||
copyout(<h, (caddr_t)args->arg, sizeof(lth));
|
||||
copyout(<h, (void *)args->arg, sizeof(lth));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1338,7 +1338,7 @@ linux_ioctl_cdrom(struct thread *td, struct linux_ioctl_args *args)
|
||||
lte.cdte_adr = irtse.entry.addr_type;
|
||||
bsd_to_linux_msf_lba(irtse.address_format,
|
||||
&irtse.entry.addr, <e.cdte_addr);
|
||||
copyout(<e, (caddr_t)args->arg, sizeof(lte));
|
||||
copyout(<e, (void *)args->arg, sizeof(lte));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1365,19 +1365,17 @@ linux_ioctl_cdrom(struct thread *td, struct linux_ioctl_args *args)
|
||||
struct ioc_read_subchannel bsdsc;
|
||||
struct cd_sub_channel_info *bsdinfo;
|
||||
caddr_t sg = stackgap_init();
|
||||
bsdinfo = (struct cd_sub_channel_info*)stackgap_alloc(&sg,
|
||||
sizeof(struct cd_sub_channel_info));
|
||||
bsdinfo = stackgap_alloc(&sg, sizeof(*bsdinfo));
|
||||
bsdsc.address_format = CD_LBA_FORMAT;
|
||||
bsdsc.data_format = CD_CURRENT_POSITION;
|
||||
bsdsc.track = 0;
|
||||
bsdsc.data_len = sizeof(struct cd_sub_channel_info);
|
||||
bsdsc.data_len = sizeof(*bsdinfo);
|
||||
bsdsc.data = bsdinfo;
|
||||
error = fo_ioctl(fp, CDIOCREADSUBCHANNEL, (caddr_t)&bsdsc,
|
||||
td->td_ucred, td);
|
||||
if (error)
|
||||
break;
|
||||
error = copyin((caddr_t)args->arg, &sc,
|
||||
sizeof(struct linux_cdrom_subchnl));
|
||||
error = copyin((void *)args->arg, &sc, sizeof(sc));
|
||||
if (error)
|
||||
break;
|
||||
sc.cdsc_audiostatus = bsdinfo->header.audio_status;
|
||||
@ -1389,8 +1387,7 @@ linux_ioctl_cdrom(struct thread *td, struct linux_ioctl_args *args)
|
||||
bsdinfo->what.position.absaddr.lba);
|
||||
set_linux_cdrom_addr(&sc.cdsc_reladdr, sc.cdsc_format,
|
||||
bsdinfo->what.position.reladdr.lba);
|
||||
error = copyout(&sc, (caddr_t)args->arg,
|
||||
sizeof(struct linux_cdrom_subchnl));
|
||||
error = copyout(&sc, (void *)args->arg, sizeof(sc));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1401,7 +1398,7 @@ linux_ioctl_cdrom(struct thread *td, struct linux_ioctl_args *args)
|
||||
struct l_cdrom_read_audio lra;
|
||||
struct ioc_read_audio bra;
|
||||
|
||||
error = copyin((caddr_t)args->arg, &lra, sizeof(lra));
|
||||
error = copyin((void *)args->arg, &lra, sizeof(lra));
|
||||
if (error)
|
||||
break;
|
||||
bra.address_format = lra.addr_format;
|
||||
@ -1450,7 +1447,7 @@ linux_ioctl_cdrom(struct thread *td, struct linux_ioctl_args *args)
|
||||
l_dvd_struct lds;
|
||||
struct dvd_struct bds;
|
||||
|
||||
error = copyin((caddr_t)args->arg, &lds, sizeof(l_dvd_struct));
|
||||
error = copyin((void *)args->arg, &lds, sizeof(lds));
|
||||
if (error)
|
||||
break;
|
||||
error = linux_to_bsd_dvd_struct(&lds, &bds);
|
||||
@ -1463,8 +1460,7 @@ linux_ioctl_cdrom(struct thread *td, struct linux_ioctl_args *args)
|
||||
error = bsd_to_linux_dvd_struct(&bds, &lds);
|
||||
if (error)
|
||||
break;
|
||||
error = copyout(&lds, (caddr_t)args->arg,
|
||||
sizeof(l_dvd_struct));
|
||||
error = copyout(&lds, (void *)args->arg, sizeof(lds));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1475,8 +1471,7 @@ linux_ioctl_cdrom(struct thread *td, struct linux_ioctl_args *args)
|
||||
struct dvd_authinfo bda;
|
||||
int bcode;
|
||||
|
||||
error = copyin((caddr_t)args->arg, &lda,
|
||||
sizeof(l_dvd_authinfo));
|
||||
error = copyin((void *)args->arg, &lda, sizeof(lda));
|
||||
if (error)
|
||||
break;
|
||||
error = linux_to_bsd_dvd_authinfo(&lda, &bcode, &bda);
|
||||
@ -1487,16 +1482,14 @@ linux_ioctl_cdrom(struct thread *td, struct linux_ioctl_args *args)
|
||||
if (error) {
|
||||
if (lda.type == LINUX_DVD_HOST_SEND_KEY2) {
|
||||
lda.type = LINUX_DVD_AUTH_FAILURE;
|
||||
copyout(&lda, (caddr_t)args->arg,
|
||||
sizeof(l_dvd_authinfo));
|
||||
copyout(&lda, (void *)args->arg, sizeof(lda));
|
||||
}
|
||||
break;
|
||||
}
|
||||
error = bsd_to_linux_dvd_authinfo(&bda, &lda);
|
||||
if (error)
|
||||
break;
|
||||
error = copyout(&lda, (caddr_t)args->arg,
|
||||
sizeof(l_dvd_authinfo));
|
||||
error = copyout(&lda, (void *)args->arg, sizeof(lda));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1604,7 +1597,7 @@ linux_ioctl_sound(struct thread *td, struct linux_ioctl_args *args)
|
||||
|
||||
case LINUX_OSS_GETVERSION: {
|
||||
int version = linux_get_oss_version(td->td_proc);
|
||||
return (copyout(&version, (caddr_t)args->arg, sizeof(int)));
|
||||
return (copyout(&version, (void *)args->arg, sizeof(int)));
|
||||
}
|
||||
|
||||
case LINUX_SOUND_MIXER_READ_STEREODEVS:
|
||||
@ -1980,7 +1973,7 @@ linux_ifconf(struct thread *td, struct ifconf *uifc)
|
||||
struct uio uio;
|
||||
int error, ethno;
|
||||
|
||||
error = copyin(uifc, &ifc, sizeof ifc);
|
||||
error = copyin(uifc, &ifc, sizeof(ifc));
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
@ -2004,7 +1997,7 @@ linux_ifconf(struct thread *td, struct ifconf *uifc)
|
||||
if (uio.uio_resid <= 0)
|
||||
break;
|
||||
|
||||
bzero(&ifr, sizeof ifr);
|
||||
bzero(&ifr, sizeof(ifr));
|
||||
if (IFP_IS_ETH(ifp))
|
||||
snprintf(ifr.ifr_name, LINUX_IFNAMSIZ, "eth%d",
|
||||
ethno++);
|
||||
@ -2024,7 +2017,7 @@ linux_ifconf(struct thread *td, struct ifconf *uifc)
|
||||
memcpy(ifr.ifr_addr.sa_data, sa->sa_data,
|
||||
sizeof(ifr.ifr_addr.sa_data));
|
||||
|
||||
error = uiomove(&ifr, sizeof ifr, &uio);
|
||||
error = uiomove(&ifr, sizeof(ifr), &uio);
|
||||
if (error != 0) {
|
||||
IFNET_RUNLOCK();
|
||||
return (error);
|
||||
@ -2035,7 +2028,7 @@ linux_ifconf(struct thread *td, struct ifconf *uifc)
|
||||
IFNET_RUNLOCK();
|
||||
|
||||
ifc.ifc_len -= uio.uio_resid;
|
||||
error = copyout(&ifc, uifc, sizeof ifc);
|
||||
error = copyout(&ifc, uifc, sizeof(ifc));
|
||||
|
||||
return (error);
|
||||
}
|
||||
@ -2055,7 +2048,7 @@ linux_gifflags(struct thread *td, struct ifnet *ifp, struct l_ifreq *ifr)
|
||||
flags |= 0x1000;
|
||||
}
|
||||
|
||||
return (copyout(&flags, &ifr->ifr_flags, sizeof flags));
|
||||
return (copyout(&flags, &ifr->ifr_flags, sizeof(flags)));
|
||||
}
|
||||
|
||||
#define ARPHRD_ETHER 1
|
||||
@ -2069,9 +2062,9 @@ linux_gifhwaddr(struct ifnet *ifp, struct l_ifreq *ifr)
|
||||
struct l_sockaddr lsa;
|
||||
|
||||
if (ifp->if_type == IFT_LOOP) {
|
||||
bzero(&lsa, sizeof lsa);
|
||||
bzero(&lsa, sizeof(lsa));
|
||||
lsa.sa_family = ARPHRD_LOOPBACK;
|
||||
return (copyout(&lsa, &ifr->ifr_hwaddr, sizeof lsa));
|
||||
return (copyout(&lsa, &ifr->ifr_hwaddr, sizeof(lsa)));
|
||||
}
|
||||
|
||||
if (ifp->if_type != IFT_ETHER)
|
||||
@ -2081,10 +2074,10 @@ linux_gifhwaddr(struct ifnet *ifp, struct l_ifreq *ifr)
|
||||
sdl = (struct sockaddr_dl*)ifa->ifa_addr;
|
||||
if (sdl != NULL && (sdl->sdl_family == AF_LINK) &&
|
||||
(sdl->sdl_type == IFT_ETHER)) {
|
||||
bzero(&lsa, sizeof lsa);
|
||||
bzero(&lsa, sizeof(lsa));
|
||||
lsa.sa_family = ARPHRD_ETHER;
|
||||
bcopy(LLADDR(sdl), lsa.sa_data, LINUX_IFHWADDRLEN);
|
||||
return (copyout(&lsa, &ifr->ifr_hwaddr, sizeof lsa));
|
||||
return (copyout(&lsa, &ifr->ifr_hwaddr, sizeof(lsa)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2157,7 +2150,7 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
|
||||
case LINUX_SIOCDEVPRIVATE:
|
||||
case LINUX_SIOCDEVPRIVATE+1:
|
||||
/* copy in the interface name and translate it. */
|
||||
error = copyin((char *)args->arg, lifname, LINUX_IFNAMSIZ);
|
||||
error = copyin((void *)args->arg, lifname, LINUX_IFNAMSIZ);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
#ifdef DEBUG
|
||||
@ -2173,7 +2166,7 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
|
||||
* the ifreq to be in user space and have the correct
|
||||
* interface name.
|
||||
*/
|
||||
error = copyout(ifname, (char *)args->arg, IFNAMSIZ);
|
||||
error = copyout(ifname, (void *)args->arg, IFNAMSIZ);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
#ifdef DEBUG
|
||||
@ -2303,7 +2296,7 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
|
||||
|
||||
if (ifp != NULL)
|
||||
/* restore the original interface name */
|
||||
copyout(lifname, (char *)args->arg, LINUX_IFNAMSIZ);
|
||||
copyout(lifname, (void *)args->arg, LINUX_IFNAMSIZ);
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("%s(): returning %d\n", __func__, error);
|
||||
|
@ -545,8 +545,8 @@ linux_semctl(struct thread *td, struct linux_semctl_args *args)
|
||||
linux_seminfo.semusz = used_semids;
|
||||
linux_seminfo.semaem = used_sems;
|
||||
*/
|
||||
error = copyout((caddr_t)&linux_seminfo, (caddr_t)args->arg.buf,
|
||||
sizeof(linux_seminfo) );
|
||||
error = copyout(&linux_seminfo, args->arg.buf,
|
||||
sizeof(linux_seminfo));
|
||||
if (error)
|
||||
return error;
|
||||
td->td_retval[0] = seminfo.semmni;
|
||||
@ -665,7 +665,7 @@ linux_shmat(struct thread *td, struct linux_shmat_args *args)
|
||||
if ((error = shmat(td, &bsd_args)))
|
||||
return error;
|
||||
#ifdef __i386__
|
||||
if ((error = copyout(td->td_retval, (caddr_t)args->raddr, sizeof(l_ulong))))
|
||||
if ((error = copyout(td->td_retval, args->raddr, sizeof(l_ulong))))
|
||||
return error;
|
||||
td->td_retval[0] = 0;
|
||||
#endif
|
||||
|
@ -154,7 +154,7 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args)
|
||||
|
||||
sysinfo.procs = 20; /* Hack */
|
||||
|
||||
return copyout(&sysinfo, (caddr_t)args->info, sizeof(sysinfo));
|
||||
return copyout(&sysinfo, args->info, sizeof(sysinfo));
|
||||
}
|
||||
#endif /*!__alpha__*/
|
||||
|
||||
@ -414,8 +414,8 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args)
|
||||
goto cleanup;
|
||||
|
||||
/* copy from kernel VM space to user space */
|
||||
error = copyout((caddr_t)(uintptr_t)(buffer + file_offset),
|
||||
(caddr_t)vmaddr, a_out->a_text + a_out->a_data);
|
||||
error = copyout((void *)(buffer + file_offset),
|
||||
(void *)vmaddr, a_out->a_text + a_out->a_data);
|
||||
|
||||
/* release temporary kernel space */
|
||||
vm_map_remove(kernel_map, buffer, buffer +
|
||||
@ -490,8 +490,7 @@ linux_select(struct thread *td, struct linux_select_args *args)
|
||||
* time left.
|
||||
*/
|
||||
if (args->timeout) {
|
||||
if ((error = copyin((caddr_t)args->timeout, &utv,
|
||||
sizeof(utv))))
|
||||
if ((error = copyin(args->timeout, &utv, sizeof(utv))))
|
||||
goto select_out;
|
||||
#ifdef DEBUG
|
||||
if (ldebug(select))
|
||||
@ -555,8 +554,7 @@ linux_select(struct thread *td, struct linux_select_args *args)
|
||||
printf(LMSG("outgoing timeout (%ld/%ld)"),
|
||||
utv.tv_sec, utv.tv_usec);
|
||||
#endif
|
||||
if ((error = copyout(&utv, (caddr_t)args->timeout,
|
||||
sizeof(utv))))
|
||||
if ((error = copyout(&utv, args->timeout, sizeof(utv))))
|
||||
goto select_out;
|
||||
}
|
||||
|
||||
@ -634,7 +632,7 @@ linux_time(struct thread *td, struct linux_time_args *args)
|
||||
|
||||
microtime(&tv);
|
||||
tm = tv.tv_sec;
|
||||
if (args->tm && (error = copyout(&tm, (caddr_t)args->tm, sizeof(tm))))
|
||||
if (args->tm && (error = copyout(&tm, args->tm, sizeof(tm))))
|
||||
return error;
|
||||
td->td_retval[0] = tm;
|
||||
return 0;
|
||||
@ -679,7 +677,7 @@ linux_times(struct thread *td, struct linux_times_args *args)
|
||||
tms.tms_cutime = CONVTCK(td->td_proc->p_stats->p_cru.ru_utime);
|
||||
tms.tms_cstime = CONVTCK(td->td_proc->p_stats->p_cru.ru_stime);
|
||||
|
||||
if ((error = copyout(&tms, (caddr_t)args->buf, sizeof(tms))))
|
||||
if ((error = copyout(&tms, args->buf, sizeof(tms))))
|
||||
return error;
|
||||
|
||||
microuptime(&tv);
|
||||
@ -710,7 +708,7 @@ linux_newuname(struct thread *td, struct linux_newuname_args *args)
|
||||
strlcpy(utsname.machine, machine, LINUX_MAX_UTSNAME);
|
||||
strlcpy(utsname.domainname, domainname, LINUX_MAX_UTSNAME);
|
||||
|
||||
return (copyout(&utsname, (caddr_t)args->buf, sizeof(utsname)));
|
||||
return (copyout(&utsname, args->buf, sizeof(utsname)));
|
||||
}
|
||||
|
||||
#if defined(__i386__)
|
||||
@ -735,7 +733,7 @@ linux_utime(struct thread *td, struct linux_utime_args *args)
|
||||
#endif
|
||||
|
||||
if (args->times) {
|
||||
if ((error = copyin((caddr_t)args->times, &lut, sizeof lut))) {
|
||||
if ((error = copyin(args->times, &lut, sizeof lut))) {
|
||||
LFREEPATH(fname);
|
||||
return error;
|
||||
}
|
||||
@ -785,8 +783,7 @@ linux_waitpid(struct thread *td, struct linux_waitpid_args *args)
|
||||
return error;
|
||||
|
||||
if (args->status) {
|
||||
if ((error = copyin((caddr_t)args->status, &tmpstat,
|
||||
sizeof(int))) != 0)
|
||||
if ((error = copyin(args->status, &tmpstat, sizeof(int))) != 0)
|
||||
return error;
|
||||
tmpstat &= 0xffff;
|
||||
if (WIFSIGNALED(tmpstat))
|
||||
@ -795,7 +792,7 @@ linux_waitpid(struct thread *td, struct linux_waitpid_args *args)
|
||||
else if (WIFSTOPPED(tmpstat))
|
||||
tmpstat = (tmpstat & 0xffff00ff) |
|
||||
(BSD_TO_LINUX_SIGNAL(WSTOPSIG(tmpstat)) << 8);
|
||||
return copyout(&tmpstat, (caddr_t)args->status, sizeof(int));
|
||||
return copyout(&tmpstat, args->status, sizeof(int));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -836,8 +833,7 @@ linux_wait4(struct thread *td, struct linux_wait4_args *args)
|
||||
PROC_UNLOCK(td->td_proc);
|
||||
|
||||
if (args->status) {
|
||||
if ((error = copyin((caddr_t)args->status, &tmpstat,
|
||||
sizeof(int))) != 0)
|
||||
if ((error = copyin(args->status, &tmpstat, sizeof(int))) != 0)
|
||||
return error;
|
||||
tmpstat &= 0xffff;
|
||||
if (WIFSIGNALED(tmpstat))
|
||||
@ -846,7 +842,7 @@ linux_wait4(struct thread *td, struct linux_wait4_args *args)
|
||||
else if (WIFSTOPPED(tmpstat))
|
||||
tmpstat = (tmpstat & 0xffff00ff) |
|
||||
(BSD_TO_LINUX_SIGNAL(WSTOPSIG(tmpstat)) << 8);
|
||||
return copyout(&tmpstat, (caddr_t)args->status, sizeof(int));
|
||||
return copyout(&tmpstat, args->status, sizeof(int));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -913,7 +909,7 @@ linux_setitimer(struct thread *td, struct linux_setitimer_args *args)
|
||||
bsa.itv = (struct itimerval *)args->itv;
|
||||
bsa.oitv = (struct itimerval *)args->oitv;
|
||||
if (args->itv) {
|
||||
if ((error = copyin((caddr_t)args->itv, &foo, sizeof(foo))))
|
||||
if ((error = copyin(args->itv, &foo, sizeof(foo))))
|
||||
return error;
|
||||
#ifdef DEBUG
|
||||
if (ldebug(setitimer)) {
|
||||
@ -965,8 +961,7 @@ linux_setgroups(struct thread *td, struct linux_setgroups_args *args)
|
||||
ngrp = args->gidsetsize;
|
||||
if (ngrp >= NGROUPS)
|
||||
return (EINVAL);
|
||||
error = copyin((caddr_t)args->grouplist, linux_gidset,
|
||||
ngrp * sizeof(l_gid_t));
|
||||
error = copyin(args->grouplist, linux_gidset, ngrp * sizeof(l_gid_t));
|
||||
if (error)
|
||||
return (error);
|
||||
newcred = crget();
|
||||
@ -1039,7 +1034,7 @@ linux_getgroups(struct thread *td, struct linux_getgroups_args *args)
|
||||
ngrp++;
|
||||
}
|
||||
|
||||
if ((error = copyout(linux_gidset, (caddr_t)args->grouplist,
|
||||
if ((error = copyout(linux_gidset, args->grouplist,
|
||||
ngrp * sizeof(l_gid_t))))
|
||||
return (error);
|
||||
|
||||
@ -1069,7 +1064,7 @@ linux_setrlimit(struct thread *td, struct linux_setrlimit_args *args)
|
||||
if (which == -1)
|
||||
return (EINVAL);
|
||||
|
||||
error = copyin((caddr_t)args->rlim, &rlim, sizeof(rlim));
|
||||
error = copyin(args->rlim, &rlim, sizeof(rlim));
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
@ -1106,7 +1101,7 @@ linux_old_getrlimit(struct thread *td, struct linux_old_getrlimit_args *args)
|
||||
rlim.rlim_max = (unsigned long)bsd_rlp->rlim_max;
|
||||
if (rlim.rlim_max == ULONG_MAX)
|
||||
rlim.rlim_max = LONG_MAX;
|
||||
return (copyout(&rlim, (caddr_t)args->rlim, sizeof(rlim)));
|
||||
return (copyout(&rlim, args->rlim, sizeof(rlim)));
|
||||
}
|
||||
|
||||
int
|
||||
@ -1133,7 +1128,7 @@ linux_getrlimit(struct thread *td, struct linux_getrlimit_args *args)
|
||||
|
||||
rlim.rlim_cur = (l_ulong)bsd_rlp->rlim_cur;
|
||||
rlim.rlim_max = (l_ulong)bsd_rlp->rlim_max;
|
||||
return (copyout(&rlim, (caddr_t)args->rlim, sizeof(rlim)));
|
||||
return (copyout(&rlim, args->rlim, sizeof(rlim)));
|
||||
}
|
||||
#endif /*!__alpha__*/
|
||||
|
||||
|
@ -116,7 +116,7 @@ do_sa_get(struct sockaddr **sap, const struct osockaddr *osa, int *osalen,
|
||||
|
||||
MALLOC(kosa, struct osockaddr *, alloclen, mtype, M_WAITOK);
|
||||
|
||||
if ((error = copyin(osa, (caddr_t) kosa, *osalen)))
|
||||
if ((error = copyin(osa, kosa, *osalen)))
|
||||
goto out;
|
||||
|
||||
bdom = linux_to_bsd_domain(kosa->sa_family);
|
||||
@ -365,7 +365,7 @@ linux_sa_put(struct osockaddr *osa)
|
||||
* Only read/write the osockaddr family part, the rest is
|
||||
* not changed.
|
||||
*/
|
||||
error = copyin((caddr_t) osa, (caddr_t) &sa, sizeof(sa.sa_family));
|
||||
error = copyin(osa, &sa, sizeof(sa.sa_family));
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
@ -1002,7 +1002,7 @@ linux_sendmsg(struct thread *td, struct linux_sendmsg_args *args)
|
||||
if ((error = copyin(args, &linux_args, sizeof(linux_args))))
|
||||
return (error);
|
||||
|
||||
error = copyin(linux_args.msg, (caddr_t) &msg, sizeof(msg));
|
||||
error = copyin(linux_args.msg, &msg, sizeof(msg));
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
@ -1085,7 +1085,7 @@ linux_recvmsg(struct thread *td, struct linux_recvmsg_args *args)
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
error = copyin((caddr_t)linux_args.msg, (caddr_t)&msg, sizeof(msg));
|
||||
error = copyin(linux_args.msg, &msg, sizeof(msg));
|
||||
if (error)
|
||||
return (error);
|
||||
if (msg.msg_name && msg.msg_namelen > 2)
|
||||
|
@ -269,8 +269,7 @@ linux_statfs(struct thread *td, struct linux_statfs_args *args)
|
||||
linux_statfs.f_fsid.val[0] = bsd_statfs->f_fsid.val[0];
|
||||
linux_statfs.f_fsid.val[1] = bsd_statfs->f_fsid.val[1];
|
||||
linux_statfs.f_namelen = MAXNAMLEN;
|
||||
return copyout((caddr_t)&linux_statfs, (caddr_t)args->buf,
|
||||
sizeof(linux_statfs));
|
||||
return copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
|
||||
}
|
||||
|
||||
int
|
||||
@ -314,8 +313,7 @@ linux_fstatfs(struct thread *td, struct linux_fstatfs_args *args)
|
||||
linux_statfs.f_fsid.val[0] = bsd_statfs->f_fsid.val[0];
|
||||
linux_statfs.f_fsid.val[1] = bsd_statfs->f_fsid.val[1];
|
||||
linux_statfs.f_namelen = MAXNAMLEN;
|
||||
error = copyout((caddr_t)&linux_statfs, (caddr_t)args->buf,
|
||||
sizeof(linux_statfs));
|
||||
error = copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
|
||||
fdrop(fp, td);
|
||||
return error;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ linux_sysctl(struct thread *td, struct linux_sysctl_args *args)
|
||||
l_int *mib;
|
||||
int error, i;
|
||||
|
||||
error = copyin((caddr_t)args->args, &la, sizeof(la));
|
||||
error = copyin(args->args, &la, sizeof(la));
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -101,8 +101,7 @@ linux_setgroups16(struct thread *td, struct linux_setgroups16_args *args)
|
||||
ngrp = args->gidsetsize;
|
||||
if (ngrp >= NGROUPS)
|
||||
return (EINVAL);
|
||||
error = copyin((caddr_t)args->gidset, linux_gidset,
|
||||
ngrp * sizeof(l_gid16_t));
|
||||
error = copyin(args->gidset, linux_gidset, ngrp * sizeof(l_gid16_t));
|
||||
if (error)
|
||||
return (error);
|
||||
newcred = crget();
|
||||
@ -180,8 +179,7 @@ linux_getgroups16(struct thread *td, struct linux_getgroups16_args *args)
|
||||
ngrp++;
|
||||
}
|
||||
|
||||
error = copyout(linux_gidset, (caddr_t)args->gidset,
|
||||
ngrp * sizeof(l_gid16_t));
|
||||
error = copyout(linux_gidset, args->gidset, ngrp * sizeof(l_gid16_t));
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -149,8 +149,8 @@ exec_linux_imgact(struct image_params *imgp)
|
||||
if (error)
|
||||
goto fail;
|
||||
|
||||
error = copyout((caddr_t)(void *)(uintptr_t)(buffer + file_offset),
|
||||
(caddr_t)vmaddr, a_out->a_text + a_out->a_data);
|
||||
error = copyout((void *)(buffer + file_offset),
|
||||
(void *)vmaddr, a_out->a_text + a_out->a_data);
|
||||
|
||||
vm_map_remove(kernel_map, buffer,
|
||||
buffer + round_page(a_out->a_text + a_out->a_data + file_offset));
|
||||
@ -223,9 +223,8 @@ exec_linux_imgact(struct image_params *imgp)
|
||||
/* Fill in process VM information */
|
||||
vmspace->vm_tsize = round_page(a_out->a_text) >> PAGE_SHIFT;
|
||||
vmspace->vm_dsize = round_page(a_out->a_data + bss_size) >> PAGE_SHIFT;
|
||||
vmspace->vm_taddr = (caddr_t)(void *)(uintptr_t)virtual_offset;
|
||||
vmspace->vm_daddr = (caddr_t)(void *)(uintptr_t)
|
||||
(virtual_offset + a_out->a_text);
|
||||
vmspace->vm_taddr = (caddr_t)virtual_offset;
|
||||
vmspace->vm_daddr = (caddr_t)(virtual_offset + a_out->a_text);
|
||||
|
||||
/* Fill in image_params */
|
||||
imgp->interpreted = 0;
|
||||
|
@ -153,7 +153,7 @@ linux_ipc(struct thread *td, struct linux_ipc_args *args)
|
||||
a.semid = args->arg1;
|
||||
a.semnum = args->arg2;
|
||||
a.cmd = args->arg3;
|
||||
error = copyin((caddr_t)args->ptr, &a.arg, sizeof(a.arg));
|
||||
error = copyin(args->ptr, &a.arg, sizeof(a.arg));
|
||||
if (error)
|
||||
return (error);
|
||||
return (linux_semctl(td, &a));
|
||||
@ -179,7 +179,7 @@ linux_ipc(struct thread *td, struct linux_ipc_args *args)
|
||||
|
||||
if (args->ptr == NULL)
|
||||
return (EINVAL);
|
||||
error = copyin((caddr_t)args->ptr, &tmp, sizeof(tmp));
|
||||
error = copyin(args->ptr, &tmp, sizeof(tmp));
|
||||
if (error)
|
||||
return (error);
|
||||
a.msgp = tmp.msgp;
|
||||
@ -255,7 +255,7 @@ linux_old_select(struct thread *td, struct linux_old_select_args *args)
|
||||
printf(ARGS(old_select, "%p"), args->ptr);
|
||||
#endif
|
||||
|
||||
error = copyin((caddr_t)args->ptr, &linux_args, sizeof(linux_args));
|
||||
error = copyin(args->ptr, &linux_args, sizeof(linux_args));
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
@ -416,7 +416,7 @@ linux_mmap(struct thread *td, struct linux_mmap_args *args)
|
||||
int error;
|
||||
struct l_mmap_argv linux_args;
|
||||
|
||||
error = copyin((caddr_t)args->ptr, &linux_args, sizeof(linux_args));
|
||||
error = copyin(args->ptr, &linux_args, sizeof(linux_args));
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
@ -683,8 +683,7 @@ linux_sigaction(struct thread *td, struct linux_sigaction_args *args)
|
||||
#endif
|
||||
|
||||
if (args->nsa != NULL) {
|
||||
error = copyin((caddr_t)args->nsa, &osa,
|
||||
sizeof(l_osigaction_t));
|
||||
error = copyin(args->nsa, &osa, sizeof(l_osigaction_t));
|
||||
if (error)
|
||||
return (error);
|
||||
act.lsa_handler = osa.lsa_handler;
|
||||
@ -702,8 +701,7 @@ linux_sigaction(struct thread *td, struct linux_sigaction_args *args)
|
||||
osa.lsa_flags = oact.lsa_flags;
|
||||
osa.lsa_restorer = oact.lsa_restorer;
|
||||
osa.lsa_mask = oact.lsa_mask.__bits[0];
|
||||
error = copyout(&osa, (caddr_t)args->osa,
|
||||
sizeof(l_osigaction_t));
|
||||
error = copyout(&osa, args->osa, sizeof(l_osigaction_t));
|
||||
}
|
||||
|
||||
return (error);
|
||||
|
@ -287,7 +287,7 @@ linux_ptrace(struct thread *td, struct linux_ptrace_args *uap)
|
||||
int rval = td->td_retval[0];
|
||||
error = kern_ptrace(td, req, pid, addr, 0);
|
||||
if (error == 0)
|
||||
error = copyout(td->td_retval, (caddr_t)uap->data,
|
||||
error = copyout(td->td_retval, (void *)uap->data,
|
||||
sizeof(l_int));
|
||||
td->td_retval[0] = rval;
|
||||
break;
|
||||
@ -309,13 +309,13 @@ linux_ptrace(struct thread *td, struct linux_ptrace_args *uap)
|
||||
error = kern_ptrace(td, PT_GETREGS, pid, &u.bsd_reg, 0);
|
||||
if (error == 0) {
|
||||
map_regs_to_linux(&u.bsd_reg, &r.reg);
|
||||
error = copyout(&r.reg, (caddr_t)uap->data,
|
||||
error = copyout(&r.reg, (void *)uap->data,
|
||||
sizeof(r.reg));
|
||||
}
|
||||
break;
|
||||
case PTRACE_SETREGS:
|
||||
/* Linux is using data where FreeBSD is using addr */
|
||||
error = copyin((caddr_t)uap->data, &r.reg, sizeof(r.reg));
|
||||
error = copyin((void *)uap->data, &r.reg, sizeof(r.reg));
|
||||
if (error == 0) {
|
||||
map_regs_from_linux(&u.bsd_reg, &r.reg);
|
||||
error = kern_ptrace(td, PT_SETREGS, pid, &u.bsd_reg, 0);
|
||||
@ -326,13 +326,13 @@ linux_ptrace(struct thread *td, struct linux_ptrace_args *uap)
|
||||
error = kern_ptrace(td, PT_GETFPREGS, pid, &u.bsd_fpreg, 0);
|
||||
if (error == 0) {
|
||||
map_fpregs_to_linux(&u.bsd_fpreg, &r.fpreg);
|
||||
error = copyout(&r.fpreg, (caddr_t)uap->data,
|
||||
error = copyout(&r.fpreg, (void *)uap->data,
|
||||
sizeof(r.fpreg));
|
||||
}
|
||||
break;
|
||||
case PTRACE_SETFPREGS:
|
||||
/* Linux is using data where FreeBSD is using addr */
|
||||
error = copyin((caddr_t)uap->data, &r.fpreg, sizeof(r.fpreg));
|
||||
error = copyin((void *)uap->data, &r.fpreg, sizeof(r.fpreg));
|
||||
if (error == 0) {
|
||||
map_fpregs_from_linux(&u.bsd_fpreg, &r.fpreg);
|
||||
error = kern_ptrace(td, PT_SETFPREGS, pid,
|
||||
@ -341,8 +341,7 @@ linux_ptrace(struct thread *td, struct linux_ptrace_args *uap)
|
||||
break;
|
||||
case PTRACE_SETFPXREGS:
|
||||
#ifdef CPU_ENABLE_SSE
|
||||
error = copyin((caddr_t)uap->data, &r.fpxreg,
|
||||
sizeof(r.fpxreg));
|
||||
error = copyin((void *)uap->data, &r.fpxreg, sizeof(r.fpxreg));
|
||||
if (error)
|
||||
break;
|
||||
#endif
|
||||
@ -401,7 +400,7 @@ linux_ptrace(struct thread *td, struct linux_ptrace_args *uap)
|
||||
_PRELE(p);
|
||||
PROC_UNLOCK(p);
|
||||
if (error == 0)
|
||||
error = copyout(&r.fpxreg, (caddr_t)uap->data,
|
||||
error = copyout(&r.fpxreg, (void *)uap->data,
|
||||
sizeof(r.fpxreg));
|
||||
} else {
|
||||
/* clear dangerous bits exactly as Linux does*/
|
||||
@ -440,7 +439,7 @@ linux_ptrace(struct thread *td, struct linux_ptrace_args *uap)
|
||||
map_regs_to_linux(&u.bsd_reg, &r.reg);
|
||||
if (req == PTRACE_PEEKUSR) {
|
||||
error = copyout((char *)&r.reg + uap->addr,
|
||||
(caddr_t)uap->data, sizeof(l_int));
|
||||
(void *)uap->data, sizeof(l_int));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -464,7 +463,7 @@ linux_ptrace(struct thread *td, struct linux_ptrace_args *uap)
|
||||
uap->addr -= LINUX_DBREG_OFFSET;
|
||||
if (req == PTRACE_PEEKUSR) {
|
||||
error = copyout((char *)&u.bsd_dbreg +
|
||||
uap->addr, (caddr_t)uap->data,
|
||||
uap->addr, (void *)uap->data,
|
||||
sizeof(l_int));
|
||||
break;
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args)
|
||||
* It is unsafe to keep track of it ourselves, in the event that a
|
||||
* program jumps out of a signal handler.
|
||||
*/
|
||||
if (copyin((caddr_t)args->sfp, &frame, sizeof(frame)) != 0)
|
||||
if (copyin(args->sfp, &frame, sizeof(frame)) != 0)
|
||||
return (EFAULT);
|
||||
|
||||
/*
|
||||
@ -619,7 +619,7 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args)
|
||||
* It is unsafe to keep track of it ourselves, in the event that a
|
||||
* program jumps out of a signal handler.
|
||||
*/
|
||||
if (copyin((caddr_t)args->ucp, &uc, sizeof(uc)) != 0)
|
||||
if (copyin(args->ucp, &uc, sizeof(uc)) != 0)
|
||||
return (EFAULT);
|
||||
|
||||
context = &uc.uc_mcontext;
|
||||
|
Loading…
Reference in New Issue
Block a user