Strange `ln` statement

I was reading the man page for malloc.conf in FreebBSD,
and came across the following

       To dump core whenever a problem occurs:

	   ln -s 'abort:true' /etc/malloc.conf

Can anyone explain how the target field in the above ln
statement can be something other than a file name?

I used the above ln statement, … it works… it makes a link in /etc called malloc.conf.

I don’t know, but I suspect…

ln -s doesn’t require the target to exist.
So that command creates a broken link to a file named abort:true, the file obviously does not exist, but the stored information is in the name of the file.

This is what I read:

Upon the first call to the malloc(3) family of functions, an initial- ization sequence inspects the symbolic link /etc/malloc.conf, next checks the environment for a variable called MALLOC_OPTIONS, and fi- nally looks at the global variable malloc_options in the program. Each is scanned for the following flags. Flags are single letters. Unless otherwise noted uppercase means on, lowercase means off.

So it doesn’t read a file (the link is pointing to), but inspects the symbolic link.

Thank you Laszlo,
Strange way of storing a piece of information.?
Now I have to find out why it is missing in my FreeBSD, and what to install to obtain the link.
I can make the link by hand, of course, but there may be other related things missing.

If I make the link, I get

$ file /etc/malloc.conf
/etc/malloc.conf: broken symbolic link to abort:true

So, because a link has an inode, it is using an inode to store the value

With the link in place, when I trace the program that is using it I get

readlink("/etc/malloc.conf","abort:true",1024)	 = 10 (0xa)
1 Like

Maybe easyer to access so, than reading a file?
As agent Moulder already told us, the truth is out there… :smiley:

1 Like