On 2 September 2012 16:37, Glenn Fowler <g...@research.att.com> wrote:
>
> 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 :)
>
> thanks
> and I'll keep that "2 syscalls almost the same as 1" in my back pocket

No, no, I didn't mean that as general rule. Just the combination of
openat() and fchdir() is fast because fchdir() has almost nothing todo
except swapping some pointers.

Ced
-- 
Cedric Blancher <cedric.blanc...@googlemail.com>
Institute Pasteur
_______________________________________________
ast-developers mailing list
ast-developers@research.att.com
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to