This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: struct stat.h with nanosecond resolution
- From: Roland McGrath <roland at redhat dot com>
- To: Ulrich Drepper <drepper at redhat dot com>
- Cc: Andreas Jaeger <aj at suse dot de>, Andi Kleen <ak at suse dot de>,GNU libc alpha <libc-alpha at sources dot redhat dot com>
- Date: Tue, 3 Dec 2002 13:25:39 -0800
- Subject: Re: struct stat.h with nanosecond resolution
> It's too much for my taste.
I was gagging too much last night to even write about it. :-)
I think your suggestion is fine. I'd go for __USE_MISC, there is no harm
in it and miscellaneous other systems have similar members in struct stat
(though BSD's are called `st_mtimensec' and the like, no second _).
Checking the feature-test macros is what BSD's struct stat does now.
In nonstandard mode they use the names `st_mtimespec' et al rather than
`st_mtim'. I am guessing the latter names are used by Solaris or something?
I was thinking about ways to avoid the ugliness and nothing fits to avoid
the macros for the struct timespec type. You can avoid the st_* macros
that need to use tv_sec in the rhs with:
struct stat {
...;
__extension__ union {
struct timespec st_mtim;
__extension__ struct {
time_t st_mtime;
__suseconds_t st_mtime_nsec;
};
};
};
But that doesn't really help since `struct timespec' itself must be defined
using `tv_sec' or else st_mtim cannot be used normally.