Date: Tue, 29 Aug 2000 15:32:58 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: Robert Watson <rwatson@FreeBSD.ORG> Cc: freebsd-fs@FreeBSD.ORG Subject: Re: volatile struct proc pointer in procfs_vnops.o Message-ID: <Pine.BSF.4.21.0008291500580.12633-100000@besplex.bde.org> In-Reply-To: <Pine.NEB.3.96L.1000828123827.84062J-100000@fledge.watson.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 28 Aug 2000, Robert Watson wrote: > I'm getting a couple of warnings compiling procfs_vnops.o with p_cansee() > instead of PRISON_CHECK(), as the struct proc *p is qualified as volatile: > > int pcnt = 0; > volatile struct proc *p = allproc.lh_first; > > ... > ../../miscfs/procfs/procfs_vnops.c: In function `procfs_readdir': > ../../miscfs/procfs/procfs_vnops.c:882: warning: passing arg 2 of > `p_cansee' discards qualifiers from pointer target type > ../../miscfs/procfs/procfs_vnops.c:886: warning: passing arg 2 of > `p_cansee' discards qualifiers from pointer target type > > Does anyone know why that struct proc is marked as volatile? Can the > volatile qualifier safely be removed? I think it can be removed. It seems to be a naive attempt to handle the allproc list changing while we traverse it. However, if the list actually changed, then traversing it might lead to garbage, since the list-changing code doesn't attempt to preserve the integrity of the list. In practice, the list doesn't actually change (e.g., because it is protected by the giant lock in the SMP case), and all other traversals of it (except a clone in linprocfs :-()) depend on this and don't use "volatile". Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0008291500580.12633-100000>