Gcc and printf says that timer_t is pointer (on my linux). But what is placed by this pointer, and is NULL a valid timer id?
Also, is it platform-specific thing, e. g. it is pointer on linux, int on macOs, sth. else on BSD.
Gcc and printf says that timer_t is pointer (on my linux). But what is placed by this pointer, and is NULL a valid timer id?
Also, is it platform-specific thing, e. g. it is pointer on linux, int on macOs, sth. else on BSD.
Copyright © 2021 Jogjafile Inc.
Are you talking about userspace or kernelspace? It makes a difference even on a single platform. Really it comes down to what the implementation of the functions, which SHOULD be considered as opaque.
The implementation of the functions uses
timer_tmight use an integer as an offset into an array of data structures, or dynamically allocates the backing timer data structures.That opaque-ness of the timer functions means that NULL might be valid in some systems but not others.
If you look at the Single Unix Specification for
sys/types.h, you'll see while it mentionstimer_t, and says "All of the types are defined as arithmetic types of an appropriate length", but doesn't specify what exactly is stored inside the type (since a pointer is really just an integer that happens to be the address of somewhere else in memory).Linux kernel headers (
int):Linux glibc sources/headers (
void*pointer):Solaris headers (via GCC) (
int):