From mboxrd@z Thu Jan 1 00:00:00 1970 From: William Ahern To: 9fans@cse.psu.edu Subject: Re: [9fans] fd2path(2) Message-ID: <20030505173233.GA19682@wilbur.25thandClement.com> References: <20030505160003.GA27502@wilbur.25thandClement.com> <6b1434ce54eef6452e6ae212a0faebe5@mightycheese.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6b1434ce54eef6452e6ae212a0faebe5@mightycheese.com> User-Agent: Mutt/1.5.3i Date: Mon, 5 May 2003 10:32:33 -0700 Topicbox-Message-UUID: 9e2b9f72-eacb-11e9-9e20-41e7f4b1d025 On Mon, May 05, 2003 at 09:18:55AM -0700, rob pike, esq. wrote: > > why not make the return value of fd2path() similar to SUSv3's snprintf()? > > that is, return the length of the logical string. i've read a few archived > > posts on this. one was to make the return value the remainder of the logical > > length and the buffer length. another pointed out that inferno just returned > > a malloc'd string on its own. > > Perhaps it's a better interface, making it like read. I don't > remember thinking about it, which probably means I just gave it the > default syscall return. I do remember thinking about the NUL on the > end, which probably means I didn't think it was the same as read. > > On the other hand, a quick grep shows most program just use the string > outright and strlen() is really cheap. I suspect that between the two > of us we've spent more time talking about it than using strlen() on an > fd2path call will require in our lifetimes. > > -rob fair enough ;) i was just inquiring 'cause i'm re-creating cleanname() and fd2path() on *bsd/linux for a little project of mine. i had the code written (fname_normalize(char *, int, const char *), fname_get(int)), when i discovered that plan9 already had an interface to do the same thing, and so i figured i might as well copy the semantics (a tad more general, and intuitive). hmmmmm. does plan 9 have an interface for inquiring about file events? for instance, on free/net/openbsd there is kqueue, which supports vnode events. something similar on linux is DNOTIFY (dentry events). SGI has IMon (inode monitor). - Bill