Jan Beulich writes ("Re: [XEN RFC for-4.14] Re: use of "stat -""):
> I'm about to test this then, but to be honest I have no idea what
> to do with the comment. I don't think I could properly justify its
> deletion in the description (beyond saying it's not really true),
> nor would I be certain whether to e.g. leave the test -ef part
> there.

You should delete the comment.  You could replace it with its
opposite.  Something like:

 # Although /dev/stdin (ie /proc/self/fd/0) looks like a symlink,
 # stat(2) bypasses the synthetic symlink and directly accesses the
 # underlying open-file.  So this works correctly even if the file
 # has been renamed or unlinked.

> Also is there any reason to go through two symlinks then, rather
> than using /proc/self/fd/$_lockfd directly?

/dev/stdin is clearer, to my mind.

(The tiny performence difference is not relevant here.  It's also
possible that at some point stat(1) might handle it specially.)

Thanks,
Ian.

Reply via email to