Date: Mon, 23 Dec 1996 10:39:34 -0600 (CST) From: Steve Price <sprice@hiwaay.net> To: David Greenman <dg@root.com> Cc: CVS-committers@freefall.freebsd.org, cvs-all@freefall.freebsd.org, cvs-bin@freefall.freebsd.org Subject: Re: cvs commit: src/bin/sh cd.c Message-ID: <Pine.OSF.3.94.961223102556.1356A-100000@fly.HiWAAY.net> In-Reply-To: <199612231605.IAA25960@root.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 23 Dec 1996, David Greenman wrote: # >steve 96/12/22 21:31:49 # > # > Modified: bin/sh cd.c # > Log: # > Don't use _POSIX_PATH_MAX to limit the size of the path, instead # > use 'getcwd(NULL, 0)' just as pwd(1) does. # # getcwd() is a rather expensive operation...are you sure you want to do # this? # Considering the alternatives (and without actually doing any time studies), yes I think it ITRTD. The alternatives (as I see them) are as follows: 1) use getcwd(3) 2) hack together sh(1)'s own version of getcwd() 3) use the fork/exec/pipe cruft of /bin/pwd that was there I prefer option #1, since I don't have to reinvent the wheel as I would have to in option #2. Option #3 is IMHO wrong since /bin/pwd essentially calls getcwd(3) and option #1 does this without the overhead of fork/exec and reading the results from a pipe. Perhaps if our version of getcwd(3) is sooooo slow, we should look into improving it so that all programs that use it can benefit from it. :) Steve # -DG # # David Greenman # Core-team/Principal Architect, The FreeBSD Project #
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.OSF.3.94.961223102556.1356A-100000>
