summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linux')
-rw-r--r--sys/compat/linux/linux_file.c215
-rw-r--r--sys/compat/linux/linux_getcwd.c46
-rw-r--r--sys/compat/linux/linux_ioctl.c278
-rw-r--r--sys/compat/linux/linux_ipc.c56
-rw-r--r--sys/compat/linux/linux_ipc.h26
-rw-r--r--sys/compat/linux/linux_misc.c216
-rw-r--r--sys/compat/linux/linux_signal.c44
-rw-r--r--sys/compat/linux/linux_signal.h2
-rw-r--r--sys/compat/linux/linux_socket.c130
-rw-r--r--sys/compat/linux/linux_stats.c62
-rw-r--r--sys/compat/linux/linux_sysctl.c2
-rw-r--r--sys/compat/linux/linux_uid16.c72
-rw-r--r--sys/compat/linux/linux_util.c14
-rw-r--r--sys/compat/linux/linux_util.h10
14 files changed, 592 insertions, 581 deletions
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 3d16a94..f1cba52 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -56,7 +56,7 @@
#ifndef __alpha__
int
-linux_creat(struct proc *p, struct linux_creat_args *args)
+linux_creat(struct thread *td, struct linux_creat_args *args)
{
struct open_args /* {
char *path;
@@ -66,7 +66,7 @@ linux_creat(struct proc *p, struct linux_creat_args *args)
caddr_t sg;
sg = stackgap_init();
- CHECKALTCREAT(p, &sg, args->path);
+ CHECKALTCREAT(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(creat))
@@ -75,27 +75,28 @@ linux_creat(struct proc *p, struct linux_creat_args *args)
bsd_open_args.path = args->path;
bsd_open_args.mode = args->mode;
bsd_open_args.flags = O_WRONLY | O_CREAT | O_TRUNC;
- return open(p, &bsd_open_args);
+ return open(td, &bsd_open_args);
}
#endif /*!__alpha__*/
int
-linux_open(struct proc *p, struct linux_open_args *args)
+linux_open(struct thread *td, struct linux_open_args *args)
{
struct open_args /* {
char *path;
int flags;
int mode;
} */ bsd_open_args;
+ struct proc *p = td->td_proc;
int error;
caddr_t sg;
sg = stackgap_init();
if (args->flags & LINUX_O_CREAT)
- CHECKALTCREAT(p, &sg, args->path);
+ CHECKALTCREAT(td, &sg, args->path);
else
- CHECKALTEXIST(p, &sg, args->path);
+ CHECKALTEXIST(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(open))
@@ -130,16 +131,16 @@ linux_open(struct proc *p, struct linux_open_args *args)
bsd_open_args.path = args->path;
bsd_open_args.mode = args->mode;
- error = open(p, &bsd_open_args);
+ error = open(td, &bsd_open_args);
PROC_LOCK(p);
if (!error && !(bsd_open_args.flags & O_NOCTTY) &&
SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
struct filedesc *fdp = p->p_fd;
- struct file *fp = fdp->fd_ofiles[p->p_retval[0]];
+ struct file *fp = fdp->fd_ofiles[td->td_retval[0]];
PROC_UNLOCK(p);
if (fp->f_type == DTYPE_VNODE)
- fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, p);
+ fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, td);
} else
PROC_UNLOCK(p);
#ifdef DEBUG
@@ -150,7 +151,7 @@ linux_open(struct proc *p, struct linux_open_args *args)
}
int
-linux_lseek(struct proc *p, struct linux_lseek_args *args)
+linux_lseek(struct thread *td, struct linux_lseek_args *args)
{
struct lseek_args /* {
@@ -169,13 +170,13 @@ linux_lseek(struct proc *p, struct linux_lseek_args *args)
tmp_args.fd = args->fdes;
tmp_args.offset = (off_t)args->off;
tmp_args.whence = args->whence;
- error = lseek(p, &tmp_args);
+ error = lseek(td, &tmp_args);
return error;
}
#ifndef __alpha__
int
-linux_llseek(struct proc *p, struct linux_llseek_args *args)
+linux_llseek(struct thread *td, struct linux_llseek_args *args)
{
struct lseek_args bsd_args;
int error;
@@ -192,27 +193,27 @@ linux_llseek(struct proc *p, struct linux_llseek_args *args)
bsd_args.offset = off;
bsd_args.whence = args->whence;
- if ((error = lseek(p, &bsd_args)))
+ if ((error = lseek(td, &bsd_args)))
return error;
- if ((error = copyout(p->p_retval, (caddr_t)args->res, sizeof (off_t))))
+ if ((error = copyout(td->td_retval, (caddr_t)args->res, sizeof (off_t))))
return error;
- p->p_retval[0] = 0;
+ td->td_retval[0] = 0;
return 0;
}
#endif /*!__alpha__*/
#ifndef __alpha__
int
-linux_readdir(struct proc *p, struct linux_readdir_args *args)
+linux_readdir(struct thread *td, struct linux_readdir_args *args)
{
struct linux_getdents_args lda;
lda.fd = args->fd;
lda.dent = args->dent;
lda.count = 1;
- return linux_getdents(p, &lda);
+ return linux_getdents(td, &lda);
}
#endif /*!__alpha__*/
@@ -246,7 +247,7 @@ struct l_dirent64 {
#define LINUX_DIRBLKSIZ 512
static int
-getdents_common(struct proc *p, struct linux_getdents64_args *args,
+getdents_common(struct thread *td, struct linux_getdents64_args *args,
int is64bit)
{
register struct dirent *bdp;
@@ -266,7 +267,7 @@ getdents_common(struct proc *p, struct linux_getdents64_args *args,
u_long *cookies = NULL, *cookiep;
int ncookies;
- if ((error = getvnode(p->p_fd, args->fd, &fp)) != 0)
+ if ((error = getvnode(td->td_proc->p_fd, args->fd, &fp)) != 0)
return (error);
if ((fp->f_flag & FREAD) == 0)
@@ -276,7 +277,7 @@ getdents_common(struct proc *p, struct linux_getdents64_args *args,
if (vp->v_type != VDIR)
return (EINVAL);
- if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p)))
+ if ((error = VOP_GETATTR(vp, &va, td->td_proc->p_ucred, td)))
return (error);
nbytes = args->count;
@@ -294,7 +295,7 @@ getdents_common(struct proc *p, struct linux_getdents64_args *args,
buflen = max(LINUX_DIRBLKSIZ, nbytes);
buflen = min(buflen, MAXBSIZE);
buf = malloc(buflen, M_TEMP, M_WAITOK);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
again:
aiov.iov_base = buf;
@@ -303,7 +304,7 @@ again:
auio.uio_iovcnt = 1;
auio.uio_rw = UIO_READ;
auio.uio_segflg = UIO_SYSSPACE;
- auio.uio_procp = p;
+ auio.uio_td = td;
auio.uio_resid = buflen;
auio.uio_offset = off;
@@ -427,19 +428,19 @@ again:
nbytes = resid + linuxreclen;
eof:
- p->p_retval[0] = nbytes - resid;
+ td->td_retval[0] = nbytes - resid;
out:
if (cookies)
free(cookies, M_TEMP);
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
free(buf, M_TEMP);
return (error);
}
int
-linux_getdents(struct proc *p, struct linux_getdents_args *args)
+linux_getdents(struct thread *td, struct linux_getdents_args *args)
{
#ifdef DEBUG
@@ -447,11 +448,11 @@ linux_getdents(struct proc *p, struct linux_getdents_args *args)
printf(ARGS(getdents, "%d, *, %d"), args->fd, args->count);
#endif
- return (getdents_common(p, (struct linux_getdents64_args*)args, 0));
+ return (getdents_common(td, (struct linux_getdents64_args*)args, 0));
}
int
-linux_getdents64(struct proc *p, struct linux_getdents64_args *args)
+linux_getdents64(struct thread *td, struct linux_getdents64_args *args)
{
#ifdef DEBUG
@@ -459,7 +460,7 @@ linux_getdents64(struct proc *p, struct linux_getdents64_args *args)
printf(ARGS(getdents64, "%d, *, %d"), args->fd, args->count);
#endif
- return (getdents_common(p, args, 1));
+ return (getdents_common(td, args, 1));
}
/*
@@ -467,13 +468,13 @@ linux_getdents64(struct proc *p, struct linux_getdents64_args *args)
*/
int
-linux_access(struct proc *p, struct linux_access_args *args)
+linux_access(struct thread *td, struct linux_access_args *args)
{
struct access_args bsd;
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->path);
+ CHECKALTEXIST(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(access))
@@ -482,17 +483,17 @@ linux_access(struct proc *p, struct linux_access_args *args)
bsd.path = args->path;
bsd.flags = args->flags;
- return access(p, &bsd);
+ return access(td, &bsd);
}
int
-linux_unlink(struct proc *p, struct linux_unlink_args *args)
+linux_unlink(struct thread *td, struct linux_unlink_args *args)
{
struct unlink_args bsd;
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->path);
+ CHECKALTEXIST(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(unlink))
@@ -500,17 +501,17 @@ linux_unlink(struct proc *p, struct linux_unlink_args *args)
#endif
bsd.path = args->path;
- return unlink(p, &bsd);
+ return unlink(td, &bsd);
}
int
-linux_chdir(struct proc *p, struct linux_chdir_args *args)
+linux_chdir(struct thread *td, struct linux_chdir_args *args)
{
struct chdir_args bsd;
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->path);
+ CHECKALTEXIST(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(chdir))
@@ -518,17 +519,17 @@ linux_chdir(struct proc *p, struct linux_chdir_args *args)
#endif
bsd.path = args->path;
- return chdir(p, &bsd);
+ return chdir(td, &bsd);
}
int
-linux_chmod(struct proc *p, struct linux_chmod_args *args)
+linux_chmod(struct thread *td, struct linux_chmod_args *args)
{
struct chmod_args bsd;
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->path);
+ CHECKALTEXIST(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(chmod))
@@ -537,17 +538,17 @@ linux_chmod(struct proc *p, struct linux_chmod_args *args)
bsd.path = args->path;
bsd.mode = args->mode;
- return chmod(p, &bsd);
+ return chmod(td, &bsd);
}
int
-linux_mkdir(struct proc *p, struct linux_mkdir_args *args)
+linux_mkdir(struct thread *td, struct linux_mkdir_args *args)
{
struct mkdir_args bsd;
caddr_t sg;
sg = stackgap_init();
- CHECKALTCREAT(p, &sg, args->path);
+ CHECKALTCREAT(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(mkdir))
@@ -556,17 +557,17 @@ linux_mkdir(struct proc *p, struct linux_mkdir_args *args)
bsd.path = args->path;
bsd.mode = args->mode;
- return mkdir(p, &bsd);
+ return mkdir(td, &bsd);
}
int
-linux_rmdir(struct proc *p, struct linux_rmdir_args *args)
+linux_rmdir(struct thread *td, struct linux_rmdir_args *args)
{
struct rmdir_args bsd;
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->path);
+ CHECKALTEXIST(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(rmdir))
@@ -574,18 +575,18 @@ linux_rmdir(struct proc *p, struct linux_rmdir_args *args)
#endif
bsd.path = args->path;
- return rmdir(p, &bsd);
+ return rmdir(td, &bsd);
}
int
-linux_rename(struct proc *p, struct linux_rename_args *args)
+linux_rename(struct thread *td, struct linux_rename_args *args)
{
struct rename_args bsd;
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->from);
- CHECKALTCREAT(p, &sg, args->to);
+ CHECKALTEXIST(td, &sg, args->from);
+ CHECKALTCREAT(td, &sg, args->to);
#ifdef DEBUG
if (ldebug(rename))
@@ -594,18 +595,18 @@ linux_rename(struct proc *p, struct linux_rename_args *args)
bsd.from = args->from;
bsd.to = args->to;
- return rename(p, &bsd);
+ return rename(td, &bsd);
}
int
-linux_symlink(struct proc *p, struct linux_symlink_args *args)
+linux_symlink(struct thread *td, struct linux_symlink_args *args)
{
struct symlink_args bsd;
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->path);
- CHECKALTCREAT(p, &sg, args->to);
+ CHECKALTEXIST(td, &sg, args->path);
+ CHECKALTCREAT(td, &sg, args->to);
#ifdef DEBUG
if (ldebug(symlink))
@@ -614,17 +615,17 @@ linux_symlink(struct proc *p, struct linux_symlink_args *args)
bsd.path = args->path;
bsd.link = args->to;
- return symlink(p, &bsd);
+ return symlink(td, &bsd);
}
int
-linux_readlink(struct proc *p, struct linux_readlink_args *args)
+linux_readlink(struct thread *td, struct linux_readlink_args *args)
{
struct readlink_args bsd;
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->name);
+ CHECKALTEXIST(td, &sg, args->name);
#ifdef DEBUG
if (ldebug(readlink))
@@ -635,17 +636,17 @@ linux_readlink(struct proc *p, struct linux_readlink_args *args)
bsd.buf = args->buf;
bsd.count = args->count;
- return readlink(p, &bsd);
+ return readlink(td, &bsd);
}
int
-linux_truncate(struct proc *p, struct linux_truncate_args *args)
+linux_truncate(struct thread *td, struct linux_truncate_args *args)
{
struct truncate_args bsd;
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->path);
+ CHECKALTEXIST(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(truncate))
@@ -655,18 +656,18 @@ linux_truncate(struct proc *p, struct linux_truncate_args *args)
bsd.path = args->path;
bsd.length = args->length;
- return truncate(p, &bsd);
+ return truncate(td, &bsd);
}
int
-linux_link(struct proc *p, struct linux_link_args *args)
+linux_link(struct thread *td, struct linux_link_args *args)
{
struct link_args bsd;
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->path);
- CHECKALTCREAT(p, &sg, args->to);
+ CHECKALTEXIST(td, &sg, args->path);
+ CHECKALTCREAT(td, &sg, args->to);
#ifdef DEBUG
if (ldebug(link))
@@ -676,25 +677,25 @@ linux_link(struct proc *p, struct linux_link_args *args)
bsd.path = args->path;
bsd.link = args->to;
- return link(p, &bsd);
+ return link(td, &bsd);
}
#ifndef __alpha__
int
-linux_fdatasync(p, uap)
- struct proc *p;
+linux_fdatasync(td, uap)
+ struct thread *td;
struct linux_fdatasync_args *uap;
{
struct fsync_args bsd;
bsd.fd = uap->fd;
- return fsync(p, &bsd);
+ return fsync(td, &bsd);
}
#endif /*!__alpha__*/
int
-linux_pread(p, uap)
- struct proc *p;
+linux_pread(td, uap)
+ struct thread *td;
struct linux_pread_args *uap;
{
struct pread_args bsd;
@@ -703,12 +704,12 @@ linux_pread(p, uap)
bsd.buf = uap->buf;
bsd.nbyte = uap->nbyte;
bsd.offset = uap->offset;
- return pread(p, &bsd);
+ return pread(td, &bsd);
}
int
-linux_pwrite(p, uap)
- struct proc *p;
+linux_pwrite(td, uap)
+ struct thread *td;
struct linux_pwrite_args *uap;
{
struct pwrite_args bsd;
@@ -717,11 +718,11 @@ linux_pwrite(p, uap)
bsd.buf = uap->buf;
bsd.nbyte = uap->nbyte;
bsd.offset = uap->offset;
- return pwrite(p, &bsd);
+ return pwrite(td, &bsd);
}
int
-linux_mount(struct proc *p, struct linux_mount_args *args)
+linux_mount(struct thread *td, struct linux_mount_args *args)
{
struct ufs_args ufs;
char fstypename[MFSNAMELEN];
@@ -782,27 +783,27 @@ linux_mount(struct proc *p, struct linux_mount_args *args)
fsflags |= MNT_UPDATE;
}
- return (vfs_mount(p, fstype, mntonname, fsflags, fsdata));
+ return (vfs_mount(td, fstype, mntonname, fsflags, fsdata));
}
int
-linux_oldumount(struct proc *p, struct linux_oldumount_args *args)
+linux_oldumount(struct thread *td, struct linux_oldumount_args *args)
{
struct linux_umount_args args2;
args2.path = args->path;
args2.flags = 0;
- return (linux_umount(p, &args2));
+ return (linux_umount(td, &args2));
}
int
-linux_umount(struct proc *p, struct linux_umount_args *args)
+linux_umount(struct thread *td, struct linux_umount_args *args)
{
struct unmount_args bsd;
bsd.path = args->path;
bsd.flags = args->flags; /* XXX correct? */
- return (unmount(p, &bsd));
+ return (unmount(td, &bsd));
}
/*
@@ -918,7 +919,7 @@ bsd_to_linux_flock64(struct flock *bsd_flock, struct l_flock64 *linux_flock)
#endif
static int
-fcntl_common(struct proc *p, struct linux_fcntl64_args *args)
+fcntl_common(struct thread *td, struct linux_fcntl64_args *args)
{
struct fcntl_args fcntl_args;
struct filedesc *fdp;
@@ -931,36 +932,36 @@ fcntl_common(struct proc *p, struct linux_fcntl64_args *args)
case LINUX_F_DUPFD:
fcntl_args.cmd = F_DUPFD;
fcntl_args.arg = args->arg;
- return (fcntl(p, &fcntl_args));
+ return (fcntl(td, &fcntl_args));
case LINUX_F_GETFD:
fcntl_args.cmd = F_GETFD;
- return (fcntl(p, &fcntl_args));
+ return (fcntl(td, &fcntl_args));
case LINUX_F_SETFD:
fcntl_args.cmd = F_SETFD;
fcntl_args.arg = args->arg;
- return (fcntl(p, &fcntl_args));
+ return (fcntl(td, &fcntl_args));
case LINUX_F_GETFL:
fcntl_args.cmd = F_GETFL;
- error = fcntl(p, &fcntl_args);
- result = p->p_retval[0];
- p->p_retval[0] = 0;
+ error = fcntl(td, &fcntl_args);
+ result = td->td_retval[0];
+ td->td_retval[0] = 0;
if (result & O_RDONLY)
- p->p_retval[0] |= LINUX_O_RDONLY;
+ td->td_retval[0] |= LINUX_O_RDONLY;
if (result & O_WRONLY)
- p->p_retval[0] |= LINUX_O_WRONLY;
+ td->td_retval[0] |= LINUX_O_WRONLY;
if (result & O_RDWR)
- p->p_retval[0] |= LINUX_O_RDWR;
+ td->td_retval[0] |= LINUX_O_RDWR;
if (result & O_NDELAY)
- p->p_retval[0] |= LINUX_O_NONBLOCK;
+ td->td_retval[0] |= LINUX_O_NONBLOCK;
if (result & O_APPEND)
- p->p_retval[0] |= LINUX_O_APPEND;
+ td->td_retval[0] |= LINUX_O_APPEND;
if (result & O_FSYNC)
- p->p_retval[0] |= LINUX_O_SYNC;
+ td->td_retval[0] |= LINUX_O_SYNC;
if (result & O_ASYNC)
- p->p_retval[0] |= LINUX_FASYNC;
+ td->td_retval[0] |= LINUX_FASYNC;
return (error);
case LINUX_F_SETFL:
@@ -974,11 +975,11 @@ fcntl_common(struct proc *p, struct linux_fcntl64_args *args)
if (args->arg & LINUX_FASYNC)
fcntl_args.arg |= O_ASYNC;
fcntl_args.cmd = F_SETFL;
- return (fcntl(p, &fcntl_args));
+ return (fcntl(td, &fcntl_args));
case LINUX_F_GETOWN:
fcntl_args.cmd = F_GETOWN;
- return (fcntl(p, &fcntl_args));
+ return (fcntl(td, &fcntl_args));
case LINUX_F_SETOWN:
/*
@@ -986,7 +987,7 @@ fcntl_common(struct proc *p, struct linux_fcntl64_args *args)
* significant effect for pipes (SIGIO is not delivered for
* pipes under Linux-2.2.35 at least).
*/
- fdp = p->p_fd;
+ fdp = td->td_proc->p_fd;
if ((u_int)args->fd >= fdp->fd_nfiles ||
(fp = fdp->fd_ofiles[args->fd]) == NULL)
return (EBADF);
@@ -995,14 +996,14 @@ fcntl_common(struct proc *p, struct linux_fcntl64_args *args)
fcntl_args.cmd = F_SETOWN;
fcntl_args.arg = args->arg;
- return (fcntl(p, &fcntl_args));
+ return (fcntl(td, &fcntl_args));
}
return (EINVAL);
}
int
-linux_fcntl(struct proc *p, struct linux_fcntl_args *args)
+linux_fcntl(struct thread *td, struct linux_fcntl_args *args)
{
struct linux_fcntl64_args args64;
struct fcntl_args fcntl_args;
@@ -1029,7 +1030,7 @@ linux_fcntl(struct proc *p, struct linux_fcntl_args *args)
fcntl_args.fd = args->fd;
fcntl_args.cmd = F_GETLK;
fcntl_args.arg = (long)bsd_flock;
- error = fcntl(p, &fcntl_args);
+ error = fcntl(td, &fcntl_args);
if (error)
return (error);
bsd_to_linux_flock(bsd_flock, &linux_flock);
@@ -1045,7 +1046,7 @@ linux_fcntl(struct proc *p, struct linux_fcntl_args *args)
fcntl_args.fd = args->fd;
fcntl_args.cmd = F_SETLK;
fcntl_args.arg = (long)bsd_flock;
- return (fcntl(p, &fcntl_args));
+ return (fcntl(td, &fcntl_args));
case LINUX_F_SETLKW:
error = copyin((caddr_t)args->arg, &linux_flock,
@@ -1056,18 +1057,18 @@ linux_fcntl(struct proc *p, struct linux_fcntl_args *args)
fcntl_args.fd = args->fd;
fcntl_args.cmd = F_SETLKW;
fcntl_args.arg = (long)bsd_flock;
- return (fcntl(p, &fcntl_args));
+ return (fcntl(td, &fcntl_args));
}
args64.fd = args->fd;
args64.cmd = args->cmd;
args64.arg = args->arg;
- return (fcntl_common(p, &args64));
+ return (fcntl_common(td, &args64));
}
#if defined(__i386__)
int
-linux_fcntl64(struct proc *p, struct linux_fcntl64_args *args)
+linux_fcntl64(struct thread *td, struct linux_fcntl64_args *args)
{
struct fcntl_args fcntl_args;
struct l_flock64 linux_flock;
@@ -1093,7 +1094,7 @@ linux_fcntl64(struct proc *p, struct linux_fcntl64_args *args)
fcntl_args.fd = args->fd;
fcntl_args.cmd = F_GETLK;
fcntl_args.arg = (long)bsd_flock;
- error = fcntl(p, &fcntl_args);
+ error = fcntl(td, &fcntl_args);
if (error)
return (error);
bsd_to_linux_flock64(bsd_flock, &linux_flock);
@@ -1109,7 +1110,7 @@ linux_fcntl64(struct proc *p, struct linux_fcntl64_args *args)
fcntl_args.fd = args->fd;
fcntl_args.cmd = F_SETLK;
fcntl_args.arg = (long)bsd_flock;
- return (fcntl(p, &fcntl_args));
+ return (fcntl(td, &fcntl_args));
case LINUX_F_SETLKW:
error = copyin((caddr_t)args->arg, &linux_flock,
@@ -1120,9 +1121,9 @@ linux_fcntl64(struct proc *p, struct linux_fcntl64_args *args)
fcntl_args.fd = args->fd;
fcntl_args.cmd = F_SETLKW;
fcntl_args.arg = (long)bsd_flock;
- return (fcntl(p, &fcntl_args));
+ return (fcntl(td, &fcntl_args));
}
- return (fcntl_common(p, args));
+ return (fcntl_common(td, args));
}
#endif /* __i386__ */
diff --git a/sys/compat/linux/linux_getcwd.c b/sys/compat/linux/linux_getcwd.c
index 2231f82..f08163b 100644
--- a/sys/compat/linux/linux_getcwd.c
+++ b/sys/compat/linux/linux_getcwd.c
@@ -61,10 +61,10 @@
static int
linux_getcwd_scandir __P((struct vnode **, struct vnode **,
- char **, char *, struct proc *));
+ char **, char *, struct thread *));
static int
linux_getcwd_common __P((struct vnode *, struct vnode *,
- char **, char *, int, int, struct proc *));
+ char **, char *, int, int, struct thread *));
#define DIRENT_MINSIZE (sizeof(struct dirent) - (MAXNAMLEN+1) + 4)
@@ -104,12 +104,12 @@ linux_getcwd_common __P((struct vnode *, struct vnode *,
* On exit, *uvpp is either NULL or is a locked vnode reference.
*/
static int
-linux_getcwd_scandir(lvpp, uvpp, bpp, bufp, p)
+linux_getcwd_scandir(lvpp, uvpp, bpp, bufp, td)
struct vnode **lvpp;
struct vnode **uvpp;
char **bpp;
char *bufp;
- struct proc *p;
+ struct thread *td;
{
int error = 0;
int eofflag;
@@ -132,7 +132,7 @@ linux_getcwd_scandir(lvpp, uvpp, bpp, bufp, p)
* current directory is still locked.
*/
if (bufp != NULL) {
- error = VOP_GETATTR(lvp, &va, p->p_ucred, p);
+ error = VOP_GETATTR(lvp, &va, td->td_proc->p_ucred, td);
if (error) {
vput(lvp);
*lvpp = NULL;
@@ -147,8 +147,8 @@ linux_getcwd_scandir(lvpp, uvpp, bpp, bufp, p)
*/
cn.cn_nameiop = LOOKUP;
cn.cn_flags = ISLASTCN | ISDOTDOT | RDONLY;
- cn.cn_proc = p;
- cn.cn_cred = p->p_ucred;
+ cn.cn_thread = td;
+ cn.cn_cred = td->td_proc->p_ucred;
cn.cn_pnbuf = NULL;
cn.cn_nameptr = "..";
cn.cn_namelen = 2;
@@ -196,11 +196,11 @@ unionread:
uio.uio_resid = dirbuflen;
uio.uio_segflg = UIO_SYSSPACE;
uio.uio_rw = UIO_READ;
- uio.uio_procp = p;
+ uio.uio_td = td;
eofflag = 0;
- error = VOP_READDIR(uvp, &uio, p->p_ucred, &eofflag, 0, 0);
+ error = VOP_READDIR(uvp, &uio, td->td_proc->p_ucred, &eofflag, 0, 0);
off = uio.uio_offset;
@@ -274,16 +274,16 @@ out:
#define GETCWD_CHECK_ACCESS 0x0001
static int
-linux_getcwd_common (lvp, rvp, bpp, bufp, limit, flags, p)
+linux_getcwd_common (lvp, rvp, bpp, bufp, limit, flags, td)
struct vnode *lvp;
struct vnode *rvp;
char **bpp;
char *bufp;
int limit;
int flags;
- struct proc *p;
+ struct thread *td;
{
- struct filedesc *fdp = p->p_fd;
+ struct filedesc *fdp = td->td_proc->p_fd;
struct vnode *uvp = NULL;
char *bp = NULL;
int error;
@@ -305,7 +305,7 @@ linux_getcwd_common (lvp, rvp, bpp, bufp, limit, flags, p)
* uvp is either NULL, or locked and held.
*/
- error = vn_lock(lvp, LK_EXCLUSIVE | LK_RETRY, p);
+ error = vn_lock(lvp, LK_EXCLUSIVE | LK_RETRY, td);
if (error) {
vrele(lvp);
lvp = NULL;
@@ -335,7 +335,7 @@ linux_getcwd_common (lvp, rvp, bpp, bufp, limit, flags, p)
* whether or not caller cares.
*/
if (flags & GETCWD_CHECK_ACCESS) {
- error = VOP_ACCESS(lvp, perms, p->p_ucred, p);
+ error = VOP_ACCESS(lvp, perms, td->td_proc->p_ucred, td);
if (error)
goto out;
perms = VEXEC|VREAD;
@@ -361,14 +361,14 @@ linux_getcwd_common (lvp, rvp, bpp, bufp, limit, flags, p)
goto out;
}
VREF(lvp);
- error = vn_lock(lvp, LK_EXCLUSIVE | LK_RETRY, p);
+ error = vn_lock(lvp, LK_EXCLUSIVE | LK_RETRY, td);
if (error != 0) {
vrele(lvp);
lvp = NULL;
goto out;
}
}
- error = linux_getcwd_scandir(&lvp, &uvp, &bp, bufp, p);
+ error = linux_getcwd_scandir(&lvp, &uvp, &bp, bufp, td);
if (error)
goto out;
#if DIAGNOSTIC
@@ -405,25 +405,25 @@ out:
*/
int
-linux_getcwd(struct proc *p, struct linux_getcwd_args *args)
+linux_getcwd(struct thread *td, struct linux_getcwd_args *args)
{
struct __getcwd_args bsd;
caddr_t sg, bp, bend, path;
int error, len, lenused;
#ifdef DEBUG
- printf("Linux-emul(%ld): getcwd(%p, %ld)\n", (long)p->p_pid,
+ printf("Linux-emul(%ld): getcwd(%p, %ld)\n", (long)td->td_proc->p_pid,
args->buf, args->bufsize);
#endif
sg = stackgap_init();
bsd.buf = stackgap_alloc(&sg, SPARE_USRSPACE);
bsd.buflen = SPARE_USRSPACE;
- error = __getcwd(p, &bsd);
+ error = __getcwd(td, &bsd);
if (!error) {
lenused = strlen(bsd.buf) + 1;
if (lenused <= args->bufsize) {
- p->p_retval[0] = lenused;
+ td->td_retval[0] = lenused;
error = copyout(bsd.buf, args->buf, lenused);
}
else
@@ -448,13 +448,13 @@ linux_getcwd(struct proc *p, struct linux_getcwd_args *args)
* limit it to N/2 vnodes for an N byte buffer.
*/
- error = linux_getcwd_common (p->p_fd->fd_cdir, NULL,
- &bp, path, len/2, GETCWD_CHECK_ACCESS, p);
+ error = linux_getcwd_common (td->td_proc->p_fd->fd_cdir, NULL,
+ &bp, path, len/2, GETCWD_CHECK_ACCESS, td);
if (error)
goto out;
lenused = bend - bp;
- p->p_retval[0] = lenused;
+ td->td_retval[0] = lenused;
/* put the result into user buffer */
error = copyout(bp, args->buf, lenused);
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
index b4fc8ce..ab80494 100644
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -91,7 +91,7 @@ DATA_SET(linux_ioctl_handler_set, termio_handler);
struct handler_element
{
TAILQ_ENTRY(handler_element) list;
- int (*func)(struct proc *, struct linux_ioctl_args *);
+ int (*func)(struct thread *, struct linux_ioctl_args *);
int low, high, span;
};
@@ -99,15 +99,15 @@ static TAILQ_HEAD(, handler_element) handlers =
TAILQ_HEAD_INITIALIZER(handlers);
static int
-linux_ioctl_disk(struct proc *p, struct linux_ioctl_args *args)
+linux_ioctl_disk(struct thread *td, struct linux_ioctl_args *args)
{
- struct file *fp = p->p_fd->fd_ofiles[args->fd];
+ struct file *fp = td->td_proc->p_fd->fd_ofiles[args->fd];
int error;
struct disklabel dl;
switch (args->cmd & 0xffff) {
case LINUX_BLKGETSIZE:
- error = fo_ioctl(fp, DIOCGDINFO, (caddr_t)&dl, p);
+ error = fo_ioctl(fp, DIOCGDINFO, (caddr_t)&dl, td);
if (error)
return (error);
return (copyout(&(dl.d_secperunit), (caddr_t)args->arg,
@@ -511,18 +511,18 @@ linux_to_bsd_termio(struct linux_termio *lio, struct termios *bios)
}
static int
-linux_ioctl_termio(struct proc *p, struct linux_ioctl_args *args)
+linux_ioctl_termio(struct thread *td, struct linux_ioctl_args *args)
{
struct termios bios;
struct linux_termios lios;
struct linux_termio lio;
- struct file *fp = p->p_fd->fd_ofiles[args->fd];
+ struct file *fp = td->td_proc->p_fd->fd_ofiles[args->fd];
int error;
switch (args->cmd & 0xffff) {
case LINUX_TCGETS:
- error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bios, p);
+ error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bios, td);
if (error)
return (error);
bsd_to_linux_termios(&bios, &lios);
@@ -533,24 +533,24 @@ linux_ioctl_termio(struct proc *p, struct linux_ioctl_args *args)
if (error)
return (error);
linux_to_bsd_termios(&lios, &bios);
- return (fo_ioctl(fp, TIOCSETA, (caddr_t)&bios, p));
+ return (fo_ioctl(fp, TIOCSETA, (caddr_t)&bios, td));
case LINUX_TCSETSW:
error = copyin((caddr_t)args->arg, &lios, sizeof(lios));
if (error)
return (error);
linux_to_bsd_termios(&lios, &bios);
- return (fo_ioctl(fp, TIOCSETAW, (caddr_t)&bios, p));
+ return (fo_ioctl(fp, TIOCSETAW, (caddr_t)&bios, td));
case LINUX_TCSETSF:
error = copyin((caddr_t)args->arg, &lios, sizeof(lios));
if (error)
return (error);
linux_to_bsd_termios(&lios, &bios);
- return (fo_ioctl(fp, TIOCSETAF, (caddr_t)&bios, p));
+ return (fo_ioctl(fp, TIOCSETAF, (caddr_t)&bios, td));
case LINUX_TCGETA:
- error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bios, p);
+ error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bios, td);
if (error)
return (error);
bsd_to_linux_termio(&bios, &lio);
@@ -561,21 +561,21 @@ linux_ioctl_termio(struct proc *p, struct linux_ioctl_args *args)
if (error)
return (error);
linux_to_bsd_termio(&lio, &bios);
- return (fo_ioctl(fp, TIOCSETA, (caddr_t)&bios, p));
+ return (fo_ioctl(fp, TIOCSETA, (caddr_t)&bios, td));
case LINUX_TCSETAW:
error = copyin((caddr_t)args->arg, &lio, sizeof(lio));
if (error)
return (error);
linux_to_bsd_termio(&lio, &bios);
- return (fo_ioctl(fp, TIOCSETAW, (caddr_t)&bios, p));
+ return (fo_ioctl(fp, TIOCSETAW, (caddr_t)&bios, td));
case LINUX_TCSETAF:
error = copyin((caddr_t)args->arg, &lio, sizeof(lio));
if (error)
return (error);
linux_to_bsd_termio(&lio, &bios);
- return (fo_ioctl(fp, TIOCSETAF, (caddr_t)&bios, p));
+ return (fo_ioctl(fp, TIOCSETAF, (caddr_t)&bios, td));
/* LINUX_TCSBRK */
@@ -591,7 +591,7 @@ linux_ioctl_termio(struct proc *p, struct linux_ioctl_args *args)
case LINUX_TCION: {
int c;
struct write_args wr;
- error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bios, p);
+ error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bios, td);
if (error)
return (error);
c = (args->arg == LINUX_TCIOFF) ? VSTOP : VSTART;
@@ -600,7 +600,7 @@ linux_ioctl_termio(struct proc *p, struct linux_ioctl_args *args)
wr.fd = args->fd;
wr.buf = &c;
wr.nbyte = sizeof(c);
- return (write(p, &wr));
+ return (write(td, &wr));
} else
return (0);
}
@@ -608,7 +608,7 @@ linux_ioctl_termio(struct proc *p, struct linux_ioctl_args *args)
return (EINVAL);
}
args->arg = 0;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
}
case LINUX_TCFLSH: {
@@ -626,66 +626,66 @@ linux_ioctl_termio(struct proc *p, struct linux_ioctl_args *args)
default:
return (EINVAL);
}
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
}
case LINUX_TIOCEXCL:
args->cmd = TIOCEXCL;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_TIOCNXCL:
args->cmd = TIOCNXCL;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
/* LINUX_TIOCSCTTY */
case LINUX_TIOCGPGRP:
args->cmd = TIOCGPGRP;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_TIOCSPGRP:
args->cmd = TIOCSPGRP;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
/* LINUX_TIOCOUTQ */
/* LINUX_TIOCSTI */
case LINUX_TIOCGWINSZ:
args->cmd = TIOCGWINSZ;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_TIOCSWINSZ:
args->cmd = TIOCSWINSZ;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_TIOCMGET:
args->cmd = TIOCMGET;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_TIOCMBIS:
args->cmd = TIOCMBIS;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_TIOCMBIC:
args->cmd = TIOCMBIC;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_TIOCMSET:
args->cmd = TIOCMSET;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
/* TIOCGSOFTCAR */
/* TIOCSSOFTCAR */
case LINUX_FIONREAD: /* LINUX_TIOCINQ */
args->cmd = FIONREAD;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
/* LINUX_TIOCLINUX */
case LINUX_TIOCCONS:
args->cmd = TIOCCONS;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_TIOCGSERIAL: {
struct linux_serial_struct lss;
@@ -710,11 +710,11 @@ linux_ioctl_termio(struct proc *p, struct linux_ioctl_args *args)
case LINUX_FIONBIO:
args->cmd = FIONBIO;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_TIOCNOTTY:
args->cmd = TIOCNOTTY;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_TIOCSETD: {
int line;
@@ -731,13 +731,13 @@ linux_ioctl_termio(struct proc *p, struct linux_ioctl_args *args)
default:
return (EINVAL);
}
- return (fo_ioctl(fp, TIOCSETD, (caddr_t)&line, p));
+ return (fo_ioctl(fp, TIOCSETD, (caddr_t)&line, td));
}
case LINUX_TIOCGETD: {
int linux_line;
int bsd_line = TTYDISC;
- error = fo_ioctl(fp, TIOCGETD, (caddr_t)&bsd_line, p);
+ error = fo_ioctl(fp, TIOCGETD, (caddr_t)&bsd_line, td);
if (error)
return (error);
switch (bsd_line) {
@@ -761,15 +761,15 @@ linux_ioctl_termio(struct proc *p, struct linux_ioctl_args *args)
case LINUX_FIONCLEX:
args->cmd = FIONCLEX;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_FIOCLEX:
args->cmd = FIOCLEX;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_FIOASYNC:
args->cmd = FIOASYNC;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
/* LINUX_TIOCSERCONFIG */
/* LINUX_TIOCSERGWILD */
@@ -860,33 +860,33 @@ set_linux_cdrom_addr(union linux_cdrom_addr *addr, int format, int lba)
}
static int
-linux_ioctl_cdrom(struct proc *p, struct linux_ioctl_args *args)
+linux_ioctl_cdrom(struct thread *td, struct linux_ioctl_args *args)
{
- struct file *fp = p->p_fd->fd_ofiles[args->fd];
+ struct file *fp = td->td_proc->p_fd->fd_ofiles[args->fd];
int error;
switch (args->cmd & 0xffff) {
case LINUX_CDROMPAUSE:
args->cmd = CDIOCPAUSE;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_CDROMRESUME:
args->cmd = CDIOCRESUME;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_CDROMPLAYMSF:
args->cmd = CDIOCPLAYMSF;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_CDROMPLAYTRKIND:
args->cmd = CDIOCPLAYTRACKS;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_CDROMREADTOCHDR: {
struct ioc_toc_header th;
struct linux_cdrom_tochdr lth;
- error = fo_ioctl(fp, CDIOREADTOCHEADER, (caddr_t)&th, p);
+ error = fo_ioctl(fp, CDIOREADTOCHEADER, (caddr_t)&th, td);
if (!error) {
lth.cdth_trk0 = th.starting_track;
lth.cdth_trk1 = th.ending_track;
@@ -901,7 +901,7 @@ linux_ioctl_cdrom(struct proc *p, struct linux_ioctl_args *args)
struct ioc_read_toc_single_entry irtse;
irtse.address_format = ltep->cdte_format;
irtse.track = ltep->cdte_track;
- error = fo_ioctl(fp, CDIOREADTOCENTRY, (caddr_t)&irtse, p);
+ error = fo_ioctl(fp, CDIOREADTOCENTRY, (caddr_t)&irtse, td);
if (!error) {
lte = *ltep;
lte.cdte_ctrl = irtse.entry.control;
@@ -915,15 +915,15 @@ linux_ioctl_cdrom(struct proc *p, struct linux_ioctl_args *args)
case LINUX_CDROMSTOP:
args->cmd = CDIOCSTOP;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_CDROMSTART:
args->cmd = CDIOCSTART;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_CDROMEJECT:
args->cmd = CDIOCEJECT;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
/* LINUX_CDROMVOLCTRL */
@@ -939,7 +939,7 @@ linux_ioctl_cdrom(struct proc *p, struct linux_ioctl_args *args)
bsdsc.track = 0;
bsdsc.data_len = sizeof(struct cd_sub_channel_info);
bsdsc.data = bsdinfo;
- error = fo_ioctl(fp, CDIOCREADSUBCHANNEL, (caddr_t)&bsdsc, p);
+ error = fo_ioctl(fp, CDIOCREADSUBCHANNEL, (caddr_t)&bsdsc, td);
if (error)
return (error);
error = copyin((caddr_t)args->arg, &sc,
@@ -969,7 +969,7 @@ linux_ioctl_cdrom(struct proc *p, struct linux_ioctl_args *args)
case LINUX_CDROMRESET:
args->cmd = CDIOCRESET;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
/* LINUX_CDROMVOLREAD */
/* LINUX_CDROMREADRAW */
@@ -994,227 +994,227 @@ static u_int32_t dirbits[4] = { IOC_VOID, IOC_IN, IOC_OUT, IOC_INOUT };
#define SETDIR(c) (((c) & ~IOC_DIRMASK) | dirbits[args->cmd >> 30])
static int
-linux_ioctl_sound(struct proc *p, struct linux_ioctl_args *args)
+linux_ioctl_sound(struct thread *td, struct linux_ioctl_args *args)
{
switch (args->cmd & 0xffff) {
case LINUX_SOUND_MIXER_WRITE_VOLUME:
args->cmd = SETDIR(SOUND_MIXER_WRITE_VOLUME);
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_MIXER_WRITE_BASS:
args->cmd = SETDIR(SOUND_MIXER_WRITE_BASS);
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_MIXER_WRITE_TREBLE:
args->cmd = SETDIR(SOUND_MIXER_WRITE_TREBLE);
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_MIXER_WRITE_SYNTH:
args->cmd = SETDIR(SOUND_MIXER_WRITE_SYNTH);
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_MIXER_WRITE_PCM:
args->cmd = SETDIR(SOUND_MIXER_WRITE_PCM);
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_MIXER_WRITE_SPEAKER:
args->cmd = SETDIR(SOUND_MIXER_WRITE_SPEAKER);
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_MIXER_WRITE_LINE:
args->cmd = SETDIR(SOUND_MIXER_WRITE_LINE);
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_MIXER_WRITE_MIC:
args->cmd = SETDIR(SOUND_MIXER_WRITE_MIC);
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_MIXER_WRITE_CD:
args->cmd = SETDIR(SOUND_MIXER_WRITE_CD);
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_MIXER_WRITE_IMIX:
args->cmd = SETDIR(SOUND_MIXER_WRITE_IMIX);
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_MIXER_WRITE_ALTPCM:
args->cmd = SETDIR(SOUND_MIXER_WRITE_ALTPCM);
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_MIXER_WRITE_RECLEV:
args->cmd = SETDIR(SOUND_MIXER_WRITE_RECLEV);
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_MIXER_WRITE_IGAIN:
args->cmd = SETDIR(SOUND_MIXER_WRITE_IGAIN);
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_MIXER_WRITE_OGAIN:
args->cmd = SETDIR(SOUND_MIXER_WRITE_OGAIN);
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_MIXER_WRITE_LINE1:
args->cmd = SETDIR(SOUND_MIXER_WRITE_LINE1);
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_MIXER_WRITE_LINE2:
args->cmd = SETDIR(SOUND_MIXER_WRITE_LINE2);
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_MIXER_WRITE_LINE3:
args->cmd = SETDIR(SOUND_MIXER_WRITE_LINE3);
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_OSS_GETVERSION: {
- int version = linux_get_oss_version(p);
+ int version = linux_get_oss_version(td->td_proc);
return (copyout(&version, (caddr_t)args->arg, sizeof(int)));
}
case LINUX_SOUND_MIXER_READ_DEVMASK:
args->cmd = SOUND_MIXER_READ_DEVMASK;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_RESET:
args->cmd = SNDCTL_DSP_RESET;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_SYNC:
args->cmd = SNDCTL_DSP_SYNC;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_SPEED:
args->cmd = SNDCTL_DSP_SPEED;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_STEREO:
args->cmd = SNDCTL_DSP_STEREO;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_GETBLKSIZE: /* LINUX_SNDCTL_DSP_SETBLKSIZE */
args->cmd = SNDCTL_DSP_GETBLKSIZE;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_SETFMT:
args->cmd = SNDCTL_DSP_SETFMT;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_PCM_WRITE_CHANNELS:
args->cmd = SOUND_PCM_WRITE_CHANNELS;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SOUND_PCM_WRITE_FILTER:
args->cmd = SOUND_PCM_WRITE_FILTER;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_POST:
args->cmd = SNDCTL_DSP_POST;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_SUBDIVIDE:
args->cmd = SNDCTL_DSP_SUBDIVIDE;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_SETFRAGMENT:
args->cmd = SNDCTL_DSP_SETFRAGMENT;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_GETFMTS:
args->cmd = SNDCTL_DSP_GETFMTS;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_GETOSPACE:
args->cmd = SNDCTL_DSP_GETOSPACE;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_GETISPACE:
args->cmd = SNDCTL_DSP_GETISPACE;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_NONBLOCK:
args->cmd = SNDCTL_DSP_NONBLOCK;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_GETCAPS:
args->cmd = SNDCTL_DSP_GETCAPS;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_SETTRIGGER: /* LINUX_SNDCTL_GETTRIGGER */
args->cmd = SNDCTL_DSP_SETTRIGGER;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_GETIPTR:
args->cmd = SNDCTL_DSP_GETIPTR;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_GETOPTR:
args->cmd = SNDCTL_DSP_GETOPTR;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_DSP_GETODELAY:
args->cmd = SNDCTL_DSP_GETODELAY;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_SEQ_RESET:
args->cmd = SNDCTL_SEQ_RESET;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_SEQ_SYNC:
args->cmd = SNDCTL_SEQ_SYNC;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_SYNTH_INFO:
args->cmd = SNDCTL_SYNTH_INFO;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_SEQ_CTRLRATE:
args->cmd = SNDCTL_SEQ_CTRLRATE;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_SEQ_GETOUTCOUNT:
args->cmd = SNDCTL_SEQ_GETOUTCOUNT;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_SEQ_GETINCOUNT:
args->cmd = SNDCTL_SEQ_GETINCOUNT;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_SEQ_PERCMODE:
args->cmd = SNDCTL_SEQ_PERCMODE;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_FM_LOAD_INSTR:
args->cmd = SNDCTL_FM_LOAD_INSTR;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_SEQ_TESTMIDI:
args->cmd = SNDCTL_SEQ_TESTMIDI;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_SEQ_RESETSAMPLES:
args->cmd = SNDCTL_SEQ_RESETSAMPLES;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_SEQ_NRSYNTHS:
args->cmd = SNDCTL_SEQ_NRSYNTHS;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_SEQ_NRMIDIS:
args->cmd = SNDCTL_SEQ_NRMIDIS;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_MIDI_INFO:
args->cmd = SNDCTL_MIDI_INFO;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_SEQ_TRESHOLD:
args->cmd = SNDCTL_SEQ_TRESHOLD;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SNDCTL_SYNTH_MEMAVL:
args->cmd = SNDCTL_SYNTH_MEMAVL;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
}
@@ -1228,39 +1228,39 @@ linux_ioctl_sound(struct proc *p, struct linux_ioctl_args *args)
#define ISSIGVALID(sig) ((sig) > 0 && (sig) < NSIG)
static int
-linux_ioctl_console(struct proc *p, struct linux_ioctl_args *args)
+linux_ioctl_console(struct thread *td, struct linux_ioctl_args *args)
{
- struct file *fp = p->p_fd->fd_ofiles[args->fd];
+ struct file *fp = td->td_proc->p_fd->fd_ofiles[args->fd];
switch (args->cmd & 0xffff) {
case LINUX_KIOCSOUND:
args->cmd = KIOCSOUND;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_KDMKTONE:
args->cmd = KDMKTONE;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_KDGETLED:
args->cmd = KDGETLED;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_KDSETLED:
args->cmd = KDSETLED;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_KDSETMODE:
args->cmd = KDSETMODE;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_KDGETMODE:
args->cmd = KDGETMODE;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_KDGKBMODE:
args->cmd = KDGKBMODE;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_KDSKBMODE: {
int kbdmode;
@@ -1277,16 +1277,16 @@ linux_ioctl_console(struct proc *p, struct linux_ioctl_args *args)
default:
return (EINVAL);
}
- return (fo_ioctl(fp, KDSKBMODE, (caddr_t)&kbdmode, p));
+ return (fo_ioctl(fp, KDSKBMODE, (caddr_t)&kbdmode, td));
}
case LINUX_VT_OPENQRY:
args->cmd = VT_OPENQRY;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_VT_GETMODE:
args->cmd = VT_GETMODE;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_VT_SETMODE: {
struct vt_mode *mode;
@@ -1294,24 +1294,24 @@ linux_ioctl_console(struct proc *p, struct linux_ioctl_args *args)
mode = (struct vt_mode *)args->arg;
if (!ISSIGVALID(mode->frsig) && ISSIGVALID(mode->acqsig))
mode->frsig = mode->acqsig;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
}
case LINUX_VT_GETSTATE:
args->cmd = VT_GETACTIVE;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_VT_RELDISP:
args->cmd = VT_RELDISP;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_VT_ACTIVATE:
args->cmd = VT_ACTIVATE;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_VT_WAITACTIVE:
args->cmd = VT_WAITACTIVE;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
}
@@ -1323,56 +1323,56 @@ linux_ioctl_console(struct proc *p, struct linux_ioctl_args *args)
*/
static int
-linux_ioctl_socket(struct proc *p, struct linux_ioctl_args *args)
+linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
{
switch (args->cmd & 0xffff) {
case LINUX_FIOSETOWN:
args->cmd = FIOSETOWN;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SIOCSPGRP:
args->cmd = SIOCSPGRP;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_FIOGETOWN:
args->cmd = FIOGETOWN;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SIOCGPGRP:
args->cmd = SIOCGPGRP;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SIOCATMARK:
args->cmd = SIOCATMARK;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
/* LINUX_SIOCGSTAMP */
case LINUX_SIOCGIFCONF:
args->cmd = OSIOCGIFCONF;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SIOCGIFFLAGS:
args->cmd = SIOCGIFFLAGS;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SIOCGIFADDR:
args->cmd = OSIOCGIFADDR;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SIOCGIFDSTADDR:
args->cmd = OSIOCGIFDSTADDR;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SIOCGIFBRDADDR:
args->cmd = OSIOCGIFBRDADDR;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SIOCGIFNETMASK:
args->cmd = OSIOCGIFNETMASK;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SIOCGIFHWADDR: {
int ifn;
@@ -1406,11 +1406,11 @@ linux_ioctl_socket(struct proc *p, struct linux_ioctl_args *args)
case LINUX_SIOCADDMULTI:
args->cmd = SIOCADDMULTI;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
case LINUX_SIOCDELMULTI:
args->cmd = SIOCDELMULTI;
- return (ioctl(p, (struct ioctl_args *)args));
+ return (ioctl(td, (struct ioctl_args *)args));
}
@@ -1422,7 +1422,7 @@ linux_ioctl_socket(struct proc *p, struct linux_ioctl_args *args)
*/
int
-linux_ioctl(struct proc *p, struct linux_ioctl_args *args)
+linux_ioctl(struct thread *td, struct linux_ioctl_args *args)
{
struct filedesc *fdp;
struct file *fp;
@@ -1434,7 +1434,7 @@ linux_ioctl(struct proc *p, struct linux_ioctl_args *args)
printf(ARGS(ioctl, "%d, %04lx, *"), args->fd, args->cmd);
#endif
- fdp = p->p_fd;
+ fdp = td->td_proc->p_fd;
if ((unsigned)args->fd >= fdp->fd_nfiles)
return (EBADF);
fp = fdp->fd_ofiles[args->fd];
@@ -1445,7 +1445,7 @@ linux_ioctl(struct proc *p, struct linux_ioctl_args *args)
cmd = args->cmd & 0xffff;
TAILQ_FOREACH(he, &handlers, list) {
if (cmd >= he->low && cmd <= he->high) {
- error = (*he->func)(p, args);
+ error = (*he->func)(td, args);
if (error != ENOIOCTL)
return (error);
}
diff --git a/sys/compat/linux/linux_ipc.c b/sys/compat/linux/linux_ipc.c
index de9b47a..9053efc 100644
--- a/sys/compat/linux/linux_ipc.c
+++ b/sys/compat/linux/linux_ipc.c
@@ -149,7 +149,7 @@ bsd_to_linux_shmid_ds(struct shmid_ds *bsp, struct l_shmid_ds *lsp)
}
int
-linux_semop(struct proc *p, struct linux_semop_args *args)
+linux_semop(struct thread *td, struct linux_semop_args *args)
{
struct semop_args /* {
int semid;
@@ -160,11 +160,11 @@ linux_semop(struct proc *p, struct linux_semop_args *args)
bsd_args.semid = args->semid;
bsd_args.sops = (struct sembuf *)args->tsops;
bsd_args.nsops = args->nsops;
- return semop(p, &bsd_args);
+ return semop(td, &bsd_args);
}
int
-linux_semget(struct proc *p, struct linux_semget_args *args)
+linux_semget(struct thread *td, struct linux_semget_args *args)
{
struct semget_args /* {
key_t key;
@@ -175,11 +175,11 @@ linux_semget(struct proc *p, struct linux_semget_args *args)
bsd_args.key = args->key;
bsd_args.nsems = args->nsems;
bsd_args.semflg = args->semflg;
- return semget(p, &bsd_args);
+ return semget(td, &bsd_args);
}
int
-linux_semctl(struct proc *p, struct linux_semctl_args *args)
+linux_semctl(struct thread *td, struct linux_semctl_args *args)
{
struct l_semid_ds linux_semid;
struct __semctl_args /* {
@@ -226,13 +226,13 @@ linux_semctl(struct proc *p, struct linux_semctl_args *args)
unptr->buf = stackgap_alloc(&sg, sizeof(struct semid_ds));
linux_to_bsd_semid_ds(&linux_semid, unptr->buf);
bsd_args.arg = unptr;
- return __semctl(p, &bsd_args);
+ return __semctl(td, &bsd_args);
case LINUX_IPC_STAT:
bsd_args.cmd = IPC_STAT;
unptr = stackgap_alloc(&sg, sizeof(union semun));
unptr->buf = stackgap_alloc(&sg, sizeof(struct semid_ds));
bsd_args.arg = unptr;
- error = __semctl(p, &bsd_args);
+ error = __semctl(td, &bsd_args);
if (error)
return error;
bsd_to_linux_semid_ds(unptr->buf, &linux_semid);
@@ -246,11 +246,11 @@ linux_semctl(struct proc *p, struct linux_semctl_args *args)
uprintf("linux: 'ipc' typ=%d not implemented\n", args->cmd);
return EINVAL;
}
- return __semctl(p, &bsd_args);
+ return __semctl(td, &bsd_args);
}
int
-linux_msgsnd(struct proc *p, struct linux_msgsnd_args *args)
+linux_msgsnd(struct thread *td, struct linux_msgsnd_args *args)
{
struct msgsnd_args /* {
int msqid;
@@ -263,11 +263,11 @@ linux_msgsnd(struct proc *p, struct linux_msgsnd_args *args)
bsd_args.msgp = args->msgp;
bsd_args.msgsz = args->msgsz;
bsd_args.msgflg = args->msgflg;
- return msgsnd(p, &bsd_args);
+ return msgsnd(td, &bsd_args);
}
int
-linux_msgrcv(struct proc *p, struct linux_msgrcv_args *args)
+linux_msgrcv(struct thread *td, struct linux_msgrcv_args *args)
{
struct msgrcv_args /* {
int msqid;
@@ -282,11 +282,11 @@ linux_msgrcv(struct proc *p, struct linux_msgrcv_args *args)
bsd_args.msgsz = args->msgsz;
bsd_args.msgtyp = 0; /* XXX - args->msgtyp; */
bsd_args.msgflg = args->msgflg;
- return msgrcv(p, &bsd_args);
+ return msgrcv(td, &bsd_args);
}
int
-linux_msgget(struct proc *p, struct linux_msgget_args *args)
+linux_msgget(struct thread *td, struct linux_msgget_args *args)
{
struct msgget_args /* {
key_t key;
@@ -295,11 +295,11 @@ linux_msgget(struct proc *p, struct linux_msgget_args *args)
bsd_args.key = args->key;
bsd_args.msgflg = args->msgflg;
- return msgget(p, &bsd_args);
+ return msgget(td, &bsd_args);
}
int
-linux_msgctl(struct proc *p, struct linux_msgctl_args *args)
+linux_msgctl(struct thread *td, struct linux_msgctl_args *args)
{
struct msgctl_args /* {
int msqid;
@@ -311,12 +311,12 @@ linux_msgctl(struct proc *p, struct linux_msgctl_args *args)
bsd_args.msqid = args->msqid;
bsd_args.cmd = args->cmd;
bsd_args.buf = (struct msqid_ds *)args->buf;
- error = msgctl(p, &bsd_args);
+ error = msgctl(td, &bsd_args);
return ((args->cmd == LINUX_IPC_RMID && error == EINVAL) ? 0 : error);
}
int
-linux_shmat(struct proc *p, struct linux_shmat_args *args)
+linux_shmat(struct thread *td, struct linux_shmat_args *args)
{
struct shmat_args /* {
int shmid;
@@ -328,29 +328,29 @@ linux_shmat(struct proc *p, struct linux_shmat_args *args)
bsd_args.shmid = args->shmid;
bsd_args.shmaddr = args->shmaddr;
bsd_args.shmflg = args->shmflg;
- if ((error = shmat(p, &bsd_args)))
+ if ((error = shmat(td, &bsd_args)))
return error;
#ifdef __i386__
- if ((error = copyout(p->p_retval, (caddr_t)args->raddr, sizeof(l_ulong))))
+ if ((error = copyout(td->td_retval, (caddr_t)args->raddr, sizeof(l_ulong))))
return error;
- p->p_retval[0] = 0;
+ td->td_retval[0] = 0;
#endif
return 0;
}
int
-linux_shmdt(struct proc *p, struct linux_shmdt_args *args)
+linux_shmdt(struct thread *td, struct linux_shmdt_args *args)
{
struct shmdt_args /* {
void *shmaddr;
} */ bsd_args;
bsd_args.shmaddr = args->shmaddr;
- return shmdt(p, &bsd_args);
+ return shmdt(td, &bsd_args);
}
int
-linux_shmget(struct proc *p, struct linux_shmget_args *args)
+linux_shmget(struct thread *td, struct linux_shmget_args *args)
{
struct shmget_args /* {
key_t key;
@@ -361,11 +361,11 @@ linux_shmget(struct proc *p, struct linux_shmget_args *args)
bsd_args.key = args->key;
bsd_args.size = args->size;
bsd_args.shmflg = args->shmflg;
- return shmget(p, &bsd_args);
+ return shmget(td, &bsd_args);
}
int
-linux_shmctl(struct proc *p, struct linux_shmctl_args *args)
+linux_shmctl(struct thread *td, struct linux_shmctl_args *args)
{
struct l_shmid_ds linux_shmid;
struct shmctl_args /* {
@@ -381,7 +381,7 @@ linux_shmctl(struct proc *p, struct linux_shmctl_args *args)
bsd_args.shmid = args->shmid;
bsd_args.cmd = IPC_STAT;
bsd_args.buf = (struct shmid_ds*)stackgap_alloc(&sg, sizeof(struct shmid_ds));
- if ((error = shmctl(p, &bsd_args)))
+ if ((error = shmctl(td, &bsd_args)))
return error;
bsd_to_linux_shmid_ds(bsd_args.buf, &linux_shmid);
return copyout(&linux_shmid, (caddr_t)args->buf, sizeof(linux_shmid));
@@ -394,7 +394,7 @@ linux_shmctl(struct proc *p, struct linux_shmctl_args *args)
linux_to_bsd_shmid_ds(&linux_shmid, bsd_args.buf);
bsd_args.shmid = args->shmid;
bsd_args.cmd = IPC_SET;
- return shmctl(p, &bsd_args);
+ return shmctl(td, &bsd_args);
case LINUX_IPC_RMID:
bsd_args.shmid = args->shmid;
@@ -408,7 +408,7 @@ linux_shmctl(struct proc *p, struct linux_shmctl_args *args)
bsd_args.buf = (struct shmid_ds*)stackgap_alloc(&sg, sizeof(struct shmid_ds));
linux_to_bsd_shmid_ds(&linux_shmid, bsd_args.buf);
}
- return shmctl(p, &bsd_args);
+ return shmctl(td, &bsd_args);
case LINUX_IPC_INFO:
case LINUX_SHM_STAT:
diff --git a/sys/compat/linux/linux_ipc.h b/sys/compat/linux/linux_ipc.h
index d0db461..a647b4b 100644
--- a/sys/compat/linux/linux_ipc.h
+++ b/sys/compat/linux/linux_ipc.h
@@ -112,19 +112,19 @@ struct linux_shmget_args
l_int shmflg;
};
-int linux_msgctl __P((struct proc *, struct linux_msgctl_args *));
-int linux_msgget __P((struct proc *, struct linux_msgget_args *));
-int linux_msgrcv __P((struct proc *, struct linux_msgrcv_args *));
-int linux_msgsnd __P((struct proc *, struct linux_msgsnd_args *));
-
-int linux_semctl __P((struct proc *, struct linux_semctl_args *));
-int linux_semget __P((struct proc *, struct linux_semget_args *));
-int linux_semop __P((struct proc *, struct linux_semop_args *));
-
-int linux_shmat __P((struct proc *, struct linux_shmat_args *));
-int linux_shmctl __P((struct proc *, struct linux_shmctl_args *));
-int linux_shmdt __P((struct proc *, struct linux_shmdt_args *));
-int linux_shmget __P((struct proc *, struct linux_shmget_args *));
+int linux_msgctl __P((struct thread *, struct linux_msgctl_args *));
+int linux_msgget __P((struct thread *, struct linux_msgget_args *));
+int linux_msgrcv __P((struct thread *, struct linux_msgrcv_args *));
+int linux_msgsnd __P((struct thread *, struct linux_msgsnd_args *));
+
+int linux_semctl __P((struct thread *, struct linux_semctl_args *));
+int linux_semget __P((struct thread *, struct linux_semget_args *));
+int linux_semop __P((struct thread *, struct linux_semop_args *));
+
+int linux_shmat __P((struct thread *, struct linux_shmat_args *));
+int linux_shmctl __P((struct thread *, struct linux_shmctl_args *));
+int linux_shmdt __P((struct thread *, struct linux_shmdt_args *));
+int linux_shmget __P((struct thread *, struct linux_shmget_args *));
#endif /* __i386__ */
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index a717d81..7acea9f 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -108,7 +108,7 @@ struct l_sysinfo {
};
#ifndef __alpha__
int
-linux_sysinfo(struct proc *p, struct linux_sysinfo_args *args)
+linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args)
{
struct l_sysinfo sysinfo;
vm_object_t object;
@@ -164,7 +164,7 @@ linux_sysinfo(struct proc *p, struct linux_sysinfo_args *args)
#ifndef __alpha__
int
-linux_alarm(struct proc *p, struct linux_alarm_args *args)
+linux_alarm(struct thread *td, struct linux_alarm_args *args)
{
struct itimerval it, old_it;
struct timeval tv;
@@ -183,31 +183,31 @@ linux_alarm(struct proc *p, struct linux_alarm_args *args)
it.it_interval.tv_sec = 0;
it.it_interval.tv_usec = 0;
s = splsoftclock();
- old_it = p->p_realtimer;
+ old_it = td->td_proc->p_realtimer;
getmicrouptime(&tv);
if (timevalisset(&old_it.it_value))
- callout_stop(&p->p_itcallout);
+ callout_stop(&td->td_proc->p_itcallout);
if (it.it_value.tv_sec != 0) {
- callout_reset(&p->p_itcallout, tvtohz(&it.it_value),
- realitexpire, p);
+ callout_reset(&td->td_proc->p_itcallout, tvtohz(&it.it_value),
+ realitexpire, td);
timevaladd(&it.it_value, &tv);
}
- p->p_realtimer = it;
+ td->td_proc->p_realtimer = it;
splx(s);
if (timevalcmp(&old_it.it_value, &tv, >)) {
timevalsub(&old_it.it_value, &tv);
if (old_it.it_value.tv_usec != 0)
old_it.it_value.tv_sec++;
- p->p_retval[0] = old_it.it_value.tv_sec;
+ td->td_retval[0] = old_it.it_value.tv_sec;
}
return 0;
}
#endif /*!__alpha__*/
int
-linux_brk(struct proc *p, struct linux_brk_args *args)
+linux_brk(struct thread *td, struct linux_brk_args *args)
{
- struct vmspace *vm = p->p_vmspace;
+ struct vmspace *vm = td->td_proc->p_vmspace;
vm_offset_t new, old;
struct obreak_args /* {
char * nsize;
@@ -220,16 +220,16 @@ linux_brk(struct proc *p, struct linux_brk_args *args)
old = (vm_offset_t)vm->vm_daddr + ctob(vm->vm_dsize);
new = (vm_offset_t)args->dsend;
tmp.nsize = (char *) new;
- if (((caddr_t)new > vm->vm_daddr) && !obreak(p, &tmp))
- p->p_retval[0] = (long)new;
+ if (((caddr_t)new > vm->vm_daddr) && !obreak(td, &tmp))
+ td->td_retval[0] = (long)new;
else
- p->p_retval[0] = (long)old;
+ td->td_retval[0] = (long)old;
return 0;
}
int
-linux_uselib(struct proc *p, struct linux_uselib_args *args)
+linux_uselib(struct thread *td, struct linux_uselib_args *args)
{
struct nameidata ni;
struct vnode *vp;
@@ -244,7 +244,7 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args)
int locked;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->library);
+ CHECKALTEXIST(td, &sg, args->library);
#ifdef DEBUG
if (ldebug(uselib))
@@ -255,7 +255,7 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args)
locked = 0;
vp = NULL;
- NDINIT(&ni, LOOKUP, FOLLOW|LOCKLEAF, UIO_USERSPACE, args->library, p);
+ NDINIT(&ni, LOOKUP, FOLLOW|LOCKLEAF, UIO_USERSPACE, args->library, td);
error = namei(&ni);
if (error)
goto cleanup;
@@ -283,7 +283,7 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args)
}
/* Executable? */
- error = VOP_GETATTR(vp, &attr, p->p_ucred, p);
+ error = VOP_GETATTR(vp, &attr, td->td_proc->p_ucred, td);
if (error)
goto cleanup;
@@ -300,18 +300,18 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args)
}
/* Can we access it? */
- error = VOP_ACCESS(vp, VEXEC, p->p_ucred, p);
+ error = VOP_ACCESS(vp, VEXEC, td->td_proc->p_ucred, td);
if (error)
goto cleanup;
- error = VOP_OPEN(vp, FREAD, p->p_ucred, p);
+ error = VOP_OPEN(vp, FREAD, td->td_proc->p_ucred, td);
if (error)
goto cleanup;
/*
* Lock no longer needed
*/
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
locked = 0;
/* Pull in executable header into kernel_map */
@@ -357,7 +357,7 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args)
goto cleanup;
}
- /* To protect p->p_rlimit in the if condition. */
+ /* To protect td->td_proc->p_rlimit in the if condition. */
mtx_assert(&Giant, MA_OWNED);
/*
@@ -366,7 +366,8 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args)
* the resources needed by this library.
*/
if (a_out->a_text > MAXTSIZ ||
- a_out->a_data + bss_size > p->p_rlimit[RLIMIT_DATA].rlim_cur) {
+ a_out->a_data + bss_size >
+ td->td_proc->p_rlimit[RLIMIT_DATA].rlim_cur) {
error = ENOMEM;
goto cleanup;
}
@@ -389,8 +390,8 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args)
vmaddr = trunc_page(a_out->a_entry);
/* get anon user mapping, read+write+execute */
- error = vm_map_find(&p->p_vmspace->vm_map, NULL, 0, &vmaddr,
- a_out->a_text + a_out->a_data, FALSE, VM_PROT_ALL,
+ error = vm_map_find(&td->td_proc->p_vmspace->vm_map, NULL, 0,
+ &vmaddr, a_out->a_text + a_out->a_data, FALSE, VM_PROT_ALL,
VM_PROT_ALL, 0);
if (error)
goto cleanup;
@@ -427,7 +428,7 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args)
* Map it all into the process's space as a single
* copy-on-write "data" segment.
*/
- error = vm_mmap(&p->p_vmspace->vm_map, &vmaddr,
+ error = vm_mmap(&td->td_proc->p_vmspace->vm_map, &vmaddr,
a_out->a_text + a_out->a_data, VM_PROT_ALL, VM_PROT_ALL,
MAP_PRIVATE | MAP_FIXED, (caddr_t)vp, file_offset);
if (error)
@@ -443,8 +444,8 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args)
a_out->a_data;
/* allocate some 'anon' space */
- error = vm_map_find(&p->p_vmspace->vm_map, NULL, 0, &vmaddr,
- bss_size, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0);
+ error = vm_map_find(&td->td_proc->p_vmspace->vm_map, NULL, 0,
+ &vmaddr, bss_size, FALSE, VM_PROT_ALL, VM_PROT_ALL, 0);
if (error)
goto cleanup;
}
@@ -452,7 +453,7 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args)
cleanup:
/* Unlock vnode if needed */
if (locked)
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
/* Release the kernel mapping. */
if (a_out)
@@ -463,7 +464,7 @@ cleanup:
}
int
-linux_select(struct proc *p, struct linux_select_args *args)
+linux_select(struct thread *td, struct linux_select_args *args)
{
struct select_args bsa;
struct timeval tv0, tv1, utv, *tvp;
@@ -520,7 +521,7 @@ linux_select(struct proc *p, struct linux_select_args *args)
microtime(&tv0);
}
- error = select(p, &bsa);
+ error = select(td, &bsa);
#ifdef DEBUG
if (ldebug(select))
printf(LMSG("real select returns %d"), error);
@@ -536,7 +537,7 @@ linux_select(struct proc *p, struct linux_select_args *args)
}
if (args->timeout) {
- if (p->p_retval[0]) {
+ if (td->td_retval[0]) {
/*
* Compute how much time was left of the timeout,
* by subtracting the current time and the time
@@ -569,7 +570,7 @@ select_out:
}
int
-linux_getpgid(struct proc *p, struct linux_getpgid_args *args)
+linux_getpgid(struct thread *td, struct linux_getpgid_args *args)
{
struct proc *curp;
@@ -578,19 +579,19 @@ linux_getpgid(struct proc *p, struct linux_getpgid_args *args)
printf(ARGS(getpgid, "%d"), args->pid);
#endif
- if (args->pid != p->p_pid) {
+ if (args->pid != td->td_proc->p_pid) {
if (!(curp = pfind(args->pid)))
return ESRCH;
- p->p_retval[0] = curp->p_pgid;
+ td->td_retval[0] = curp->p_pgid;
PROC_UNLOCK(curp);
} else
- p->p_retval[0] = p->p_pgid;
+ td->td_retval[0] = td->td_proc->p_pgid;
return 0;
}
int
-linux_mremap(struct proc *p, struct linux_mremap_args *args)
+linux_mremap(struct thread *td, struct linux_mremap_args *args)
{
struct munmap_args /* {
void *addr;
@@ -610,22 +611,22 @@ linux_mremap(struct proc *p, struct linux_mremap_args *args)
args->old_len = round_page(args->old_len);
if (args->new_len > args->old_len) {
- p->p_retval[0] = 0;
+ td->td_retval[0] = 0;
return ENOMEM;
}
if (args->new_len < args->old_len) {
bsd_args.addr = (caddr_t)(args->addr + args->new_len);
bsd_args.len = args->old_len - args->new_len;
- error = munmap(p, &bsd_args);
+ error = munmap(td, &bsd_args);
}
- p->p_retval[0] = error ? 0 : (u_long)args->addr;
+ td->td_retval[0] = error ? 0 : (u_long)args->addr;
return error;
}
int
-linux_msync(struct proc *p, struct linux_msync_args *args)
+linux_msync(struct thread *td, struct linux_msync_args *args)
{
struct msync_args bsd_args;
@@ -633,12 +634,12 @@ linux_msync(struct proc *p, struct linux_msync_args *args)
bsd_args.len = args->len;
bsd_args.flags = 0; /* XXX ignore */
- return msync(p, &bsd_args);
+ return msync(td, &bsd_args);
}
#ifndef __alpha__
int
-linux_time(struct proc *p, struct linux_time_args *args)
+linux_time(struct thread *td, struct linux_time_args *args)
{
struct timeval tv;
l_time_t tm;
@@ -653,7 +654,7 @@ linux_time(struct proc *p, struct linux_time_args *args)
tm = tv.tv_sec;
if (args->tm && (error = copyout(&tm, (caddr_t)args->tm, sizeof(tm))))
return error;
- p->p_retval[0] = tm;
+ td->td_retval[0] = tm;
return 0;
}
#endif /*!__alpha__*/
@@ -674,7 +675,7 @@ struct l_times_argv {
#define CONVTCK(r) (r.tv_sec * CLK_TCK + r.tv_usec / (1000000 / CLK_TCK))
int
-linux_times(struct proc *p, struct linux_times_args *args)
+linux_times(struct thread *td, struct linux_times_args *args)
{
struct timeval tv;
struct l_times_argv tms;
@@ -687,25 +688,25 @@ linux_times(struct proc *p, struct linux_times_args *args)
#endif
mtx_lock_spin(&sched_lock);
- calcru(p, &ru.ru_utime, &ru.ru_stime, NULL);
+ calcru(td->td_proc, &ru.ru_utime, &ru.ru_stime, NULL);
mtx_unlock_spin(&sched_lock);
tms.tms_utime = CONVTCK(ru.ru_utime);
tms.tms_stime = CONVTCK(ru.ru_stime);
- tms.tms_cutime = CONVTCK(p->p_stats->p_cru.ru_utime);
- tms.tms_cstime = CONVTCK(p->p_stats->p_cru.ru_stime);
+ 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))))
return error;
microuptime(&tv);
- p->p_retval[0] = (int)CONVTCK(tv);
+ td->td_retval[0] = (int)CONVTCK(tv);
return 0;
}
int
-linux_newuname(struct proc *p, struct linux_newuname_args *args)
+linux_newuname(struct thread *td, struct linux_newuname_args *args)
{
struct l_new_utsname utsname;
char *osrelease, *osname;
@@ -715,8 +716,8 @@ linux_newuname(struct proc *p, struct linux_newuname_args *args)
printf(ARGS(newuname, "*"));
#endif
- osname = linux_get_osname(p);
- osrelease = linux_get_osrelease(p);
+ osname = linux_get_osname(td->td_proc);
+ osrelease = linux_get_osrelease(td->td_proc);
bzero(&utsname, sizeof(utsname));
strncpy(utsname.sysname, osname, LINUX_MAX_UTSNAME-1);
@@ -736,7 +737,7 @@ struct l_utimbuf {
};
int
-linux_utime(struct proc *p, struct linux_utime_args *args)
+linux_utime(struct thread *td, struct linux_utime_args *args)
{
struct utimes_args /* {
char *path;
@@ -748,7 +749,7 @@ linux_utime(struct proc *p, struct linux_utime_args *args)
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->fname);
+ CHECKALTEXIST(td, &sg, args->fname);
#ifdef DEBUG
if (ldebug(utime))
@@ -773,7 +774,7 @@ linux_utime(struct proc *p, struct linux_utime_args *args)
bsdutimes.tptr = NULL;
bsdutimes.path = args->fname;
- return utimes(p, &bsdutimes);
+ return utimes(td, &bsdutimes);
}
#endif /* __i386__ */
@@ -781,7 +782,7 @@ linux_utime(struct proc *p, struct linux_utime_args *args)
#ifndef __alpha__
int
-linux_waitpid(struct proc *p, struct linux_waitpid_args *args)
+linux_waitpid(struct thread *td, struct linux_waitpid_args *args)
{
struct wait_args /* {
int pid;
@@ -805,7 +806,7 @@ linux_waitpid(struct proc *p, struct linux_waitpid_args *args)
tmp.options |= WLINUXCLONE;
tmp.rusage = NULL;
- if ((error = wait4(p, &tmp)) != 0)
+ if ((error = wait4(td, &tmp)) != 0)
return error;
if (args->status) {
@@ -827,7 +828,7 @@ linux_waitpid(struct proc *p, struct linux_waitpid_args *args)
#endif /*!__alpha__*/
int
-linux_wait4(struct proc *p, struct linux_wait4_args *args)
+linux_wait4(struct thread *td, struct linux_wait4_args *args)
{
struct wait_args /* {
int pid;
@@ -852,10 +853,10 @@ linux_wait4(struct proc *p, struct linux_wait4_args *args)
tmp.options |= WLINUXCLONE;
tmp.rusage = (struct rusage *)args->rusage;
- if ((error = wait4(p, &tmp)) != 0)
+ if ((error = wait4(td, &tmp)) != 0)
return error;
- SIGDELSET(p->p_siglist, SIGCHLD);
+ SIGDELSET(td->td_proc->p_siglist, SIGCHLD);
if (args->status) {
if ((error = copyin((caddr_t)args->status, &tmpstat,
@@ -875,7 +876,7 @@ linux_wait4(struct proc *p, struct linux_wait4_args *args)
}
int
-linux_mknod(struct proc *p, struct linux_mknod_args *args)
+linux_mknod(struct thread *td, struct linux_mknod_args *args)
{
caddr_t sg;
struct mknod_args bsd_mknod;
@@ -883,7 +884,7 @@ linux_mknod(struct proc *p, struct linux_mknod_args *args)
sg = stackgap_init();
- CHECKALTCREAT(p, &sg, args->path);
+ CHECKALTCREAT(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(mknod))
@@ -894,12 +895,12 @@ linux_mknod(struct proc *p, struct linux_mknod_args *args)
if (args->mode & S_IFIFO) {
bsd_mkfifo.path = args->path;
bsd_mkfifo.mode = args->mode;
- return mkfifo(p, &bsd_mkfifo);
+ return mkfifo(td, &bsd_mkfifo);
} else {
bsd_mknod.path = args->path;
bsd_mknod.mode = args->mode;
bsd_mknod.dev = args->dev;
- return mknod(p, &bsd_mknod);
+ return mknod(td, &bsd_mknod);
}
}
@@ -907,7 +908,7 @@ linux_mknod(struct proc *p, struct linux_mknod_args *args)
* UGH! This is just about the dumbest idea I've ever heard!!
*/
int
-linux_personality(struct proc *p, struct linux_personality_args *args)
+linux_personality(struct thread *td, struct linux_personality_args *args)
{
#ifdef DEBUG
if (ldebug(personality))
@@ -919,7 +920,7 @@ linux_personality(struct proc *p, struct linux_personality_args *args)
#endif
/* Yes Jim, it's still a Linux... */
- p->p_retval[0] = 0;
+ td->td_retval[0] = 0;
return 0;
}
@@ -927,7 +928,7 @@ linux_personality(struct proc *p, struct linux_personality_args *args)
* Wrappers for get/setitimer for debugging..
*/
int
-linux_setitimer(struct proc *p, struct linux_setitimer_args *args)
+linux_setitimer(struct thread *td, struct linux_setitimer_args *args)
{
struct setitimer_args bsa;
struct itimerval foo;
@@ -953,11 +954,11 @@ linux_setitimer(struct proc *p, struct linux_setitimer_args *args)
}
#endif
}
- return setitimer(p, &bsa);
+ return setitimer(td, &bsa);
}
int
-linux_getitimer(struct proc *p, struct linux_getitimer_args *args)
+linux_getitimer(struct thread *td, struct linux_getitimer_args *args)
{
struct getitimer_args bsa;
#ifdef DEBUG
@@ -966,24 +967,24 @@ linux_getitimer(struct proc *p, struct linux_getitimer_args *args)
#endif
bsa.which = args->which;
bsa.itv = (struct itimerval *)args->itv;
- return getitimer(p, &bsa);
+ return getitimer(td, &bsa);
}
#ifndef __alpha__
int
-linux_nice(struct proc *p, struct linux_nice_args *args)
+linux_nice(struct thread *td, struct linux_nice_args *args)
{
struct setpriority_args bsd_args;
bsd_args.which = PRIO_PROCESS;
bsd_args.who = 0; /* current process */
bsd_args.prio = args->inc;
- return setpriority(p, &bsd_args);
+ return setpriority(td, &bsd_args);
}
#endif /*!__alpha__*/
int
-linux_setgroups(struct proc *p, struct linux_setgroups_args *args)
+linux_setgroups(struct thread *td, struct linux_setgroups_args *args)
{
struct ucred *newcred, *oldcred;
l_gid_t linux_gidset[NGROUPS];
@@ -991,7 +992,7 @@ linux_setgroups(struct proc *p, struct linux_setgroups_args *args)
int ngrp, error;
ngrp = args->gidsetsize;
- oldcred = p->p_ucred;
+ oldcred = td->td_proc->p_ucred;
/*
* cr_groups[0] holds egid. Setting the whole set from
@@ -1024,21 +1025,21 @@ linux_setgroups(struct proc *p, struct linux_setgroups_args *args)
else
newcred->cr_ngroups = 1;
- setsugid(p);
- p->p_ucred = newcred;
+ setsugid(td->td_proc);
+ td->td_proc->p_ucred = newcred;
crfree(oldcred);
return (0);
}
int
-linux_getgroups(struct proc *p, struct linux_getgroups_args *args)
+linux_getgroups(struct thread *td, struct linux_getgroups_args *args)
{
struct ucred *cred;
l_gid_t linux_gidset[NGROUPS];
gid_t *bsd_gidset;
int bsd_gidsetsz, ngrp, error;
- cred = p->p_ucred;
+ cred = td->td_proc->p_ucred;
bsd_gidset = cred->cr_groups;
bsd_gidsetsz = cred->cr_ngroups - 1;
@@ -1049,7 +1050,7 @@ linux_getgroups(struct proc *p, struct linux_getgroups_args *args)
*/
if ((ngrp = args->gidsetsize) == 0) {
- p->p_retval[0] = bsd_gidsetsz;
+ td->td_retval[0] = bsd_gidsetsz;
return (0);
}
@@ -1066,13 +1067,13 @@ linux_getgroups(struct proc *p, struct linux_getgroups_args *args)
ngrp * sizeof(l_gid_t))))
return (error);
- p->p_retval[0] = ngrp;
+ td->td_retval[0] = ngrp;
return (0);
}
#ifndef __alpha__
int
-linux_setrlimit(struct proc *p, struct linux_setrlimit_args *args)
+linux_setrlimit(struct thread *td, struct linux_setrlimit_args *args)
{
struct __setrlimit_args bsd;
struct l_rlimit rlim;
@@ -1099,11 +1100,11 @@ linux_setrlimit(struct proc *p, struct linux_setrlimit_args *args)
bsd.rlp = stackgap_alloc(&sg, sizeof(struct rlimit));
bsd.rlp->rlim_cur = (rlim_t)rlim.rlim_cur;
bsd.rlp->rlim_max = (rlim_t)rlim.rlim_max;
- return (setrlimit(p, &bsd));
+ return (setrlimit(td, &bsd));
}
int
-linux_old_getrlimit(struct proc *p, struct linux_old_getrlimit_args *args)
+linux_old_getrlimit(struct thread *td, struct linux_old_getrlimit_args *args)
{
struct __getrlimit_args bsd;
struct l_rlimit rlim;
@@ -1124,7 +1125,7 @@ linux_old_getrlimit(struct proc *p, struct linux_old_getrlimit_args *args)
return (EINVAL);
bsd.rlp = stackgap_alloc(&sg, sizeof(struct rlimit));
- error = getrlimit(p, &bsd);
+ error = getrlimit(td, &bsd);
if (error)
return (error);
@@ -1138,7 +1139,7 @@ linux_old_getrlimit(struct proc *p, struct linux_old_getrlimit_args *args)
}
int
-linux_getrlimit(struct proc *p, struct linux_getrlimit_args *args)
+linux_getrlimit(struct thread *td, struct linux_getrlimit_args *args)
{
struct __getrlimit_args bsd;
struct l_rlimit rlim;
@@ -1159,7 +1160,7 @@ linux_getrlimit(struct proc *p, struct linux_getrlimit_args *args)
return (EINVAL);
bsd.rlp = stackgap_alloc(&sg, sizeof(struct rlimit));
- error = getrlimit(p, &bsd);
+ error = getrlimit(td, &bsd);
if (error)
return (error);
@@ -1170,7 +1171,7 @@ linux_getrlimit(struct proc *p, struct linux_getrlimit_args *args)
#endif /*!__alpha__*/
int
-linux_sched_setscheduler(struct proc *p,
+linux_sched_setscheduler(struct thread *td,
struct linux_sched_setscheduler_args *args)
{
struct sched_setscheduler_args bsd;
@@ -1197,11 +1198,11 @@ linux_sched_setscheduler(struct proc *p,
bsd.pid = args->pid;
bsd.param = (struct sched_param *)args->param;
- return sched_setscheduler(p, &bsd);
+ return sched_setscheduler(td, &bsd);
}
int
-linux_sched_getscheduler(struct proc *p,
+linux_sched_getscheduler(struct thread *td,
struct linux_sched_getscheduler_args *args)
{
struct sched_getscheduler_args bsd;
@@ -1213,17 +1214,17 @@ linux_sched_getscheduler(struct proc *p,
#endif
bsd.pid = args->pid;
- error = sched_getscheduler(p, &bsd);
+ error = sched_getscheduler(td, &bsd);
- switch (p->p_retval[0]) {
+ switch (td->td_retval[0]) {
case SCHED_OTHER:
- p->p_retval[0] = LINUX_SCHED_OTHER;
+ td->td_retval[0] = LINUX_SCHED_OTHER;
break;
case SCHED_FIFO:
- p->p_retval[0] = LINUX_SCHED_FIFO;
+ td->td_retval[0] = LINUX_SCHED_FIFO;
break;
case SCHED_RR:
- p->p_retval[0] = LINUX_SCHED_RR;
+ td->td_retval[0] = LINUX_SCHED_RR;
break;
}
@@ -1231,7 +1232,7 @@ linux_sched_getscheduler(struct proc *p,
}
int
-linux_sched_get_priority_max(struct proc *p,
+linux_sched_get_priority_max(struct thread *td,
struct linux_sched_get_priority_max_args *args)
{
struct sched_get_priority_max_args bsd;
@@ -1254,11 +1255,11 @@ linux_sched_get_priority_max(struct proc *p,
default:
return EINVAL;
}
- return sched_get_priority_max(p, &bsd);
+ return sched_get_priority_max(td, &bsd);
}
int
-linux_sched_get_priority_min(struct proc *p,
+linux_sched_get_priority_min(struct thread *td,
struct linux_sched_get_priority_min_args *args)
{
struct sched_get_priority_min_args bsd;
@@ -1281,7 +1282,7 @@ linux_sched_get_priority_min(struct proc *p,
default:
return EINVAL;
}
- return sched_get_priority_min(p, &bsd);
+ return sched_get_priority_min(td, &bsd);
}
#define REBOOT_CAD_ON 0x89abcdef
@@ -1289,7 +1290,7 @@ linux_sched_get_priority_min(struct proc *p,
#define REBOOT_HALT 0xcdef0123
int
-linux_reboot(struct proc *p, struct linux_reboot_args *args)
+linux_reboot(struct thread *td, struct linux_reboot_args *args)
{
struct reboot_args bsd_args;
@@ -1300,12 +1301,12 @@ linux_reboot(struct proc *p, struct linux_reboot_args *args)
if (args->cmd == REBOOT_CAD_ON || args->cmd == REBOOT_CAD_OFF)
return (0);
bsd_args.opt = (args->cmd == REBOOT_HALT) ? RB_HALT : 0;
- return (reboot(p, &bsd_args));
+ return (reboot(td, &bsd_args));
}
/*
* The FreeBSD native getpid(2), getgid(2) and getuid(2) also modify
- * p->p_retval[1] when COMPAT_43 or COMPAT_SUNOS is defined. This
+ * td->td_retval[1] when COMPAT_43 or COMPAT_SUNOS is defined. This
* globbers registers that are assumed to be preserved. The following
* lightweight syscalls fixes this. See also linux_getgid16() and
* linux_getuid16() in linux_uid16.c.
@@ -1316,22 +1317,25 @@ linux_reboot(struct proc *p, struct linux_reboot_args *args)
*/
int
-linux_getpid(struct proc *p, struct linux_getpid_args *args)
+linux_getpid(struct thread *td, struct linux_getpid_args *args)
{
- p->p_retval[0] = p->p_pid;
+
+ td->td_retval[0] = td->td_proc->p_pid;
return (0);
}
int
-linux_getgid(struct proc *p, struct linux_getgid_args *args)
+linux_getgid(struct thread *td, struct linux_getgid_args *args)
{
- p->p_retval[0] = p->p_ucred->cr_rgid;
+
+ td->td_retval[0] = td->td_proc->p_ucred->cr_rgid;
return (0);
}
int
-linux_getuid(struct proc *p, struct linux_getuid_args *args)
+linux_getuid(struct thread *td, struct linux_getuid_args *args)
{
- p->p_retval[0] = p->p_ucred->cr_ruid;
+
+ td->td_retval[0] = td->td_proc->p_ucred->cr_ruid;
return (0);
}
diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c
index 24a540f..ccc30f0 100644
--- a/sys/compat/linux/linux_signal.c
+++ b/sys/compat/linux/linux_signal.c
@@ -131,7 +131,7 @@ bsd_to_linux_sigaction(struct sigaction *bsa, l_sigaction_t *lsa)
}
int
-linux_do_sigaction(struct proc *p, int linux_sig, l_sigaction_t *linux_nsa,
+linux_do_sigaction(struct thread *td, int linux_sig, l_sigaction_t *linux_nsa,
l_sigaction_t *linux_osa)
{
struct sigaction *nsa, *osa;
@@ -163,7 +163,7 @@ linux_do_sigaction(struct proc *p, int linux_sig, l_sigaction_t *linux_nsa,
sa_args.act = nsa;
sa_args.oact = osa;
- error = sigaction(p, &sa_args);
+ error = sigaction(td, &sa_args);
if (error)
return (error);
@@ -176,7 +176,7 @@ linux_do_sigaction(struct proc *p, int linux_sig, l_sigaction_t *linux_nsa,
#ifndef __alpha__
int
-linux_signal(struct proc *p, struct linux_signal_args *args)
+linux_signal(struct thread *td, struct linux_signal_args *args)
{
l_sigaction_t nsa, osa;
int error;
@@ -191,15 +191,15 @@ linux_signal(struct proc *p, struct linux_signal_args *args)
nsa.lsa_flags = LINUX_SA_ONESHOT | LINUX_SA_NOMASK;
LINUX_SIGEMPTYSET(nsa.lsa_mask);
- error = linux_do_sigaction(p, args->sig, &nsa, &osa);
- p->p_retval[0] = (int)osa.lsa_handler;
+ error = linux_do_sigaction(td, args->sig, &nsa, &osa);
+ td->td_retval[0] = (int)osa.lsa_handler;
return (error);
}
#endif /*!__alpha__*/
int
-linux_rt_sigaction(struct proc *p, struct linux_rt_sigaction_args *args)
+linux_rt_sigaction(struct thread *td, struct linux_rt_sigaction_args *args)
{
l_sigaction_t nsa, osa;
int error;
@@ -220,7 +220,7 @@ linux_rt_sigaction(struct proc *p, struct linux_rt_sigaction_args *args)
return (error);
}
- error = linux_do_sigaction(p, args->sig,
+ error = linux_do_sigaction(td, args->sig,
args->act ? &nsa : NULL,
args->oact ? &osa : NULL);
@@ -232,14 +232,15 @@ linux_rt_sigaction(struct proc *p, struct linux_rt_sigaction_args *args)
}
static int
-linux_do_sigprocmask(struct proc *p, int how, l_sigset_t *new,
+linux_do_sigprocmask(struct thread *td, int how, l_sigset_t *new,
l_sigset_t *old)
{
int error;
sigset_t mask;
+ struct proc *p = td->td_proc;
error = 0;
- p->p_retval[0] = 0;
+ td->td_retval[0] = 0;
PROC_LOCK(p);
if (old != NULL)
@@ -272,7 +273,7 @@ linux_do_sigprocmask(struct proc *p, int how, l_sigset_t *new,
#ifndef __alpha__
int
-linux_sigprocmask(struct proc *p, struct linux_sigprocmask_args *args)
+linux_sigprocmask(struct thread *td, struct linux_sigprocmask_args *args)
{
l_osigset_t mask;
l_sigset_t set, oset;
@@ -291,7 +292,7 @@ linux_sigprocmask(struct proc *p, struct linux_sigprocmask_args *args)
set.__bits[0] = mask;
}
- error = linux_do_sigprocmask(p, args->how,
+ error = linux_do_sigprocmask(td, args->how,
args->mask ? &set : NULL,
args->omask ? &oset : NULL);
@@ -305,7 +306,7 @@ linux_sigprocmask(struct proc *p, struct linux_sigprocmask_args *args)
#endif /*!__alpha__*/
int
-linux_rt_sigprocmask(struct proc *p, struct linux_rt_sigprocmask_args *args)
+linux_rt_sigprocmask(struct thread *td, struct linux_rt_sigprocmask_args *args)
{
l_sigset_t set, oset;
int error;
@@ -326,7 +327,7 @@ linux_rt_sigprocmask(struct proc *p, struct linux_rt_sigprocmask_args *args)
return (error);
}
- error = linux_do_sigprocmask(p, args->how,
+ error = linux_do_sigprocmask(td, args->how,
args->mask ? &set : NULL,
args->omask ? &oset : NULL);
@@ -339,8 +340,9 @@ linux_rt_sigprocmask(struct proc *p, struct linux_rt_sigprocmask_args *args)
#ifndef __alpha__
int
-linux_sgetmask(struct proc *p, struct linux_sgetmask_args *args)
+linux_sgetmask(struct thread *td, struct linux_sgetmask_args *args)
{
+ struct proc *p = td->td_proc;
l_sigset_t mask;
#ifdef DEBUG
@@ -351,13 +353,14 @@ linux_sgetmask(struct proc *p, struct linux_sgetmask_args *args)
PROC_LOCK(p);
bsd_to_linux_sigset(&p->p_sigmask, &mask);
PROC_UNLOCK(p);
- p->p_retval[0] = mask.__bits[0];
+ td->td_retval[0] = mask.__bits[0];
return (0);
}
int
-linux_ssetmask(struct proc *p, struct linux_ssetmask_args *args)
+linux_ssetmask(struct thread *td, struct linux_ssetmask_args *args)
{
+ struct proc *p = td->td_proc;
l_sigset_t lset;
sigset_t bset;
@@ -368,7 +371,7 @@ linux_ssetmask(struct proc *p, struct linux_ssetmask_args *args)
PROC_LOCK(p);
bsd_to_linux_sigset(&p->p_sigmask, &lset);
- p->p_retval[0] = lset.__bits[0];
+ td->td_retval[0] = lset.__bits[0];
LINUX_SIGEMPTYSET(lset);
lset.__bits[0] = args->mask;
linux_to_bsd_sigset(&lset, &bset);
@@ -379,8 +382,9 @@ linux_ssetmask(struct proc *p, struct linux_ssetmask_args *args)
}
int
-linux_sigpending(struct proc *p, struct linux_sigpending_args *args)
+linux_sigpending(struct thread *td, struct linux_sigpending_args *args)
{
+ struct proc *p = td->td_proc;
sigset_t bset;
l_sigset_t lset;
l_osigset_t mask;
@@ -401,7 +405,7 @@ linux_sigpending(struct proc *p, struct linux_sigpending_args *args)
#endif /*!__alpha__*/
int
-linux_kill(struct proc *p, struct linux_kill_args *args)
+linux_kill(struct thread *td, struct linux_kill_args *args)
{
struct kill_args /* {
int pid;
@@ -427,5 +431,5 @@ linux_kill(struct proc *p, struct linux_kill_args *args)
tmp.signum = args->signum;
tmp.pid = args->pid;
- return (kill(p, &tmp));
+ return (kill(td, &tmp));
}
diff --git a/sys/compat/linux/linux_signal.h b/sys/compat/linux/linux_signal.h
index e9dcec0..8d0825b 100644
--- a/sys/compat/linux/linux_signal.h
+++ b/sys/compat/linux/linux_signal.h
@@ -33,7 +33,7 @@
void linux_to_bsd_sigset __P((l_sigset_t *, sigset_t *));
void bsd_to_linux_sigset __P((sigset_t *, l_sigset_t *));
-int linux_do_sigaction __P((struct proc *, int, l_sigaction_t *,
+int linux_do_sigaction __P((struct thread *, int, l_sigaction_t *,
l_sigaction_t *));
#endif /* _LINUX_SIGNAL_H_ */
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index ac73dde..de74054 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -187,7 +187,7 @@ linux_to_bsd_msg_flags(int flags)
/* Return 0 if IP_HDRINCL is set for the given socket. */
static int
-linux_check_hdrincl(struct proc *p, int s)
+linux_check_hdrincl(struct thread *td, int s)
{
struct getsockopt_args /* {
int s;
@@ -213,7 +213,7 @@ linux_check_hdrincl(struct proc *p, int s)
bsd_args.name = IP_HDRINCL;
bsd_args.val = val;
bsd_args.avalsize = (int *)valsize;
- if ((error = getsockopt(p, &bsd_args)))
+ if ((error = getsockopt(td, &bsd_args)))
return (error);
if ((error = copyin(val, &optval, sizeof(optval))))
@@ -227,7 +227,7 @@ linux_check_hdrincl(struct proc *p, int s)
* tweak endian-dependent fields in the IP packet.
*/
static int
-linux_sendto_hdrincl(struct proc *p, struct sendto_args *bsd_args)
+linux_sendto_hdrincl(struct thread *td, struct sendto_args *bsd_args)
{
/*
* linux_ip_copysize defines how many bytes we should copy
@@ -288,7 +288,7 @@ linux_sendto_hdrincl(struct proc *p, struct sendto_args *bsd_args)
sendmsg_args.s = bsd_args->s;
sendmsg_args.msg = (caddr_t)msg;
sendmsg_args.flags = bsd_args->flags;
- return (sendmsg(p, &sendmsg_args));
+ return (sendmsg(td, &sendmsg_args));
}
struct linux_socket_args {
@@ -298,7 +298,7 @@ struct linux_socket_args {
};
static int
-linux_socket(struct proc *p, struct linux_socket_args *args)
+linux_socket(struct thread *td, struct linux_socket_args *args)
{
struct linux_socket_args linux_args;
struct socket_args /* {
@@ -318,7 +318,7 @@ linux_socket(struct proc *p, struct linux_socket_args *args)
if (bsd_args.domain == -1)
return (EINVAL);
- retval_socket = socket(p, &bsd_args);
+ retval_socket = socket(td, &bsd_args);
if (bsd_args.type == SOCK_RAW
&& (bsd_args.protocol == IPPROTO_RAW || bsd_args.protocol == 0)
&& bsd_args.domain == AF_INET
@@ -337,15 +337,15 @@ linux_socket(struct proc *p, struct linux_socket_args *args)
sg = stackgap_init();
hdrincl = (int *)stackgap_alloc(&sg, sizeof(*hdrincl));
*hdrincl = 1;
- bsd_setsockopt_args.s = p->p_retval[0];
+ bsd_setsockopt_args.s = td->td_retval[0];
bsd_setsockopt_args.level = IPPROTO_IP;
bsd_setsockopt_args.name = IP_HDRINCL;
bsd_setsockopt_args.val = (caddr_t)hdrincl;
bsd_setsockopt_args.valsize = sizeof(*hdrincl);
/* We ignore any error returned by setsockopt() */
- setsockopt(p, &bsd_setsockopt_args);
+ setsockopt(td, &bsd_setsockopt_args);
/* Copy back the return value from socket() */
- p->p_retval[0] = bsd_setsockopt_args.s;
+ td->td_retval[0] = bsd_setsockopt_args.s;
}
return (retval_socket);
@@ -358,7 +358,7 @@ struct linux_bind_args {
};
static int
-linux_bind(struct proc *p, struct linux_bind_args *args)
+linux_bind(struct thread *td, struct linux_bind_args *args)
{
struct linux_bind_args linux_args;
struct bind_args /* {
@@ -374,7 +374,7 @@ linux_bind(struct proc *p, struct linux_bind_args *args)
bsd_args.s = linux_args.s;
bsd_args.name = (caddr_t)linux_args.name;
bsd_args.namelen = linux_args.namelen;
- return (bind(p, &bsd_args));
+ return (bind(td, &bsd_args));
}
struct linux_connect_args {
@@ -382,11 +382,11 @@ struct linux_connect_args {
struct sockaddr * name;
int namelen;
};
-int linux_connect(struct proc *, struct linux_connect_args *);
+int linux_connect(struct thread *, struct linux_connect_args *);
#endif /* !__alpha__*/
int
-linux_connect(struct proc *p, struct linux_connect_args *args)
+linux_connect(struct thread *td, struct linux_connect_args *args)
{
struct linux_connect_args linux_args;
struct connect_args /* {
@@ -408,7 +408,7 @@ linux_connect(struct proc *p, struct linux_connect_args *args)
bsd_args.s = linux_args.s;
bsd_args.name = (caddr_t)linux_args.name;
bsd_args.namelen = linux_args.namelen;
- error = connect(p, &bsd_args);
+ error = connect(td, &bsd_args);
if (error != EISCONN)
return (error);
@@ -417,7 +417,7 @@ linux_connect(struct proc *p, struct linux_connect_args *args)
* when on a non-blocking socket. Instead it returns the
* error getsockopt(SOL_SOCKET, SO_ERROR) would return on BSD.
*/
- error = holdsock(p->p_fd, linux_args.s, &fp);
+ error = holdsock(td->td_proc->p_fd, linux_args.s, &fp);
if (error)
return (error);
error = EISCONN;
@@ -427,7 +427,7 @@ linux_connect(struct proc *p, struct linux_connect_args *args)
error = so->so_error;
so->so_emuldata = (void *)1;
}
- fdrop(fp, p);
+ fdrop(fp, td);
return (error);
}
@@ -439,7 +439,7 @@ struct linux_listen_args {
};
static int
-linux_listen(struct proc *p, struct linux_listen_args *args)
+linux_listen(struct thread *td, struct linux_listen_args *args)
{
struct linux_listen_args linux_args;
struct listen_args /* {
@@ -453,7 +453,7 @@ linux_listen(struct proc *p, struct linux_listen_args *args)
bsd_args.s = linux_args.s;
bsd_args.backlog = linux_args.backlog;
- return (listen(p, &bsd_args));
+ return (listen(td, &bsd_args));
}
struct linux_accept_args {
@@ -463,7 +463,7 @@ struct linux_accept_args {
};
static int
-linux_accept(struct proc *p, struct linux_accept_args *args)
+linux_accept(struct thread *td, struct linux_accept_args *args)
{
struct linux_accept_args linux_args;
struct accept_args /* {
@@ -484,7 +484,7 @@ linux_accept(struct proc *p, struct linux_accept_args *args)
bsd_args.s = linux_args.s;
bsd_args.name = (caddr_t)linux_args.addr;
bsd_args.anamelen = linux_args.namelen;
- error = oaccept(p, &bsd_args);
+ error = oaccept(td, &bsd_args);
if (error)
return (error);
@@ -493,11 +493,11 @@ linux_accept(struct proc *p, struct linux_accept_args *args)
* accepted one, so we must clear the flags in the new descriptor.
* Ignore any errors, because we already have an open fd.
*/
- f_args.fd = p->p_retval[0];
+ f_args.fd = td->td_retval[0];
f_args.cmd = F_SETFL;
f_args.arg = 0;
- (void)fcntl(p, &f_args);
- p->p_retval[0] = f_args.fd;
+ (void)fcntl(td, &f_args);
+ td->td_retval[0] = f_args.fd;
return (0);
}
@@ -508,7 +508,7 @@ struct linux_getsockname_args {
};
static int
-linux_getsockname(struct proc *p, struct linux_getsockname_args *args)
+linux_getsockname(struct thread *td, struct linux_getsockname_args *args)
{
struct linux_getsockname_args linux_args;
struct getsockname_args /* {
@@ -524,7 +524,7 @@ linux_getsockname(struct proc *p, struct linux_getsockname_args *args)
bsd_args.fdes = linux_args.s;
bsd_args.asa = (caddr_t) linux_args.addr;
bsd_args.alen = linux_args.namelen;
- return (ogetsockname(p, &bsd_args));
+ return (ogetsockname(td, &bsd_args));
}
struct linux_getpeername_args {
@@ -534,7 +534,7 @@ struct linux_getpeername_args {
};
static int
-linux_getpeername(struct proc *p, struct linux_getpeername_args *args)
+linux_getpeername(struct thread *td, struct linux_getpeername_args *args)
{
struct linux_getpeername_args linux_args;
struct ogetpeername_args /* {
@@ -550,7 +550,7 @@ linux_getpeername(struct proc *p, struct linux_getpeername_args *args)
bsd_args.fdes = linux_args.s;
bsd_args.asa = (caddr_t) linux_args.addr;
bsd_args.alen = linux_args.namelen;
- return (ogetpeername(p, &bsd_args));
+ return (ogetpeername(td, &bsd_args));
}
struct linux_socketpair_args {
@@ -561,7 +561,7 @@ struct linux_socketpair_args {
};
static int
-linux_socketpair(struct proc *p, struct linux_socketpair_args *args)
+linux_socketpair(struct thread *td, struct linux_socketpair_args *args)
{
struct linux_socketpair_args linux_args;
struct socketpair_args /* {
@@ -582,7 +582,7 @@ linux_socketpair(struct proc *p, struct linux_socketpair_args *args)
bsd_args.type = linux_args.type;
bsd_args.protocol = linux_args.protocol;
bsd_args.rsv = linux_args.rsv;
- return (socketpair(p, &bsd_args));
+ return (socketpair(td, &bsd_args));
}
struct linux_send_args {
@@ -593,7 +593,7 @@ struct linux_send_args {
};
static int
-linux_send(struct proc *p, struct linux_send_args *args)
+linux_send(struct thread *td, struct linux_send_args *args)
{
struct linux_send_args linux_args;
struct osend_args /* {
@@ -611,7 +611,7 @@ linux_send(struct proc *p, struct linux_send_args *args)
bsd_args.buf = linux_args.msg;
bsd_args.len = linux_args.len;
bsd_args.flags = linux_args.flags;
- return (osend(p, &bsd_args));
+ return (osend(td, &bsd_args));
}
struct linux_recv_args {
@@ -622,7 +622,7 @@ struct linux_recv_args {
};
static int
-linux_recv(struct proc *p, struct linux_recv_args *args)
+linux_recv(struct thread *td, struct linux_recv_args *args)
{
struct linux_recv_args linux_args;
struct orecv_args /* {
@@ -640,7 +640,7 @@ linux_recv(struct proc *p, struct linux_recv_args *args)
bsd_args.buf = linux_args.msg;
bsd_args.len = linux_args.len;
bsd_args.flags = linux_args.flags;
- return (orecv(p, &bsd_args));
+ return (orecv(td, &bsd_args));
}
struct linux_sendto_args {
@@ -653,7 +653,7 @@ struct linux_sendto_args {
};
static int
-linux_sendto(struct proc *p, struct linux_sendto_args *args)
+linux_sendto(struct thread *td, struct linux_sendto_args *args)
{
struct linux_sendto_args linux_args;
struct sendto_args /* {
@@ -676,11 +676,11 @@ linux_sendto(struct proc *p, struct linux_sendto_args *args)
bsd_args.to = linux_args.to;
bsd_args.tolen = linux_args.tolen;
- if (linux_check_hdrincl(p, linux_args.s) == 0)
+ if (linux_check_hdrincl(td, linux_args.s) == 0)
/* IP_HDRINCL set, tweak the packet before sending */
- return (linux_sendto_hdrincl(p, &bsd_args));
+ return (linux_sendto_hdrincl(td, &bsd_args));
- return (sendto(p, &bsd_args));
+ return (sendto(td, &bsd_args));
}
struct linux_recvfrom_args {
@@ -693,7 +693,7 @@ struct linux_recvfrom_args {
};
static int
-linux_recvfrom(struct proc *p, struct linux_recvfrom_args *args)
+linux_recvfrom(struct thread *td, struct linux_recvfrom_args *args)
{
struct linux_recvfrom_args linux_args;
struct recvfrom_args /* {
@@ -715,7 +715,7 @@ linux_recvfrom(struct proc *p, struct linux_recvfrom_args *args)
bsd_args.flags = linux_to_bsd_msg_flags(linux_args.flags);
bsd_args.from = linux_args.from;
bsd_args.fromlenaddr = linux_args.fromlen;
- return (orecvfrom(p, &bsd_args));
+ return (orecvfrom(td, &bsd_args));
}
struct linux_recvmsg_args {
@@ -725,7 +725,7 @@ struct linux_recvmsg_args {
};
static int
-linux_recvmsg(struct proc *p, struct linux_recvmsg_args *args)
+linux_recvmsg(struct thread *td, struct linux_recvmsg_args *args)
{
struct linux_recvmsg_args linux_args;
struct recvmsg_args /* {
@@ -741,7 +741,7 @@ linux_recvmsg(struct proc *p, struct linux_recvmsg_args *args)
bsd_args.s = linux_args.s;
bsd_args.msg = linux_args.msg;
bsd_args.flags = linux_to_bsd_msg_flags(linux_args.flags);
- return (recvmsg(p, &bsd_args));
+ return (recvmsg(td, &bsd_args));
}
struct linux_shutdown_args {
@@ -750,7 +750,7 @@ struct linux_shutdown_args {
};
static int
-linux_shutdown(struct proc *p, struct linux_shutdown_args *args)
+linux_shutdown(struct thread *td, struct linux_shutdown_args *args)
{
struct linux_shutdown_args linux_args;
struct shutdown_args /* {
@@ -764,7 +764,7 @@ linux_shutdown(struct proc *p, struct linux_shutdown_args *args)
bsd_args.s = linux_args.s;
bsd_args.how = linux_args.how;
- return (shutdown(p, &bsd_args));
+ return (shutdown(td, &bsd_args));
}
struct linux_setsockopt_args {
@@ -776,7 +776,7 @@ struct linux_setsockopt_args {
};
static int
-linux_setsockopt(struct proc *p, struct linux_setsockopt_args *args)
+linux_setsockopt(struct thread *td, struct linux_setsockopt_args *args)
{
struct linux_setsockopt_args linux_args;
struct setsockopt_args /* {
@@ -814,7 +814,7 @@ linux_setsockopt(struct proc *p, struct linux_setsockopt_args *args)
bsd_args.name = name;
bsd_args.val = linux_args.optval;
bsd_args.valsize = linux_args.optlen;
- return (setsockopt(p, &bsd_args));
+ return (setsockopt(td, &bsd_args));
}
struct linux_getsockopt_args {
@@ -826,7 +826,7 @@ struct linux_getsockopt_args {
};
static int
-linux_getsockopt(struct proc *p, struct linux_getsockopt_args *args)
+linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args)
{
struct linux_getsockopt_args linux_args;
struct getsockopt_args /* {
@@ -864,45 +864,45 @@ linux_getsockopt(struct proc *p, struct linux_getsockopt_args *args)
bsd_args.name = name;
bsd_args.val = linux_args.optval;
bsd_args.avalsize = linux_args.optlen;
- return (getsockopt(p, &bsd_args));
+ return (getsockopt(td, &bsd_args));
}
int
-linux_socketcall(struct proc *p, struct linux_socketcall_args *args)
+linux_socketcall(struct thread *td, struct linux_socketcall_args *args)
{
void *arg = (void *)args->args;
switch (args->what) {
case LINUX_SOCKET:
- return (linux_socket(p, arg));
+ return (linux_socket(td, arg));
case LINUX_BIND:
- return (linux_bind(p, arg));
+ return (linux_bind(td, arg));
case LINUX_CONNECT:
- return (linux_connect(p, arg));
+ return (linux_connect(td, arg));
case LINUX_LISTEN:
- return (linux_listen(p, arg));
+ return (linux_listen(td, arg));
case LINUX_ACCEPT:
- return (linux_accept(p, arg));
+ return (linux_accept(td, arg));
case LINUX_GETSOCKNAME:
- return (linux_getsockname(p, arg));
+ return (linux_getsockname(td, arg));
case LINUX_GETPEERNAME:
- return (linux_getpeername(p, arg));
+ return (linux_getpeername(td, arg));
case LINUX_SOCKETPAIR:
- return (linux_socketpair(p, arg));
+ return (linux_socketpair(td, arg));
case LINUX_SEND:
- return (linux_send(p, arg));
+ return (linux_send(td, arg));
case LINUX_RECV:
- return (linux_recv(p, arg));
+ return (linux_recv(td, arg));
case LINUX_SENDTO:
- return (linux_sendto(p, arg));
+ return (linux_sendto(td, arg));
case LINUX_RECVFROM:
- return (linux_recvfrom(p, arg));
+ return (linux_recvfrom(td, arg));
case LINUX_SHUTDOWN:
- return (linux_shutdown(p, arg));
+ return (linux_shutdown(td, arg));
case LINUX_SETSOCKOPT:
- return (linux_setsockopt(p, arg));
+ return (linux_setsockopt(td, arg));
case LINUX_GETSOCKOPT:
- return (linux_getsockopt(p, arg));
+ return (linux_getsockopt(td, arg));
case LINUX_SENDMSG:
do {
int error;
@@ -940,10 +940,10 @@ linux_socketcall(struct proc *p, struct linux_socketcall_args *args)
return (error);
}
done:
- return (sendmsg(p, arg));
+ return (sendmsg(td, arg));
} while (0);
case LINUX_RECVMSG:
- return (linux_recvmsg(p, arg));
+ return (linux_recvmsg(td, arg));
}
uprintf("LINUX: 'socket' typ=%d not implemented\n", args->what);
diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c
index 5d1572b..d0c8ea2 100644
--- a/sys/compat/linux/linux_stats.c
+++ b/sys/compat/linux/linux_stats.c
@@ -87,7 +87,7 @@ newstat_copyout(struct stat *buf, void *ubuf)
}
int
-linux_newstat(struct proc *p, struct linux_newstat_args *args)
+linux_newstat(struct thread *td, struct linux_newstat_args *args)
{
struct stat buf;
struct nameidata nd;
@@ -95,7 +95,7 @@ linux_newstat(struct proc *p, struct linux_newstat_args *args)
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->path);
+ CHECKALTEXIST(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(newstat))
@@ -103,13 +103,13 @@ linux_newstat(struct proc *p, struct linux_newstat_args *args)
#endif
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE,
- args->path, p);
+ args->path, td);
error = namei(&nd);
if (error)
return (error);
NDFREE(&nd, NDF_ONLY_PNBUF);
- error = vn_stat(nd.ni_vp, &buf, p);
+ error = vn_stat(nd.ni_vp, &buf, td);
vput(nd.ni_vp);
if (error)
return (error);
@@ -118,7 +118,7 @@ linux_newstat(struct proc *p, struct linux_newstat_args *args)
}
int
-linux_newlstat(struct proc *p, struct linux_newlstat_args *args)
+linux_newlstat(struct thread *td, struct linux_newlstat_args *args)
{
int error;
struct stat sb;
@@ -126,7 +126,7 @@ linux_newlstat(struct proc *p, struct linux_newlstat_args *args)
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->path);
+ CHECKALTEXIST(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(newlstat))
@@ -134,13 +134,13 @@ linux_newlstat(struct proc *p, struct linux_newlstat_args *args)
#endif
NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE,
- args->path, p);
+ args->path, td);
error = namei(&nd);
if (error)
return (error);
NDFREE(&nd, NDF_ONLY_PNBUF);
- error = vn_stat(nd.ni_vp, &sb, p);
+ error = vn_stat(nd.ni_vp, &sb, td);
vput(nd.ni_vp);
if (error)
return (error);
@@ -149,7 +149,7 @@ linux_newlstat(struct proc *p, struct linux_newlstat_args *args)
}
int
-linux_newfstat(struct proc *p, struct linux_newfstat_args *args)
+linux_newfstat(struct thread *td, struct linux_newfstat_args *args)
{
struct filedesc *fdp;
struct file *fp;
@@ -161,12 +161,12 @@ linux_newfstat(struct proc *p, struct linux_newfstat_args *args)
printf(ARGS(newfstat, "%d, *"), args->fd);
#endif
- fdp = p->p_fd;
+ fdp = td->td_proc->p_fd;
if ((unsigned)args->fd >= fdp->fd_nfiles ||
(fp = fdp->fd_ofiles[args->fd]) == NULL)
return (EBADF);
- error = fo_stat(fp, &buf, p);
+ error = fo_stat(fp, &buf, td);
if (!error)
error = newstat_copyout(&buf, args->buf);
@@ -235,7 +235,7 @@ bsd_to_linux_ftype(int tag)
}
int
-linux_statfs(struct proc *p, struct linux_statfs_args *args)
+linux_statfs(struct thread *td, struct linux_statfs_args *args)
{
struct mount *mp;
struct nameidata *ndp;
@@ -246,14 +246,14 @@ linux_statfs(struct proc *p, struct linux_statfs_args *args)
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->path);
+ CHECKALTEXIST(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(statfs))
printf(ARGS(statfs, "%s, *"), args->path);
#endif
ndp = &nd;
- NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args->path, curproc);
+ NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args->path, curthread);
error = namei(ndp);
if (error)
return error;
@@ -261,7 +261,7 @@ linux_statfs(struct proc *p, struct linux_statfs_args *args)
mp = ndp->ni_vp->v_mount;
bsd_statfs = &mp->mnt_stat;
vrele(ndp->ni_vp);
- error = VFS_STATFS(mp, bsd_statfs, p);
+ error = VFS_STATFS(mp, bsd_statfs, td);
if (error)
return error;
bsd_statfs->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
@@ -280,7 +280,7 @@ linux_statfs(struct proc *p, struct linux_statfs_args *args)
}
int
-linux_fstatfs(struct proc *p, struct linux_fstatfs_args *args)
+linux_fstatfs(struct thread *td, struct linux_fstatfs_args *args)
{
struct file *fp;
struct mount *mp;
@@ -292,12 +292,12 @@ linux_fstatfs(struct proc *p, struct linux_fstatfs_args *args)
if (ldebug(fstatfs))
printf(ARGS(fstatfs, "%d, *"), args->fd);
#endif
- error = getvnode(p->p_fd, args->fd, &fp);
+ error = getvnode(td->td_proc->p_fd, args->fd, &fp);
if (error)
return error;
mp = ((struct vnode *)fp->f_data)->v_mount;
bsd_statfs = &mp->mnt_stat;
- error = VFS_STATFS(mp, bsd_statfs, p);
+ error = VFS_STATFS(mp, bsd_statfs, td);
if (error)
return error;
bsd_statfs->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
@@ -324,7 +324,7 @@ struct l_ustat
};
int
-linux_ustat(struct proc *p, struct linux_ustat_args *args)
+linux_ustat(struct thread *td, struct linux_ustat_args *args)
{
struct l_ustat lu;
dev_t dev;
@@ -355,7 +355,7 @@ linux_ustat(struct proc *p, struct linux_ustat_args *args)
if (vp->v_mount == NULL)
return (EINVAL);
stat = &(vp->v_mount->mnt_stat);
- error = VFS_STATFS(vp->v_mount, stat, p);
+ error = VFS_STATFS(vp->v_mount, stat, td);
if (error)
return (error);
@@ -400,7 +400,7 @@ stat64_copyout(struct stat *buf, void *ubuf)
}
int
-linux_stat64(struct proc *p, struct linux_stat64_args *args)
+linux_stat64(struct thread *td, struct linux_stat64_args *args)
{
struct stat buf;
struct nameidata nd;
@@ -408,7 +408,7 @@ linux_stat64(struct proc *p, struct linux_stat64_args *args)
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->filename);
+ CHECKALTEXIST(td, &sg, args->filename);
#ifdef DEBUG
if (ldebug(stat64))
@@ -416,13 +416,13 @@ linux_stat64(struct proc *p, struct linux_stat64_args *args)
#endif
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE,
- args->filename, p);
+ args->filename, td);
error = namei(&nd);
if (error)
return (error);
NDFREE(&nd, NDF_ONLY_PNBUF);
- error = vn_stat(nd.ni_vp, &buf, p);
+ error = vn_stat(nd.ni_vp, &buf, td);
vput(nd.ni_vp);
if (error)
return (error);
@@ -431,7 +431,7 @@ linux_stat64(struct proc *p, struct linux_stat64_args *args)
}
int
-linux_lstat64(struct proc *p, struct linux_lstat64_args *args)
+linux_lstat64(struct thread *td, struct linux_lstat64_args *args)
{
int error;
struct stat sb;
@@ -439,7 +439,7 @@ linux_lstat64(struct proc *p, struct linux_lstat64_args *args)
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->filename);
+ CHECKALTEXIST(td, &sg, args->filename);
#ifdef DEBUG
if (ldebug(lstat64))
@@ -447,13 +447,13 @@ linux_lstat64(struct proc *p, struct linux_lstat64_args *args)
#endif
NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE,
- args->filename, p);
+ args->filename, td);
error = namei(&nd);
if (error)
return (error);
NDFREE(&nd, NDF_ONLY_PNBUF);
- error = vn_stat(nd.ni_vp, &sb, p);
+ error = vn_stat(nd.ni_vp, &sb, td);
vput(nd.ni_vp);
if (error)
return (error);
@@ -462,7 +462,7 @@ linux_lstat64(struct proc *p, struct linux_lstat64_args *args)
}
int
-linux_fstat64(struct proc *p, struct linux_fstat64_args *args)
+linux_fstat64(struct thread *td, struct linux_fstat64_args *args)
{
struct filedesc *fdp;
struct file *fp;
@@ -474,12 +474,12 @@ linux_fstat64(struct proc *p, struct linux_fstat64_args *args)
printf(ARGS(fstat64, "%d, *"), args->fd);
#endif
- fdp = p->p_fd;
+ fdp = td->td_proc->p_fd;
if ((unsigned)args->fd >= fdp->fd_nfiles ||
(fp = fdp->fd_ofiles[args->fd]) == NULL)
return (EBADF);
- error = fo_stat(fp, &buf, p);
+ error = fo_stat(fp, &buf, td);
if (!error)
error = stat64_copyout(&buf, args->statbuf);
diff --git a/sys/compat/linux/linux_sysctl.c b/sys/compat/linux/linux_sysctl.c
index 14c5a6f..98dab20 100644
--- a/sys/compat/linux/linux_sysctl.c
+++ b/sys/compat/linux/linux_sysctl.c
@@ -75,7 +75,7 @@ handle_string(struct l___sysctl_args *la, char *value)
}
int
-linux_sysctl(struct proc *p, struct linux_sysctl_args *args)
+linux_sysctl(struct thread *td, struct linux_sysctl_args *args)
{
struct l___sysctl_args la;
l_int *mib;
diff --git a/sys/compat/linux/linux_uid16.c b/sys/compat/linux/linux_uid16.c
index c6a1c12..80e5763 100644
--- a/sys/compat/linux/linux_uid16.c
+++ b/sys/compat/linux/linux_uid16.c
@@ -43,13 +43,13 @@ DUMMY(getresuid16);
DUMMY(getresgid16);
int
-linux_chown16(struct proc *p, struct linux_chown16_args *args)
+linux_chown16(struct thread *td, struct linux_chown16_args *args)
{
struct chown_args bsd;
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->path);
+ CHECKALTEXIST(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(chown16))
@@ -60,17 +60,17 @@ linux_chown16(struct proc *p, struct linux_chown16_args *args)
bsd.path = args->path;
bsd.uid = args->uid;
bsd.gid = args->gid;
- return (chown(p, &bsd));
+ return (chown(td, &bsd));
}
int
-linux_lchown16(struct proc *p, struct linux_lchown16_args *args)
+linux_lchown16(struct thread *td, struct linux_lchown16_args *args)
{
struct lchown_args bsd;
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->path);
+ CHECKALTEXIST(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(lchown16))
@@ -81,11 +81,11 @@ linux_lchown16(struct proc *p, struct linux_lchown16_args *args)
bsd.path = args->path;
bsd.uid = args->uid;
bsd.gid = args->gid;
- return (lchown(p, &bsd));
+ return (lchown(td, &bsd));
}
int
-linux_setgroups16(struct proc *p, struct linux_setgroups16_args *args)
+linux_setgroups16(struct thread *td, struct linux_setgroups16_args *args)
{
struct ucred *newcred, *oldcred;
l_gid16_t linux_gidset[NGROUPS];
@@ -98,7 +98,7 @@ linux_setgroups16(struct proc *p, struct linux_setgroups16_args *args)
#endif
ngrp = args->gidsetsize;
- oldcred = p->p_ucred;
+ oldcred = td->td_proc->p_ucred;
/*
* cr_groups[0] holds egid. Setting the whole set from
@@ -131,14 +131,14 @@ linux_setgroups16(struct proc *p, struct linux_setgroups16_args *args)
else
newcred->cr_ngroups = 1;
- setsugid(p);
- p->p_ucred = newcred;
+ setsugid(td->td_proc);
+ td->td_proc->p_ucred = newcred;
crfree(oldcred);
return (0);
}
int
-linux_getgroups16(struct proc *p, struct linux_getgroups16_args *args)
+linux_getgroups16(struct thread *td, struct linux_getgroups16_args *args)
{
struct ucred *cred;
l_gid16_t linux_gidset[NGROUPS];
@@ -150,7 +150,7 @@ linux_getgroups16(struct proc *p, struct linux_getgroups16_args *args)
printf(ARGS(getgroups16, "%d, *"), args->gidsetsize);
#endif
- cred = p->p_ucred;
+ cred = td->td_proc->p_ucred;
bsd_gidset = cred->cr_groups;
bsd_gidsetsz = cred->cr_ngroups - 1;
@@ -161,7 +161,7 @@ linux_getgroups16(struct proc *p, struct linux_getgroups16_args *args)
*/
if ((ngrp = args->gidsetsize) == 0) {
- p->p_retval[0] = bsd_gidsetsz;
+ td->td_retval[0] = bsd_gidsetsz;
return (0);
}
@@ -179,12 +179,12 @@ linux_getgroups16(struct proc *p, struct linux_getgroups16_args *args)
if (error)
return (error);
- p->p_retval[0] = ngrp;
+ td->td_retval[0] = ngrp;
return (0);
}
/*
- * The FreeBSD native getgid(2) and getuid(2) also modify p->p_retval[1]
+ * The FreeBSD native getgid(2) and getuid(2) also modify td->td_retval[1]
* when COMPAT_43 or COMPAT_SUNOS is defined. This globbers registers that
* are assumed to be preserved. The following lightweight syscalls fixes
* this. See also linux_getpid(2), linux_getgid(2) and linux_getuid(2) in
@@ -195,91 +195,93 @@ linux_getgroups16(struct proc *p, struct linux_getgroups16_args *args)
*/
int
-linux_getgid16(struct proc *p, struct linux_getgid16_args *args)
+linux_getgid16(struct thread *td, struct linux_getgid16_args *args)
{
- p->p_retval[0] = p->p_ucred->cr_rgid;
+
+ td->td_retval[0] = td->td_proc->p_ucred->cr_rgid;
return (0);
}
int
-linux_getuid16(struct proc *p, struct linux_getuid16_args *args)
+linux_getuid16(struct thread *td, struct linux_getuid16_args *args)
{
- p->p_retval[0] = p->p_ucred->cr_ruid;
+
+ td->td_retval[0] = td->td_proc->p_ucred->cr_ruid;
return (0);
}
int
-linux_getegid16(struct proc *p, struct linux_getegid16_args *args)
+linux_getegid16(struct thread *td, struct linux_getegid16_args *args)
{
struct getegid_args bsd;
- return (getegid(p, &bsd));
+ return (getegid(td, &bsd));
}
int
-linux_geteuid16(struct proc *p, struct linux_geteuid16_args *args)
+linux_geteuid16(struct thread *td, struct linux_geteuid16_args *args)
{
struct geteuid_args bsd;
- return (geteuid(p, &bsd));
+ return (geteuid(td, &bsd));
}
int
-linux_setgid16(struct proc *p, struct linux_setgid16_args *args)
+linux_setgid16(struct thread *td, struct linux_setgid16_args *args)
{
struct setgid_args bsd;
bsd.gid = args->gid;
- return (setgid(p, &bsd));
+ return (setgid(td, &bsd));
}
int
-linux_setuid16(struct proc *p, struct linux_setuid16_args *args)
+linux_setuid16(struct thread *td, struct linux_setuid16_args *args)
{
struct setuid_args bsd;
bsd.uid = args->uid;
- return (setuid(p, &bsd));
+ return (setuid(td, &bsd));
}
int
-linux_setregid16(struct proc *p, struct linux_setregid16_args *args)
+linux_setregid16(struct thread *td, struct linux_setregid16_args *args)
{
struct setregid_args bsd;
bsd.rgid = args->rgid;
bsd.egid = args->egid;
- return (setregid(p, &bsd));
+ return (setregid(td, &bsd));
}
int
-linux_setreuid16(struct proc *p, struct linux_setreuid16_args *args)
+linux_setreuid16(struct thread *td, struct linux_setreuid16_args *args)
{
struct setreuid_args bsd;
bsd.ruid = args->ruid;
bsd.euid = args->euid;
- return (setreuid(p, &bsd));
+ return (setreuid(td, &bsd));
}
int
-linux_setresgid16(struct proc *p, struct linux_setresgid16_args *args)
+linux_setresgid16(struct thread *td, struct linux_setresgid16_args *args)
{
struct setresgid_args bsd;
bsd.rgid = args->rgid;
bsd.egid = args->egid;
bsd.sgid = args->sgid;
- return (setresgid(p, &bsd));
+ return (setresgid(td, &bsd));
}
int
-linux_setresuid16(struct proc *p, struct linux_setresuid16_args *args)
+linux_setresuid16(struct thread *td, struct linux_setresuid16_args *args)
{
struct setresuid_args bsd;
bsd.ruid = args->ruid;
bsd.euid = args->euid;
bsd.suid = args->suid;
- return (setresuid(p, &bsd));
+ return (setresuid(td, &bsd));
}
diff --git a/sys/compat/linux/linux_util.c b/sys/compat/linux/linux_util.c
index 6e14080..45c85b6 100644
--- a/sys/compat/linux/linux_util.c
+++ b/sys/compat/linux/linux_util.c
@@ -50,8 +50,8 @@ const char linux_emul_path[] = "/compat/linux";
* be in exists.
*/
int
-linux_emul_find(p, sgp, prefix, path, pbuf, cflag)
- struct proc *p;
+linux_emul_find(td, sgp, prefix, path, pbuf, cflag)
+ struct thread *td;
caddr_t *sgp; /* Pointer to stackgap memory */
const char *prefix;
char *path;
@@ -104,7 +104,7 @@ linux_emul_find(p, sgp, prefix, path, pbuf, cflag)
for (cp = &ptr[len] - 1; *cp != '/'; cp--);
*cp = '\0';
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, p);
+ NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, td);
if ((error = namei(&nd)) != 0) {
free(buf, M_TEMP);
@@ -114,7 +114,7 @@ linux_emul_find(p, sgp, prefix, path, pbuf, cflag)
*cp = '/';
}
else {
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, p);
+ NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, td);
if ((error = namei(&nd)) != 0) {
free(buf, M_TEMP);
@@ -130,7 +130,7 @@ linux_emul_find(p, sgp, prefix, path, pbuf, cflag)
* to the emulation root directory. This is expensive :-(
*/
NDINIT(&ndroot, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path,
- p);
+ td);
if ((error = namei(&ndroot)) != 0) {
/* Cannot happen! */
@@ -140,11 +140,11 @@ linux_emul_find(p, sgp, prefix, path, pbuf, cflag)
return error;
}
- if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, p)) != 0) {
+ if ((error = VOP_GETATTR(nd.ni_vp, &vat, td->td_proc->p_ucred, td)) != 0) {
goto bad;
}
- if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, p->p_ucred, p))
+ if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, td->td_proc->p_ucred, td))
!= 0) {
goto bad;
}
diff --git a/sys/compat/linux/linux_util.h b/sys/compat/linux/linux_util.h
index 81bacc2..b79b5b6 100644
--- a/sys/compat/linux/linux_util.h
+++ b/sys/compat/linux/linux_util.h
@@ -52,7 +52,7 @@
static __inline caddr_t stackgap_init(void);
static __inline void *stackgap_alloc(caddr_t *, size_t);
-#define szsigcode (*(curproc->p_sysent->sv_szsigcode))
+#define szsigcode (*(curthread->td_proc->p_sysent->sv_szsigcode))
static __inline caddr_t
stackgap_init()
@@ -76,7 +76,7 @@ stackgap_alloc(sgp, sz)
extern const char linux_emul_path[];
-int linux_emul_find __P((struct proc *, caddr_t *, const char *, char *,
+int linux_emul_find __P((struct thread *, caddr_t *, const char *, char *,
char **, int));
#define CHECKALT(p, sgp, path, i) \
@@ -94,18 +94,18 @@ int linux_emul_find __P((struct proc *, caddr_t *, const char *, char *,
#define DUMMY(s) \
int \
-linux_ ## s(struct proc *p, struct linux_ ## s ## _args *args) \
+linux_ ## s(struct thread *p, struct linux_ ## s ## _args *args) \
{ \
return (unsupported_msg(p, #s)); \
} \
struct __hack
static __inline int
-unsupported_msg(struct proc *p, const char *fname)
+unsupported_msg(struct thread *td, const char *fname)
{
printf("linux: syscall %s is obsoleted or not implemented (pid=%ld)\n",
- fname, (long)p->p_pid);
+ fname, (long)td->td_proc->p_pid);
return (ENOSYS);
}
OpenPOWER on IntegriCloud