This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi Joseph,
Thanks for a prompt response.
> On Wed, 27 Mar 2019, Lukasz Majewski wrote:
>
> > This type is a glibc's type similar to struct timespec
> > but whose tv_sec field is a __time64_t rather than a time_t,
> > which makes it Y2038-proof and usable to pass between user
> > code and Y2038-proof kernel syscalls (e.g. clock_gettime()).
>
> Could you please give a detailed explanation of why this needs to go
> in an installed header, as opposed to purely in a glibc-internal
> header?
For Y2038 safe code on 32 bit machines we do need 64 bit representation
for some legacy data structures: time_t, struct timespec, etc.
Linux kernel (5.0-rc2) is using (expecting):
struct __kernel_timespec {
__kernel_time64_t tv_sec; /* seconds */
long long tv_nsec; /* nanoseconds */
};
in its syscalls.
With glibc I could introduce an "internal" struct timespec64 (with 64
bit tv_sec field) which would match the above kernel definition and
"installed" one which would be posix compliant (to be still long - 32
bits on 32 bits systems).
Instead - only one ("installed") struct __timespec64 has been
introduced to be also used as glibc internal and OS installed
one to be used by user space programs.
> (All bits/ headers should be installed headers; the set of
> installed headers is determined by the "headers" settings in
> makefiles.
Yes. The struct___timespec64.h has been added to "headers" and on
purpose made "installed".
> Since you're not actually including this from the public
> time.h in this patch, only the internal one, there doesn't seem to be
> a reason here for either the naming or installing the header.)
>
The idea with this exported/installed struct __timespec64 is as
follows:
User space programs on 32 bit machines use struct timespec, which when
one passes -D_TIME_BITS==64 -D_FILE_OFFSET_BITS==64 during compilation
is replaced by struct __timespec64, which correctly handles time after
Y2038.
Then glibc functions work on struct __timespec64 and provide results to
user space program.
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Attachment:
pgpViKpPjZbf3.pgp
Description: OpenPGP digital signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |