Page MenuHomeFreeBSD

Fix getsecs() in loader to return time_t
ClosedPublic

Authored by stevek on Aug 10 2016, 11:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 4, 11:57 AM
Unknown Object (File)
Fri, Nov 22, 3:56 PM
Unknown Object (File)
Nov 14 2024, 1:58 PM
Unknown Object (File)
Nov 4 2024, 5:47 AM
Unknown Object (File)
Oct 7 2024, 9:03 PM
Unknown Object (File)
Oct 5 2024, 11:57 AM
Unknown Object (File)
Oct 2 2024, 8:28 PM
Unknown Object (File)
Oct 2 2024, 7:06 PM
Subscribers

Details

Summary

The getsecs() function is implemented in platform- and bootfw-specific files and, in a number of these places, there are problems with how they are declared.

  • Some use int return instead of time_t. On some architectures the bit width of time_t does not naturally fit into an integer and can lead to some unexpected behavior. (For example, 32-bit ARM builds use a 64-bit time_t.)
  • The function prototypes do not always specify void for the argument list, which can cause some compilers to complain about the prototype.
Test Plan

These changes have been tested on Juniper platforms using loader and ubldr. Specifically, the return type mismatch was causing issues with network installs on ARM platforms using TFTP. The connection would time out pre-maturely, due to incorrect time calculations caused by the bit width mismatch. With the changes (and some additional debug statements to monitor the calculations) and extensive testing, the problem with pre-mature timeout was resolved.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

stevek retitled this revision from to Fix getsecs() in loader to return time_t.
stevek updated this object.
stevek edited the test plan for this revision. (Show Details)
stevek added a reviewer: ARM.
stevek edited the test plan for this revision. (Show Details)
sjg added a reviewer: sjg.
sjg added a subscriber: sjg.

thanks

This revision is now accepted and ready to land.Aug 23 2016, 4:34 PM
This revision was automatically updated to reflect the committed changes.