This is the mail archive of the libc-alpha@sources.redhat.com 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]

Re: struct stat.h with nanosecond resolution


The patch looks mostly OK.  I don't like the transparent union thing
very much.  Let's keep it simple.

=====================
> Index: sysdeps/unix/sysv/linux/bits/stat.h
> --- sysdeps/unix/sysv/linux/bits/stat.h	8 Feb 2002 07:48:10 -0000	1.15
> +++ sysdeps/unix/sysv/linux/bits/stat.h	28 Dec 2002 14:38:47 -0000
> @@ -60,12 +60,21 @@ struct stat
>  #else
>      __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
>  #endif
> -    __time_t st_atime;			/* Time of last access.  */
> -    unsigned long int __unused1;
> +#ifdef __USE_MISC
> +    struct timespec st_atim;		/* Time of last access.  */
> +    struct timespec st_mtim;		/* Time of last modification.  */
> +    struct timespec st_ctim;		/* Time of last status change.  */
> +# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
> +# define st_mtime st_mtim.tv_sec
> +# define st_ctime st_ctim.tv_sec
> +#else
> +    time_t st_atime;			/* Time of last access.  */

Why is the type changed to time_t?  It should remain __time_t.  See the
other fields, they are not changed.

The struct definitions should also contain a comment explaining this
ugly hack.  There are people out there who compile their sources with
the POSIX options only enabled.  If this code gets reused in a
_GNU_SOURCE context or so it might be a surprise that it fails.


-- 
--------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]