M
mars
Which file is the "printf" implemention in glibc?
The stdio.c is very small.
It seems using __printf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
And __printf_chk using __nldbl___vfprintf_chk, but
__nldbl___vfprintf_chk using __printf_chk.
I found the implement as following, I can not understand how it works.
int attribute_hidden __printf_chk (int flag, const char *fmt, ...)
{
va_list arg;
int done;
va_start (arg, fmt);
done = __nldbl___vfprintf_chk (stdout, flag, fmt, arg);
va_end (arg);
return done;
}
int attribute_compat_text_section __nldbl___vfprintf_chk (FILE *s, int
flag, const char *fmt, va_list ap)
{
int res;
set_no_long_double ();
res = __vfprintf_chk (s, flag, fmt, ap);
clear_no_long_double ();
return res;
}
The stdio.c is very small.
It seems using __printf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__)
And __printf_chk using __nldbl___vfprintf_chk, but
__nldbl___vfprintf_chk using __printf_chk.
I found the implement as following, I can not understand how it works.
int attribute_hidden __printf_chk (int flag, const char *fmt, ...)
{
va_list arg;
int done;
va_start (arg, fmt);
done = __nldbl___vfprintf_chk (stdout, flag, fmt, arg);
va_end (arg);
return done;
}
int attribute_compat_text_section __nldbl___vfprintf_chk (FILE *s, int
flag, const char *fmt, va_list ap)
{
int res;
set_no_long_double ();
res = __vfprintf_chk (s, flag, fmt, ap);
clear_no_long_double ();
return res;
}