error = nlookup_init(&nd, path, UIO_SYSSPACE, NLC_FOLLOW);
if (error == 0) {
error = kern_open(&nd, O_WRONLY | O_CREAT | O_TRUNC,
- args->mode, &args->sysmsg_result);
+ args->mode, &args->sysmsg_iresult);
}
linux_free_path(&path);
return(error);
error = nlookup_init(&nd, path, UIO_SYSSPACE, NLC_FOLLOW);
if (error == 0) {
error = kern_open(&nd, flags,
- args->mode, &args->sysmsg_result);
+ args->mode, &args->sysmsg_iresult);
}
if (error == 0 && !(flags & O_NOCTTY) &&
SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
struct file *fp;
- fp = holdfp(p->p_fd, args->sysmsg_result, -1);
+ fp = holdfp(p->p_fd, args->sysmsg_iresult, -1);
if (fp) {
if (fp->f_type == DTYPE_VNODE)
fo_ioctl(fp, TIOCSCTTY, NULL, p->p_ucred);
lda.fd = args->fd;
lda.dent = args->dent;
lda.count = -1;
- lda.sysmsg_result = 0;
+ lda.sysmsg_iresult = 0;
error = sys_linux_getdents(&lda);
- args->sysmsg_result = lda.sysmsg_result;
+ args->sysmsg_iresult = lda.sysmsg_iresult;
return(error);
}
struct dirent *bdp;
struct vnode *vp;
caddr_t inp, buf; /* BSD-format */
- int len, reclen; /* BSD-format */
+ int reclen; /* BSD-format */
+ size_t len;
caddr_t outp; /* Linux-format */
- int resid, linuxreclen=0; /* Linux-format */
+ int linuxreclen = 0; /* Linux-format */
+ size_t resid;
struct file *fp;
struct uio auio;
struct iovec aiov;
off_t off;
struct l_dirent linux_dirent;
struct l_dirent64 linux_dirent64;
- int buflen, error, eofflag, nbytes, justone;
+ int error, eofflag, justone;
+ size_t buflen, nbytes;
off_t *cookies = NULL, *cookiep;
int ncookies;
goto done;
nbytes = args->count;
- if (nbytes == -1) {
+ if (nbytes == (size_t)-1) {
/* readdir(2) case. Always struct dirent. */
if (is64bit) {
error = EINVAL;
} else {
justone = 0;
}
- if (nbytes < 0)
+ if ((size_t)nbytes < 0)
nbytes = 0;
off = fp->f_offset;
inp = buf;
outp = (caddr_t)args->dirent;
resid = nbytes;
- if ((len = buflen - auio.uio_resid) <= 0)
+ if (auio.uio_resid >= buflen);
goto eof;
-
+ len = buflen - auio.uio_resid;
cookiep = cookies;
if (cookies) {
nbytes = resid + linuxreclen;
eof:
- args->sysmsg_result = nbytes - resid;
+ args->sysmsg_iresult = (int)(nbytes - resid);
out:
if (cookies)
error = nlookup_init(&nd, path, UIO_SYSSPACE, 0);
if (error == 0) {
error = kern_readlink(&nd, args->buf, args->count,
- &args->sysmsg_result);
+ &args->sysmsg_iresult);
}
nlookup_done(&nd);
linux_free_path(&path);
int error;
bsd.fd = uap->fd;
- bsd.sysmsg_result = 0;
+ bsd.sysmsg_iresult = 0;
error = sys_fsync(&bsd);
- uap->sysmsg_result = bsd.sysmsg_result;
+ uap->sysmsg_iresult = bsd.sysmsg_iresult;
return(error);
}
auio.uio_segflg = UIO_USERSPACE;
auio.uio_td = td;
- if (auio.uio_resid < 0)
+ if ((ssize_t)auio.uio_resid < 0) {
error = EINVAL;
- else
- error = kern_preadv(uap->fd, &auio, O_FOFFSET, &uap->sysmsg_result);
+ } else {
+ error = kern_preadv(uap->fd, &auio, O_FOFFSET,
+ &uap->sysmsg_szresult);
+ }
return(error);
}
auio.uio_segflg = UIO_USERSPACE;
auio.uio_td = td;
- if (auio.uio_resid < 0)
+ if ((ssize_t)auio.uio_resid < 0) {
error = EINVAL;
- else
- error = kern_pwritev(uap->fd, &auio, O_FOFFSET, &uap->sysmsg_result);
-
+ } else {
+ error = kern_pwritev(uap->fd, &auio, O_FOFFSET,
+ &uap->sysmsg_szresult);
+ }
return(error);
}
args2.path = args->path;
args2.flags = 0;
- args2.sysmsg_result = 0;
+ args2.sysmsg_iresult = 0;
error = sys_linux_umount(&args2);
- args->sysmsg_result = args2.sysmsg_result;
+ args->sysmsg_iresult = args2.sysmsg_iresult;
return(error);
}
bsd.path = args->path;
bsd.flags = args->flags; /* XXX correct? */
- bsd.sysmsg_result = 0;
+ bsd.sysmsg_iresult = 0;
error = sys_unmount(&bsd);
- args->sysmsg_result = bsd.sysmsg_result;
+ args->sysmsg_iresult = bsd.sysmsg_iresult;
return(error);
}
if (error == 0) {
switch (args->cmd) {
case LINUX_F_DUPFD:
- args->sysmsg_result = dat.fc_fd;
+ args->sysmsg_iresult = dat.fc_fd;
break;
case LINUX_F_GETFD:
- args->sysmsg_result = dat.fc_cloexec;
+ args->sysmsg_iresult = dat.fc_cloexec;
break;
case LINUX_F_SETFD:
break;
case LINUX_F_GETFL:
- args->sysmsg_result = 0;
+ args->sysmsg_iresult = 0;
if (dat.fc_flags & O_RDONLY)
- args->sysmsg_result |= LINUX_O_RDONLY;
+ args->sysmsg_iresult |= LINUX_O_RDONLY;
if (dat.fc_flags & O_WRONLY)
- args->sysmsg_result |= LINUX_O_WRONLY;
+ args->sysmsg_iresult |= LINUX_O_WRONLY;
if (dat.fc_flags & O_RDWR)
- args->sysmsg_result |= LINUX_O_RDWR;
+ args->sysmsg_iresult |= LINUX_O_RDWR;
if (dat.fc_flags & O_NDELAY)
- args->sysmsg_result |= LINUX_O_NONBLOCK;
+ args->sysmsg_iresult |= LINUX_O_NONBLOCK;
if (dat.fc_flags & O_APPEND)
- args->sysmsg_result |= LINUX_O_APPEND;
+ args->sysmsg_iresult |= LINUX_O_APPEND;
if (dat.fc_flags & O_FSYNC)
- args->sysmsg_result |= LINUX_O_SYNC;
+ args->sysmsg_iresult |= LINUX_O_SYNC;
if (dat.fc_flags & O_ASYNC)
- args->sysmsg_result |= LINUX_FASYNC;
+ args->sysmsg_iresult |= LINUX_FASYNC;
break;
case LINUX_F_GETLK:
bsd_to_linux_flock(&dat.fc_flock, &linux_flock);
case LINUX_F_SETLKW:
break;
case LINUX_F_GETOWN:
- args->sysmsg_result = dat.fc_owner;
+ args->sysmsg_iresult = dat.fc_owner;
break;
case LINUX_F_SETOWN:
break;
args64.fd = args->fd;
args64.cmd = args->cmd;
args64.arg = args->arg;
- args64.sysmsg_result = 0;
+ args64.sysmsg_iresult = 0;
error = linux_fcntl_common(&args64);
- args->sysmsg_result = args64.sysmsg_result;
+ args->sysmsg_iresult = args64.sysmsg_iresult;
return(error);
}