svn commit: r306159 - in head/sys/boot: efi/libefi i386/libi386 ofw/libofw powerpc/kboot powerpc/ps3 uboot/lib

Stephen J. Kiernan stevek at FreeBSD.org
Thu Sep 22 06:24:42 UTC 2016


Author: stevek
Date: Thu Sep 22 06:24:40 2016
New Revision: 306159
URL: https://svnweb.freebsd.org/changeset/base/306159

Log:
  The getsecs() function is implemented in platform- and bootfw-specific
  files and, in a number of these places, there were problems with how they
  were declared.
  
  Some used int return instead of time_t. On some architectures the bit
  width of time_t did not naturally fit into an integer and could lead to
  some unexpected behavior. (For example, 32-bit ARM builds uses a 64-bit
  time_t.)
  
  Make sure the function prototypes always specify void for the argument
  list when they do not have any arguemnts, otherwise some compilers can
  complain about the prototype.
  
  Reported by:	Kevin Zheng
  Reviewed by:	sjg
  Approved by:	sjg (mentor)
  Obtained from:	Juniper Networks, Inc.
  MFC after:	1 month
  Differential Revision:	https://reviews.freebsd.org/D7463

Modified:
  head/sys/boot/efi/libefi/time.c
  head/sys/boot/efi/libefi/time_event.c
  head/sys/boot/i386/libi386/pxe.c
  head/sys/boot/ofw/libofw/ofw_time.c
  head/sys/boot/powerpc/kboot/main.c
  head/sys/boot/powerpc/ps3/main.c
  head/sys/boot/uboot/lib/time.c

Modified: head/sys/boot/efi/libefi/time.c
==============================================================================
--- head/sys/boot/efi/libefi/time.c	Thu Sep 22 04:50:03 2016	(r306158)
+++ head/sys/boot/efi/libefi/time.c	Thu Sep 22 06:24:40 2016	(r306159)
@@ -228,7 +228,7 @@ time(time_t *tloc)
 }
 
 time_t
-getsecs()
+getsecs(void)
 {
     return time(0);
 }

Modified: head/sys/boot/efi/libefi/time_event.c
==============================================================================
--- head/sys/boot/efi/libefi/time_event.c	Thu Sep 22 04:50:03 2016	(r306158)
+++ head/sys/boot/efi/libefi/time_event.c	Thu Sep 22 06:24:40 2016	(r306159)
@@ -76,7 +76,7 @@ time(time_t *tloc)
 }
 
 time_t
-getsecs()
+getsecs(void)
 {
     return time(0);
 }

Modified: head/sys/boot/i386/libi386/pxe.c
==============================================================================
--- head/sys/boot/i386/libi386/pxe.c	Thu Sep 22 04:50:03 2016	(r306158)
+++ head/sys/boot/i386/libi386/pxe.c	Thu Sep 22 06:24:40 2016	(r306159)
@@ -586,7 +586,7 @@ bangpxe_call(int func)
 
 
 time_t
-getsecs()
+getsecs(void)
 {
 	time_t n = 0;
 	time(&n);

Modified: head/sys/boot/ofw/libofw/ofw_time.c
==============================================================================
--- head/sys/boot/ofw/libofw/ofw_time.c	Thu Sep 22 04:50:03 2016	(r306158)
+++ head/sys/boot/ofw/libofw/ofw_time.c	Thu Sep 22 06:24:40 2016	(r306159)
@@ -41,8 +41,8 @@ time(time_t *tloc)
 	return secs;
 }
 
-int
-getsecs()
+time_t
+getsecs(void)
 {
 	time_t	n = 0;
 	time(&n);

Modified: head/sys/boot/powerpc/kboot/main.c
==============================================================================
--- head/sys/boot/powerpc/kboot/main.c	Thu Sep 22 04:50:03 2016	(r306158)
+++ head/sys/boot/powerpc/kboot/main.c	Thu Sep 22 06:24:40 2016	(r306159)
@@ -151,8 +151,8 @@ delay(int usecs)
 	} while (t < ti + usecs);
 }
 
-int
-getsecs()
+time_t
+getsecs(void)
 {
 	struct host_timeval tv;
 	host_gettimeofday(&tv, NULL);

Modified: head/sys/boot/powerpc/ps3/main.c
==============================================================================
--- head/sys/boot/powerpc/ps3/main.c	Thu Sep 22 04:50:03 2016	(r306158)
+++ head/sys/boot/powerpc/ps3/main.c	Thu Sep 22 06:24:40 2016	(r306159)
@@ -179,10 +179,10 @@ delay(int usecs)
 		tb = mftb();
 }
 
-int
-getsecs()
+time_t
+getsecs(void)
 {
-	return ((mftb() - basetb)*ns_per_tick/1000000000);
+	return ((time_t)((mftb() - basetb)*ns_per_tick/1000000000));
 }
 
 time_t

Modified: head/sys/boot/uboot/lib/time.c
==============================================================================
--- head/sys/boot/uboot/lib/time.c	Thu Sep 22 04:50:03 2016	(r306158)
+++ head/sys/boot/uboot/lib/time.c	Thu Sep 22 06:24:40 2016	(r306159)
@@ -47,7 +47,7 @@ time(time_t *tloc)
 	return (secs);
 }
 
-int
+time_t
 getsecs(void)
 {
 


More information about the svn-src-head mailing list