Re: *at syscalls for xattrs?

H. Peter Anvin
2007-07-16T09:38:19Z

Miklos Szeredi wrote:
>
> The *at() thing basically gives you the advantages of a CWD without
> the disadvantages.
>
> For example it could be useful to implement the functionality of
> find(1) as a library interface.
>

What the *at() interfaces really do is fix/paper over a longstanding
wart in Unix: the cwd really should have been a standard file descriptor
(like stdin/stdout/stderr) instead of a magic piece of state maintained
in kernel space.

If they had been designed-in from the beginning I suspect we wouldn't
have had, say, stat() and fstat(), but simply statat() -- the "normal"
ones would simply be statat(stddir, path) and statat(fd, NULL)
respectively. Now it isn't quite so clean.

You can do some of that stuff with fchdir(), but *at() is much nicer,
minus the oddball Solaris naming with random presence and absence of f-
prefixes.

-hpa