Subject: Re: what is the status of the ktrace-lwp branch?
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: tech-kern
Date: 10/30/2005 16:07:59
In article <1130658176.873608.2040.nullmailer@yamt.dyndns.org>,
YAMAMOTO Takashi  <yamt@mwd.biglobe.ne.jp> wrote:
>> 2. I understand where chuq is coming from and I think I agree with him. I
>>    think that the uio_ is a process wide struct and not an lwp specific one.
>>    For example, what happens when the lwp exits before the uio is completed?
>
>for aio-like things, i think uio_proc should be changed to vmspace,
>and reference to the vmspace should be kept.
>
>>    On the other hand, keeping it as uio_proc, would require us to call
>>    proc_representative_lwp(uio->uio_proc) in a bunch of places; not very
>>    attractive either.
>
>where is "a bunch of places" for example?
>using uio_proc for other than address space is evil, IMO.
>if proc (or lwp, or ucred, etc) is really necessary,
>it should be passed as another argument.  (or curlwp, where appropriate.)

Not many places. The most common users are socket/io and nfs.

christos

./compat/common/vfs_syscalls_43.c:	auio.uio_lwp = l;
./compat/common/vfs_syscalls_30.c:	auio.uio_lwp = NULL;
./compat/darwin/darwin_iohidsystem.c:		auio.uio_lwp = NULL;
./compat/darwin/darwin_sysctl.c:	auio.uio_lwp = NULL;
./compat/darwin/darwin_sysctl.c:	auio.uio_lwp = NULL;
./compat/darwin/darwin_sysctl.c:		auio.uio_lwp = NULL;
./compat/darwin/darwin_sysctl.c:		auio.uio_lwp = NULL;
./compat/ibcs2/ibcs2_misc.c:	auio.uio_lwp = NULL;
./compat/ibcs2/ibcs2_misc.c:	auio.uio_lwp = NULL;
./compat/irix/irix_dirent.c:	auio.uio_lwp = NULL;
./compat/irix/irix_dirent.c:	auio.uio_lwp = NULL;
./compat/linux/common/linux_file64.c:	auio.uio_lwp = NULL;
./compat/linux/common/linux_misc.c:	auio.uio_lwp = NULL;
./compat/netbsd32/netbsd32_fs.c:	auio.uio_lwp = l;
./compat/netbsd32/netbsd32_fs.c:	auio.uio_lwp = l;
./compat/netbsd32/netbsd32_socket.c:	auio.uio_lwp = l;
./compat/sunos/sunos_misc.c:	auio.uio_lwp = NULL;
./compat/sunos32/sunos32_misc.c:	auio.uio_lwp = NULL;
./compat/svr4/svr4_misc.c:	auio.uio_lwp = NULL;
./compat/svr4/svr4_misc.c:	auio.uio_lwp = NULL;
./compat/svr4_32/svr4_32_misc.c:	auio.uio_lwp = NULL;
./compat/svr4_32/svr4_32_misc.c:	auio.uio_lwp = NULL;
./dev/audiobell.c:	auio.uio_lwp = NULL;
./dev/kttcp.c:	if (uio->uio_lwp)
./dev/kttcp.c:		uio->uio_lwp->l_proc->p_stats->p_ru.ru_msgrcv++;
./dev/vnd.c:	auio.uio_lwp = proc_representative_lwp(bp->b_proc);
./dev/ata/wd.c:		auio.uio_lwp = l;
./dev/ata/wd.c:			wi->wi_uio.uio_lwp = l;
./dev/dkwedge/dk.c:	uio.uio_lwp = l;
./dev/dmover/dmover_io.c:		uio_out->uio_lwp = curlwp;
./dev/dmover/dmover_io.c:		uio_in->uio_lwp = curlwp;
./dev/mca/ed_mca.c:		auio.uio_lwp = l;
./dev/scsipi/scsipi_ioctl.c:			si->si_uio.uio_lwp = l;
./dev/usb/ugen.c:		uio.uio_lwp = l;
./dev/usb/ugen.c:			uio.uio_lwp = l;
./dev/usb/urio.c:		uio.uio_lwp = l;
./dev/usb/usb.c:			uio.uio_lwp = l;
./opencrypto/cryptodev.c:	cse->uio.uio_lwp = NULL;
./fs/cd9660/cd9660_vnops.c:		auio.uio_lwp = NULL;
./fs/msdosfs/msdosfs_vnops.c:	struct proc *p = uio->uio_lwp->l_proc;
./fs/smbfs/smbfs_io.c:	smb_makescred(&scred, uio->uio_lwp, cred);
./fs/smbfs/smbfs_io.c:	l = uiop->uio_lwp;
./fs/smbfs/smbfs_io.c:	l = uiop->uio_lwp;
./fs/smbfs/smbfs_io.c:	uiop->uio_lwp = NULL;
./fs/union/union_subr.c:	uio.uio_lwp = NULL;
./kern/vfs_xattr.c:	auio.uio_lwp = l;
./kern/vfs_xattr.c:		auio.uio_lwp = l;
./kern/vfs_xattr.c:		auio.uio_lwp = l;
./kern/init_sysctl.c:	auio.uio_lwp = NULL;
./kern/init_sysctl.c:	auio.uio_lwp = NULL;
./kern/init_sysctl.c:		auio.uio_lwp = NULL;
./kern/kern_ktrace.c:	auio.uio_lwp = NULL;
./kern/kern_subr.c:	struct lwp *l = uio->uio_lwp;
./kern/kern_subr.c:			l = uio->uio_lwp;
./kern/kern_subr.c:	uio.uio_lwp = NULL;
./kern/kern_subr.c:	uio.uio_lwp = NULL;
./kern/sys_generic.c:	auio.uio_lwp = l;
./kern/sys_generic.c:	auio.uio_lwp = l;
./kern/sys_generic.c:	auio.uio_lwp = l;
./kern/sys_generic.c:	auio.uio_lwp = l;
./kern/sys_pipe.c:	error = uvm_loan(&uio->uio_lwp->l_proc->p_vmspace->vm_map, base, blen,
./kern/sys_process.c:		uio.uio_lwp = NULL;
./kern/sys_process.c:		uio.uio_lwp = l;
./kern/sys_process.c:			uio.uio_lwp = l;
./kern/sys_process.c:			uio.uio_lwp = l;
./kern/sys_socket.c:		uio, (struct mbuf *)0, (struct mbuf *)0, 0, uio->uio_lwp));
./kern/tty_tty.c:	struct vnode *ttyvp = cttyvp(uio->uio_lwp->l_proc);
./kern/tty_tty.c:	struct vnode *ttyvp = cttyvp(uio->uio_lwp->l_proc);
./kern/kern_systrace.c:	uio.uio_lwp = l;
./kern/uipc_socket.c:	KASSERT(uio->uio_lwp != NULL);
./kern/uipc_socket.c:	error = uvm_loan(&uio->uio_lwp->l_proc->p_vmspace->vm_map, sva, len,
./kern/uipc_socket.c:	l = uio->uio_lwp;
./kern/uipc_syscalls.c:	auio.uio_lwp = l;
./kern/uipc_syscalls.c:	auio.uio_lwp = l;
./kern/vfs_getcwd.c:		uio.uio_lwp = NULL;
./kern/vfs_lookup.c:		auio.uio_lwp = NULL;
./kern/vfs_syscalls.c:		auio.uio_lwp = l;
./kern/vfs_vnops.c:	auio.uio_lwp = l;
./kern/vfs_vnops.c:	auio.uio_lwp = l;
./kern/vfs_vnops.c:	VOP_LEASE(vp, uio->uio_lwp, cred, LEASE_READ);
./kern/vfs_vnops.c:	VOP_LEASE(vp, uio->uio_lwp, cred, LEASE_WRITE);
./kern/vfs_vnops.c:	auio.uio_lwp = l;
./kern/vfs_vnops.c:	auio.uio_lwp = l;
./lkm/dev/vnd/obj.i386/real-vnd.c:	auio.uio_lwp = proc_representative_lwp(bp->b_proc);
./miscfs/fdesc/fdesc_vnops.c:	fdp = uio->uio_lwp ? uio->uio_lwp->l_proc->p_fd : NULL;
./miscfs/fdesc/fdesc_vnops.c:				if (uio->uio_lwp == NULL ||
./miscfs/fdesc/fdesc_vnops.c:				    cttyvp(uio->uio_lwp->l_proc) == NULL)
./miscfs/genfs/genfs_vnops.c:		uio.uio_lwp = NULL;
./miscfs/genfs/genfs_vnops.c:	uio.uio_lwp = NULL;
./miscfs/kernfs/kernfs_vnops.c:		    ap->a_uio->uio_lwp : &lwp0)) != 0)
./miscfs/portal/portal_vnops.c:	auio.uio_lwp = l;
./miscfs/procfs/procfs_cmdline.c:	auio.uio_lwp = NULL;
./miscfs/procfs/procfs_cmdline.c:	auio.uio_lwp = NULL;
./miscfs/procfs/procfs_cmdline.c:		auio.uio_lwp = NULL;
./miscfs/procfs/procfs_subr.c:	curl = uio->uio_lwp;
./miscfs/specfs/spec_vnops.c: 	struct lwp *l = uio->uio_lwp;
./miscfs/specfs/spec_vnops.c:	if (uio->uio_segflg == UIO_USERSPACE && uio->uio_lwp != curlwp)
./miscfs/specfs/spec_vnops.c:	struct lwp *l = uio->uio_lwp;
./miscfs/specfs/spec_vnops.c:	if (uio->uio_segflg == UIO_USERSPACE && uio->uio_lwp != curlwp)
./netsmb/smb_dev.c:		auio.uio_lwp = l;
./netsmb/smb_trantcp.c:	auio.uio_lwp = NULL;
./netsmb/smb_trantcp.c:			auio.uio_lwp = l;
./nfs/nfs_bio.c:	struct lwp *l = uio->uio_lwp;
./nfs/nfs_bio.c:	struct lwp *l = uio->uio_lwp;
./nfs/nfs_bio.c:	struct lwp *l = uiop->uio_lwp;
./nfs/nfs_bio.c:	uiop->uio_lwp = NULL;
./nfs/nfs_boot.c:		uio.uio_lwp = lwp;
./nfs/nfs_serv.c:	uiop->uio_lwp = NULL;
./nfs/nfs_serv.c:		uiop->uio_lwp = NULL;
./nfs/nfs_serv.c:		uiop->uio_lwp = NULL;
./nfs/nfs_serv.c:	io.uio_lwp = NULL;
./nfs/nfs_serv.c:	io.uio_lwp = NULL;
./nfs/nfs_serv.c:	io.uio_lwp = NULL;
./nfs/nfs_socket.c:			auio.uio_lwp = NULL;
./nfs/nfs_socket.c:			auio.uio_lwp = l;
./nfs/nfs_socket.c:		auio.uio_lwp = l;
./nfs/nfs_socket.c:	/* XXX: was NULL, soreceive() requires non-NULL uio->uio_lwp */
./nfs/nfs_socket.c:	auio.uio_lwp = curlwp;	/* XXX curlwp */
./nfs/nfs_subs.c:				if ((error = copyout_proc(uiop->uio_lwp->l_proc,
./nfs/nfs_subs.c:				(void)copyin_proc(uiop->uio_lwp->l_proc, uiocp,
./nfs/nfs_subs.c:	auio.uio_lwp = NULL;
./nfs/nfs_subs.c:		auio.uio_lwp = NULL;
./nfs/nfs_vnops.c:	nfsm_request(np, NFSPROC_READLINK, uiop->uio_lwp, cred);
./nfs/nfs_vnops.c:		nfsm_request(np, NFSPROC_READ, uiop->uio_lwp, np->n_rcred);
./nfs/nfs_vnops.c:		nfsm_request(np, NFSPROC_WRITE, uiop->uio_lwp, np->n_wcred);
./nfs/nfs_vnops.c:		nfsm_request(dnp, NFSPROC_READDIR, uiop->uio_lwp, cred);
./nfs/nfs_vnops.c:		nfsm_request(dnp, NFSPROC_READDIRPLUS, uiop->uio_lwp, cred);
./sys/uio.h:	struct	lwp *uio_lwp;	/* LWP if UIO_USERSPACE */
./ufs/ext2fs/ext2fs_lookup.c:		auio.uio_lwp = NULL;
./ufs/ext2fs/ext2fs_readwrite.c:	p = uio->uio_lwp->l_proc;
./ufs/ext2fs/ext2fs_readwrite.c:		    uio->uio_lwp);
./ufs/ufs/ufs_quota.c:	auio.uio_lwp = NULL;
./ufs/ufs/ufs_quota.c:	auio.uio_lwp = NULL;
./ufs/ufs/ufs_readwrite.c:	l = uio->uio_lwp;
./ufs/ufs/ufs_readwrite.c:		    uio->uio_lwp);