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
This commit is contained in:
Stephen J. Kiernan 2016-09-22 06:24:40 +00:00
parent bdaf6d6913
commit 5c6b397ff1
7 changed files with 11 additions and 11 deletions

View File

@ -228,7 +228,7 @@ time(time_t *tloc)
}
time_t
getsecs()
getsecs(void)
{
return time(0);
}

View File

@ -76,7 +76,7 @@ time(time_t *tloc)
}
time_t
getsecs()
getsecs(void)
{
return time(0);
}

View File

@ -586,7 +586,7 @@ bangpxe_call(int func)
time_t
getsecs()
getsecs(void)
{
time_t n = 0;
time(&n);

View File

@ -41,8 +41,8 @@ time(time_t *tloc)
return secs;
}
int
getsecs()
time_t
getsecs(void)
{
time_t n = 0;
time(&n);

View File

@ -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);

View File

@ -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

View File

@ -47,7 +47,7 @@ time(time_t *tloc)
return (secs);
}
int
time_t
getsecs(void)
{