9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] fd2path(2)
@ 2003-05-05 16:00 William Ahern
  2003-05-05 16:18 ` rob pike, esq.
  0 siblings, 1 reply; 6+ messages in thread
From: William Ahern @ 2003-05-05 16:00 UTC (permalink / raw)
  To: 9fans

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.

but, why force superfluous use of strlen()? the semantics of snprintf() seem
quite reasonable. in fact, i can't really figure out a down side... anybody?

- Bill



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] fd2path(2)
  2003-05-05 16:00 [9fans] fd2path(2) William Ahern
@ 2003-05-05 16:18 ` rob pike, esq.
  2003-05-05 17:32   ` William Ahern
  0 siblings, 1 reply; 6+ messages in thread
From: rob pike, esq. @ 2003-05-05 16:18 UTC (permalink / raw)
  To: 9fans

> 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



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] fd2path(2)
  2003-05-05 16:18 ` rob pike, esq.
@ 2003-05-05 17:32   ` William Ahern
  2003-05-05 18:05     ` William Josephson
  2003-05-05 18:12     ` rsc
  0 siblings, 2 replies; 6+ messages in thread
From: William Ahern @ 2003-05-05 17:32 UTC (permalink / raw)
  To: 9fans

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] fd2path(2)
  2003-05-05 17:32   ` William Ahern
@ 2003-05-05 18:05     ` William Josephson
  2003-05-05 18:12     ` rsc
  1 sibling, 0 replies; 6+ messages in thread
From: William Josephson @ 2003-05-05 18:05 UTC (permalink / raw)
  To: 9fans

On Mon, May 05, 2003 at 10:32:33AM -0700, William Ahern wrote:
> 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).

No.  No select, either.  You can use libthread and ioprocs, though.
Or just use rfork() manually.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] fd2path(2)
  2003-05-05 17:32   ` William Ahern
  2003-05-05 18:05     ` William Josephson
@ 2003-05-05 18:12     ` rsc
  2003-05-05 18:17       ` William Ahern
  1 sibling, 1 reply; 6+ messages in thread
From: rsc @ 2003-05-05 18:12 UTC (permalink / raw)
  To: 9fans

> 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).

Plan 9 has no ``file events''.  Hence there is no interface for inquiring about them.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] fd2path(2)
  2003-05-05 18:12     ` rsc
@ 2003-05-05 18:17       ` William Ahern
  0 siblings, 0 replies; 6+ messages in thread
From: William Ahern @ 2003-05-05 18:17 UTC (permalink / raw)
  To: 9fans

On Mon, May 05, 2003 at 02:12:37PM -0400, rsc@plan9.bell-labs.com wrote:
> > 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).
>
> Plan 9 has no ``file events''.  Hence there is no interface for inquiring about them.

apologies for the ignorant question. didn't think that one through....


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-05-05 18:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-05 16:00 [9fans] fd2path(2) William Ahern
2003-05-05 16:18 ` rob pike, esq.
2003-05-05 17:32   ` William Ahern
2003-05-05 18:05     ` William Josephson
2003-05-05 18:12     ` rsc
2003-05-05 18:17       ` William Ahern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).