[lsb-discuss] LSB conf call notes for 2008-06-18

Denis Silakov silakov at ispras.ru
Wed Jun 18 14:22:44 PDT 2008


On Wednesday 18 June 2008 11:19:57 pm Jeff Licquia wrote:
> Joseph Kowalski wrote:
> > If there is a need for something called "__getdelim", perhaps you should
> > create a public interface called "getdelim"?
>
> That's already been done.

Well, as Jeff has mentioned in bug 2128
(http://bugs.linuxbase.org/show_bug.cgi?id=2128), both getdelim and 
__getdelim in glibc are weak aliases for _IO_getdelim.

> > If the LSB were to produce a specification for __getdelim, the LSB would
> > be in violation of POSIX....  Remember that stuff about "symbols
> > beginning with `_[_A-Z]' belonging to the implementation".

However, it's a normal way for glibc to introduce a 'normal' symbol as a weak 
alias for the same symbol with the leading '__', which usually provides the 
actual implementation (situation with getdelim is not exactly the same, but 
getdelim is not a common example, indeed). Surely, glibc inside its own code 
uses underscored symbols, not their aliases. On binary level, all symbols are 
visible; but the weak aliases have 'weak' binding, while the symbols that  
really implement the functionality, have the 'global' one.

The particular problem with getdelim comes from getline optimization; let me 
quote the bug 2128 - here is the code from bits/stdio.h:

# ifdef __USE_GNU
/* Like `getdelim', but reads up to a newline.  */
__STDIO_INLINE _IO_ssize_t
getline (char **__lineptr, size_t *__n, FILE *__stream)
{
  return __getdelim (__lineptr, __n, '\n', __stream);
}
# endif /* GNU */

- we have getline function redeclared as inline and calling __getdelim. Thus, 
if some application uses getline, it actually obtains __getdelim dependency.

--
Regards,
Denis.



More information about the lsb-discuss mailing list