summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linprocfs/linprocfs.c14
-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
-rw-r--r--sys/compat/pecoff/imgact_pecoff.c86
-rw-r--r--sys/compat/svr4/Makefile9
-rw-r--r--sys/compat/svr4/svr4_exec.h2
-rw-r--r--sys/compat/svr4/svr4_fcntl.c133
-rw-r--r--sys/compat/svr4/svr4_filio.c36
-rw-r--r--sys/compat/svr4/svr4_ioctl.c12
-rw-r--r--sys/compat/svr4/svr4_ioctl.h12
-rw-r--r--sys/compat/svr4/svr4_misc.c297
-rw-r--r--sys/compat/svr4/svr4_proto.h158
-rw-r--r--sys/compat/svr4/svr4_resource.c28
-rw-r--r--sys/compat/svr4/svr4_signal.c116
-rw-r--r--sys/compat/svr4/svr4_socket.c24
-rw-r--r--sys/compat/svr4/svr4_socket.h5
-rw-r--r--sys/compat/svr4/svr4_sockio.c8
-rw-r--r--sys/compat/svr4/svr4_stat.c140
-rw-r--r--sys/compat/svr4/svr4_stream.c284
-rw-r--r--sys/compat/svr4/svr4_syscall.h2
-rw-r--r--sys/compat/svr4/svr4_syscallnames.c2
-rw-r--r--sys/compat/svr4/svr4_sysent.c2
-rw-r--r--sys/compat/svr4/svr4_sysvec.c15
-rw-r--r--sys/compat/svr4/svr4_termios.c16
-rw-r--r--sys/compat/svr4/svr4_ttold.c28
-rw-r--r--sys/compat/svr4/svr4_util.h4
38 files changed, 1313 insertions, 1293 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
index f41d536..987588a 100644
--- a/sys/compat/linprocfs/linprocfs.c
+++ b/sys/compat/linprocfs/linprocfs.c
@@ -376,8 +376,8 @@ linprocfs_doversion(PFS_FILL_ARGS)
sbuf_printf(sb,
"%s version %s (des@freebsd.org) (gcc version " __VERSION__ ")"
" #4 Sun Dec 18 04:30:00 CET 1977\n",
- linux_get_osname(curp),
- linux_get_osrelease(curp));
+ linux_get_osname(td->td_proc),
+ linux_get_osrelease(td->td_proc));
return (0);
}
@@ -581,7 +581,7 @@ linprocfs_doprocstatus(PFS_FILL_ARGS)
static int
linprocfs_doselflink(PFS_FILL_ARGS)
{
- sbuf_printf(sb, "%ld", (long)curp->p_pid);
+ sbuf_printf(sb, "%ld", (long)td->td_proc->p_pid);
return (0);
}
@@ -604,9 +604,9 @@ linprocfs_doproccmdline(PFS_FILL_ARGS)
* Linux behaviour is to return zero-length in this case.
*/
- if (p->p_args && (ps_argsopen || !p_cansee(curp, p))) {
+ if (p->p_args && (ps_argsopen || !p_cansee(td->td_proc, p))) {
sbuf_bcpy(sb, p->p_args->ar_args, p->p_args->ar_length);
- } else if (p != curp) {
+ } else if (p != td->td_proc) {
sbuf_printf(sb, "%.*s", MAXCOMLEN, p->p_comm);
} else {
error = copyin((void*)PS_STRINGS, &pstr, sizeof(pstr));
@@ -663,8 +663,8 @@ linprocfs_donetdev(PFS_FILL_ARGS)
sbuf_printf(sb,
"%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu "
"%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0);
+ 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
+ 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L);
}
return (0);
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);
}
diff --git a/sys/compat/pecoff/imgact_pecoff.c b/sys/compat/pecoff/imgact_pecoff.c
index 9d08513..3d6db4f 100644
--- a/sys/compat/pecoff/imgact_pecoff.c
+++ b/sys/compat/pecoff/imgact_pecoff.c
@@ -84,7 +84,7 @@
#define PECOFF_PE_SIGNATURE "PE\0\0"
static int pecoff_fixup(register_t **, struct image_params *);
static int
-pecoff_coredump(register struct proc *, register struct vnode *,
+pecoff_coredump(register struct thread *, register struct vnode *,
off_t);
#ifndef PECOFF_DEBUG
#define DPRINTF(a)
@@ -131,10 +131,10 @@ static int
exec_pecoff_coff_makecmds(struct image_params *,
struct coff_filehdr *, int);
-static int pecoff_signature(struct proc *, struct vnode *, const struct pecoff_dos_filehdr *);
-static int pecoff_read_from(struct proc *, struct vnode *, int, caddr_t, int);
+static int pecoff_signature(struct thread *, struct vnode *, const struct pecoff_dos_filehdr *);
+static int pecoff_read_from(struct thread *, struct vnode *, int, caddr_t, int);
static int
-pecoff_load_section(struct proc * p,
+pecoff_load_section(struct thread * td,
struct vmspace * vmspace, struct vnode * vp,
vm_offset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz,
vm_prot_t prot);
@@ -160,11 +160,11 @@ pecoff_fixup(register_t ** stack_base, struct image_params * imgp)
static int
-pecoff_coredump(register struct proc * p, register struct vnode * vp,
+pecoff_coredump(register struct thread * td, register struct vnode * vp,
off_t limit)
{
- register struct ucred *cred = p->p_ucred;
- register struct vmspace *vm = p->p_vmspace;
+ register struct ucred *cred = td->td_proc->p_ucred;
+ register struct vmspace *vm = td->td_proc->p_vmspace;
int error;
#ifdef PECOFF_DEBUG
struct vm_map *map;
@@ -172,12 +172,12 @@ pecoff_coredump(register struct proc * p, register struct vnode * vp,
struct reg regs;
#endif
- if (ctob(UPAGES + vm->vm_dsize + vm->vm_ssize) >= limit)
+ if (ctob((UAREA_PAGES+KSTACK_PAGES) + vm->vm_dsize + vm->vm_ssize) >= limit)
return (EFAULT);
- fill_kinfo_proc(p, &p->p_addr->u_kproc);
+ fill_kinfo_proc(td->td_proc, &td->td_proc->p_uarea->u_kproc);
#if PECOFF_DEBUG
- fill_regs(p, &regs);
+ fill_regs(td, &regs);
printf("EIP%x\n", regs.r_eip);
printf("EAX%x EBX%x ECX%x EDI%x\n",
regs.r_eax, regs.r_ebx, regs.r_ecx, regs.r_edi);
@@ -185,23 +185,25 @@ pecoff_coredump(register struct proc * p, register struct vnode * vp,
ent = &map->header;
printf("%p %p %p\n", ent, ent->prev, ent->next);
#endif
- error = cpu_coredump(p, vp, cred);
+ error = cpu_coredump(td, vp, cred);
if (error == 0)
error = vn_rdwr_inchunks(UIO_WRITE, vp, vm->vm_daddr,
- (int) ctob(vm->vm_dsize), (off_t) ctob(UPAGES), UIO_USERSPACE,
- IO_UNIT, cred, (int *) NULL, p);
+ (int)ctob(vm->vm_dsize),
+ (off_t)ctob((UAREA_PAGES+KSTACK_PAGES)),
+ UIO_USERSPACE, IO_UNIT, cred, (int *)NULL, td);
if (error == 0)
error = vn_rdwr_inchunks(UIO_WRITE, vp,
- (caddr_t) trunc_page(USRSTACK - ctob(vm->vm_ssize)),
- round_page(ctob(vm->vm_ssize)),
- (off_t) ctob(UPAGES) + ctob(vm->vm_dsize), UIO_USERSPACE,
- IO_UNIT, cred, (int *) NULL, p);
+ (caddr_t)trunc_page(USRSTACK - ctob(vm->vm_ssize)),
+ round_page(ctob(vm->vm_ssize)),
+ (off_t)ctob((UAREA_PAGES+KSTACK_PAGES)) +
+ ctob(vm->vm_dsize),
+ UIO_USERSPACE, IO_UNIT, cred, (int *)NULL, td);
return (error);
}
static int
-pecoff_load_section(struct proc * p, struct vmspace * vmspace, struct vnode * vp, vm_offset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot)
+pecoff_load_section(struct thread * td, struct vmspace * vmspace, struct vnode * vp, vm_offset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot)
{
size_t map_len;
vm_offset_t map_addr;
@@ -318,7 +320,7 @@ pecoff_load_section(struct proc * p, struct vmspace * vmspace, struct vnode * vp
}
static int
-pecoff_load_file(struct proc * p, const char *file, u_long * addr, u_long * entry, u_long * ldexport)
+pecoff_load_file(struct thread * td, const char *file, u_long * addr, u_long * entry, u_long * ldexport)
{
struct nameidata nd;
@@ -327,7 +329,7 @@ pecoff_load_file(struct proc * p, const char *file, u_long * addr, u_long * entr
struct coff_aouthdr *ap;
struct pecoff_opthdr *wp;
struct coff_scnhdr *sh = 0;
- struct vmspace *vmspace = p->p_vmspace;
+ struct vmspace *vmspace = td->td_proc->p_vmspace;
struct vattr attr;
struct image_params image_params, *imgp;
int peofs;
@@ -337,12 +339,12 @@ pecoff_load_file(struct proc * p, const char *file, u_long * addr, u_long * entr
/*
* Initialize part of the common data
*/
- imgp->proc = p;
+ imgp->proc = td->td_proc;
imgp->uap = NULL;
imgp->attr = &attr;
imgp->firstpage = NULL;
- NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_SYSSPACE, file, p);
+ NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_SYSSPACE, file, td);
if ((error = namei(&nd)) != 0) {
nd.ni_vp = NULL;
@@ -356,19 +358,19 @@ pecoff_load_file(struct proc * p, const char *file, u_long * addr, u_long * entr
*/
error = exec_check_permissions(imgp);
if (error) {
- VOP_UNLOCK(nd.ni_vp, 0, p);
+ VOP_UNLOCK(nd.ni_vp, 0, td);
goto fail;
}
- VOP_UNLOCK(nd.ni_vp, 0, p);
+ VOP_UNLOCK(nd.ni_vp, 0, td);
if (error)
goto fail;
- if ((error = pecoff_read_from(p, imgp->vp, 0, (caddr_t) & dh, sizeof(dh))) != 0)
+ if ((error = pecoff_read_from(td, imgp->vp, 0, (caddr_t) & dh, sizeof(dh))) != 0)
goto fail;
- if ((error = pecoff_signature(p, imgp->vp, &dh) != 0))
+ if ((error = pecoff_signature(td, imgp->vp, &dh) != 0))
goto fail;
fp = malloc(PECOFF_HDR_SIZE, M_TEMP, M_WAITOK);
peofs = dh.d_peofs + sizeof(signature) - 1;
- if ((error = pecoff_read_from(p, imgp->vp, peofs, (caddr_t) fp, PECOFF_HDR_SIZE) != 0))
+ if ((error = pecoff_read_from(td, imgp->vp, peofs, (caddr_t) fp, PECOFF_HDR_SIZE) != 0))
goto fail;
if (COFF_BADMAG(fp)) {
error = ENOEXEC;
@@ -379,7 +381,7 @@ pecoff_load_file(struct proc * p, const char *file, u_long * addr, u_long * entr
/* read section header */
scnsiz = sizeof(struct coff_scnhdr) * fp->f_nscns;
sh = malloc(scnsiz, M_TEMP, M_WAITOK);
- if ((error = pecoff_read_from(p, imgp->vp, peofs + PECOFF_HDR_SIZE,
+ if ((error = pecoff_read_from(td, imgp->vp, peofs + PECOFF_HDR_SIZE,
(caddr_t) sh, scnsiz)) != 0)
goto fail;
@@ -404,7 +406,7 @@ pecoff_load_file(struct proc * p, const char *file, u_long * addr, u_long * entr
prot |= (sh[i].s_flags & COFF_STYP_EXEC) ? VM_PROT_EXECUTE : 0;
sh[i].s_vaddr += wp->w_base; /* RVA --> VA */
- if ((error = pecoff_load_section(p, vmspace, imgp->vp, sh[i].s_scnptr
+ if ((error = pecoff_load_section(td, vmspace, imgp->vp, sh[i].s_scnptr
,(caddr_t) sh[i].s_vaddr,
sh[i].s_paddr, sh[i].s_size
,prot)) != 0)
@@ -457,7 +459,7 @@ exec_pecoff_coff_prep_zmagic(struct image_params * imgp,
sh = malloc(scnsiz, M_TEMP, M_WAITOK);
wp = (void *) ((char *) ap + sizeof(struct coff_aouthdr));
- error = pecoff_read_from(imgp->proc, imgp->vp, peofs + PECOFF_HDR_SIZE,
+ error = pecoff_read_from(&imgp->proc->p_thread, imgp->vp, peofs + PECOFF_HDR_SIZE,
(caddr_t) sh, scnsiz);
if ((error = exec_extract_strings(imgp)) != 0)
goto fail;
@@ -473,7 +475,7 @@ exec_pecoff_coff_prep_zmagic(struct image_params * imgp,
continue;
if ((sh[i].s_flags & COFF_STYP_TEXT) != 0) {
- error = pecoff_load_section(imgp->proc, vmspace,
+ error = pecoff_load_section(&imgp->proc->p_thread, vmspace,
imgp->vp, sh[i].s_scnptr
,(caddr_t) sh[i].s_vaddr, sh[i].s_paddr, sh[i].s_size
,prot);
@@ -485,7 +487,7 @@ exec_pecoff_coff_prep_zmagic(struct image_params * imgp,
}
if ((sh[i].s_flags & (COFF_STYP_DATA|COFF_STYP_BSS)) != 0) {
- if (pecoff_load_section(imgp->proc,
+ if (pecoff_load_section(&imgp->proc->p_thread,
vmspace, imgp->vp, sh[i].s_scnptr
,(caddr_t) sh[i].s_vaddr, sh[i].s_paddr, sh[i].s_size,
prot) != 0)
@@ -510,7 +512,7 @@ exec_pecoff_coff_prep_zmagic(struct image_params * imgp,
argp->a_entry = wp->w_base + ap->a_entry;
argp->a_end = data_addr + data_size;
argp->a_subsystem = wp->w_subvers;
- error = pecoff_load_file(imgp->proc, "/usr/libexec/ld.so.dll", &ldbase, &imgp->entry_addr, &ldexport);
+ error = pecoff_load_file(&imgp->proc->p_thread, "/usr/libexec/ld.so.dll", &ldbase, &imgp->entry_addr, &ldexport);
if (error)
goto fail;
@@ -570,8 +572,8 @@ exec_pecoff_coff_makecmds(struct image_params * imgp,
}
static int
-pecoff_signature(p, vp, dp)
- struct proc *p;
+pecoff_signature(td, vp, dp)
+ struct thread *td;
struct vnode *vp;
const struct pecoff_dos_filehdr *dp;
{
@@ -581,7 +583,7 @@ pecoff_signature(p, vp, dp)
if (DOS_BADMAG(dp)) {
return ENOEXEC;
}
- error = pecoff_read_from(p, vp, dp->d_peofs, buf, sizeof(buf));
+ error = pecoff_read_from(td, vp, dp->d_peofs, buf, sizeof(buf));
if (error) {
return error;
}
@@ -592,8 +594,8 @@ pecoff_signature(p, vp, dp)
return EFTYPE;
}
int
-pecoff_read_from(p, vp, pos, buf, siz)
- struct proc *p;
+pecoff_read_from(td, vp, pos, buf, siz)
+ struct thread *td;
struct vnode *vp;
int pos;
caddr_t buf;
@@ -603,8 +605,8 @@ pecoff_read_from(p, vp, pos, buf, siz)
size_t resid;
error = vn_rdwr(UIO_READ, vp, buf, siz, pos,
- UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred,
- &resid, p);
+ UIO_SYSSPACE, IO_NODELOCKED, td->td_proc->p_ucred,
+ &resid, td);
if (error)
return error;
@@ -621,13 +623,13 @@ imgact_pecoff(struct image_params * imgp)
imgp->image_header;
struct coff_filehdr *fp;
int error, peofs;
- error = pecoff_signature(imgp->proc, imgp->vp, dp);
+ error = pecoff_signature(&imgp->proc->p_thread, imgp->vp, dp);
if (error) {
return -1;
}
peofs = dp->d_peofs + sizeof(signature) - 1;
fp = malloc(PECOFF_HDR_SIZE, M_TEMP, M_WAITOK);
- error = pecoff_read_from(imgp->proc, imgp->vp, peofs, (caddr_t) fp,
+ error = pecoff_read_from(&imgp->proc->p_thread, imgp->vp, peofs, (caddr_t) fp,
PECOFF_HDR_SIZE);
if (error) {
free(fp, M_TEMP);
diff --git a/sys/compat/svr4/Makefile b/sys/compat/svr4/Makefile
index 00f8264..6de19bc 100644
--- a/sys/compat/svr4/Makefile
+++ b/sys/compat/svr4/Makefile
@@ -5,14 +5,15 @@
MAINTAINER= newton@freebsd.org
all:
- @echo "make sysent only"
+ @echo "make syscallnames only"
-syscallnames: svr4_sysent.c svr4_syscall.h svr4_proto.h
+sysent: svr4_sysent.c svr4_syscall.h svr4_proto.h
svr4_syscallnames.c svr4_sysent.c svr4_syscall.h svr4_proto.h: \
- ../kern/makesyscalls.sh syscalls.master syscalls.conf
+ ../../kern/makesyscalls.sh syscalls.master syscalls.conf
-mv -f svr4_syscallnames.c svr4_syscallnames.c.bak
-mv -f svr4_sysent.c svr4_sysent.c.bak
-mv -f svr4_syscall.h svr4_syscall.h.bak
-mv -f svr4_proto.h svr4_proto.h.bak
- sh ../kern/makesyscalls.sh syscalls.master syscalls.conf
+ sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
+
diff --git a/sys/compat/svr4/svr4_exec.h b/sys/compat/svr4/svr4_exec.h
index 716dad1..f15211b 100644
--- a/sys/compat/svr4/svr4_exec.h
+++ b/sys/compat/svr4/svr4_exec.h
@@ -65,6 +65,6 @@
#endif
#endif
-/*void svr4_setregs __P((struct proc *, struct exec_package *, u_long));*/
+/*void svr4_setregs __P((struct thread *, struct exec_package *, u_long));*/
#endif /* !_SVR4_EXEC_H_ */
diff --git a/sys/compat/svr4/svr4_fcntl.c b/sys/compat/svr4/svr4_fcntl.c
index afa62b7..465bae5 100644
--- a/sys/compat/svr4/svr4_fcntl.c
+++ b/sys/compat/svr4/svr4_fcntl.c
@@ -55,8 +55,8 @@
static int svr4_to_bsd_flags __P((int));
static u_long svr4_to_bsd_cmd __P((u_long));
-static int fd_revoke __P((struct proc *, int));
-static int fd_truncate __P((struct proc *, int, struct flock *));
+static int fd_revoke __P((struct thread *, int));
+static int fd_truncate __P((struct thread *, int, struct flock *));
static int bsd_to_svr4_flags __P((int));
static void bsd_to_svr4_flock __P((struct flock *, struct svr4_flock *));
static void svr4_to_bsd_flock __P((struct svr4_flock *, struct flock *));
@@ -242,18 +242,18 @@ svr4_to_bsd_flock64(iflp, oflp)
static int
-fd_revoke(p, fd)
- struct proc *p;
+fd_revoke(td, fd)
+ struct thread *td;
int fd;
{
- struct filedesc *fdp = p->p_fd;
+ struct filedesc *fdp = td->td_proc->p_fd;
struct file *fp;
struct vnode *vp;
struct mount *mp;
struct vattr vattr;
int error, *retval;
- retval = p->p_retval;
+ retval = td->td_retval;
if ((u_int)fd >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[fd]) == NULL)
return EBADF;
@@ -267,11 +267,11 @@ fd_revoke(p, fd)
goto out;
}
- if ((error = VOP_GETATTR(vp, &vattr, p->p_ucred, p)) != 0)
+ if ((error = VOP_GETATTR(vp, &vattr, td->td_proc->p_ucred, td)) != 0)
goto out;
- if (p->p_ucred->cr_uid != vattr.va_uid &&
- (error = suser(p)) != 0)
+ if (td->td_proc->p_ucred->cr_uid != vattr.va_uid &&
+ (error = suser_td(td)) != 0)
goto out;
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
@@ -286,12 +286,12 @@ out:
static int
-fd_truncate(p, fd, flp)
- struct proc *p;
+fd_truncate(td, fd, flp)
+ struct thread *td;
int fd;
struct flock *flp;
{
- struct filedesc *fdp = p->p_fd;
+ struct filedesc *fdp = td->td_proc->p_fd;
struct file *fp;
off_t start, length;
struct vnode *vp;
@@ -299,7 +299,7 @@ fd_truncate(p, fd, flp)
int error, *retval;
struct ftruncate_args ft;
- retval = p->p_retval;
+ retval = td->td_retval;
/*
* We only support truncating the file.
@@ -311,7 +311,7 @@ fd_truncate(p, fd, flp)
if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO)
return ESPIPE;
- if ((error = VOP_GETATTR(vp, &vattr, p->p_ucred, p)) != 0)
+ if ((error = VOP_GETATTR(vp, &vattr, td->td_proc->p_ucred, td)) != 0)
return error;
length = vattr.va_size;
@@ -341,24 +341,25 @@ fd_truncate(p, fd, flp)
SCARG(&ft, fd) = fd;
SCARG(&ft, length) = start;
- return ftruncate(p, &ft);
+ return ftruncate(td, &ft);
}
int
-svr4_sys_open(p, uap)
- register struct proc *p;
+svr4_sys_open(td, uap)
+ register struct thread *td;
struct svr4_sys_open_args *uap;
{
+ struct proc *p = td->td_proc;
int error, retval;
struct open_args cup;
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
(&cup)->path = uap->path;
(&cup)->flags = svr4_to_bsd_flags(uap->flags);
(&cup)->mode = uap->mode;
- error = open(p, &cup);
+ error = open(td, &cup);
if (error) {
/* uprintf("svr4_open(%s, 0x%0x, 0%o): %d\n", uap->path,
@@ -366,19 +367,19 @@ svr4_sys_open(p, uap)
return error;
}
- retval = p->p_retval[0];
+ retval = td->td_retval[0];
PROC_LOCK(p);
if (!(SCARG(&cup, flags) & O_NOCTTY) && SESS_LEADER(p) &&
- !(p->p_flag & P_CONTROLT)) {
+ !(td->td_proc->p_flag & P_CONTROLT)) {
#if defined(NOTYET)
- struct filedesc *fdp = p->p_fd;
+ struct filedesc *fdp = td->td_proc->p_fd;
struct file *fp = fdp->fd_ofiles[retval];
PROC_UNLOCK(p);
/* ignore any error, just give it a try */
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);
#else
@@ -389,41 +390,41 @@ svr4_sys_open(p, uap)
}
int
-svr4_sys_open64(p, uap)
- register struct proc *p;
+svr4_sys_open64(td, uap)
+ register struct thread *td;
struct svr4_sys_open64_args *uap;
{
- return svr4_sys_open(p, (struct svr4_sys_open_args *)uap);
+ return svr4_sys_open(td, (struct svr4_sys_open_args *)uap);
}
int
-svr4_sys_creat(p, uap)
- register struct proc *p;
+svr4_sys_creat(td, uap)
+ register struct thread *td;
struct svr4_sys_creat_args *uap;
{
struct open_args cup;
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
SCARG(&cup, path) = SCARG(uap, path);
SCARG(&cup, mode) = SCARG(uap, mode);
SCARG(&cup, flags) = O_WRONLY | O_CREAT | O_TRUNC;
- return open(p, &cup);
+ return open(td, &cup);
}
int
-svr4_sys_creat64(p, uap)
- register struct proc *p;
+svr4_sys_creat64(td, uap)
+ register struct thread *td;
struct svr4_sys_creat64_args *uap;
{
- return svr4_sys_creat(p, (struct svr4_sys_creat_args *)uap);
+ return svr4_sys_creat(td, (struct svr4_sys_creat_args *)uap);
}
int
-svr4_sys_llseek(p, uap)
- register struct proc *p;
+svr4_sys_llseek(td, uap)
+ register struct thread *td;
struct svr4_sys_llseek_args *uap;
{
struct lseek_args ap;
@@ -439,32 +440,32 @@ svr4_sys_llseek(p, uap)
#endif
SCARG(&ap, whence) = SCARG(uap, whence);
- return lseek(p, &ap);
+ return lseek(td, &ap);
}
int
-svr4_sys_access(p, uap)
- register struct proc *p;
+svr4_sys_access(td, uap)
+ register struct thread *td;
struct svr4_sys_access_args *uap;
{
struct access_args cup;
int *retval;
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
- retval = p->p_retval;
+ retval = td->td_retval;
SCARG(&cup, path) = SCARG(uap, path);
SCARG(&cup, flags) = SCARG(uap, flags);
- return access(p, &cup);
+ return access(td, &cup);
}
#if defined(NOTYET)
int
-svr4_sys_pread(p, uap)
- register struct proc *p;
+svr4_sys_pread(td, uap)
+ register struct thread *td;
struct svr4_sys_pread_args *uap;
{
struct pread_args pra;
@@ -478,14 +479,14 @@ svr4_sys_pread(p, uap)
SCARG(&pra, nbyte) = SCARG(uap, nbyte);
SCARG(&pra, offset) = SCARG(uap, off);
- return pread(p, &pra);
+ return pread(td, &pra);
}
#endif
#if defined(NOTYET)
int
-svr4_sys_pread64(p, v, retval)
- register struct proc *p;
+svr4_sys_pread64(td, v, retval)
+ register struct thread *td;
void *v;
register_t *retval;
{
@@ -502,14 +503,14 @@ svr4_sys_pread64(p, v, retval)
SCARG(&pra, nbyte) = SCARG(uap, nbyte);
SCARG(&pra, offset) = SCARG(uap, off);
- return (sys_pread(p, &pra, retval));
+ return (sys_pread(td, &pra, retval));
}
#endif /* NOTYET */
#if defined(NOTYET)
int
-svr4_sys_pwrite(p, uap)
- register struct proc *p;
+svr4_sys_pwrite(td, uap)
+ register struct thread *td;
struct svr4_sys_pwrite_args *uap;
{
struct pwrite_args pwa;
@@ -523,14 +524,14 @@ svr4_sys_pwrite(p, uap)
SCARG(&pwa, nbyte) = SCARG(uap, nbyte);
SCARG(&pwa, offset) = SCARG(uap, off);
- return pwrite(p, &pwa);
+ return pwrite(td, &pwa);
}
#endif
#if defined(NOTYET)
int
-svr4_sys_pwrite64(p, v, retval)
- register struct proc *p;
+svr4_sys_pwrite64(td, v, retval)
+ register struct thread *td;
void *v;
register_t *retval;
{
@@ -546,20 +547,20 @@ svr4_sys_pwrite64(p, v, retval)
SCARG(&pwa, nbyte) = SCARG(uap, nbyte);
SCARG(&pwa, offset) = SCARG(uap, off);
- return (sys_pwrite(p, &pwa, retval));
+ return (sys_pwrite(td, &pwa, retval));
}
#endif /* NOTYET */
int
-svr4_sys_fcntl(p, uap)
- register struct proc *p;
+svr4_sys_fcntl(td, uap)
+ register struct thread *td;
struct svr4_sys_fcntl_args *uap;
{
int error;
struct fcntl_args fa;
int *retval;
- retval = p->p_retval;
+ retval = td->td_retval;
SCARG(&fa, fd) = SCARG(uap, fd);
SCARG(&fa, cmd) = svr4_to_bsd_cmd(SCARG(uap, cmd));
@@ -569,11 +570,11 @@ svr4_sys_fcntl(p, uap)
case F_GETFD:
case F_SETFD:
SCARG(&fa, arg) = (long) SCARG(uap, arg);
- return fcntl(p, &fa);
+ return fcntl(td, &fa);
case F_GETFL:
SCARG(&fa, arg) = (long) SCARG(uap, arg);
- error = fcntl(p, &fa);
+ error = fcntl(td, &fa);
if (error)
return error;
*retval = bsd_to_svr4_flags(*retval);
@@ -592,14 +593,14 @@ svr4_sys_fcntl(p, uap)
cmd = SCARG(&fa, cmd); /* save it for a while */
SCARG(&fa, cmd) = F_GETFL;
- if ((error = fcntl(p, &fa)) != 0)
+ if ((error = fcntl(td, &fa)) != 0)
return error;
flags = *retval;
flags &= O_ASYNC;
flags |= svr4_to_bsd_flags((u_long) SCARG(uap, arg));
SCARG(&fa, cmd) = cmd;
SCARG(&fa, arg) = (long) flags;
- return fcntl(p, &fa);
+ return fcntl(td, &fa);
}
case F_GETLK:
@@ -623,7 +624,7 @@ svr4_sys_fcntl(p, uap)
if (error)
return error;
- error = fcntl(p, &fa);
+ error = fcntl(td, &fa);
if (error || SCARG(&fa, cmd) != F_GETLK)
return error;
@@ -643,7 +644,7 @@ svr4_sys_fcntl(p, uap)
SCARG(&du, from) = SCARG(uap, fd);
SCARG(&du, to) = (int)SCARG(uap, arg);
- error = dup2(p, &du);
+ error = dup2(td, &du);
if (error)
return error;
*retval = SCARG(&du, to);
@@ -660,7 +661,7 @@ svr4_sys_fcntl(p, uap)
if (error)
return error;
svr4_to_bsd_flock(&ifl, &fl);
- return fd_truncate(p, SCARG(uap, fd), &fl);
+ return fd_truncate(td, SCARG(uap, fd), &fl);
}
case SVR4_F_GETLK64:
@@ -685,7 +686,7 @@ svr4_sys_fcntl(p, uap)
if (error)
return error;
- error = fcntl(p, &fa);
+ error = fcntl(td, &fa);
if (error || SCARG(&fa, cmd) != F_GETLK)
return error;
@@ -709,11 +710,11 @@ svr4_sys_fcntl(p, uap)
if (error)
return error;
svr4_to_bsd_flock64(&ifl, &fl);
- return fd_truncate(p, SCARG(uap, fd), &fl);
+ return fd_truncate(td, SCARG(uap, fd), &fl);
}
case SVR4_F_REVOKE:
- return fd_revoke(p, SCARG(uap, fd));
+ return fd_revoke(td, SCARG(uap, fd));
default:
return ENOSYS;
diff --git a/sys/compat/svr4/svr4_filio.c b/sys/compat/svr4/svr4_filio.c
index c467dad..8d24788 100644
--- a/sys/compat/svr4/svr4_filio.c
+++ b/sys/compat/svr4/svr4_filio.c
@@ -51,8 +51,8 @@
/*#define GROTTY_READ_HACK*/
int
-svr4_sys_poll(p, uap)
- struct proc *p;
+svr4_sys_poll(td, uap)
+ struct thread *td;
struct svr4_sys_poll_args *uap;
{
int error;
@@ -68,7 +68,7 @@ svr4_sys_poll(p, uap)
siz = SCARG(uap, nfds) * sizeof(struct pollfd);
pfd = (struct pollfd *)malloc(siz, M_TEMP, M_WAITOK);
- error = poll(p, (struct poll_args *)uap);
+ error = poll(td, (struct poll_args *)uap);
if ((cerr = copyin(SCARG(uap, fds), pfd, siz)) != 0) {
error = cerr;
@@ -92,12 +92,12 @@ done:
#if defined(READ_TEST)
int
-svr4_sys_read(p, uap)
- struct proc *p;
+svr4_sys_read(td, uap)
+ struct thread *td;
struct svr4_sys_read_args *uap;
{
struct read_args ra;
- struct filedesc *fdp = p->p_fd;
+ struct filedesc *fdp = td->td_proc->p_fd;
struct file *fp;
struct socket *so = NULL;
int so_state;
@@ -126,15 +126,15 @@ svr4_sys_read(p, uap)
#endif
}
- rv = read(p, &ra);
+ rv = read(td, &ra);
DPRINTF(("svr4_read(%d, 0x%0x, %d) = %d\n",
SCARG(uap, fd), SCARG(uap, buf), SCARG(uap, nbyte), rv));
if (rv == EAGAIN) {
- DPRINTF(("sigmask = 0x%x\n", p->p_sigmask));
- DPRINTF(("sigignore = 0x%x\n", p->p_sigignore));
- DPRINTF(("sigcaught = 0x%x\n", p->p_sigcatch));
- DPRINTF(("siglist = 0x%x\n", p->p_siglist));
+ DPRINTF(("sigmask = 0x%x\n", td->td_proc->p_sigmask));
+ DPRINTF(("sigignore = 0x%x\n", td->td_proc->p_sigignore));
+ DPRINTF(("sigcaught = 0x%x\n", td->td_proc->p_sigcatch));
+ DPRINTF(("siglist = 0x%x\n", td->td_proc->p_siglist));
}
#if defined(GROTTY_READ_HACK)
@@ -149,8 +149,8 @@ svr4_sys_read(p, uap)
#if defined(BOGUS)
int
-svr4_sys_write(p, uap)
- struct proc *p;
+svr4_sys_write(td, uap)
+ struct thread *td;
struct svr4_sys_write_args *uap;
{
struct write_args wa;
@@ -162,7 +162,7 @@ svr4_sys_write(p, uap)
SCARG(&wa, buf) = SCARG(uap, buf);
SCARG(&wa, nbyte) = SCARG(uap, nbyte);
- rv = write(p, &wa);
+ rv = write(td, &wa);
DPRINTF(("svr4_write(%d, 0x%0x, %d) = %d\n",
SCARG(uap, fd), SCARG(uap, buf), SCARG(uap, nbyte), rv));
@@ -172,9 +172,9 @@ svr4_sys_write(p, uap)
#endif /* BOGUS */
int
-svr4_fil_ioctl(fp, p, retval, fd, cmd, data)
+svr4_fil_ioctl(fp, td, retval, fd, cmd, data)
struct file *fp;
- struct proc *p;
+ struct thread *td;
register_t *retval;
int fd;
u_long cmd;
@@ -182,7 +182,7 @@ svr4_fil_ioctl(fp, p, retval, fd, cmd, data)
{
int error;
int num;
- struct filedesc *fdp = p->p_fd;
+ struct filedesc *fdp = td->td_proc->p_fd;
*retval = 0;
@@ -214,7 +214,7 @@ svr4_fil_ioctl(fp, p, retval, fd, cmd, data)
#ifdef SVR4_DEBUG
if (cmd == FIOASYNC) DPRINTF(("FIOASYNC\n"));
#endif
- error = fo_ioctl(fp, cmd, (caddr_t) &num, p);
+ error = fo_ioctl(fp, cmd, (caddr_t) &num, td);
if (error)
return error;
diff --git a/sys/compat/svr4/svr4_ioctl.c b/sys/compat/svr4/svr4_ioctl.c
index d93e2b8..e153713 100644
--- a/sys/compat/svr4/svr4_ioctl.c
+++ b/sys/compat/svr4/svr4_ioctl.c
@@ -78,15 +78,15 @@ svr4_decode_cmd(cmd, dir, c, num, argsiz)
#endif
int
-svr4_sys_ioctl(p, uap)
- register struct proc *p;
+svr4_sys_ioctl(td, uap)
+ register struct thread *td;
struct svr4_sys_ioctl_args *uap;
{
int *retval;
struct file *fp;
struct filedesc *fdp;
u_long cmd;
- int (*fun) __P((struct file *, struct proc *, register_t *,
+ int (*fun) __P((struct file *, struct thread *, register_t *,
int, u_long, caddr_t));
#ifdef DEBUG_SVR4
char dir[4];
@@ -99,8 +99,8 @@ svr4_sys_ioctl(p, uap)
DPRINTF(("svr4_ioctl[%lx](%d, _IO%s(%c, %d, %d), %p);\n", SCARG(uap, com), SCARG(uap, fd),
dir, c, num, argsiz, SCARG(uap, data)));
#endif
- retval = p->p_retval;
- fdp = p->p_fd;
+ retval = td->td_retval;
+ fdp = td->td_proc->p_fd;
cmd = SCARG(uap, com);
if ((u_int)SCARG(uap, fd) >= fdp->fd_nfiles ||
@@ -157,5 +157,5 @@ svr4_sys_ioctl(p, uap)
DPRINTF((">>> OUT: so_state = 0x%x\n", so->so_state));
}
#endif
- return (*fun)(fp, p, retval, SCARG(uap, fd), cmd, SCARG(uap, data));
+ return (*fun)(fp, td, retval, SCARG(uap, fd), cmd, SCARG(uap, data));
}
diff --git a/sys/compat/svr4/svr4_ioctl.h b/sys/compat/svr4/svr4_ioctl.h
index a5c6a53..2d7e136 100644
--- a/sys/compat/svr4/svr4_ioctl.h
+++ b/sys/compat/svr4/svr4_ioctl.h
@@ -46,17 +46,17 @@
#define SVR4_IOW(g,n,t) SVR4_IOC(SVR4_IOC_IN, (g), (n), sizeof(t))
#define SVR4_IOWR(g,n,t) SVR4_IOC(SVR4_IOC_INOUT,(g), (n), sizeof(t))
-int svr4_stream_ti_ioctl __P((struct file *, struct proc *, register_t *,
+int svr4_stream_ti_ioctl __P((struct file *, struct thread *, register_t *,
int, u_long, caddr_t));
-int svr4_stream_ioctl __P((struct file *, struct proc *, register_t *,
+int svr4_stream_ioctl __P((struct file *, struct thread *, register_t *,
int, u_long, caddr_t));
-int svr4_term_ioctl __P((struct file *, struct proc *, register_t *,
+int svr4_term_ioctl __P((struct file *, struct thread *, register_t *,
int, u_long, caddr_t));
-int svr4_ttold_ioctl __P((struct file *, struct proc *, register_t *,
+int svr4_ttold_ioctl __P((struct file *, struct thread *, register_t *,
int, u_long, caddr_t));
-int svr4_fil_ioctl __P((struct file *, struct proc *, register_t *,
+int svr4_fil_ioctl __P((struct file *, struct thread *, register_t *,
int, u_long, caddr_t));
-int svr4_sock_ioctl __P((struct file *, struct proc *, register_t *,
+int svr4_sock_ioctl __P((struct file *, struct thread *, register_t *,
int, u_long, caddr_t));
#endif /* !_SVR4_IOCTL_H_ */
diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c
index 6865880..fd6c472 100644
--- a/sys/compat/svr4/svr4_misc.c
+++ b/sys/compat/svr4/svr4_misc.c
@@ -95,14 +95,14 @@
#define BSD_DIRENT(cp) ((struct dirent *)(cp))
-static int svr4_mknod __P((struct proc *, register_t *, char *,
+static int svr4_mknod __P((struct thread *, register_t *, char *,
svr4_mode_t, svr4_dev_t));
static __inline clock_t timeval_to_clock_t __P((struct timeval *));
static int svr4_setinfo __P((struct proc *, int, svr4_siginfo_t *));
struct svr4_hrtcntl_args;
-static int svr4_hrtcntl __P((struct proc *, struct svr4_hrtcntl_args *,
+static int svr4_hrtcntl __P((struct thread *, struct svr4_hrtcntl_args *,
register_t *));
static void bsd_statfs_to_svr4_statvfs __P((const struct statfs *,
struct svr4_statvfs *));
@@ -113,22 +113,22 @@ static struct proc *svr4_pfind __P((pid_t pid));
/* BOGUS noop */
#if defined(BOGUS)
int
-svr4_sys_setitimer(p, uap)
- register struct proc *p;
+svr4_sys_setitimer(td, uap)
+ register struct thread *td;
struct svr4_sys_setitimer_args *uap;
{
- p->p_retval[0] = 0;
+ td->td_retval[0] = 0;
return 0;
}
#endif
int
-svr4_sys_wait(p, uap)
- struct proc *p;
+svr4_sys_wait(td, uap)
+ struct thread *td;
struct svr4_sys_wait_args *uap;
{
struct wait_args w4;
- int error, *retval = p->p_retval, st, sig;
+ int error, *retval = td->td_retval, st, sig;
size_t sz = sizeof(*SCARG(&w4, status));
SCARG(&w4, rusage) = NULL;
@@ -144,7 +144,7 @@ svr4_sys_wait(p, uap)
SCARG(&w4, pid) = WAIT_ANY;
- if ((error = wait4(p, &w4)) != 0)
+ if ((error = wait4(td, &w4)) != 0)
return error;
if ((error = copyin(SCARG(&w4, status), &st, sizeof(st))) != 0)
@@ -174,44 +174,44 @@ svr4_sys_wait(p, uap)
}
int
-svr4_sys_execv(p, uap)
- struct proc *p;
+svr4_sys_execv(td, uap)
+ struct thread *td;
struct svr4_sys_execv_args *uap;
{
struct execve_args ap;
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
SCARG(&ap, fname) = SCARG(uap, path);
SCARG(&ap, argv) = SCARG(uap, argp);
SCARG(&ap, envv) = NULL;
- return execve(p, &ap);
+ return execve(td, &ap);
}
int
-svr4_sys_execve(p, uap)
- struct proc *p;
+svr4_sys_execve(td, uap)
+ struct thread *td;
struct svr4_sys_execve_args *uap;
{
struct execve_args ap;
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, uap->path);
+ CHECKALTEXIST(td, &sg, uap->path);
SCARG(&ap, fname) = SCARG(uap, path);
SCARG(&ap, argv) = SCARG(uap, argp);
SCARG(&ap, envv) = SCARG(uap, envp);
- return execve(p, &ap);
+ return execve(td, &ap);
}
int
-svr4_sys_time(p, v)
- struct proc *p;
+svr4_sys_time(td, v)
+ struct thread *td;
struct svr4_sys_time_args *v;
{
struct svr4_sys_time_args *uap = v;
@@ -222,7 +222,7 @@ svr4_sys_time(p, v)
if (SCARG(uap, t))
error = copyout(&tv.tv_sec, SCARG(uap, t),
sizeof(*(SCARG(uap, t))));
- p->p_retval[0] = (int) tv.tv_sec;
+ td->td_retval[0] = (int) tv.tv_sec;
return error;
}
@@ -237,8 +237,8 @@ svr4_sys_time(p, v)
* to adapt the NetBSD version.
*/
int
-svr4_sys_getdents64(p, uap)
- struct proc *p;
+svr4_sys_getdents64(td, uap)
+ struct thread *td;
struct svr4_sys_getdents64_args *uap;
{
register struct dirent *bdp;
@@ -258,8 +258,8 @@ svr4_sys_getdents64(p, uap)
int ncookies;
DPRINTF(("svr4_sys_getdents64(%d, *, %d)\n",
- p->p_pid, SCARG(uap, fd), SCARG(uap, nbytes)));
- if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) {
+ td->td_proc->p_pid, SCARG(uap, fd), SCARG(uap, nbytes)));
+ if ((error = getvnode(td->td_proc->p_fd, SCARG(uap, fd), &fp)) != 0) {
return (error);
}
@@ -271,7 +271,7 @@ svr4_sys_getdents64(p, uap)
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;
}
@@ -288,7 +288,7 @@ svr4_sys_getdents64(p, uap)
buflen = max(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;
aiov.iov_len = buflen;
@@ -296,7 +296,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;
@@ -398,19 +398,19 @@ again:
nbytes = resid + svr4reclen;
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
-svr4_sys_getdents(p, uap)
- struct proc *p;
+svr4_sys_getdents(td, uap)
+ struct thread *td;
struct svr4_sys_getdents_args *uap;
{
struct dirent *bdp;
@@ -426,9 +426,9 @@ svr4_sys_getdents(p, uap)
off_t off; /* true file offset */
int buflen, error, eofflag;
u_long *cookiebuf = NULL, *cookie;
- int ncookies = 0, *retval = p->p_retval;
+ int ncookies = 0, *retval = td->td_retval;
- if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)
+ if ((error = getvnode(td->td_proc->p_fd, SCARG(uap, fd), &fp)) != 0)
return (error);
if ((fp->f_flag & FREAD) == 0)
@@ -440,7 +440,7 @@ svr4_sys_getdents(p, uap)
buflen = min(MAXBSIZE, SCARG(uap, nbytes));
buf = malloc(buflen, M_TEMP, M_WAITOK);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
off = fp->f_offset;
again:
aiov.iov_base = buf;
@@ -449,7 +449,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;
/*
@@ -514,7 +514,7 @@ again:
eof:
*retval = SCARG(uap, nbytes) - resid;
out:
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
if (cookiebuf)
free(cookiebuf, M_TEMP);
free(buf, M_TEMP);
@@ -523,14 +523,14 @@ out:
int
-svr4_sys_mmap(p, uap)
- struct proc *p;
+svr4_sys_mmap(td, uap)
+ struct thread *td;
struct svr4_sys_mmap_args *uap;
{
struct mmap_args mm;
int *retval;
- retval = p->p_retval;
+ retval = td->td_retval;
#define _MAP_NEW 0x80000000
/*
* Verify the arguments.
@@ -548,12 +548,12 @@ svr4_sys_mmap(p, uap)
SCARG(&mm, addr) = SCARG(uap, addr);
SCARG(&mm, pos) = SCARG(uap, pos);
- return mmap(p, &mm);
+ return mmap(td, &mm);
}
int
-svr4_sys_mmap64(p, uap)
- struct proc *p;
+svr4_sys_mmap64(td, uap)
+ struct thread *td;
struct svr4_sys_mmap64_args *uap;
{
struct mmap_args mm;
@@ -576,36 +576,36 @@ svr4_sys_mmap64(p, uap)
SCARG(&mm, addr) = SCARG(uap, addr);
SCARG(&mm, pos) = SCARG(uap, pos);
- rp = (void *) round_page((vm_offset_t)(p->p_vmspace->vm_daddr + MAXDSIZ));
+ rp = (void *) round_page((vm_offset_t)(td->td_proc->p_vmspace->vm_daddr + MAXDSIZ));
if ((SCARG(&mm, flags) & MAP_FIXED) == 0 &&
SCARG(&mm, addr) != 0 && (void *)SCARG(&mm, addr) < rp)
SCARG(&mm, addr) = rp;
- return mmap(p, &mm);
+ return mmap(td, &mm);
}
int
-svr4_sys_fchroot(p, uap)
- struct proc *p;
+svr4_sys_fchroot(td, uap)
+ struct thread *td;
struct svr4_sys_fchroot_args *uap;
{
- struct filedesc *fdp = p->p_fd;
+ struct filedesc *fdp = td->td_proc->p_fd;
struct vnode *vp;
struct file *fp;
int error;
- if ((error = suser(p)) != 0)
+ if ((error = suser_td(td)) != 0)
return error;
if ((error = getvnode(fdp, SCARG(uap, fd), &fp)) != 0)
return error;
vp = (struct vnode *) fp->f_data;
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
if (vp->v_type != VDIR)
error = ENOTDIR;
else
- error = VOP_ACCESS(vp, VEXEC, p->p_ucred, p);
- VOP_UNLOCK(vp, 0, p);
+ error = VOP_ACCESS(vp, VEXEC, td->td_proc->p_ucred, td);
+ VOP_UNLOCK(vp, 0, td);
if (error)
return error;
VREF(vp);
@@ -617,8 +617,8 @@ svr4_sys_fchroot(p, uap)
static int
-svr4_mknod(p, retval, path, mode, dev)
- struct proc *p;
+svr4_mknod(td, retval, path, mode, dev)
+ struct thread *td;
register_t *retval;
char *path;
svr4_mode_t mode;
@@ -626,50 +626,50 @@ svr4_mknod(p, retval, path, mode, dev)
{
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, path);
+ CHECKALTEXIST(td, &sg, path);
if (S_ISFIFO(mode)) {
struct mkfifo_args ap;
SCARG(&ap, path) = path;
SCARG(&ap, mode) = mode;
- return mkfifo(p, &ap);
+ return mkfifo(td, &ap);
} else {
struct mknod_args ap;
SCARG(&ap, path) = path;
SCARG(&ap, mode) = mode;
SCARG(&ap, dev) = dev;
- return mknod(p, &ap);
+ return mknod(td, &ap);
}
}
int
-svr4_sys_mknod(p, uap)
- register struct proc *p;
+svr4_sys_mknod(td, uap)
+ register struct thread *td;
struct svr4_sys_mknod_args *uap;
{
- int *retval = p->p_retval;
- return svr4_mknod(p, retval,
+ int *retval = td->td_retval;
+ return svr4_mknod(td, retval,
SCARG(uap, path), SCARG(uap, mode),
(svr4_dev_t)svr4_to_bsd_odev_t(SCARG(uap, dev)));
}
int
-svr4_sys_xmknod(p, uap)
- struct proc *p;
+svr4_sys_xmknod(td, uap)
+ struct thread *td;
struct svr4_sys_xmknod_args *uap;
{
- int *retval = p->p_retval;
- return svr4_mknod(p, retval,
+ int *retval = td->td_retval;
+ return svr4_mknod(td, retval,
SCARG(uap, path), SCARG(uap, mode),
(svr4_dev_t)svr4_to_bsd_dev_t(SCARG(uap, dev)));
}
int
-svr4_sys_vhangup(p, uap)
- struct proc *p;
+svr4_sys_vhangup(td, uap)
+ struct thread *td;
struct svr4_sys_vhangup_args *uap;
{
return 0;
@@ -677,13 +677,13 @@ svr4_sys_vhangup(p, uap)
int
-svr4_sys_sysconfig(p, uap)
- struct proc *p;
+svr4_sys_sysconfig(td, uap)
+ struct thread *td;
struct svr4_sys_sysconfig_args *uap;
{
int *retval;
- retval = &(p->p_retval[0]);
+ retval = &(td->td_retval[0]);
switch (SCARG(uap, name)) {
case SVR4_CONFIG_UNUSED:
@@ -779,11 +779,11 @@ extern int swap_pager_full;
/* ARGSUSED */
int
-svr4_sys_break(p, uap)
- struct proc *p;
+svr4_sys_break(td, uap)
+ struct thread *td;
struct svr4_sys_break_args *uap;
{
- struct vmspace *vm = p->p_vmspace;
+ struct vmspace *vm = td->td_proc->p_vmspace;
vm_offset_t new, old, base, ns;
int rv;
@@ -793,7 +793,7 @@ svr4_sys_break(p, uap)
/* For p_rlimit. */
mtx_assert(&Giant, MA_OWNED);
if (new > base) {
- if ((new - base) > (unsigned) p->p_rlimit[RLIMIT_DATA].rlim_cur) {
+ if ((new - base) > (unsigned) td->td_proc->p_rlimit[RLIMIT_DATA].rlim_cur) {
return ENOMEM;
}
if (new >= VM_MAXUSER_ADDRESS) {
@@ -842,11 +842,11 @@ timeval_to_clock_t(tv)
int
-svr4_sys_times(p, uap)
- struct proc *p;
+svr4_sys_times(td, uap)
+ struct thread *td;
struct svr4_sys_times_args *uap;
{
- int error, *retval = p->p_retval;
+ int error, *retval = td->td_retval;
struct tms tms;
struct timeval t;
struct rusage *ru;
@@ -859,7 +859,7 @@ svr4_sys_times(p, uap)
SCARG(&ga, who) = RUSAGE_SELF;
SCARG(&ga, rusage) = ru;
- error = getrusage(p, &ga);
+ error = getrusage(td, &ga);
if (error)
return error;
@@ -870,7 +870,7 @@ svr4_sys_times(p, uap)
tms.tms_stime = timeval_to_clock_t(&r.ru_stime);
SCARG(&ga, who) = RUSAGE_CHILDREN;
- error = getrusage(p, &ga);
+ error = getrusage(td, &ga);
if (error)
return error;
@@ -888,17 +888,17 @@ svr4_sys_times(p, uap)
int
-svr4_sys_ulimit(p, uap)
- struct proc *p;
+svr4_sys_ulimit(td, uap)
+ struct thread *td;
struct svr4_sys_ulimit_args *uap;
{
- int *retval = p->p_retval;
+ int *retval = td->td_retval;
switch (SCARG(uap, cmd)) {
case SVR4_GFILLIM:
/* For p_rlimit below. */
mtx_assert(&Giant, MA_OWNED);
- *retval = p->p_rlimit[RLIMIT_FSIZE].rlim_cur / 512;
+ *retval = td->td_proc->p_rlimit[RLIMIT_FSIZE].rlim_cur / 512;
if (*retval == -1)
*retval = 0x7fffffff;
return 0;
@@ -914,7 +914,7 @@ svr4_sys_ulimit(p, uap)
krl.rlim_cur = SCARG(uap, newlimit) * 512;
mtx_assert(&Giant, MA_OWNED);
- krl.rlim_max = p->p_rlimit[RLIMIT_FSIZE].rlim_max;
+ krl.rlim_max = td->td_proc->p_rlimit[RLIMIT_FSIZE].rlim_max;
error = copyout(&krl, url, sizeof(*url));
if (error)
@@ -923,12 +923,12 @@ svr4_sys_ulimit(p, uap)
SCARG(&srl, which) = RLIMIT_FSIZE;
SCARG(&srl, rlp) = url;
- error = setrlimit(p, &srl);
+ error = setrlimit(td, &srl);
if (error)
return error;
mtx_assert(&Giant, MA_OWNED);
- *retval = p->p_rlimit[RLIMIT_FSIZE].rlim_cur;
+ *retval = td->td_proc->p_rlimit[RLIMIT_FSIZE].rlim_cur;
if (*retval == -1)
*retval = 0x7fffffff;
return 0;
@@ -936,11 +936,11 @@ svr4_sys_ulimit(p, uap)
case SVR4_GMEMLIM:
{
- struct vmspace *vm = p->p_vmspace;
+ struct vmspace *vm = td->td_proc->p_vmspace;
register_t r;
mtx_assert(&Giant, MA_OWNED);
- r = p->p_rlimit[RLIMIT_DATA].rlim_cur;
+ r = td->td_proc->p_rlimit[RLIMIT_DATA].rlim_cur;
if (r == -1)
r = 0x7fffffff;
@@ -953,7 +953,7 @@ svr4_sys_ulimit(p, uap)
case SVR4_GDESLIM:
mtx_assert(&Giant, MA_OWNED);
- *retval = p->p_rlimit[RLIMIT_NOFILE].rlim_cur;
+ *retval = td->td_proc->p_rlimit[RLIMIT_NOFILE].rlim_cur;
if (*retval == -1)
*retval = 0x7fffffff;
return 0;
@@ -979,11 +979,12 @@ svr4_pfind(pid)
int
-svr4_sys_pgrpsys(p, uap)
- struct proc *p;
+svr4_sys_pgrpsys(td, uap)
+ struct thread *td;
struct svr4_sys_pgrpsys_args *uap;
{
- int *retval = p->p_retval;
+ int *retval = td->td_retval;
+ struct proc *p = td->td_proc;
switch (SCARG(uap, cmd)) {
case 1: /* setpgrp() */
@@ -994,7 +995,7 @@ svr4_sys_pgrpsys(p, uap)
* setsid() for SVR4. (Under BSD, the difference is that
* a setpgid(0,0) will not create a new session.)
*/
- setsid(p, NULL);
+ setsid(td, NULL);
/*FALLTHROUGH*/
case 0: /* getpgrp() */
@@ -1014,7 +1015,7 @@ svr4_sys_pgrpsys(p, uap)
return 0;
case 3: /* setsid() */
- return setsid(p, NULL);
+ return setsid(td, NULL);
case 4: /* getpgid(pid) */
@@ -1032,7 +1033,7 @@ svr4_sys_pgrpsys(p, uap)
SCARG(&sa, pid) = SCARG(uap, pid);
SCARG(&sa, pgid) = SCARG(uap, pgid);
- return setpgid(p, &sa);
+ return setpgid(td, &sa);
}
default:
@@ -1052,8 +1053,8 @@ struct svr4_hrtcntl_args {
static int
-svr4_hrtcntl(p, uap, retval)
- struct proc *p;
+svr4_hrtcntl(td, uap, retval)
+ struct thread *td;
struct svr4_hrtcntl_args *uap;
register_t *retval;
{
@@ -1098,15 +1099,15 @@ svr4_hrtcntl(p, uap, retval)
int
-svr4_sys_hrtsys(p, uap)
- struct proc *p;
+svr4_sys_hrtsys(td, uap)
+ struct thread *td;
struct svr4_sys_hrtsys_args *uap;
{
- int *retval = p->p_retval;
+ int *retval = td->td_retval;
switch (SCARG(uap, cmd)) {
case SVR4_HRT_CNTL:
- return svr4_hrtcntl(p, (struct svr4_hrtcntl_args *) uap,
+ return svr4_hrtcntl(td, (struct svr4_hrtcntl_args *) uap,
retval);
case SVR4_HRT_ALRM:
@@ -1187,12 +1188,12 @@ svr4_setinfo(p, st, s)
int
-svr4_sys_waitsys(p, uap)
- struct proc *p;
+svr4_sys_waitsys(td, uap)
+ struct thread *td;
struct svr4_sys_waitsys_args *uap;
{
int nfound;
- int error, *retval = p->p_retval;
+ int error, *retval = td->td_retval;
struct proc *q, *t;
@@ -1201,7 +1202,7 @@ svr4_sys_waitsys(p, uap)
break;
case SVR4_P_PGID:
- SCARG(uap, id) = -p->p_pgid;
+ SCARG(uap, id) = -td->td_proc->p_pgid;
break;
case SVR4_P_ALL:
@@ -1219,7 +1220,7 @@ svr4_sys_waitsys(p, uap)
loop:
nfound = 0;
sx_slock(&proctree_lock);
- LIST_FOREACH(q, &p->p_children, p_sibling) {
+ LIST_FOREACH(q, &td->td_proc->p_children, p_sibling) {
if (SCARG(uap, id) != WAIT_ANY &&
q->p_pid != SCARG(uap, id) &&
q->p_pgid != -SCARG(uap, id)) {
@@ -1276,7 +1277,7 @@ loop:
PROC_UNLOCK(q);
sx_xunlock(&proctree_lock);
q->p_xstat = 0;
- ruadd(&p->p_stats->p_cru, q->p_ru);
+ ruadd(&td->td_proc->p_stats->p_cru, q->p_ru);
FREE(q->p_ru, M_ZOMBIE);
q->p_ru = 0;
@@ -1320,7 +1321,7 @@ loop:
PROC_LOCK(q);
if (--q->p_procsig->ps_refcnt == 0) {
- if (q->p_sigacts != &q->p_addr->u_sigacts)
+ if (q->p_sigacts != &q->p_uarea->u_sigacts)
FREE(q->p_sigacts, M_SUBPROC);
FREE(q->p_procsig, M_SUBPROC);
q->p_procsig = NULL;
@@ -1369,7 +1370,7 @@ loop:
return 0;
}
- if ((error = tsleep((caddr_t)p, PWAIT | PCATCH, "svr4_wait", 0)) != 0)
+ if ((error = tsleep((caddr_t)td->td_proc, PWAIT | PCATCH, "svr4_wait", 0)) != 0)
return error;
goto loop;
}
@@ -1428,8 +1429,8 @@ bsd_statfs_to_svr4_statvfs64(bfs, sfs)
int
-svr4_sys_statvfs(p, uap)
- struct proc *p;
+svr4_sys_statvfs(td, uap)
+ struct thread *td;
struct svr4_sys_statvfs_args *uap;
{
struct statfs_args fs_args;
@@ -1439,11 +1440,11 @@ svr4_sys_statvfs(p, uap)
struct svr4_statvfs sfs;
int error;
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
SCARG(&fs_args, path) = SCARG(uap, path);
SCARG(&fs_args, buf) = fs;
- if ((error = statfs(p, &fs_args)) != 0)
+ if ((error = statfs(td, &fs_args)) != 0)
return error;
if ((error = copyin(fs, &bfs, sizeof(bfs))) != 0)
@@ -1456,8 +1457,8 @@ svr4_sys_statvfs(p, uap)
int
-svr4_sys_fstatvfs(p, uap)
- struct proc *p;
+svr4_sys_fstatvfs(td, uap)
+ struct thread *td;
struct svr4_sys_fstatvfs_args *uap;
{
struct fstatfs_args fs_args;
@@ -1470,7 +1471,7 @@ svr4_sys_fstatvfs(p, uap)
SCARG(&fs_args, fd) = SCARG(uap, fd);
SCARG(&fs_args, buf) = fs;
- if ((error = fstatfs(p, &fs_args)) != 0)
+ if ((error = fstatfs(td, &fs_args)) != 0)
return error;
if ((error = copyin(fs, &bfs, sizeof(bfs))) != 0)
@@ -1483,8 +1484,8 @@ svr4_sys_fstatvfs(p, uap)
int
-svr4_sys_statvfs64(p, uap)
- struct proc *p;
+svr4_sys_statvfs64(td, uap)
+ struct thread *td;
struct svr4_sys_statvfs64_args *uap;
{
struct statfs_args fs_args;
@@ -1494,11 +1495,11 @@ svr4_sys_statvfs64(p, uap)
struct svr4_statvfs64 sfs;
int error;
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
SCARG(&fs_args, path) = SCARG(uap, path);
SCARG(&fs_args, buf) = fs;
- if ((error = statfs(p, &fs_args)) != 0)
+ if ((error = statfs(td, &fs_args)) != 0)
return error;
if ((error = copyin(fs, &bfs, sizeof(bfs))) != 0)
@@ -1511,8 +1512,8 @@ svr4_sys_statvfs64(p, uap)
int
-svr4_sys_fstatvfs64(p, uap)
- struct proc *p;
+svr4_sys_fstatvfs64(td, uap)
+ struct thread *td;
struct svr4_sys_fstatvfs64_args *uap;
{
struct fstatfs_args fs_args;
@@ -1525,7 +1526,7 @@ svr4_sys_fstatvfs64(p, uap)
SCARG(&fs_args, fd) = SCARG(uap, fd);
SCARG(&fs_args, buf) = fs;
- if ((error = fstatfs(p, &fs_args)) != 0)
+ if ((error = fstatfs(td, &fs_args)) != 0)
return error;
if ((error = copyin(fs, &bfs, sizeof(bfs))) != 0)
@@ -1537,8 +1538,8 @@ svr4_sys_fstatvfs64(p, uap)
}
int
-svr4_sys_alarm(p, uap)
- struct proc *p;
+svr4_sys_alarm(td, uap)
+ struct thread *td;
struct svr4_sys_alarm_args *uap;
{
int error;
@@ -1555,19 +1556,19 @@ svr4_sys_alarm(p, uap)
SCARG(&sa, which) = ITIMER_REAL;
SCARG(&sa, itv) = itp;
SCARG(&sa, oitv) = oitp;
- error = setitimer(p, &sa);
+ error = setitimer(td, &sa);
if (error)
return error;
if (oitp->it_value.tv_usec)
oitp->it_value.tv_sec++;
- p->p_retval[0] = oitp->it_value.tv_sec;
+ td->td_retval[0] = oitp->it_value.tv_sec;
return 0;
}
int
-svr4_sys_gettimeofday(p, uap)
- struct proc *p;
+svr4_sys_gettimeofday(td, uap)
+ struct thread *td;
struct svr4_sys_gettimeofday_args *uap;
{
if (SCARG(uap, tp)) {
@@ -1581,13 +1582,13 @@ svr4_sys_gettimeofday(p, uap)
}
int
-svr4_sys_facl(p, uap)
- struct proc *p;
+svr4_sys_facl(td, uap)
+ struct thread *td;
struct svr4_sys_facl_args *uap;
{
int *retval;
- retval = p->p_retval;
+ retval = td->td_retval;
*retval = 0;
switch (SCARG(uap, cmd)) {
@@ -1609,17 +1610,17 @@ svr4_sys_facl(p, uap)
int
-svr4_sys_acl(p, uap)
- struct proc *p;
+svr4_sys_acl(td, uap)
+ struct thread *td;
struct svr4_sys_acl_args *uap;
{
/* XXX: for now the same */
- return svr4_sys_facl(p, (struct svr4_sys_facl_args *)uap);
+ return svr4_sys_facl(td, (struct svr4_sys_facl_args *)uap);
}
int
-svr4_sys_auditsys(p, uap)
- struct proc *p;
+svr4_sys_auditsys(td, uap)
+ struct thread *td;
struct svr4_sys_auditsys_args *uap;
{
/*
@@ -1629,8 +1630,8 @@ svr4_sys_auditsys(p, uap)
}
int
-svr4_sys_memcntl(p, uap)
- struct proc *p;
+svr4_sys_memcntl(td, uap)
+ struct thread *td;
struct svr4_sys_memcntl_args *uap;
{
switch (SCARG(uap, cmd)) {
@@ -1642,7 +1643,7 @@ svr4_sys_memcntl(p, uap)
SCARG(&msa, len) = SCARG(uap, len);
SCARG(&msa, flags) = (int)SCARG(uap, arg);
- return msync(p, &msa);
+ return msync(td, &msa);
}
case SVR4_MC_ADVISE:
{
@@ -1652,7 +1653,7 @@ svr4_sys_memcntl(p, uap)
SCARG(&maa, len) = SCARG(uap, len);
SCARG(&maa, behav) = (int)SCARG(uap, arg);
- return madvise(p, &maa);
+ return madvise(td, &maa);
}
case SVR4_MC_LOCK:
case SVR4_MC_UNLOCK:
@@ -1666,8 +1667,8 @@ svr4_sys_memcntl(p, uap)
int
-svr4_sys_nice(p, uap)
- struct proc *p;
+svr4_sys_nice(td, uap)
+ struct thread *td;
struct svr4_sys_nice_args *uap;
{
struct setpriority_args ap;
@@ -1677,26 +1678,26 @@ svr4_sys_nice(p, uap)
SCARG(&ap, who) = 0;
SCARG(&ap, prio) = SCARG(uap, prio);
- if ((error = setpriority(p, &ap)) != 0)
+ if ((error = setpriority(td, &ap)) != 0)
return error;
/* the cast is stupid, but the structures are the same */
- if ((error = getpriority(p, (struct getpriority_args *)&ap)) != 0)
+ if ((error = getpriority(td, (struct getpriority_args *)&ap)) != 0)
return error;
return 0;
}
int
-svr4_sys_resolvepath(p, uap)
- struct proc *p;
+svr4_sys_resolvepath(td, uap)
+ struct thread *td;
struct svr4_sys_resolvepath_args *uap;
{
struct nameidata nd;
- int error, *retval = p->p_retval;
+ int error, *retval = td->td_retval;
NDINIT(&nd, LOOKUP, NOFOLLOW | SAVENAME, UIO_USERSPACE,
- SCARG(uap, path), p);
+ SCARG(uap, path), td);
if ((error = namei(&nd)) != 0)
return error;
diff --git a/sys/compat/svr4/svr4_proto.h b/sys/compat/svr4/svr4_proto.h
index 95a0ae7..d2a862f 100644
--- a/sys/compat/svr4/svr4_proto.h
+++ b/sys/compat/svr4/svr4_proto.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: src/sys/svr4/syscalls.master,v 1.10 2000/07/29 10:05:24 peter Exp
+ * created from FreeBSD: src/sys/compat/svr4/syscalls.master,v 1.11 2000/08/31 22:54:05 obrien Exp
*/
#ifndef _SVR4_SYSPROTO_H_
@@ -15,6 +15,8 @@
struct proc;
+struct thread;
+
#define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \
0 : sizeof(register_t) - sizeof(t))
@@ -381,86 +383,86 @@ struct svr4_sys_sendto_args {
struct sockaddr * to; char to_[PAD_(struct sockaddr *)];
int tolen; char tolen_[PAD_(int)];
};
-int svr4_sys_open __P((struct proc *, struct svr4_sys_open_args *));
-int svr4_sys_wait __P((struct proc *, struct svr4_sys_wait_args *));
-int svr4_sys_creat __P((struct proc *, struct svr4_sys_creat_args *));
-int svr4_sys_execv __P((struct proc *, struct svr4_sys_execv_args *));
-int svr4_sys_time __P((struct proc *, struct svr4_sys_time_args *));
-int svr4_sys_mknod __P((struct proc *, struct svr4_sys_mknod_args *));
-int svr4_sys_break __P((struct proc *, struct svr4_sys_break_args *));
-int svr4_sys_stat __P((struct proc *, struct svr4_sys_stat_args *));
-int svr4_sys_alarm __P((struct proc *, struct svr4_sys_alarm_args *));
-int svr4_sys_fstat __P((struct proc *, struct svr4_sys_fstat_args *));
-int svr4_sys_pause __P((struct proc *, struct svr4_sys_pause_args *));
-int svr4_sys_utime __P((struct proc *, struct svr4_sys_utime_args *));
-int svr4_sys_access __P((struct proc *, struct svr4_sys_access_args *));
-int svr4_sys_nice __P((struct proc *, struct svr4_sys_nice_args *));
-int svr4_sys_kill __P((struct proc *, struct svr4_sys_kill_args *));
-int svr4_sys_pgrpsys __P((struct proc *, struct svr4_sys_pgrpsys_args *));
-int svr4_sys_times __P((struct proc *, struct svr4_sys_times_args *));
-int svr4_sys_signal __P((struct proc *, struct svr4_sys_signal_args *));
+int svr4_sys_open __P((struct thread *, struct svr4_sys_open_args *));
+int svr4_sys_wait __P((struct thread *, struct svr4_sys_wait_args *));
+int svr4_sys_creat __P((struct thread *, struct svr4_sys_creat_args *));
+int svr4_sys_execv __P((struct thread *, struct svr4_sys_execv_args *));
+int svr4_sys_time __P((struct thread *, struct svr4_sys_time_args *));
+int svr4_sys_mknod __P((struct thread *, struct svr4_sys_mknod_args *));
+int svr4_sys_break __P((struct thread *, struct svr4_sys_break_args *));
+int svr4_sys_stat __P((struct thread *, struct svr4_sys_stat_args *));
+int svr4_sys_alarm __P((struct thread *, struct svr4_sys_alarm_args *));
+int svr4_sys_fstat __P((struct thread *, struct svr4_sys_fstat_args *));
+int svr4_sys_pause __P((struct thread *, struct svr4_sys_pause_args *));
+int svr4_sys_utime __P((struct thread *, struct svr4_sys_utime_args *));
+int svr4_sys_access __P((struct thread *, struct svr4_sys_access_args *));
+int svr4_sys_nice __P((struct thread *, struct svr4_sys_nice_args *));
+int svr4_sys_kill __P((struct thread *, struct svr4_sys_kill_args *));
+int svr4_sys_pgrpsys __P((struct thread *, struct svr4_sys_pgrpsys_args *));
+int svr4_sys_times __P((struct thread *, struct svr4_sys_times_args *));
+int svr4_sys_signal __P((struct thread *, struct svr4_sys_signal_args *));
#if defined(NOTYET)
-int svr4_sys_msgsys __P((struct proc *, struct svr4_sys_msgsys_args *));
+int svr4_sys_msgsys __P((struct thread *, struct svr4_sys_msgsys_args *));
#else
#endif
-int svr4_sys_sysarch __P((struct proc *, struct svr4_sys_sysarch_args *));
-int svr4_sys_ioctl __P((struct proc *, struct svr4_sys_ioctl_args *));
-int svr4_sys_utssys __P((struct proc *, struct svr4_sys_utssys_args *));
-int svr4_sys_execve __P((struct proc *, struct svr4_sys_execve_args *));
-int svr4_sys_fcntl __P((struct proc *, struct svr4_sys_fcntl_args *));
-int svr4_sys_ulimit __P((struct proc *, struct svr4_sys_ulimit_args *));
-int svr4_sys_getdents __P((struct proc *, struct svr4_sys_getdents_args *));
-int svr4_sys_getmsg __P((struct proc *, struct svr4_sys_getmsg_args *));
-int svr4_sys_putmsg __P((struct proc *, struct svr4_sys_putmsg_args *));
-int svr4_sys_poll __P((struct proc *, struct svr4_sys_poll_args *));
-int svr4_sys_lstat __P((struct proc *, struct svr4_sys_lstat_args *));
-int svr4_sys_sigprocmask __P((struct proc *, struct svr4_sys_sigprocmask_args *));
-int svr4_sys_sigsuspend __P((struct proc *, struct svr4_sys_sigsuspend_args *));
-int svr4_sys_sigaltstack __P((struct proc *, struct svr4_sys_sigaltstack_args *));
-int svr4_sys_sigaction __P((struct proc *, struct svr4_sys_sigaction_args *));
-int svr4_sys_sigpending __P((struct proc *, struct svr4_sys_sigpending_args *));
-int svr4_sys_context __P((struct proc *, struct svr4_sys_context_args *));
-int svr4_sys_statvfs __P((struct proc *, struct svr4_sys_statvfs_args *));
-int svr4_sys_fstatvfs __P((struct proc *, struct svr4_sys_fstatvfs_args *));
-int svr4_sys_waitsys __P((struct proc *, struct svr4_sys_waitsys_args *));
-int svr4_sys_hrtsys __P((struct proc *, struct svr4_sys_hrtsys_args *));
-int svr4_sys_pathconf __P((struct proc *, struct svr4_sys_pathconf_args *));
-int svr4_sys_mmap __P((struct proc *, struct svr4_sys_mmap_args *));
-int svr4_sys_fpathconf __P((struct proc *, struct svr4_sys_fpathconf_args *));
-int svr4_sys_xstat __P((struct proc *, struct svr4_sys_xstat_args *));
-int svr4_sys_lxstat __P((struct proc *, struct svr4_sys_lxstat_args *));
-int svr4_sys_fxstat __P((struct proc *, struct svr4_sys_fxstat_args *));
-int svr4_sys_xmknod __P((struct proc *, struct svr4_sys_xmknod_args *));
-int svr4_sys_setrlimit __P((struct proc *, struct svr4_sys_setrlimit_args *));
-int svr4_sys_getrlimit __P((struct proc *, struct svr4_sys_getrlimit_args *));
-int svr4_sys_memcntl __P((struct proc *, struct svr4_sys_memcntl_args *));
-int svr4_sys_uname __P((struct proc *, struct svr4_sys_uname_args *));
-int svr4_sys_sysconfig __P((struct proc *, struct svr4_sys_sysconfig_args *));
-int svr4_sys_systeminfo __P((struct proc *, struct svr4_sys_systeminfo_args *));
-int svr4_sys_fchroot __P((struct proc *, struct svr4_sys_fchroot_args *));
-int svr4_sys_utimes __P((struct proc *, struct svr4_sys_utimes_args *));
-int svr4_sys_vhangup __P((struct proc *, struct svr4_sys_vhangup_args *));
-int svr4_sys_gettimeofday __P((struct proc *, struct svr4_sys_gettimeofday_args *));
-int svr4_sys_llseek __P((struct proc *, struct svr4_sys_llseek_args *));
-int svr4_sys_acl __P((struct proc *, struct svr4_sys_acl_args *));
-int svr4_sys_auditsys __P((struct proc *, struct svr4_sys_auditsys_args *));
-int svr4_sys_facl __P((struct proc *, struct svr4_sys_facl_args *));
-int svr4_sys_resolvepath __P((struct proc *, struct svr4_sys_resolvepath_args *));
-int svr4_sys_getdents64 __P((struct proc *, struct svr4_sys_getdents64_args *));
-int svr4_sys_mmap64 __P((struct proc *, struct svr4_sys_mmap64_args *));
-int svr4_sys_stat64 __P((struct proc *, struct svr4_sys_stat64_args *));
-int svr4_sys_lstat64 __P((struct proc *, struct svr4_sys_lstat64_args *));
-int svr4_sys_fstat64 __P((struct proc *, struct svr4_sys_fstat64_args *));
-int svr4_sys_statvfs64 __P((struct proc *, struct svr4_sys_statvfs64_args *));
-int svr4_sys_fstatvfs64 __P((struct proc *, struct svr4_sys_fstatvfs64_args *));
-int svr4_sys_setrlimit64 __P((struct proc *, struct svr4_sys_setrlimit64_args *));
-int svr4_sys_getrlimit64 __P((struct proc *, struct svr4_sys_getrlimit64_args *));
-int svr4_sys_creat64 __P((struct proc *, struct svr4_sys_creat64_args *));
-int svr4_sys_open64 __P((struct proc *, struct svr4_sys_open64_args *));
-int svr4_sys_socket __P((struct proc *, struct svr4_sys_socket_args *));
-int svr4_sys_recv __P((struct proc *, struct svr4_sys_recv_args *));
-int svr4_sys_send __P((struct proc *, struct svr4_sys_send_args *));
-int svr4_sys_sendto __P((struct proc *, struct svr4_sys_sendto_args *));
+int svr4_sys_sysarch __P((struct thread *, struct svr4_sys_sysarch_args *));
+int svr4_sys_ioctl __P((struct thread *, struct svr4_sys_ioctl_args *));
+int svr4_sys_utssys __P((struct thread *, struct svr4_sys_utssys_args *));
+int svr4_sys_execve __P((struct thread *, struct svr4_sys_execve_args *));
+int svr4_sys_fcntl __P((struct thread *, struct svr4_sys_fcntl_args *));
+int svr4_sys_ulimit __P((struct thread *, struct svr4_sys_ulimit_args *));
+int svr4_sys_getdents __P((struct thread *, struct svr4_sys_getdents_args *));
+int svr4_sys_getmsg __P((struct thread *, struct svr4_sys_getmsg_args *));
+int svr4_sys_putmsg __P((struct thread *, struct svr4_sys_putmsg_args *));
+int svr4_sys_poll __P((struct thread *, struct svr4_sys_poll_args *));
+int svr4_sys_lstat __P((struct thread *, struct svr4_sys_lstat_args *));
+int svr4_sys_sigprocmask __P((struct thread *, struct svr4_sys_sigprocmask_args *));
+int svr4_sys_sigsuspend __P((struct thread *, struct svr4_sys_sigsuspend_args *));
+int svr4_sys_sigaltstack __P((struct thread *, struct svr4_sys_sigaltstack_args *));
+int svr4_sys_sigaction __P((struct thread *, struct svr4_sys_sigaction_args *));
+int svr4_sys_sigpending __P((struct thread *, struct svr4_sys_sigpending_args *));
+int svr4_sys_context __P((struct thread *, struct svr4_sys_context_args *));
+int svr4_sys_statvfs __P((struct thread *, struct svr4_sys_statvfs_args *));
+int svr4_sys_fstatvfs __P((struct thread *, struct svr4_sys_fstatvfs_args *));
+int svr4_sys_waitsys __P((struct thread *, struct svr4_sys_waitsys_args *));
+int svr4_sys_hrtsys __P((struct thread *, struct svr4_sys_hrtsys_args *));
+int svr4_sys_pathconf __P((struct thread *, struct svr4_sys_pathconf_args *));
+int svr4_sys_mmap __P((struct thread *, struct svr4_sys_mmap_args *));
+int svr4_sys_fpathconf __P((struct thread *, struct svr4_sys_fpathconf_args *));
+int svr4_sys_xstat __P((struct thread *, struct svr4_sys_xstat_args *));
+int svr4_sys_lxstat __P((struct thread *, struct svr4_sys_lxstat_args *));
+int svr4_sys_fxstat __P((struct thread *, struct svr4_sys_fxstat_args *));
+int svr4_sys_xmknod __P((struct thread *, struct svr4_sys_xmknod_args *));
+int svr4_sys_setrlimit __P((struct thread *, struct svr4_sys_setrlimit_args *));
+int svr4_sys_getrlimit __P((struct thread *, struct svr4_sys_getrlimit_args *));
+int svr4_sys_memcntl __P((struct thread *, struct svr4_sys_memcntl_args *));
+int svr4_sys_uname __P((struct thread *, struct svr4_sys_uname_args *));
+int svr4_sys_sysconfig __P((struct thread *, struct svr4_sys_sysconfig_args *));
+int svr4_sys_systeminfo __P((struct thread *, struct svr4_sys_systeminfo_args *));
+int svr4_sys_fchroot __P((struct thread *, struct svr4_sys_fchroot_args *));
+int svr4_sys_utimes __P((struct thread *, struct svr4_sys_utimes_args *));
+int svr4_sys_vhangup __P((struct thread *, struct svr4_sys_vhangup_args *));
+int svr4_sys_gettimeofday __P((struct thread *, struct svr4_sys_gettimeofday_args *));
+int svr4_sys_llseek __P((struct thread *, struct svr4_sys_llseek_args *));
+int svr4_sys_acl __P((struct thread *, struct svr4_sys_acl_args *));
+int svr4_sys_auditsys __P((struct thread *, struct svr4_sys_auditsys_args *));
+int svr4_sys_facl __P((struct thread *, struct svr4_sys_facl_args *));
+int svr4_sys_resolvepath __P((struct thread *, struct svr4_sys_resolvepath_args *));
+int svr4_sys_getdents64 __P((struct thread *, struct svr4_sys_getdents64_args *));
+int svr4_sys_mmap64 __P((struct thread *, struct svr4_sys_mmap64_args *));
+int svr4_sys_stat64 __P((struct thread *, struct svr4_sys_stat64_args *));
+int svr4_sys_lstat64 __P((struct thread *, struct svr4_sys_lstat64_args *));
+int svr4_sys_fstat64 __P((struct thread *, struct svr4_sys_fstat64_args *));
+int svr4_sys_statvfs64 __P((struct thread *, struct svr4_sys_statvfs64_args *));
+int svr4_sys_fstatvfs64 __P((struct thread *, struct svr4_sys_fstatvfs64_args *));
+int svr4_sys_setrlimit64 __P((struct thread *, struct svr4_sys_setrlimit64_args *));
+int svr4_sys_getrlimit64 __P((struct thread *, struct svr4_sys_getrlimit64_args *));
+int svr4_sys_creat64 __P((struct thread *, struct svr4_sys_creat64_args *));
+int svr4_sys_open64 __P((struct thread *, struct svr4_sys_open64_args *));
+int svr4_sys_socket __P((struct thread *, struct svr4_sys_socket_args *));
+int svr4_sys_recv __P((struct thread *, struct svr4_sys_recv_args *));
+int svr4_sys_send __P((struct thread *, struct svr4_sys_send_args *));
+int svr4_sys_sendto __P((struct thread *, struct svr4_sys_sendto_args *));
#ifdef COMPAT_43
diff --git a/sys/compat/svr4/svr4_resource.c b/sys/compat/svr4/svr4_resource.c
index 2b52140..976475d 100644
--- a/sys/compat/svr4/svr4_resource.c
+++ b/sys/compat/svr4/svr4_resource.c
@@ -128,8 +128,8 @@ svr4_to_native_rl(rl)
((svr4_rlim64_t)(l)) != SVR4_RLIM64_SAVED_MAX)
int
-svr4_sys_getrlimit(p, uap)
- register struct proc *p;
+svr4_sys_getrlimit(td, uap)
+ register struct thread *td;
struct svr4_sys_getrlimit_args *uap;
{
int rl = svr4_to_native_rl(SCARG(uap, which));
@@ -141,7 +141,7 @@ svr4_sys_getrlimit(p, uap)
/* For p_rlimit. */
mtx_assert(&Giant, MA_OWNED);
- blim = p->p_rlimit[rl];
+ blim = td->td_proc->p_rlimit[rl];
/*
* Our infinity, is their maxfiles.
@@ -175,8 +175,8 @@ svr4_sys_getrlimit(p, uap)
int
-svr4_sys_setrlimit(p, uap)
- register struct proc *p;
+svr4_sys_setrlimit(td, uap)
+ register struct thread *td;
struct svr4_sys_setrlimit_args *uap;
{
int rl = svr4_to_native_rl(SCARG(uap, which));
@@ -189,7 +189,7 @@ svr4_sys_setrlimit(p, uap)
/* For p_rlimit. */
mtx_assert(&Giant, MA_OWNED);
- limp = &p->p_rlimit[rl];
+ limp = &td->td_proc->p_rlimit[rl];
if ((error = copyin(SCARG(uap, rlp), &slim, sizeof(slim))) != 0)
return error;
@@ -221,13 +221,13 @@ svr4_sys_setrlimit(p, uap)
else if (slim.rlim_cur == SVR4_RLIM_SAVED_CUR)
blim.rlim_cur = limp->rlim_cur;
- return dosetrlimit(p, rl, &blim);
+ return dosetrlimit(td, rl, &blim);
}
int
-svr4_sys_getrlimit64(p, uap)
- register struct proc *p;
+svr4_sys_getrlimit64(td, uap)
+ register struct thread *td;
struct svr4_sys_getrlimit64_args *uap;
{
int rl = svr4_to_native_rl(SCARG(uap, which));
@@ -239,7 +239,7 @@ svr4_sys_getrlimit64(p, uap)
/* For p_rlimit. */
mtx_assert(&Giant, MA_OWNED);
- blim = p->p_rlimit[rl];
+ blim = td->td_proc->p_rlimit[rl];
/*
* Our infinity, is their maxfiles.
@@ -273,8 +273,8 @@ svr4_sys_getrlimit64(p, uap)
int
-svr4_sys_setrlimit64(p, uap)
- register struct proc *p;
+svr4_sys_setrlimit64(td, uap)
+ register struct thread *td;
struct svr4_sys_setrlimit64_args *uap;
{
int rl = svr4_to_native_rl(SCARG(uap, which));
@@ -287,7 +287,7 @@ svr4_sys_setrlimit64(p, uap)
/* For p_rlimit. */
mtx_assert(&Giant, MA_OWNED);
- limp = &p->p_rlimit[rl];
+ limp = &td->td_proc->p_rlimit[rl];
if ((error = copyin(SCARG(uap, rlp), &slim, sizeof(slim))) != 0)
return error;
@@ -319,5 +319,5 @@ svr4_sys_setrlimit64(p, uap)
else if (slim.rlim_cur == SVR4_RLIM64_SAVED_CUR)
blim.rlim_cur = limp->rlim_cur;
- return dosetrlimit(p, rl, &blim);
+ return dosetrlimit(td, rl, &blim);
}
diff --git a/sys/compat/svr4/svr4_signal.c b/sys/compat/svr4/svr4_signal.c
index 0273a7a..d4bf8e9 100644
--- a/sys/compat/svr4/svr4_signal.c
+++ b/sys/compat/svr4/svr4_signal.c
@@ -260,8 +260,8 @@ bsd_to_svr4_sigaltstack(bss, sss)
}
int
-svr4_sys_sigaction(p, uap)
- register struct proc *p;
+svr4_sys_sigaction(td, uap)
+ register struct thread *td;
struct svr4_sys_sigaction_args *uap;
{
struct svr4_sigaction *nisa, *oisa, tmpisa;
@@ -270,7 +270,7 @@ svr4_sys_sigaction(p, uap)
caddr_t sg;
int error;
- DPRINTF(("@@@ svr4_sys_sigaction(%d, %d, %d)\n", p->p_pid,
+ DPRINTF(("@@@ svr4_sys_sigaction(%d, %d, %d)\n", td->td_proc->p_pid,
SCARG(uap, signum),
SVR4_SVR42BSD_SIG(SCARG(uap, signum))));
@@ -307,7 +307,7 @@ svr4_sys_sigaction(p, uap)
SCARG(&sa, act) = nbsa;
SCARG(&sa, oact) = obsa;
- if ((error = sigaction(p, &sa)) != 0)
+ if ((error = sigaction(td, &sa)) != 0)
return error;
if (oisa != NULL) {
@@ -322,8 +322,8 @@ svr4_sys_sigaction(p, uap)
}
int
-svr4_sys_sigaltstack(p, uap)
- register struct proc *p;
+svr4_sys_sigaltstack(td, uap)
+ register struct thread *td;
struct svr4_sys_sigaltstack_args *uap;
{
struct svr4_sigaltstack *nsss, *osss, tmpsss;
@@ -332,7 +332,7 @@ svr4_sys_sigaltstack(p, uap)
caddr_t sg;
int error, *retval;
- retval = p->p_retval;
+ retval = td->td_retval;
sg = stackgap_init();
nsss = SCARG(uap, nss);
osss = SCARG(uap, oss);
@@ -355,7 +355,7 @@ svr4_sys_sigaltstack(p, uap)
SCARG(&sa, ss) = nbss;
SCARG(&sa, oss) = obss;
- if ((error = sigaltstack(p, &sa)) != 0)
+ if ((error = sigaltstack(td, &sa)) != 0)
return error;
if (obss != NULL) {
@@ -373,15 +373,15 @@ svr4_sys_sigaltstack(p, uap)
* Stolen from the ibcs2 one
*/
int
-svr4_sys_signal(p, uap)
- register struct proc *p;
+svr4_sys_signal(td, uap)
+ register struct thread *td;
struct svr4_sys_signal_args *uap;
{
int signum;
- int error, *retval = p->p_retval;
+ int error, *retval = td->td_retval;
caddr_t sg = stackgap_init();
- DPRINTF(("@@@ svr4_sys_signal(%d)\n", p->p_pid));
+ DPRINTF(("@@@ svr4_sys_signal(%d)\n", td->td_proc->p_pid));
signum = SVR4_SVR42BSD_SIG(SVR4_SIGNO(SCARG(uap, signum)));
if (signum <= 0 || signum > SVR4_NSIG)
@@ -413,7 +413,7 @@ svr4_sys_signal(p, uap)
if ((error = copyout(&sa, nbsa, sizeof(sa))) != 0)
return error;
- if ((error = sigaction(p, &sa_args)) != 0) {
+ if ((error = sigaction(td, &sa_args)) != 0) {
DPRINTF(("signal: sigaction failed: %d\n",
error));
*retval = (int)SVR4_SIG_ERR;
@@ -437,7 +437,7 @@ sighold:
SCARG(&sa, how) = SIG_BLOCK;
SCARG(&sa, set) = set;
SCARG(&sa, oset) = NULL;
- return sigprocmask(p, &sa);
+ return sigprocmask(td, &sa);
}
case SVR4_SIGRELSE_MASK:
@@ -451,7 +451,7 @@ sighold:
SCARG(&sa, how) = SIG_UNBLOCK;
SCARG(&sa, set) = set;
SCARG(&sa, oset) = NULL;
- return sigprocmask(p, &sa);
+ return sigprocmask(td, &sa);
}
case SVR4_SIGIGNORE_MASK:
@@ -469,7 +469,7 @@ sighold:
sa.sa_flags = 0;
if ((error = copyout(&sa, bsa, sizeof(sa))) != 0)
return error;
- if ((error = sigaction(p, &sa_args)) != 0) {
+ if ((error = sigaction(td, &sa_args)) != 0) {
DPRINTF(("sigignore: sigaction failed\n"));
return error;
}
@@ -482,12 +482,12 @@ sighold:
sigset_t *set;
set = stackgap_alloc(&sg, sizeof(sigset_t));
- PROC_LOCK(p);
- *set = p->p_sigmask;
- PROC_UNLOCK(p);
+ PROC_LOCK(td->td_proc);
+ *set = td->td_proc->p_sigmask;
+ PROC_UNLOCK(td->td_proc);
SIGDELSET(*set, signum);
SCARG(&sa, sigmask) = set;
- return sigsuspend(p, &sa);
+ return sigsuspend(td, &sa);
}
default:
@@ -497,20 +497,20 @@ sighold:
int
-svr4_sys_sigprocmask(p, uap)
- struct proc *p;
+svr4_sys_sigprocmask(td, uap)
+ struct thread *td;
struct svr4_sys_sigprocmask_args *uap;
{
svr4_sigset_t sss;
sigset_t bss;
int error = 0, *retval;
- retval = p->p_retval;
+ retval = td->td_retval;
if (SCARG(uap, oset) != NULL) {
/* Fix the return value first if needed */
- PROC_LOCK(p);
- bsd_to_svr4_sigset(&p->p_sigmask, &sss);
- PROC_UNLOCK(p);
+ PROC_LOCK(td->td_proc);
+ bsd_to_svr4_sigset(&td->td_proc->p_sigmask, &sss);
+ PROC_UNLOCK(td->td_proc);
if ((error = copyout(&sss, SCARG(uap, oset), sizeof(sss))) != 0)
return error;
}
@@ -524,50 +524,50 @@ svr4_sys_sigprocmask(p, uap)
svr4_to_bsd_sigset(&sss, &bss);
- PROC_LOCK(p);
+ PROC_LOCK(td->td_proc);
switch (SCARG(uap, how)) {
case SVR4_SIG_BLOCK:
- SIGSETOR(p->p_sigmask, bss);
- SIG_CANTMASK(p->p_sigmask);
+ SIGSETOR(td->td_proc->p_sigmask, bss);
+ SIG_CANTMASK(td->td_proc->p_sigmask);
break;
case SVR4_SIG_UNBLOCK:
- SIGSETNAND(p->p_sigmask, bss);
+ SIGSETNAND(td->td_proc->p_sigmask, bss);
break;
case SVR4_SIG_SETMASK:
- p->p_sigmask = bss;
- SIG_CANTMASK(p->p_sigmask);
+ td->td_proc->p_sigmask = bss;
+ SIG_CANTMASK(td->td_proc->p_sigmask);
break;
default:
error = EINVAL;
break;
}
- PROC_UNLOCK(p);
+ PROC_UNLOCK(td->td_proc);
return error;
}
int
-svr4_sys_sigpending(p, uap)
- struct proc *p;
+svr4_sys_sigpending(td, uap)
+ struct thread *td;
struct svr4_sys_sigpending_args *uap;
{
sigset_t bss;
int *retval;
svr4_sigset_t sss;
- DPRINTF(("@@@ svr4_sys_sigpending(%d)\n", p->p_pid));
- retval = p->p_retval;
+ DPRINTF(("@@@ svr4_sys_sigpending(%d)\n", td->td_proc->p_pid));
+ retval = td->td_retval;
switch (SCARG(uap, what)) {
case 1: /* sigpending */
if (SCARG(uap, mask) == NULL)
return 0;
- PROC_LOCK(p);
- bss = p->p_siglist;
- SIGSETAND(bss, p->p_sigmask);
- PROC_UNLOCK(p);
+ PROC_LOCK(td->td_proc);
+ bss = td->td_proc->p_siglist;
+ SIGSETAND(bss, td->td_proc->p_sigmask);
+ PROC_UNLOCK(td->td_proc);
bsd_to_svr4_sigset(&bss, &sss);
break;
@@ -590,8 +590,8 @@ svr4_sys_sigpending(p, uap)
}
int
-svr4_sys_sigsuspend(p, uap)
- register struct proc *p;
+svr4_sys_sigsuspend(td, uap)
+ register struct thread *td;
struct svr4_sys_sigsuspend_args *uap;
{
svr4_sigset_t sss;
@@ -607,26 +607,26 @@ svr4_sys_sigsuspend(p, uap)
svr4_to_bsd_sigset(&sss, bss);
SCARG(&sa, sigmask) = bss;
- return sigsuspend(p, &sa);
+ return sigsuspend(td, &sa);
}
int
-svr4_sys_kill(p, uap)
- register struct proc *p;
+svr4_sys_kill(td, uap)
+ register struct thread *td;
struct svr4_sys_kill_args *uap;
{
struct kill_args ka;
SCARG(&ka, pid) = SCARG(uap, pid);
SCARG(&ka, signum) = SVR4_SVR42BSD_SIG(SCARG(uap, signum));
- return kill(p, &ka);
+ return kill(td, &ka);
}
int
-svr4_sys_context(p, uap)
- register struct proc *p;
+svr4_sys_context(td, uap)
+ register struct thread *td;
struct svr4_sys_context_args *uap;
{
struct svr4_ucontext uc;
@@ -634,11 +634,11 @@ svr4_sys_context(p, uap)
switch (uap->func) {
case 0:
- PROC_LOCK(p);
+ PROC_LOCK(td->td_proc);
DPRINTF(("getcontext(%p)\n", uap->uc));
- svr4_getcontext(p, &uc, &p->p_sigmask,
- sigonstack(cpu_getstack(p)));
- PROC_UNLOCK(p);
+ svr4_getcontext(td, &uc, &td->td_proc->p_sigmask,
+ sigonstack(cpu_getstack(td)));
+ PROC_UNLOCK(td->td_proc);
return copyout(&uc, uap->uc, sizeof(uc));
case 1:
@@ -654,7 +654,7 @@ svr4_sys_context(p, uap)
uc.uc_sigmask.bits[i]));
}
#endif
- return svr4_setcontext(p, &uc);
+ return svr4_setcontext(td, &uc);
default:
DPRINTF(("context(%d, %p)\n", uap->func,
@@ -665,12 +665,12 @@ svr4_sys_context(p, uap)
}
int
-svr4_sys_pause(p, uap)
- register struct proc *p;
+svr4_sys_pause(td, uap)
+ register struct thread *td;
struct svr4_sys_pause_args *uap;
{
struct sigsuspend_args bsa;
- SCARG(&bsa, sigmask) = &p->p_sigmask;
- return sigsuspend(p, &bsa);
+ SCARG(&bsa, sigmask) = &td->td_proc->p_sigmask;
+ return sigsuspend(td, &bsa);
}
diff --git a/sys/compat/svr4/svr4_socket.c b/sys/compat/svr4/svr4_socket.c
index bd14556..b4f2b55 100644
--- a/sys/compat/svr4/svr4_socket.c
+++ b/sys/compat/svr4/svr4_socket.c
@@ -75,8 +75,8 @@ extern TAILQ_HEAD(svr4_sockcache_head, svr4_sockcache_entry) svr4_head;
extern int svr4_str_initialized;
struct sockaddr_un *
-svr4_find_socket(p, fp, dev, ino)
- struct proc *p;
+svr4_find_socket(td, fp, dev, ino)
+ struct thread *td;
struct file *fp;
udev_t dev;
ino_t ino;
@@ -87,7 +87,7 @@ svr4_find_socket(p, fp, dev, ino)
if (svr4_str_initialized != 2) {
if (atomic_cmpset_acq_int(&svr4_str_initialized, 0, 1)) {
DPRINTF(("svr4_find_socket: uninitialized [%p,%d,%d]\n",
- p, dev, ino));
+ td, dev, ino));
TAILQ_INIT(&svr4_head);
atomic_store_rel_int(&svr4_str_initialized, 2);
}
@@ -95,9 +95,9 @@ svr4_find_socket(p, fp, dev, ino)
}
- DPRINTF(("svr4_find_socket: [%p,%d,%d]: ", p, dev, ino));
+ DPRINTF(("svr4_find_socket: [%p,%d,%d]: ", td, dev, ino));
TAILQ_FOREACH(e, &svr4_head, entries)
- if (e->p == p && e->dev == dev && e->ino == ino) {
+ if (e->p == td->td_proc && e->dev == dev && e->ino == ino) {
#ifdef DIAGNOSTIC
if (e->cookie != NULL && e->cookie != cookie)
panic("svr4 socket cookie mismatch");
@@ -117,8 +117,8 @@ svr4_find_socket(p, fp, dev, ino)
* the streams "soo_close()" routine).
*/
int
-svr4_add_socket(p, path, st)
- struct proc *p;
+svr4_add_socket(td, path, st)
+ struct thread *td;
const char *path;
struct stat *st;
{
@@ -142,7 +142,7 @@ svr4_add_socket(p, path, st)
e->cookie = NULL;
e->dev = st->st_dev;
e->ino = st->st_ino;
- e->p = p;
+ e->p = td->td_proc;
if ((error = copyinstr(path, e->sock.sun_path,
sizeof(e->sock.sun_path), &len)) != 0) {
@@ -156,14 +156,14 @@ svr4_add_socket(p, path, st)
TAILQ_INSERT_HEAD(&svr4_head, e, entries);
DPRINTF(("svr4_add_socket: %s [%p,%d,%d]\n", e->sock.sun_path,
- p, e->dev, e->ino));
+ td->td_proc, e->dev, e->ino));
return 0;
}
int
-svr4_sys_socket(p, uap)
- struct proc *p;
+svr4_sys_socket(td, uap)
+ struct thread *td;
struct svr4_sys_socket_args *uap;
{
switch (SCARG(uap, type)) {
@@ -189,5 +189,5 @@ svr4_sys_socket(p, uap)
default:
return EINVAL;
}
- return socket(p, (struct socket_args *)uap);
+ return socket(td, (struct socket_args *)uap);
}
diff --git a/sys/compat/svr4/svr4_socket.h b/sys/compat/svr4/svr4_socket.h
index 96e3582..e860392 100644
--- a/sys/compat/svr4/svr4_socket.h
+++ b/sys/compat/svr4/svr4_socket.h
@@ -38,6 +38,7 @@
struct sockaddr_un;
struct proc;
+struct thread;
struct file;
struct svr4_sockaddr_in {
@@ -47,9 +48,9 @@ struct svr4_sockaddr_in {
u_char sin_zero[8];
};
-struct sockaddr_un *svr4_find_socket __P((struct proc *, struct file *,
+struct sockaddr_un *svr4_find_socket __P((struct thread *, struct file *,
udev_t, ino_t));
void svr4_delete_socket __P((struct proc *, struct file *));
-int svr4_add_socket __P((struct proc *, const char *, struct stat *));
+int svr4_add_socket __P((struct thread *, const char *, struct stat *));
#endif /* _SVR4_SOCKET_H_ */
diff --git a/sys/compat/svr4/svr4_sockio.c b/sys/compat/svr4/svr4_sockio.c
index b96be4d..65cf49a 100644
--- a/sys/compat/svr4/svr4_sockio.c
+++ b/sys/compat/svr4/svr4_sockio.c
@@ -70,9 +70,9 @@ bsd_to_svr4_flags(bf)
}
int
-svr4_sock_ioctl(fp, p, retval, fd, cmd, data)
+svr4_sock_ioctl(fp, td, retval, fd, cmd, data)
struct file *fp;
- struct proc *p;
+ struct thread *td;
register_t *retval;
int fd;
u_long cmd;
@@ -125,7 +125,7 @@ svr4_sock_ioctl(fp, p, retval, fd, cmd, data)
(void) strncpy(br.ifr_name, sr.svr4_ifr_name,
sizeof(br.ifr_name));
if ((error = fo_ioctl(fp, SIOCGIFFLAGS,
- (caddr_t) &br, p)) != 0) {
+ (caddr_t) &br, td)) != 0) {
DPRINTF(("SIOCGIFFLAGS (%s) %s: error %d\n",
br.ifr_name, sr.svr4_ifr_name, error));
return error;
@@ -149,7 +149,7 @@ svr4_sock_ioctl(fp, p, retval, fd, cmd, data)
sc.svr4_ifc_len));
if ((error = fo_ioctl(fp, OSIOCGIFCONF,
- (caddr_t) &sc, p)) != 0)
+ (caddr_t) &sc, td)) != 0)
return error;
DPRINTF(("SIOCGIFCONF\n"));
diff --git a/sys/compat/svr4/svr4_stat.c b/sys/compat/svr4/svr4_stat.c
index a3f22c8..d44a51b 100644
--- a/sys/compat/svr4/svr4_stat.c
+++ b/sys/compat/svr4/svr4_stat.c
@@ -73,7 +73,7 @@ struct svr4_ustat_args {
static void bsd_to_svr4_xstat __P((struct stat *, struct svr4_xstat *));
static void bsd_to_svr4_stat64 __P((struct stat *, struct svr4_stat64 *));
-int svr4_ustat __P((struct proc *, struct svr4_ustat_args *));
+int svr4_ustat __P((struct thread *, struct svr4_ustat_args *));
static int svr4_to_bsd_pathconf __P((int));
/*
@@ -153,8 +153,8 @@ bsd_to_svr4_stat64(st, st4)
}
int
-svr4_sys_stat(p, uap)
- struct proc *p;
+svr4_sys_stat(td, uap)
+ struct thread *td;
struct svr4_sys_stat_args *uap;
{
struct stat st;
@@ -163,13 +163,13 @@ svr4_sys_stat(p, uap)
int error;
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
SCARG(&cup, path) = SCARG(uap, path);
SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat));
- if ((error = stat(p, &cup)) != 0)
+ if ((error = stat(td, &cup)) != 0)
return error;
if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0)
@@ -178,7 +178,7 @@ svr4_sys_stat(p, uap)
bsd_to_svr4_stat(&st, &svr4_st);
if (S_ISSOCK(st.st_mode))
- (void) svr4_add_socket(p, SCARG(uap, path), &st);
+ (void) svr4_add_socket(td, SCARG(uap, path), &st);
if ((error = copyout(&svr4_st, SCARG(uap, ub), sizeof svr4_st)) != 0)
return error;
@@ -188,8 +188,8 @@ svr4_sys_stat(p, uap)
int
-svr4_sys_lstat(p, uap)
- register struct proc *p;
+svr4_sys_lstat(td, uap)
+ register struct thread *td;
struct svr4_sys_lstat_args *uap;
{
struct stat st;
@@ -198,12 +198,12 @@ svr4_sys_lstat(p, uap)
int error;
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
SCARG(&cup, path) = SCARG(uap, path);
SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat));
- if ((error = lstat(p, &cup)) != 0)
+ if ((error = lstat(td, &cup)) != 0)
return error;
if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0)
@@ -212,7 +212,7 @@ svr4_sys_lstat(p, uap)
bsd_to_svr4_stat(&st, &svr4_st);
if (S_ISSOCK(st.st_mode))
- (void) svr4_add_socket(p, SCARG(uap, path), &st);
+ (void) svr4_add_socket(td, SCARG(uap, path), &st);
if ((error = copyout(&svr4_st, SCARG(uap, ub), sizeof svr4_st)) != 0)
return error;
@@ -222,8 +222,8 @@ svr4_sys_lstat(p, uap)
int
-svr4_sys_fstat(p, uap)
- register struct proc *p;
+svr4_sys_fstat(td, uap)
+ register struct thread *td;
struct svr4_sys_fstat_args *uap;
{
struct stat st;
@@ -235,7 +235,7 @@ svr4_sys_fstat(p, uap)
SCARG(&cup, fd) = SCARG(uap, fd);
SCARG(&cup, sb) = stackgap_alloc(&sg, sizeof(struct stat));
- if ((error = fstat(p, &cup)) != 0)
+ if ((error = fstat(td, &cup)) != 0)
return error;
if ((error = copyin(SCARG(&cup, sb), &st, sizeof st)) != 0)
@@ -251,8 +251,8 @@ svr4_sys_fstat(p, uap)
int
-svr4_sys_xstat(p, uap)
- register struct proc *p;
+svr4_sys_xstat(td, uap)
+ register struct thread *td;
struct svr4_sys_xstat_args *uap;
{
struct stat st;
@@ -261,12 +261,12 @@ svr4_sys_xstat(p, uap)
int error;
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
SCARG(&cup, path) = SCARG(uap, path);
SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat));
- if ((error = stat(p, &cup)) != 0)
+ if ((error = stat(td, &cup)) != 0)
return error;
if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0)
@@ -276,7 +276,7 @@ svr4_sys_xstat(p, uap)
#if defined(SOCKET_NOTYET)
if (S_ISSOCK(st.st_mode))
- (void) svr4_add_socket(p, SCARG(uap, path), &st);
+ (void) svr4_add_socket(td, SCARG(uap, path), &st);
#endif
if ((error = copyout(&svr4_st, SCARG(uap, ub), sizeof svr4_st)) != 0)
@@ -286,8 +286,8 @@ svr4_sys_xstat(p, uap)
}
int
-svr4_sys_lxstat(p, uap)
- register struct proc *p;
+svr4_sys_lxstat(td, uap)
+ register struct thread *td;
struct svr4_sys_lxstat_args *uap;
{
struct stat st;
@@ -295,12 +295,12 @@ svr4_sys_lxstat(p, uap)
struct lstat_args cup;
int error;
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
SCARG(&cup, path) = SCARG(uap, path);
SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat));
- if ((error = lstat(p, &cup)) != 0)
+ if ((error = lstat(td, &cup)) != 0)
return error;
if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0)
@@ -310,7 +310,7 @@ svr4_sys_lxstat(p, uap)
#if defined(SOCKET_NOTYET)
if (S_ISSOCK(st.st_mode))
- (void) svr4_add_socket(p, SCARG(uap, path), &st);
+ (void) svr4_add_socket(td, SCARG(uap, path), &st);
#endif
if ((error = copyout(&svr4_st, SCARG(uap, ub), sizeof svr4_st)) != 0)
return error;
@@ -320,8 +320,8 @@ svr4_sys_lxstat(p, uap)
int
-svr4_sys_fxstat(p, uap)
- register struct proc *p;
+svr4_sys_fxstat(td, uap)
+ register struct thread *td;
struct svr4_sys_fxstat_args *uap;
{
struct stat st;
@@ -334,7 +334,7 @@ svr4_sys_fxstat(p, uap)
SCARG(&cup, fd) = SCARG(uap, fd);
SCARG(&cup, sb) = stackgap_alloc(&sg, sizeof(struct stat));
- if ((error = fstat(p, &cup)) != 0)
+ if ((error = fstat(td, &cup)) != 0)
return error;
if ((error = copyin(SCARG(&cup, sb), &st, sizeof st)) != 0)
@@ -349,8 +349,8 @@ svr4_sys_fxstat(p, uap)
}
int
-svr4_sys_stat64(p, uap)
- register struct proc *p;
+svr4_sys_stat64(td, uap)
+ register struct thread *td;
struct svr4_sys_stat64_args *uap;
{
struct stat st;
@@ -359,12 +359,12 @@ svr4_sys_stat64(p, uap)
int error;
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
SCARG(&cup, path) = SCARG(uap, path);
SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat));
- if ((error = stat(p, &cup)) != 0)
+ if ((error = stat(td, &cup)) != 0)
return error;
if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0)
@@ -373,7 +373,7 @@ svr4_sys_stat64(p, uap)
bsd_to_svr4_stat64(&st, &svr4_st);
if (S_ISSOCK(st.st_mode))
- (void) svr4_add_socket(p, SCARG(uap, path), &st);
+ (void) svr4_add_socket(td, SCARG(uap, path), &st);
if ((error = copyout(&svr4_st, SCARG(uap, sb), sizeof svr4_st)) != 0)
return error;
@@ -383,8 +383,8 @@ svr4_sys_stat64(p, uap)
int
-svr4_sys_lstat64(p, uap)
- register struct proc *p;
+svr4_sys_lstat64(td, uap)
+ register struct thread *td;
struct svr4_sys_lstat64_args *uap;
{
struct stat st;
@@ -393,12 +393,12 @@ svr4_sys_lstat64(p, uap)
int error;
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, (char *) SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, (char *) SCARG(uap, path));
SCARG(&cup, path) = SCARG(uap, path);
SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat));
- if ((error = lstat(p, (struct lstat_args *)&cup)) != 0)
+ if ((error = lstat(td, (struct lstat_args *)&cup)) != 0)
return error;
if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0)
@@ -407,7 +407,7 @@ svr4_sys_lstat64(p, uap)
bsd_to_svr4_stat64(&st, &svr4_st);
if (S_ISSOCK(st.st_mode))
- (void) svr4_add_socket(p, SCARG(uap, path), &st);
+ (void) svr4_add_socket(td, SCARG(uap, path), &st);
if ((error = copyout(&svr4_st, SCARG(uap, sb), sizeof svr4_st)) != 0)
return error;
@@ -417,8 +417,8 @@ svr4_sys_lstat64(p, uap)
int
-svr4_sys_fstat64(p, uap)
- register struct proc *p;
+svr4_sys_fstat64(td, uap)
+ register struct thread *td;
struct svr4_sys_fstat64_args *uap;
{
struct stat st;
@@ -430,7 +430,7 @@ svr4_sys_fstat64(p, uap)
SCARG(&cup, fd) = SCARG(uap, fd);
SCARG(&cup, sb) = stackgap_alloc(&sg, sizeof(struct stat));
- if ((error = fstat(p, &cup)) != 0)
+ if ((error = fstat(td, &cup)) != 0)
return error;
if ((error = copyin(SCARG(&cup, sb), &st, sizeof st)) != 0)
@@ -446,8 +446,8 @@ svr4_sys_fstat64(p, uap)
int
-svr4_ustat(p, uap)
- register struct proc *p;
+svr4_ustat(td, uap)
+ register struct thread *td;
struct svr4_ustat_args *uap;
{
struct svr4_ustat us;
@@ -468,8 +468,8 @@ svr4_ustat(p, uap)
/*extern char ostype[], hostname[], osrelease[], version[], machine[];*/
int
-svr4_sys_uname(p, uap)
- register struct proc *p;
+svr4_sys_uname(td, uap)
+ register struct thread *td;
struct svr4_sys_uname_args *uap;
{
struct svr4_utsname sut;
@@ -497,13 +497,13 @@ svr4_sys_uname(p, uap)
}
int
-svr4_sys_systeminfo(p, uap)
- struct proc *p;
+svr4_sys_systeminfo(td, uap)
+ struct thread *td;
struct svr4_sys_systeminfo_args *uap;
{
char *str = NULL;
int error = 0;
- register_t *retval = p->p_retval;
+ register_t *retval = td->td_retval;
size_t len = 0;
char buf[1]; /* XXX NetBSD uses 256, but that seems
like awfully excessive kstack usage
@@ -563,13 +563,13 @@ svr4_sys_systeminfo(p, uap)
if ((error = suser(p)) != 0)
return error;
name = KERN_HOSTNAME;
- return kern_sysctl(&name, 1, 0, 0, SCARG(uap, buf), rlen, p);
+ return kern_sysctl(&name, 1, 0, 0, SCARG(uap, buf), rlen, td);
case SVR4_SI_SET_SRPC_DOMAIN:
if ((error = suser(p)) != 0)
return error;
name = KERN_NISDOMAINNAME;
- return kern_sysctl(&name, 1, 0, 0, SCARG(uap, buf), rlen, p);
+ return kern_sysctl(&name, 1, 0, 0, SCARG(uap, buf), rlen, td);
#else
case SVR4_SI_SET_HOSTNAME:
case SVR4_SI_SET_SRPC_DOMAIN:
@@ -607,8 +607,8 @@ svr4_sys_systeminfo(p, uap)
}
int
-svr4_sys_utssys(p, uap)
- register struct proc *p;
+svr4_sys_utssys(td, uap)
+ register struct thread *td;
struct svr4_sys_utssys_args *uap;
{
switch (SCARG(uap, sel)) {
@@ -616,7 +616,7 @@ svr4_sys_utssys(p, uap)
{
struct svr4_sys_uname_args ua;
SCARG(&ua, name) = SCARG(uap, a1);
- return svr4_sys_uname(p, &ua);
+ return svr4_sys_uname(td, &ua);
}
case 2: /* ustat(2) */
@@ -624,7 +624,7 @@ svr4_sys_utssys(p, uap)
struct svr4_ustat_args ua;
SCARG(&ua, dev) = (svr4_dev_t) SCARG(uap, a2);
SCARG(&ua, name) = SCARG(uap, a1);
- return svr4_ustat(p, &ua);
+ return svr4_ustat(td, &ua);
}
case 3: /* fusers(2) */
@@ -638,8 +638,8 @@ svr4_sys_utssys(p, uap)
int
-svr4_sys_utime(p, uap)
- register struct proc *p;
+svr4_sys_utime(td, uap)
+ register struct thread *td;
struct svr4_sys_utime_args *uap;
{
struct svr4_utimbuf ub;
@@ -649,7 +649,7 @@ svr4_sys_utime(p, uap)
caddr_t sg = stackgap_init();
void *ttp;
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
SCARG(&ap, path) = SCARG(uap, path);
if (SCARG(uap, ubuf) != NULL) {
if ((error = copyin(SCARG(uap, ubuf), &ub, sizeof(ub))) != 0)
@@ -666,18 +666,18 @@ svr4_sys_utime(p, uap)
}
else
SCARG(&ap, tptr) = NULL;
- return utimes(p, &ap);
+ return utimes(td, &ap);
}
int
-svr4_sys_utimes(p, uap)
- register struct proc *p;
+svr4_sys_utimes(td, uap)
+ register struct thread *td;
struct svr4_sys_utimes_args *uap;
{
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
- return utimes(p, (struct utimes_args *)uap);
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
+ return utimes(td, (struct utimes_args *)uap);
}
static int
@@ -730,14 +730,14 @@ svr4_to_bsd_pathconf(name)
int
-svr4_sys_pathconf(p, uap)
- register struct proc *p;
+svr4_sys_pathconf(td, uap)
+ register struct thread *td;
struct svr4_sys_pathconf_args *uap;
{
caddr_t sg = stackgap_init();
- register_t *retval = p->p_retval;
+ register_t *retval = td->td_retval;
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
SCARG(uap, name) = svr4_to_bsd_pathconf(SCARG(uap, name));
@@ -749,17 +749,17 @@ svr4_sys_pathconf(p, uap)
*retval = 0;
return 0;
default:
- return pathconf(p, (struct pathconf_args *)uap);
+ return pathconf(td, (struct pathconf_args *)uap);
}
}
int
-svr4_sys_fpathconf(p, uap)
- register struct proc *p;
+svr4_sys_fpathconf(td, uap)
+ register struct thread *td;
struct svr4_sys_fpathconf_args *uap;
{
- register_t *retval = p->p_retval;
+ register_t *retval = td->td_retval;
SCARG(uap, name) = svr4_to_bsd_pathconf(SCARG(uap, name));
@@ -771,6 +771,6 @@ svr4_sys_fpathconf(p, uap)
*retval = 0;
return 0;
default:
- return fpathconf(p, (struct fpathconf_args *)uap);
+ return fpathconf(td, (struct fpathconf_args *)uap);
}
}
diff --git a/sys/compat/svr4/svr4_stream.c b/sys/compat/svr4/svr4_stream.c
index 45a2a5e..cb19305 100644
--- a/sys/compat/svr4/svr4_stream.c
+++ b/sys/compat/svr4/svr4_stream.c
@@ -75,7 +75,7 @@
#include <compat/svr4/svr4_socket.h>
/* Utils */
-static int clean_pipe __P((struct proc *, const char *));
+static int clean_pipe __P((struct thread *, const char *));
static void getparm __P((struct file *, struct svr4_si_sockparms *));
/* Address Conversions */
@@ -89,48 +89,48 @@ static void netaddr_to_sockaddr_un __P((struct sockaddr_un *,
const struct svr4_strmcmd *));
/* stream ioctls */
-static int i_nread __P((struct file *, struct proc *, register_t *, int,
+static int i_nread __P((struct file *, struct thread *, register_t *, int,
u_long, caddr_t));
-static int i_fdinsert __P((struct file *, struct proc *, register_t *, int,
+static int i_fdinsert __P((struct file *, struct thread *, register_t *, int,
u_long, caddr_t));
-static int i_str __P((struct file *, struct proc *, register_t *, int,
+static int i_str __P((struct file *, struct thread *, register_t *, int,
u_long, caddr_t));
-static int i_setsig __P((struct file *, struct proc *, register_t *, int,
+static int i_setsig __P((struct file *, struct thread *, register_t *, int,
u_long, caddr_t));
-static int i_getsig __P((struct file *, struct proc *, register_t *, int,
+static int i_getsig __P((struct file *, struct thread *, register_t *, int,
u_long, caddr_t));
-static int _i_bind_rsvd __P((struct file *, struct proc *, register_t *, int,
+static int _i_bind_rsvd __P((struct file *, struct thread *, register_t *, int,
u_long, caddr_t));
-static int _i_rele_rsvd __P((struct file *, struct proc *, register_t *, int,
+static int _i_rele_rsvd __P((struct file *, struct thread *, register_t *, int,
u_long, caddr_t));
/* i_str sockmod calls */
static int sockmod __P((struct file *, int, struct svr4_strioctl *,
- struct proc *));
+ struct thread *));
static int si_listen __P((struct file *, int, struct svr4_strioctl *,
- struct proc *));
+ struct thread *));
static int si_ogetudata __P((struct file *, int, struct svr4_strioctl *,
- struct proc *));
+ struct thread *));
static int si_sockparams __P((struct file *, int, struct svr4_strioctl *,
- struct proc *));
+ struct thread *));
static int si_shutdown __P((struct file *, int, struct svr4_strioctl *,
- struct proc *));
+ struct thread *));
static int si_getudata __P((struct file *, int, struct svr4_strioctl *,
- struct proc *));
+ struct thread *));
/* i_str timod calls */
static int timod __P((struct file *, int, struct svr4_strioctl *,
- struct proc *));
+ struct thread *));
static int ti_getinfo __P((struct file *, int, struct svr4_strioctl *,
- struct proc *));
+ struct thread *));
static int ti_bind __P((struct file *, int, struct svr4_strioctl *,
- struct proc *));
+ struct thread *));
/* infrastructure */
-static int svr4_sendit __P((struct proc *p, int s, struct msghdr *mp,
+static int svr4_sendit __P((struct thread *td, int s, struct msghdr *mp,
int flags));
-static int svr4_recvit __P((struct proc *p, int s, struct msghdr *mp,
+static int svr4_recvit __P((struct thread *td, int s, struct msghdr *mp,
caddr_t namelenp));
/* <sigh> Ok, so we shouldn't use sendit() in uipc_syscalls.c because
@@ -144,8 +144,8 @@ static int svr4_recvit __P((struct proc *p, int s, struct msghdr *mp,
* I will take out all the #ifdef COMPAT_OLDSOCK gumph, though.
*/
static int
-svr4_sendit(p, s, mp, flags)
- register struct proc *p;
+svr4_sendit(td, s, mp, flags)
+ register struct thread *td;
int s;
register struct msghdr *mp;
int flags;
@@ -163,27 +163,27 @@ svr4_sendit(p, s, mp, flags)
struct uio ktruio;
#endif
- error = holdsock(p->p_fd, s, &fp);
+ error = holdsock(td->td_proc->p_fd, s, &fp);
if (error)
return (error);
auio.uio_iov = mp->msg_iov;
auio.uio_iovcnt = mp->msg_iovlen;
auio.uio_segflg = UIO_USERSPACE;
auio.uio_rw = UIO_WRITE;
- auio.uio_procp = p;
+ auio.uio_td = td;
auio.uio_offset = 0; /* XXX */
auio.uio_resid = 0;
iov = mp->msg_iov;
for (i = 0; i < mp->msg_iovlen; i++, iov++) {
if ((auio.uio_resid += iov->iov_len) < 0) {
- fdrop(fp, p);
+ fdrop(fp, td);
return (EINVAL);
}
}
if (mp->msg_name) {
error = getsockaddr(&to, mp->msg_name, mp->msg_namelen);
if (error) {
- fdrop(fp, p);
+ fdrop(fp, td);
return (error);
}
} else {
@@ -202,7 +202,7 @@ svr4_sendit(p, s, mp, flags)
control = 0;
}
#ifdef KTRACE
- if (KTRPOINT(p, KTR_GENIO)) {
+ if (KTRPOINT(td->td_proc, KTR_GENIO)) {
int iovlen = auio.uio_iovcnt * sizeof (struct iovec);
MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK);
@@ -213,25 +213,25 @@ svr4_sendit(p, s, mp, flags)
len = auio.uio_resid;
so = (struct socket *)fp->f_data;
error = so->so_proto->pr_usrreqs->pru_sosend(so, to, &auio, 0, control,
- flags, p);
+ flags, td);
if (error) {
if (auio.uio_resid != len && (error == ERESTART ||
error == EINTR || error == EWOULDBLOCK))
error = 0;
if (error == EPIPE) {
- PROC_LOCK(p);
- psignal(p, SIGPIPE);
- PROC_UNLOCK(p);
+ PROC_LOCK(td->td_proc);
+ psignal(td->td_proc, SIGPIPE);
+ PROC_UNLOCK(td->td_proc);
}
}
if (error == 0)
- p->p_retval[0] = len - auio.uio_resid;
+ td->td_retval[0] = len - auio.uio_resid;
#ifdef KTRACE
if (ktriov != NULL) {
if (error == 0) {
ktruio.uio_iov = ktriov;
- ktruio.uio_resid = p->p_retval[0];
- ktrgenio(p->p_tracep, s, UIO_WRITE, &ktruio, error);
+ ktruio.uio_resid = td->td_retval[0];
+ ktrgenio(td->td_proc->p_tracep, s, UIO_WRITE, &ktruio, error);
}
FREE(ktriov, M_TEMP);
}
@@ -239,13 +239,13 @@ svr4_sendit(p, s, mp, flags)
bad:
if (to)
FREE(to, M_SONAME);
- fdrop(fp, p);
+ fdrop(fp, td);
return (error);
}
static int
-svr4_recvit(p, s, mp, namelenp)
- register struct proc *p;
+svr4_recvit(td, s, mp, namelenp)
+ register struct thread *td;
int s;
register struct msghdr *mp;
caddr_t namelenp;
@@ -264,25 +264,25 @@ svr4_recvit(p, s, mp, namelenp)
struct uio ktruio;
#endif
- error = holdsock(p->p_fd, s, &fp);
+ error = holdsock(td->td_proc->p_fd, s, &fp);
if (error)
return (error);
auio.uio_iov = mp->msg_iov;
auio.uio_iovcnt = mp->msg_iovlen;
auio.uio_segflg = UIO_USERSPACE;
auio.uio_rw = UIO_READ;
- auio.uio_procp = p;
+ auio.uio_td = td;
auio.uio_offset = 0; /* XXX */
auio.uio_resid = 0;
iov = mp->msg_iov;
for (i = 0; i < mp->msg_iovlen; i++, iov++) {
if ((auio.uio_resid += iov->iov_len) < 0) {
- fdrop(fp, p);
+ fdrop(fp, td);
return (EINVAL);
}
}
#ifdef KTRACE
- if (KTRPOINT(p, KTR_GENIO)) {
+ if (KTRPOINT(td->td_proc, KTR_GENIO)) {
int iovlen = auio.uio_iovcnt * sizeof (struct iovec);
MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK);
@@ -305,14 +305,14 @@ svr4_recvit(p, s, mp, namelenp)
if (error == 0) {
ktruio.uio_iov = ktriov;
ktruio.uio_resid = len - auio.uio_resid;
- ktrgenio(p->p_tracep, s, UIO_READ, &ktruio, error);
+ ktrgenio(td->td_proc->p_tracep, s, UIO_READ, &ktruio, error);
}
FREE(ktriov, M_TEMP);
}
#endif
if (error)
goto out;
- p->p_retval[0] = len - auio.uio_resid;
+ td->td_retval[0] = len - auio.uio_resid;
if (mp->msg_name) {
len = mp->msg_namelen;
if (len <= 0 || fromsa == 0)
@@ -365,7 +365,7 @@ out:
FREE(fromsa, M_SONAME);
if (control)
m_freem(control);
- fdrop(fp, p);
+ fdrop(fp, td);
return (error);
}
@@ -499,8 +499,8 @@ show_msg(str, fd, ctl, dat, flags)
* to avoid code duplication.
*/
static int
-clean_pipe(p, path)
- struct proc *p;
+clean_pipe(td, path)
+ struct thread *td;
const char *path;
{
struct lstat_args la;
@@ -519,7 +519,7 @@ clean_pipe(p, path)
SCARG(&la, path) = tpath;
- if ((error = lstat(p, &la)) != 0)
+ if ((error = lstat(td, &la)) != 0)
return 0;
if ((error = copyin(SCARG(&la, ub), &st, sizeof(st))) != 0)
@@ -536,7 +536,7 @@ clean_pipe(p, path)
SCARG(&ua, path) = SCARG(&la, path);
- if ((error = unlink(p, &ua)) != 0) {
+ if ((error = unlink(td, &ua)) != 0) {
DPRINTF(("clean_pipe: unlink failed %d\n", error));
return error;
}
@@ -662,11 +662,11 @@ getparm(fp, pa)
static int
-si_ogetudata(fp, fd, ioc, p)
+si_ogetudata(fp, fd, ioc, td)
struct file *fp;
int fd;
struct svr4_strioctl *ioc;
- struct proc *p;
+ struct thread *td;
{
int error;
struct svr4_si_oudata ud;
@@ -719,11 +719,11 @@ si_ogetudata(fp, fd, ioc, p)
static int
-si_sockparams(fp, fd, ioc, p)
+si_sockparams(fp, fd, ioc, td)
struct file *fp;
int fd;
struct svr4_strioctl *ioc;
- struct proc *p;
+ struct thread *td;
{
struct svr4_si_sockparms pa;
@@ -733,11 +733,11 @@ si_sockparams(fp, fd, ioc, p)
static int
-si_listen(fp, fd, ioc, p)
+si_listen(fp, fd, ioc, td)
struct file *fp;
int fd;
struct svr4_strioctl *ioc;
- struct proc *p;
+ struct thread *td;
{
int error;
struct svr4_strm *st = svr4_stream_get(fp);
@@ -762,7 +762,7 @@ si_listen(fp, fd, ioc, p)
DPRINTF(("SI_LISTEN: fileno %d backlog = %d\n", fd, 5));
SCARG(&la, backlog) = 5;
- if ((error = listen(p, &la)) != 0) {
+ if ((error = listen(td, &la)) != 0) {
DPRINTF(("SI_LISTEN: listen failed %d\n", error));
return error;
}
@@ -797,11 +797,11 @@ si_listen(fp, fd, ioc, p)
static int
-si_getudata(fp, fd, ioc, p)
+si_getudata(fp, fd, ioc, td)
struct file *fp;
int fd;
struct svr4_strioctl *ioc;
- struct proc *p;
+ struct thread *td;
{
int error;
struct svr4_si_udata ud;
@@ -856,11 +856,11 @@ si_getudata(fp, fd, ioc, p)
static int
-si_shutdown(fp, fd, ioc, p)
+si_shutdown(fp, fd, ioc, td)
struct file *fp;
int fd;
struct svr4_strioctl *ioc;
- struct proc *p;
+ struct thread *td;
{
int error;
struct shutdown_args ap;
@@ -876,29 +876,29 @@ si_shutdown(fp, fd, ioc, p)
SCARG(&ap, s) = fd;
- return shutdown(p, &ap);
+ return shutdown(td, &ap);
}
static int
-sockmod(fp, fd, ioc, p)
+sockmod(fp, fd, ioc, td)
struct file *fp;
int fd;
struct svr4_strioctl *ioc;
- struct proc *p;
+ struct thread *td;
{
switch (ioc->cmd) {
case SVR4_SI_OGETUDATA:
DPRINTF(("SI_OGETUDATA\n"));
- return si_ogetudata(fp, fd, ioc, p);
+ return si_ogetudata(fp, fd, ioc, td);
case SVR4_SI_SHUTDOWN:
DPRINTF(("SI_SHUTDOWN\n"));
- return si_shutdown(fp, fd, ioc, p);
+ return si_shutdown(fp, fd, ioc, td);
case SVR4_SI_LISTEN:
DPRINTF(("SI_LISTEN\n"));
- return si_listen(fp, fd, ioc, p);
+ return si_listen(fp, fd, ioc, td);
case SVR4_SI_SETMYNAME:
DPRINTF(("SI_SETMYNAME\n"));
@@ -922,11 +922,11 @@ sockmod(fp, fd, ioc, p)
case SVR4_SI_SOCKPARAMS:
DPRINTF(("SI_SOCKPARAMS\n"));
- return si_sockparams(fp, fd, ioc, p);
+ return si_sockparams(fp, fd, ioc, td);
case SVR4_SI_GETUDATA:
DPRINTF(("SI_GETUDATA\n"));
- return si_getudata(fp, fd, ioc, p);
+ return si_getudata(fp, fd, ioc, td);
default:
DPRINTF(("Unknown sockmod ioctl %lx\n", ioc->cmd));
@@ -937,11 +937,11 @@ sockmod(fp, fd, ioc, p)
static int
-ti_getinfo(fp, fd, ioc, p)
+ti_getinfo(fp, fd, ioc, td)
struct file *fp;
int fd;
struct svr4_strioctl *ioc;
- struct proc *p;
+ struct thread *td;
{
int error;
struct svr4_infocmd info;
@@ -975,11 +975,11 @@ ti_getinfo(fp, fd, ioc, p)
static int
-ti_bind(fp, fd, ioc, p)
+ti_bind(fp, fd, ioc, td)
struct file *fp;
int fd;
struct svr4_strioctl *ioc;
- struct proc *p;
+ struct thread *td;
{
int error;
struct svr4_strm *st = svr4_stream_get(fp);
@@ -1033,7 +1033,7 @@ ti_bind(fp, fd, ioc, p)
DPRINTF(("TI_BIND: fam %d, path %s\n",
saun.sun_family, saun.sun_path));
- if ((error = clean_pipe(p, saun.sun_path)) != 0)
+ if ((error = clean_pipe(td, saun.sun_path)) != 0)
return error;
bnd.pad[28] = 0x00001000; /* magic again */
@@ -1056,7 +1056,7 @@ ti_bind(fp, fd, ioc, p)
SCARG(&ba, name) = (void *) sup;
SCARG(&ba, namelen) = sasize;
- if ((error = bind(p, &ba)) != 0) {
+ if ((error = bind(td, &ba)) != 0) {
DPRINTF(("TI_BIND: bind failed %d\n", error));
return error;
}
@@ -1078,16 +1078,16 @@ reply:
static int
-timod(fp, fd, ioc, p)
+timod(fp, fd, ioc, td)
struct file *fp;
int fd;
struct svr4_strioctl *ioc;
- struct proc *p;
+ struct thread *td;
{
switch (ioc->cmd) {
case SVR4_TI_GETINFO:
DPRINTF(("TI_GETINFO\n"));
- return ti_getinfo(fp, fd, ioc, p);
+ return ti_getinfo(fp, fd, ioc, td);
case SVR4_TI_OPTMGMT:
DPRINTF(("TI_OPTMGMT\n"));
@@ -1095,7 +1095,7 @@ timod(fp, fd, ioc, p)
case SVR4_TI_BIND:
DPRINTF(("TI_BIND\n"));
- return ti_bind(fp, fd, ioc, p);
+ return ti_bind(fp, fd, ioc, td);
case SVR4_TI_UNBIND:
DPRINTF(("TI_UNBIND\n"));
@@ -1109,9 +1109,9 @@ timod(fp, fd, ioc, p)
int
-svr4_stream_ti_ioctl(fp, p, retval, fd, cmd, dat)
+svr4_stream_ti_ioctl(fp, td, retval, fd, cmd, dat)
struct file *fp;
- struct proc *p;
+ struct thread *td;
register_t *retval;
int fd;
u_long cmd;
@@ -1174,7 +1174,7 @@ svr4_stream_ti_ioctl(fp, p, retval, fd, cmd, dat)
SCARG(&ap, fdes) = fd;
SCARG(&ap, asa) = sup;
SCARG(&ap, alen) = lenp;
- if ((error = getsockname(p, &ap)) != 0) {
+ if ((error = getsockname(td, &ap)) != 0) {
DPRINTF(("ti_ioctl: getsockname error\n"));
return error;
}
@@ -1188,7 +1188,7 @@ svr4_stream_ti_ioctl(fp, p, retval, fd, cmd, dat)
SCARG(&ap, fdes) = fd;
SCARG(&ap, asa) = sup;
SCARG(&ap, alen) = lenp;
- if ((error = getpeername(p, &ap)) != 0) {
+ if ((error = getpeername(td, &ap)) != 0) {
DPRINTF(("ti_ioctl: getpeername error\n"));
return error;
}
@@ -1251,9 +1251,9 @@ svr4_stream_ti_ioctl(fp, p, retval, fd, cmd, dat)
static int
-i_nread(fp, p, retval, fd, cmd, dat)
+i_nread(fp, td, retval, fd, cmd, dat)
struct file *fp;
- struct proc *p;
+ struct thread *td;
register_t *retval;
int fd;
u_long cmd;
@@ -1269,7 +1269,7 @@ i_nread(fp, p, retval, fd, cmd, dat)
* for us, and if we do, then we assume that we have at least one
* message waiting for us.
*/
- if ((error = fo_ioctl(fp, FIONREAD, (caddr_t) &nread, p)) != 0)
+ if ((error = fo_ioctl(fp, FIONREAD, (caddr_t) &nread, td)) != 0)
return error;
if (nread != 0)
@@ -1281,9 +1281,9 @@ i_nread(fp, p, retval, fd, cmd, dat)
}
static int
-i_fdinsert(fp, p, retval, fd, cmd, dat)
+i_fdinsert(fp, td, retval, fd, cmd, dat)
struct file *fp;
- struct proc *p;
+ struct thread *td;
register_t *retval;
int fd;
u_long cmd;
@@ -1321,7 +1321,7 @@ i_fdinsert(fp, p, retval, fd, cmd, dat)
SCARG(&d2p, from) = st->s_afd;
SCARG(&d2p, to) = fdi.fd;
- if ((error = dup2(p, &d2p)) != 0) {
+ if ((error = dup2(td, &d2p)) != 0) {
DPRINTF(("fdinsert: dup2(%d, %d) failed %d\n",
st->s_afd, fdi.fd, error));
return error;
@@ -1329,7 +1329,7 @@ i_fdinsert(fp, p, retval, fd, cmd, dat)
SCARG(&clp, fd) = st->s_afd;
- if ((error = close(p, &clp)) != 0) {
+ if ((error = close(td, &clp)) != 0) {
DPRINTF(("fdinsert: close(%d) failed %d\n",
st->s_afd, error));
return error;
@@ -1343,9 +1343,9 @@ i_fdinsert(fp, p, retval, fd, cmd, dat)
static int
-_i_bind_rsvd(fp, p, retval, fd, cmd, dat)
+_i_bind_rsvd(fp, td, retval, fd, cmd, dat)
struct file *fp;
- struct proc *p;
+ struct thread *td;
register_t *retval;
int fd;
u_long cmd;
@@ -1363,13 +1363,13 @@ _i_bind_rsvd(fp, p, retval, fd, cmd, dat)
SCARG(&ap, path) = dat;
SCARG(&ap, mode) = S_IFIFO;
- return mkfifo(p, &ap);
+ return mkfifo(td, &ap);
}
static int
-_i_rele_rsvd(fp, p, retval, fd, cmd, dat)
+_i_rele_rsvd(fp, td, retval, fd, cmd, dat)
struct file *fp;
- struct proc *p;
+ struct thread *td;
register_t *retval;
int fd;
u_long cmd;
@@ -1383,13 +1383,13 @@ _i_rele_rsvd(fp, p, retval, fd, cmd, dat)
*/
SCARG(&ap, path) = dat;
- return unlink(p, &ap);
+ return unlink(td, &ap);
}
static int
-i_str(fp, p, retval, fd, cmd, dat)
+i_str(fp, td, retval, fd, cmd, dat)
struct file *fp;
- struct proc *p;
+ struct thread *td;
register_t *retval;
int fd;
u_long cmd;
@@ -1408,12 +1408,12 @@ i_str(fp, p, retval, fd, cmd, dat)
switch (ioc.cmd & 0xff00) {
case SVR4_SIMOD:
- if ((error = sockmod(fp, fd, &ioc, p)) != 0)
+ if ((error = sockmod(fp, fd, &ioc, td)) != 0)
return error;
break;
case SVR4_TIMOD:
- if ((error = timod(fp, fd, &ioc, p)) != 0)
+ if ((error = timod(fp, fd, &ioc, td)) != 0)
return error;
break;
@@ -1431,9 +1431,9 @@ i_str(fp, p, retval, fd, cmd, dat)
}
static int
-i_setsig(fp, p, retval, fd, cmd, dat)
+i_setsig(fp, td, retval, fd, cmd, dat)
struct file *fp;
- struct proc *p;
+ struct thread *td;
register_t *retval;
int fd;
u_long cmd;
@@ -1459,10 +1459,10 @@ i_setsig(fp, p, retval, fd, cmd, dat)
/* get old status flags */
SCARG(&fa, fd) = fd;
SCARG(&fa, cmd) = F_GETFL;
- if ((error = fcntl(p, &fa)) != 0)
+ if ((error = fcntl(td, &fa)) != 0)
return error;
- oflags = p->p_retval[0];
+ oflags = td->td_retval[0];
/* update the flags */
if (dat != NULL) {
@@ -1488,24 +1488,24 @@ i_setsig(fp, p, retval, fd, cmd, dat)
if (flags != oflags) {
SCARG(&fa, cmd) = F_SETFL;
SCARG(&fa, arg) = (long) flags;
- if ((error = fcntl(p, &fa)) != 0)
+ if ((error = fcntl(td, &fa)) != 0)
return error;
- flags = p->p_retval[0];
+ flags = td->td_retval[0];
}
/* set up SIGIO receiver if needed */
if (dat != NULL) {
SCARG(&fa, cmd) = F_SETOWN;
- SCARG(&fa, arg) = (long) p->p_pid;
- return fcntl(p, &fa);
+ SCARG(&fa, arg) = (long) td->td_proc->p_pid;
+ return fcntl(td, &fa);
}
return 0;
}
static int
-i_getsig(fp, p, retval, fd, cmd, dat)
+i_getsig(fp, td, retval, fd, cmd, dat)
struct file *fp;
- struct proc *p;
+ struct thread *td;
register_t *retval;
int fd;
u_long cmd;
@@ -1530,9 +1530,9 @@ i_getsig(fp, p, retval, fd, cmd, dat)
}
int
-svr4_stream_ioctl(fp, p, retval, fd, cmd, dat)
+svr4_stream_ioctl(fp, td, retval, fd, cmd, dat)
struct file *fp;
- struct proc *p;
+ struct thread *td;
register_t *retval;
int fd;
u_long cmd;
@@ -1546,7 +1546,7 @@ svr4_stream_ioctl(fp, p, retval, fd, cmd, dat)
switch (cmd) {
case SVR4_I_NREAD:
DPRINTF(("I_NREAD\n"));
- return i_nread(fp, p, retval, fd, cmd, dat);
+ return i_nread(fp, td, retval, fd, cmd, dat);
case SVR4_I_PUSH:
DPRINTF(("I_PUSH %p\n", dat));
@@ -1577,15 +1577,15 @@ svr4_stream_ioctl(fp, p, retval, fd, cmd, dat)
case SVR4_I_STR:
DPRINTF(("I_STR\n"));
- return i_str(fp, p, retval, fd, cmd, dat);
+ return i_str(fp, td, retval, fd, cmd, dat);
case SVR4_I_SETSIG:
DPRINTF(("I_SETSIG\n"));
- return i_setsig(fp, p, retval, fd, cmd, dat);
+ return i_setsig(fp, td, retval, fd, cmd, dat);
case SVR4_I_GETSIG:
DPRINTF(("I_GETSIG\n"));
- return i_getsig(fp, p, retval, fd, cmd, dat);
+ return i_getsig(fp, td, retval, fd, cmd, dat);
case SVR4_I_FIND:
DPRINTF(("I_FIND\n"));
@@ -1614,7 +1614,7 @@ svr4_stream_ioctl(fp, p, retval, fd, cmd, dat)
case SVR4_I_FDINSERT:
DPRINTF(("I_FDINSERT\n"));
- return i_fdinsert(fp, p, retval, fd, cmd, dat);
+ return i_fdinsert(fp, td, retval, fd, cmd, dat);
case SVR4_I_SENDFD:
DPRINTF(("I_SENDFD\n"));
@@ -1690,11 +1690,11 @@ svr4_stream_ioctl(fp, p, retval, fd, cmd, dat)
case SVR4__I_BIND_RSVD:
DPRINTF(("_I_BIND_RSVD\n"));
- return _i_bind_rsvd(fp, p, retval, fd, cmd, dat);
+ return _i_bind_rsvd(fp, td, retval, fd, cmd, dat);
case SVR4__I_RELE_RSVD:
DPRINTF(("_I_RELE_RSVD\n"));
- return _i_rele_rsvd(fp, p, retval, fd, cmd, dat);
+ return _i_rele_rsvd(fp, td, retval, fd, cmd, dat);
default:
DPRINTF(("unimpl cmd = %lx\n", cmd));
@@ -1707,11 +1707,11 @@ svr4_stream_ioctl(fp, p, retval, fd, cmd, dat)
int
-svr4_sys_putmsg(p, uap)
- register struct proc *p;
+svr4_sys_putmsg(td, uap)
+ register struct thread *td;
struct svr4_sys_putmsg_args *uap;
{
- struct filedesc *fdp = p->p_fd;
+ struct filedesc *fdp = td->td_proc->p_fd;
struct file *fp;
struct svr4_strbuf dat, ctl;
struct svr4_strmcmd sc;
@@ -1723,7 +1723,7 @@ svr4_sys_putmsg(p, uap)
int error;
caddr_t sg;
- retval = p->p_retval;
+ retval = td->td_retval;
fp = fdp->fd_ofiles[SCARG(uap, fd)];
if (((u_int)SCARG(uap, fd) >= fdp->fd_nfiles) || (fp == NULL)) {
@@ -1802,7 +1802,7 @@ svr4_sys_putmsg(p, uap)
SCARG(&wa, fd) = SCARG(uap, fd);
SCARG(&wa, buf) = dat.buf;
SCARG(&wa, nbyte) = dat.len;
- return write(p, &wa);
+ return write(td, &wa);
}
DPRINTF(("putmsg: Invalid inet length %ld\n", sc.len));
return EINVAL;
@@ -1824,7 +1824,7 @@ svr4_sys_putmsg(p, uap)
/* Maybe we've been given a device/inode pair */
udev_t *dev = SVR4_ADDROF(&sc);
ino_t *ino = (ino_t *) &dev[1];
- skp = svr4_find_socket(p, fp, *dev, *ino);
+ skp = svr4_find_socket(td, fp, *dev, *ino);
if (skp == NULL) {
skp = &saun;
/* I guess we have it by name */
@@ -1855,7 +1855,7 @@ svr4_sys_putmsg(p, uap)
SCARG(&co, name) = (void *) sup;
SCARG(&co, namelen) = (int) sasize;
- return connect(p, &co);
+ return connect(td, &co);
}
case SVR4_TI_SENDTO_REQUEST: /* sendto */
@@ -1873,9 +1873,9 @@ svr4_sys_putmsg(p, uap)
aiov.iov_len = dat.len;
#if 0
error = so->so_proto->pr_usrreqs->pru_sosend(so, 0,
- uio, 0, 0, 0, uio->uio_procp);
+ uio, 0, 0, 0, uio->uio_td);
#endif
- error = svr4_sendit(p, SCARG(uap, fd), &msg,
+ error = svr4_sendit(td, SCARG(uap, fd), &msg,
SCARG(uap, flags));
DPRINTF(("sendto_request error: %d\n", error));
*retval = 0;
@@ -1889,11 +1889,11 @@ svr4_sys_putmsg(p, uap)
}
int
-svr4_sys_getmsg(p, uap)
- register struct proc *p;
+svr4_sys_getmsg(td, uap)
+ register struct thread *td;
struct svr4_sys_getmsg_args *uap;
{
- struct filedesc *fdp = p->p_fd;
+ struct filedesc *fdp = td->td_proc->p_fd;
struct file *fp;
struct getpeername_args ga;
struct accept_args aa;
@@ -1911,7 +1911,7 @@ svr4_sys_getmsg(p, uap)
int fl;
caddr_t sg;
- retval = p->p_retval;
+ retval = td->td_retval;
fp = fdp->fd_ofiles[SCARG(uap, fd)];
if (((u_int)SCARG(uap, fd) >= fdp->fd_nfiles) || (fp == NULL))
@@ -2010,7 +2010,7 @@ svr4_sys_getmsg(p, uap)
SCARG(&ga, asa) = (void *) sup;
SCARG(&ga, alen) = flen;
- if ((error = getpeername(p, &ga)) != 0) {
+ if ((error = getpeername(td, &ga)) != 0) {
DPRINTF(("getmsg: getpeername failed %d\n", error));
return error;
}
@@ -2069,7 +2069,7 @@ svr4_sys_getmsg(p, uap)
SCARG(&aa, name) = (void *) sup;
SCARG(&aa, anamelen) = flen;
- if ((error = accept(p, &aa)) != 0) {
+ if ((error = accept(td, &aa)) != 0) {
DPRINTF(("getmsg: accept failed %d\n", error));
return error;
}
@@ -2140,7 +2140,7 @@ svr4_sys_getmsg(p, uap)
aiov.iov_len = dat.maxlen;
msg.msg_flags = 0;
- error = svr4_recvit(p, SCARG(uap, fd), &msg, (caddr_t) flen);
+ error = svr4_recvit(td, SCARG(uap, fd), &msg, (caddr_t) flen);
if (error) {
DPRINTF(("getmsg: recvit failed %d\n", error));
@@ -2191,7 +2191,7 @@ svr4_sys_getmsg(p, uap)
SCARG(&ra, fd) = SCARG(uap, fd);
SCARG(&ra, buf) = dat.buf;
SCARG(&ra, nbyte) = dat.maxlen;
- if ((error = read(p, &ra)) != 0) {
+ if ((error = read(td, &ra)) != 0) {
return error;
}
dat.len = *retval;
@@ -2231,8 +2231,8 @@ svr4_sys_getmsg(p, uap)
return error;
}
-int svr4_sys_send(p, uap)
- struct proc *p;
+int svr4_sys_send(td, uap)
+ struct thread *td;
struct svr4_sys_send_args *uap;
{
struct osend_args osa;
@@ -2240,11 +2240,11 @@ int svr4_sys_send(p, uap)
SCARG(&osa, buf) = SCARG(uap, buf);
SCARG(&osa, len) = SCARG(uap, len);
SCARG(&osa, flags) = SCARG(uap, flags);
- return osend(p, &osa);
+ return osend(td, &osa);
}
-int svr4_sys_recv(p, uap)
- struct proc *p;
+int svr4_sys_recv(td, uap)
+ struct thread *td;
struct svr4_sys_recv_args *uap;
{
struct orecv_args ora;
@@ -2252,7 +2252,7 @@ int svr4_sys_recv(p, uap)
SCARG(&ora, buf) = SCARG(uap, buf);
SCARG(&ora, len) = SCARG(uap, len);
SCARG(&ora, flags) = SCARG(uap, flags);
- return orecv(p, &ora);
+ return orecv(td, &ora);
}
/*
@@ -2260,8 +2260,8 @@ int svr4_sys_recv(p, uap)
* sendto(). Let's leave it here for now...
*/
int
-svr4_sys_sendto(p, uap)
- struct proc *p;
+svr4_sys_sendto(td, uap)
+ struct thread *td;
struct svr4_sys_sendto_args *uap;
{
struct sendto_args sa;
@@ -2274,6 +2274,6 @@ svr4_sys_sendto(p, uap)
SCARG(&sa, tolen) = SCARG(uap, tolen);
DPRINTF(("calling sendto()\n"));
- return sendto(p, &sa);
+ return sendto(td, &sa);
}
diff --git a/sys/compat/svr4/svr4_syscall.h b/sys/compat/svr4/svr4_syscall.h
index 9d25526..b1898b5 100644
--- a/sys/compat/svr4/svr4_syscall.h
+++ b/sys/compat/svr4/svr4_syscall.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: src/sys/svr4/syscalls.master,v 1.10 2000/07/29 10:05:24 peter Exp
+ * created from FreeBSD: src/sys/compat/svr4/syscalls.master,v 1.11 2000/08/31 22:54:05 obrien Exp
*/
#define SVR4_SYS_exit 1
diff --git a/sys/compat/svr4/svr4_syscallnames.c b/sys/compat/svr4/svr4_syscallnames.c
index 479a6b7..1f9add4 100644
--- a/sys/compat/svr4/svr4_syscallnames.c
+++ b/sys/compat/svr4/svr4_syscallnames.c
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: src/sys/svr4/syscalls.master,v 1.10 2000/07/29 10:05:24 peter Exp
+ * created from FreeBSD: src/sys/compat/svr4/syscalls.master,v 1.11 2000/08/31 22:54:05 obrien Exp
*/
char *svr4_syscallnames[] = {
diff --git a/sys/compat/svr4/svr4_sysent.c b/sys/compat/svr4/svr4_sysent.c
index bad9e4e..2bb003e 100644
--- a/sys/compat/svr4/svr4_sysent.c
+++ b/sys/compat/svr4/svr4_sysent.c
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: src/sys/svr4/syscalls.master,v 1.10 2000/07/29 10:05:24 peter Exp
+ * created from FreeBSD: src/sys/compat/svr4/syscalls.master,v 1.11 2000/08/31 22:54:05 obrien Exp
*/
#include <sys/types.h>
diff --git a/sys/compat/svr4/svr4_sysvec.c b/sys/compat/svr4/svr4_sysvec.c
index 9137e0c..39aa904 100644
--- a/sys/compat/svr4/svr4_sysvec.c
+++ b/sys/compat/svr4/svr4_sysvec.c
@@ -238,14 +238,15 @@ svr4_fixup(register_t **stack_base, struct image_params *imgp)
* Code shamelessly stolen by Mark Newton from IBCS2 emulation code.
*/
int
-svr4_emul_find(p, sgp, prefix, path, pbuf, cflag)
- struct proc *p;
+svr4_emul_find(td, sgp, prefix, path, pbuf, cflag)
+ struct thread *td;
caddr_t *sgp; /* Pointer to stackgap memory */
const char *prefix;
char *path;
char **pbuf;
int cflag;
{
+ struct proc *p = td->td_proc;
struct nameidata nd;
struct nameidata ndroot;
struct vattr vat;
@@ -292,7 +293,7 @@ svr4_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);
@@ -303,7 +304,7 @@ svr4_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);
@@ -320,7 +321,7 @@ svr4_emul_find(p, sgp, prefix, path, pbuf, cflag)
* to the emulation root directory. This is expensive :-(
*/
NDINIT(&ndroot, LOOKUP, FOLLOW, UIO_SYSSPACE, svr4_emul_path,
- p);
+ td);
if ((error = namei(&ndroot)) != 0) {
/* Cannot happen! */
@@ -330,11 +331,11 @@ svr4_emul_find(p, sgp, prefix, path, pbuf, cflag)
}
NDFREE(&ndroot, NDF_ONLY_PNBUF);
- if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, p)) != 0) {
+ if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, td)) != 0) {
goto done;
}
- if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, p->p_ucred, p))
+ if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, p->p_ucred, td))
!= 0) {
goto done;
}
diff --git a/sys/compat/svr4/svr4_termios.c b/sys/compat/svr4/svr4_termios.c
index d50f97f..981aef8 100644
--- a/sys/compat/svr4/svr4_termios.c
+++ b/sys/compat/svr4/svr4_termios.c
@@ -478,9 +478,9 @@ svr4_termios_to_termio(ts, t)
}
int
-svr4_term_ioctl(fp, p, retval, fd, cmd, data)
+svr4_term_ioctl(fp, td, retval, fd, cmd, data)
struct file *fp;
- struct proc *p;
+ struct thread *td;
register_t *retval;
int fd;
u_long cmd;
@@ -499,7 +499,7 @@ svr4_term_ioctl(fp, p, retval, fd, cmd, data)
case SVR4_TCGETA:
case SVR4_TCGETS:
DPRINTF(("ioctl(TCGET%c);\n", cmd == SVR4_TCGETA ? 'A' : 'S'));
- if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t) &bt, p)) != 0)
+ if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t) &bt, td)) != 0)
return error;
memset(&st, 0, sizeof(st));
@@ -526,7 +526,7 @@ svr4_term_ioctl(fp, p, retval, fd, cmd, data)
case SVR4_TCSETSF:
DPRINTF(("TCSET{A,S,AW,SW,AF,SF}\n"));
/* get full BSD termios so we don't lose information */
- if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t) &bt, p)) != 0)
+ if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t) &bt, td)) != 0)
return error;
switch (cmd) {
@@ -577,14 +577,14 @@ svr4_term_ioctl(fp, p, retval, fd, cmd, data)
print_svr4_termios(&st);
#endif /* DEBUG_SVR4 */
- return fo_ioctl(fp, cmd, (caddr_t) &bt, p);
+ return fo_ioctl(fp, cmd, (caddr_t) &bt, td);
case SVR4_TIOCGWINSZ:
DPRINTF(("TIOCGWINSZ\n"));
{
struct svr4_winsize ws;
- error = fo_ioctl(fp, TIOCGWINSZ, (caddr_t) &ws, p);
+ error = fo_ioctl(fp, TIOCGWINSZ, (caddr_t) &ws, td);
if (error)
return error;
return copyout(&ws, data, sizeof(ws));
@@ -597,11 +597,11 @@ svr4_term_ioctl(fp, p, retval, fd, cmd, data)
if ((error = copyin(data, &ws, sizeof(ws))) != 0)
return error;
- return fo_ioctl(fp, TIOCSWINSZ, (caddr_t) &ws, p);
+ return fo_ioctl(fp, TIOCSWINSZ, (caddr_t) &ws, td);
}
default:
DPRINTF(("teleport to STREAMS ioctls...\n"));
- return svr4_stream_ti_ioctl(fp, p, retval, fd, cmd, data);
+ return svr4_stream_ti_ioctl(fp, td, retval, fd, cmd, data);
}
}
diff --git a/sys/compat/svr4/svr4_ttold.c b/sys/compat/svr4/svr4_ttold.c
index e139016..90cdae1 100644
--- a/sys/compat/svr4/svr4_ttold.c
+++ b/sys/compat/svr4/svr4_ttold.c
@@ -175,9 +175,9 @@ bsd_ltchars_to_svr4_ltchars(bl, sl)
int
-svr4_ttold_ioctl(fp, p, retval, fd, cmd, data)
+svr4_ttold_ioctl(fp, td, retval, fd, cmd, data)
struct file *fp;
- struct proc *p;
+ struct thread *td;
register_t *retval;
int fd;
u_long cmd;
@@ -192,7 +192,7 @@ svr4_ttold_ioctl(fp, p, retval, fd, cmd, data)
{
pid_t pid;
- if ((error = fo_ioctl(fp, TIOCGPGRP, (caddr_t) &pid, p)) != 0)
+ if ((error = fo_ioctl(fp, TIOCGPGRP, (caddr_t) &pid, td)) != 0)
return error;
DPRINTF(("TIOCGPGRP %d\n", pid));
@@ -211,21 +211,21 @@ svr4_ttold_ioctl(fp, p, retval, fd, cmd, data)
DPRINTF(("TIOCSPGRP %d\n", pid));
- return fo_ioctl(fp, TIOCSPGRP, (caddr_t) &pid, p);
+ return fo_ioctl(fp, TIOCSPGRP, (caddr_t) &pid, td);
}
case SVR4_TIOCGSID:
{
#if defined(TIOCGSID)
pid_t pid;
- if ((error = fo_ioctl(fp, TIOCGSID, (caddr_t) &pid, p)) != 0)
+ if ((error = fo_ioctl(fp, TIOCGSID, (caddr_t) &pid, td)) != 0)
return error;
DPRINTF(("TIOCGSID %d\n", pid));
return copyout(&pid, data, sizeof(pid));
#else
- uprintf("ioctl(TIOCGSID) for pid %d unsupported\n", p->p_pid);
+ uprintf("ioctl(TIOCGSID) for pid %d unsupported\n", td->td_proc->p_pid);
return EINVAL;
#endif
}
@@ -235,7 +235,7 @@ svr4_ttold_ioctl(fp, p, retval, fd, cmd, data)
struct sgttyb bs;
struct svr4_sgttyb ss;
- error = fo_ioctl(fp, TIOCGETP, (caddr_t) &bs, p);
+ error = fo_ioctl(fp, TIOCGETP, (caddr_t) &bs, td);
if (error)
return error;
@@ -260,7 +260,7 @@ svr4_ttold_ioctl(fp, p, retval, fd, cmd, data)
print_svr4_sgttyb("SVR4_TIOCSET{P,N}", &ss);
#endif /* DEBUG_SVR4 */
cmd = (cmd == SVR4_TIOCSETP) ? TIOCSETP : TIOCSETN;
- return fo_ioctl(fp, cmd, (caddr_t) &bs, p);
+ return fo_ioctl(fp, cmd, (caddr_t) &bs, td);
}
case SVR4_TIOCGETC:
@@ -268,7 +268,7 @@ svr4_ttold_ioctl(fp, p, retval, fd, cmd, data)
struct tchars bt;
struct svr4_tchars st;
- error = fo_ioctl(fp, TIOCGETC, (caddr_t) &bt, p);
+ error = fo_ioctl(fp, TIOCGETC, (caddr_t) &bt, td);
if (error)
return error;
@@ -291,7 +291,7 @@ svr4_ttold_ioctl(fp, p, retval, fd, cmd, data)
#ifdef DEBUG_SVR4
print_svr4_tchars("SVR4_TIOCSETC", &st);
#endif /* DEBUG_SVR4 */
- return fo_ioctl(fp, TIOCSETC, (caddr_t) &bt, p);
+ return fo_ioctl(fp, TIOCSETC, (caddr_t) &bt, td);
}
case SVR4_TIOCGLTC:
@@ -299,7 +299,7 @@ svr4_ttold_ioctl(fp, p, retval, fd, cmd, data)
struct ltchars bl;
struct svr4_ltchars sl;
- error = fo_ioctl(fp, TIOCGLTC, (caddr_t) &bl, p);
+ error = fo_ioctl(fp, TIOCGLTC, (caddr_t) &bl, td);
if (error)
return error;
@@ -322,13 +322,13 @@ svr4_ttold_ioctl(fp, p, retval, fd, cmd, data)
#ifdef DEBUG_SVR4
print_svr4_ltchars("SVR4_TIOCSLTC", &sl);
#endif /* DEBUG_SVR4 */
- return fo_ioctl(fp, TIOCSLTC, (caddr_t) &bl, p);
+ return fo_ioctl(fp, TIOCSLTC, (caddr_t) &bl, td);
}
case SVR4_TIOCLGET:
{
int flags;
- if ((error = fo_ioctl(fp, TIOCLGET, (caddr_t) &flags, p)) != 0)
+ if ((error = fo_ioctl(fp, TIOCLGET, (caddr_t) &flags, td)) != 0)
return error;
DPRINTF(("SVR4_TIOCLGET %o\n", flags));
return copyout(&flags, data, sizeof(flags));
@@ -356,7 +356,7 @@ svr4_ttold_ioctl(fp, p, retval, fd, cmd, data)
}
DPRINTF(("SVR4_TIOCL{SET,BIS,BIC} %o\n", flags));
- return fo_ioctl(fp, cmd, (caddr_t) &flags, p);
+ return fo_ioctl(fp, cmd, (caddr_t) &flags, td);
}
default:
diff --git a/sys/compat/svr4/svr4_util.h b/sys/compat/svr4/svr4_util.h
index 629edd6..9429c0f 100644
--- a/sys/compat/svr4/svr4_util.h
+++ b/sys/compat/svr4/svr4_util.h
@@ -53,7 +53,7 @@ static __inline void *stackgap_alloc(caddr_t *, size_t);
static __inline caddr_t
stackgap_init()
{
-#define szsigcode (*(curproc->p_sysent->sv_szsigcode))
+#define szsigcode (*(curthread->td_proc->p_sysent->sv_szsigcode))
return (caddr_t)(((caddr_t)PS_STRINGS) - szsigcode - SPARE_USRSPACE);
}
@@ -68,7 +68,7 @@ stackgap_alloc(sgp, sz)
}
extern const char svr4_emul_path[];
-int svr4_emul_find __P((struct proc *, caddr_t *, const char *, char *,
+int svr4_emul_find __P((struct thread *, caddr_t *, const char *, char *,
char **, int));
#define CHECKALT(p, sgp, path, i) \
OpenPOWER on IntegriCloud