LSB 4.0 Beta 1: possible <time.h> header file error
Submitted by LSB List on Fri, 10/17/2008 - 01:30.
Printer-friendly versionPosted to the lsb-discuss mailing list by: Nelson H. F. Beebe
I've just installed the LSB 4.0 Beta 1 release on all of our IA-32, IA-64, and AMD64 systems running Red Hat GNU/Linux versions 4 and 5. For each platform with the new LSB installation, I then ran test builds of a large mathematical library that I'm developing, and got a compilation error that can be distilled to this simple example: % cat lsb-bug.c #include
#include
double clock_ticks_per_second;
void
lsb_bug(void)
{
clock_ticks_per_second = (double)CLK_TCK;
}
% lsbcc -c -Werror-implicit-function-declaration -Wall -Wmissing-prototypes lsb-bug.c
lsb-bug.c:8: warning: no previous prototype for 'lsb_bug'
lsb-bug.c: In function 'lsb_bug':
lsb-bug.c:9: error: implicit declaration of function '__sysconf'
% lsbcc -E lsb-bug.c | grep sysconf
extern long int sysconf(int);
clock_ticks_per_second = (double)((clock_t)__sysconf(2));
% find /opt/lsb/include/ -type f | xargs grep sysconf
/opt/lsb/include/unistd.h:/* `sysconf' NAME values.*/
/opt/lsb/include/unistd.h: extern long int sysconf(int);
/opt/lsb/include/time.h:#define CLK_TCK ((clock_t)__sysconf(2))
It looks like the LSB file should be calling sysconf(), not
__sysconf(), since there is no prototype visible for the latter
anywhere in the LSB header file directory tree. Its intended type is
"long int", which is incompatible with C's default integer type, so
one cannot just accept the default return type.
Comments and/or advice?
-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- University of Utah FAX: +1 801 581 4148 -
- Department of Mathematics, 110 LCB Internet e-mail: beebe@math.utah.edu -
- 155 S 1400 E RM 233 beebe@acm.org beebe@computer.org -
- Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------
I've just installed the LSB 4.0 Beta 1 release on all of our IA-32, IA-64, and AMD64 systems running Red Hat GNU/Linux versions 4 and 5. For each platform with the new LSB installation, I then ran test builds of a large mathematical library that I'm developing, and got a compilation error that can be distilled to this simple example: % cat lsb-bug.c #include

