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)
Fri, Apr 19, 3:16 AM
Unknown Object (File)
Feb 8 2024, 3:52 AM
Unknown Object (File)
Dec 20 2023, 1:03 AM
Unknown Object (File)
Dec 12 2023, 4:22 AM
Unknown Object (File)
Nov 22 2023, 9:05 AM
Unknown Object (File)
Oct 19 2023, 10:03 AM
Unknown Object (File)
Oct 19 2023, 6:43 AM
Unknown Object (File)
Aug 21 2023, 2:34 AM
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.