On 2020-05-31 20:46, Mark Kettenis wrote:
Forget about all that for a moment. Here is an alternative suggestion:
On sparc64 we need to support both tick_timecounter and
sys_tick_timecounter. So we need some sort of clockid value to
distnguish between those two. I already suggested to use the tc_user
field of the timecounter for that. 0 means that a timecounter is not
usable in userland, a (small) positive integer means a specific
timecounter type. The code in libc will need to know whether a
particular timecounter type can be supported. My proposal would be to
implement a function*on all architecture* that takes the clockid as
an argument and returns a pointer to the function that implements
support for that timecounter. On architectures without support, ir
when called with a clockid that isn't supported, that function would
simply return NULL.
I am sorry, but the more I try to implement this in a sane way, the more
obvious it is that it is not possible. I would rather have a define
sausage than something like this.
I will try to think of something else that avoids the defines, but I do
not think that your proposal is a valid solution.