Redundant syscalls?
I was wondering why do we need fsetxattr(2), fgetxattr(2) etc when we already have setxattr(2), getxattr(2) etc working on file names instead of file descriptors.
truncate(2)/ftruncate(2) is another more traditional example.
Thanks
Quoted 4 lines · Lorenzo Allegrucci
I was wondering why do we need fsetxattr(2), fgetxattr(2) etc when we already have setxattr(2), getxattr(2) etc working on file names instead of file descriptors.
truncate(2)/ftruncate(2) is another more traditional example.
Because you can't reliably derive a file name from an open file descriptor, so it's useful to have a way to act on the file directly through the descriptor.
-Doug
Signature · 2 lines
Let us cross over the river, and rest under the shade of the trees. --T. J. Jackson, 1863
--------- Received message begins Here ---------
Quoted 6 lines
I was wondering why do we need fsetxattr(2), fgetxattr(2) etc when we already have setxattr(2), getxattr(2) etc working on file names instead of file descriptors.
truncate(2)/ftruncate(2) is another more traditional example.
Atomic actions.
Consider the case of a file that doesn't exist yet. first you open it, then perform the fsetxattr. If you use the name, then it becomes possible to rename the file and substitute a different one before the setxattr. Now, the open file will be missing the attribute(s).
-------------------------------------------------------------------------
Jesse I Pollard, II
Email: [email protected]
Any opinions expressed are solely my own.