From owner-freebsd-current Thu Sep 6 23:50:23 2001 Delivered-To: freebsd-current@freebsd.org Received: from peter3.wemm.org (c1315225-a.plstn1.sfba.home.com [24.14.150.180]) by hub.freebsd.org (Postfix) with ESMTP id 1E91537B409; Thu, 6 Sep 2001 23:50:18 -0700 (PDT) Received: from overcee.netplex.com.au (overcee.wemm.org [10.0.0.3]) by peter3.wemm.org (8.11.0/8.11.0) with ESMTP id f876oHM49042; Thu, 6 Sep 2001 23:50:17 -0700 (PDT) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by overcee.netplex.com.au (Postfix) with ESMTP id A22A6380C; Thu, 6 Sep 2001 23:50:17 -0700 (PDT) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.3.1 01/18/2001 with nmh-1.0.4 To: Poul-Henning Kamp Cc: "John W. De Boskey" , Current List Subject: Re: __getcwd & errno 20 (Not a directory) vfs_cache.c In-Reply-To: <86509.999840257@critter> Date: Thu, 06 Sep 2001 23:50:17 -0700 From: Peter Wemm Message-Id: <20010907065017.A22A6380C@overcee.netplex.com.au> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Poul-Henning Kamp wrote: > > You are not supposed to call __getcwd() directly. Yes, but it would be an excellent junior-kernel-hacker task to make it work in all cases, ie: manually searching parent directories. netbsd does this, as does linux, and if we're going to emulate the linux getcwd(2) syscall then we need it. The NetBSD code is probably a good place to start for pointers, but it wont be directly usable due to name-cache differences. > Poul-Henning > > In message <20010906211532.A52687@FreeBSD.org>, "John W. De Boskey" writes: > >Hi, > > > > I'm in the middle of trying to debug a java problem > >and have found something I don't quite understand. > > > > Basically, __getcwd() is returning errno 20, Not > >a directory. man getcwd doesn't list ENOTDIR so I > >started looking in the sources and found kern/vfs_cache.c: > > > > if (vp->v_dd->v_id != vp->v_ddid) { > > numcwdfail1++; > > free(buf, M_TEMP); > > return (ENOTDIR); > > } > > > > > > Could someone who is more familiar with the vfs > >layers provide some pointers as to what is being > >done here? The code is instrumented, and sysctl > >has the following to say: > > > >% sysctl -a | grep cwd > >vfs.cache.numcwdcalls: 225014 > >vfs.cache.numcwdfail1: 845 1 -> ENOTDIR > >vfs.cache.numcwdfail2: 6775 2 -> ENOENT > >vfs.cache.numcwdfail3: 0 > >vfs.cache.numcwdfail4: 0 > >vfs.cache.numcwdfound: 217394 > > > > The really annoying aspect to this is that it doesn't > >happen everytime, and happens more often when in a nfs > >mounted directory vs. a local directory. > > > >Thanks! > >John > > > > > >To Unsubscribe: send mail to majordomo@FreeBSD.org > >with "unsubscribe freebsd-current" in the body of the message > > > > -- > Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 > phk@FreeBSD.ORG | TCP/IP since RFC 956 > FreeBSD committer | BSD since 4.3-tahoe > Never attribute to malice what can adequately be explained by incompetence. > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message > > Cheers, -Peter -- Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message