add time32 ABI compat shims, compat source tree
these files provide the symbols for the traditional 32-bit time_t ABI
on existing 32-bit archs by wrapping the real, internal versions of
the corresponding functions, which always work with 64-bit time_t.
they are written to be as agnostic as possible to the implementation
details of the real functions, so that they can be written once and
mostly forgotten, but they are aware of details of the old (and
sometimes new) ABI, which is okay since ABI is fixed and cannot
change.
a new compat tree is added, separate from src, which the Makefile does
not see or use now, but which archs will be able to add to the build
process. we could also consider moving other things that are compat
shims here, like functions which are purely for glibc-ABI-compat, with
the goal of making it optional or just cleaning up the main src tree
to make the distinction between actual implementation/API files and
ABI-compat shims clear.
2019-08-02 19:52:42 +00:00
|
|
|
#include "time32.h"
|
|
|
|
#include <time.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
int __setitimer_time32(int which, const struct itimerval32 *restrict new32, struct itimerval32 *restrict old32)
|
|
|
|
{
|
|
|
|
struct itimerval old;
|
|
|
|
int r = setitimer(which, (&(struct itimerval){
|
|
|
|
.it_interval.tv_sec = new32->it_interval.tv_sec,
|
|
|
|
.it_interval.tv_usec = new32->it_interval.tv_usec,
|
|
|
|
.it_value.tv_sec = new32->it_value.tv_sec,
|
|
|
|
.it_value.tv_usec = new32->it_value.tv_usec}), &old);
|
|
|
|
if (r) return r;
|
|
|
|
/* The above call has already committed to success by changing the
|
|
|
|
* timer setting, so we can't fail on out-of-range old value.
|
|
|
|
* Since these are relative times, values large enough to overflow
|
|
|
|
* don't make sense anyway. */
|
2019-12-08 15:35:04 +00:00
|
|
|
if (old32) {
|
|
|
|
old32->it_interval.tv_sec = old.it_interval.tv_sec;
|
|
|
|
old32->it_interval.tv_usec = old.it_interval.tv_usec;
|
|
|
|
old32->it_value.tv_sec = old.it_value.tv_sec;
|
|
|
|
old32->it_value.tv_usec = old.it_value.tv_usec;
|
|
|
|
}
|
add time32 ABI compat shims, compat source tree
these files provide the symbols for the traditional 32-bit time_t ABI
on existing 32-bit archs by wrapping the real, internal versions of
the corresponding functions, which always work with 64-bit time_t.
they are written to be as agnostic as possible to the implementation
details of the real functions, so that they can be written once and
mostly forgotten, but they are aware of details of the old (and
sometimes new) ABI, which is okay since ABI is fixed and cannot
change.
a new compat tree is added, separate from src, which the Makefile does
not see or use now, but which archs will be able to add to the build
process. we could also consider moving other things that are compat
shims here, like functions which are purely for glibc-ABI-compat, with
the goal of making it optional or just cleaning up the main src tree
to make the distinction between actual implementation/API files and
ABI-compat shims clear.
2019-08-02 19:52:42 +00:00
|
|
|
return 0;
|
|
|
|
}
|