On Thu, Sep 8, 2011 at 4:30 PM, Mike Shal <mar...@gmail.com> wrote: > On Thu, Sep 8, 2011 at 8:09 AM, Paul Smith <psm...@gnu.org> wrote: >> One last thing: it is NOT necessary that the target of a symlink exist! >> Just because you can create the link without error doesn't meant that >> the link can be resolved. In fact a number of programs use this feature >> to good advantage, since creating a symlink is an atomic operation on >> the filesystem, for creating lock files, etc. where the target of the >> symlink is not a file at all, but rather some useful information related >> to the lock (etc.) If the information you want to keep is small this is >> MUCH more efficient than open/write/close for a real file: it's one >> (atomic) system call. > > Can you point to a specific program that uses symlinks in this way? I > never thought of using it like that - it sounds pretty inventive so > I'd like to see it in action :)
On at least OpenBSD and FreeBSD systems, the malloc() implementation in libc does this for configuration flags given as letters in the value of the optional symlink /etc/malloc.conf. So, on those systems, basically *every* program uses this idea. For example: $ ls -l /etc/malloc.conf lrwxr-xr-x 1 root wheel 1 Jul 1 15:19 /etc/malloc.conf -> S $ That 'S' turns on additional checks and operations that aim to increase the security of the malloc implementation in the face of application bugs (e.g., better detection of use-after-free and double-free occurrences). Philip Guenther _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make