This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: PATCH [3/n]: Add __snseconds_t and __SNSECONDS_T_TYPE
On Thu, Mar 15, 2012 at 4:29 PM, Roland McGrath <roland@hack.frob.com> wrote:
> For some reason your mail contains the ChangeLog fragment twice.
> There's no need for that.
>
>> ? ? ? * bits/types.h (__snseconds_t): New.
>
> Say "New type".
>
>> ? ? ? * bits/typesizes.h (__SNSECONDS_T_TYPE): Likewise.
>
> Say "New macro".
>
>> ? ? ? * sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h (__SNSECONDS_T_TYPE):
>
> This line is too long. ?Wrap it so the second line starts with the (.
>
>> ? ? ? * time/time.h (timespec): Use __snseconds_t on tv_nsec.
>
> It should be "(struct timespec)", i.e. it's always the full proper C
> nomenclature for the type.
>
> This change comes chronologically after the typesizes.h changes, i.e.
> closer to the top of the file.
>
> In this particular case, it could either be considered part of the same
> change and so in the same paragraph (in which case at the end of the
> paragraph makes sense), or it could be considered a follow-on change and so
> in its own paragraph (in which case that paragraph goes higher up in the
> file).
>
> While these two changes are arguably logically separable, they are
> sufficiently closely related that it is indeed right for them to be
> in one patch (and thus one commit when it goes in).
>
>
Does this look OK?
Thanks.
--
H.J.
2012-03-16 H.J. Lu <hongjiu.lu@intel.com>
* bits/types.h (__snseconds_t): New type.
* time/time.h (struct timespec): Use __snseconds_t on tv_nsec.
* bits/typesizes.h (__SNSECONDS_T_TYPE): New macro.
* sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h
(__SNSECONDS_T_TYPE): Likewise.
* sysdeps/unix/sysv/linux/s390/bits/typesizes.h
(__SNSECONDS_T_TYPE): Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
(__SNSECONDS_T_TYPE): Likewise.
diff --git a/bits/types.h b/bits/types.h
index a9bf0ad..ae79a6f 100644
--- a/bits/types.h
+++ b/bits/types.h
@@ -148,6 +148,7 @@ __STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */
__STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */
__STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */
__STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */
+__STD_TYPE __SNSECONDS_T_TYPE __snseconds_t; /* Signed count of nanoseconds. */
__STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */
__STD_TYPE __SWBLK_T_TYPE __swblk_t; /* Type of a swap block maybe? */
diff --git a/bits/typesizes.h b/bits/typesizes.h
index e1c5a27..abd9fbe 100644
--- a/bits/typesizes.h
+++ b/bits/typesizes.h
@@ -57,6 +58,7 @@
#define __BLKSIZE_T_TYPE __SLONGWORD_TYPE
#define __FSID_T_TYPE struct { int __val[2]; }
#define __SSIZE_T_TYPE __SWORD_TYPE
+#define __SNSECONDS_T_TYPE __SLONGWORD_TYPE
/* Number of descriptors that can fit in an `fd_set'. */
#define __FD_SETSIZE 1024
diff --git a/sysdeps/mach/hurd/bits/typesizes.h b/sysdeps/mach/hurd/bits/typesizes.h
index 7bde5d5..bca63ed 100644
--- a/sysdeps/mach/hurd/bits/typesizes.h
+++ b/sysdeps/mach/hurd/bits/typesizes.h
@@ -57,6 +57,7 @@
#define __BLKSIZE_T_TYPE __SLONGWORD_TYPE
#define __FSID_T_TYPE __UQUAD_TYPE
#define __SSIZE_T_TYPE __SWORD_TYPE
+#define __SNSECONDS_T_TYPE __SLONGWORD_TYPE
/* Number of descriptors that can fit in an `fd_set'. */
#define __FD_SETSIZE 256
diff --git a/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h b/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h
index 6703473..1c763c2 100644
--- a/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h
+++ b/sysdeps/unix/bsd/bsd4.4/freebsd/bits/typesizes.h
@@ -57,6 +57,7 @@
#define __BLKSIZE_T_TYPE __U32_TYPE
#define __FSID_T_TYPE struct { int __val[2]; }
#define __SSIZE_T_TYPE __SWORD_TYPE
+#define __SNSECONDS_T_TYPE __SLONGWORD_TYPE
/* Number of descriptors that can fit in an `fd_set'. */
#define __FD_SETSIZE 1024
diff --git a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
index ee85531..af7021f 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/typesizes.h
@@ -63,6 +63,7 @@
/* size_t is unsigned long int on s390 -m31. */
#define __SSIZE_T_TYPE __SLONGWORD_TYPE
#endif
+#define __SNSECONDS_T_TYPE __SLONGWORD_TYPE
/* Number of descriptors that can fit in an `fd_set'. */
#define __FD_SETSIZE 1024
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
index 37b7656..bba82b3 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
@@ -57,6 +57,7 @@
#define __BLKSIZE_T_TYPE __SLONGWORD_TYPE
#define __FSID_T_TYPE struct { int __val[2]; }
#define __SSIZE_T_TYPE __SWORD_TYPE
+#define __SNSECONDS_T_TYPE __SLONGWORD_TYPE
/* Number of descriptors that can fit in an `fd_set'. */
#define __FD_SETSIZE 1024
diff --git a/time/time.h b/time/time.h
index 775c092..776dc40 100644
--- a/time/time.h
+++ b/time/time.h
@@ -120,7 +120,7 @@ typedef __timer_t timer_t;
struct timespec
{
__time_t tv_sec; /* Seconds. */
- long int tv_nsec; /* Nanoseconds. */
+ __snseconds_t tv_nsec; /* Nanoseconds. */
};
#endif /* timespec not defined and <time.h> or need timespec. */
--
1.7.6.5