On Sun, 2 Sep 2012 12:43:58 +0200 Cedric Blancher wrote:
> On 2 September 2012 06:04, Glenn Fowler <g...@research.att.com> wrote:
> >
> > is there any rationale for there being no *at() variant for
> >
> >         chdir()
> >         truncate()

> If I remember it right from the old POSIX conf calls: Everything which
> requires to access a file's content and has a f* function should go
> through openat()+f*(). In this case this means you'd have to call
> openat() to get a file handle and use ftruncate().

> chdir() has explicitly no at version because the same basic rule
> (replace "file's content" with "directory's content") applies: Use
> openat() with O_SEARCH+fchdir(). It's two syscalls but it's almost
> having identical performance. And you always have the directory fd
> around for later usage :)

and I'll keep that "2 syscalls almost the same as 1" in my back pocket

ast-developers mailing list

Reply via email to