The name of each function consists of various parts:
service of course corresponds to the name of the module this
function is found in.3 The function part is derived
from the interface function in the C library itself. If the user calls
gethostbyname and the service used is
in the module
is used. You see, what is explained above in not the whole truth. In
fact the NSS modules only contain reentrant versions of the lookup
functions. I.e., if the user would call the
function this also would end in the above function. For all user
interface functions the C library maps this call to a call to the
reentrant function. For reentrant functions this is trivial since the
interface is (nearly) the same. For the non-reentrant version the
library keeps internal buffers which are used to replace the user
I.e., the reentrant functions can have counterparts. No service
module is forced to have functions for all databases and all kinds to
access them. If a function is not available it is simply treated as if
the function would return
(see Actions in the NSS configuration).
The file name libnss_files.so.2 would be on a Solaris 2 system nss_files.so.2. This is the difference mentioned above. Sun’s NSS modules are usable as modules which get indirectly loaded only.
The NSS modules in the GNU C Library are prepared to be used as normal libraries themselves. This is not true at the moment, though. However, the organization of the name space in the modules does not make it impossible like it is for Solaris. Now you can see why the modules are still libraries.4
Now you might ask why this information is duplicated. The answer is that we want to make it possible to link directly with these shared objects.
There is a second explanation: we were too lazy to change the Makefiles to allow the generation of shared objects not starting with lib but don’t tell this to anybody.