Details
[Home]
Issue of the Implementation # S0558
Brief
Call to timer_create() with clock_id received from clock_getcpuclockid() cause an error EINVAL
Detailed Description
The timer_create() function shall create a per-process timer using the specified clock, clock_id, as the timing base. But call to timer_create with clock_id received from clock_getcpuclockid() cause an error EINVAL.
Problem location(s) in the standard
Linux Standard Base Core Specification 3.1, Chapter 13. Base Libraries, 13.17. Interfaces for librt, timer_create() function.
Example
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <time.h>
int printResAndErrno( int res, const char * funcName, const char * funcArgs ) {
int savedErrno = errno;
printf( "%s%s is %d\n", funcName, funcArgs, res );
printf( "after %s( ... ) errno is %d ( %s )\n", funcName, savedErrno, strerror( savedErrno ) );
return savedErrno;
}
#define callPrintResAndErrno( func, pars ) printResAndErrno( ( errno = 0, func pars ), #func, #pars )
int main( int argc, char ** argv ) {
clockid_t clockId;
timer_t timerId;
// prepare clockId
callPrintResAndErrno( clock_getcpuclockid, ( 0, & clockId ) );
// find error
if ( callPrintResAndErrno( timer_create, ( clockId, NULL, & timerId ) ) == EINVAL ) {
// error found
printf( "error : after timer_create( ... ) errno can not be %d ( %s )\n", EINVAL, strerror( EINVAL ) );
} else {
// error not found
printf( "no error\n" );
}
return 0;
}
Component
glibc 2.3.6 or earlier
Status
Fixed in glibc 2.4
[Home]
»