Page MenuHomeFreeBSD

Fix typing of srandom() and initstate().
ClosedPublic

Authored by ed on May 30 2016, 8:19 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jan 9, 7:47 AM
Unknown Object (File)
Dec 2 2024, 6:07 AM
Unknown Object (File)
Dec 2 2024, 6:06 AM
Unknown Object (File)
Dec 2 2024, 6:06 AM
Unknown Object (File)
Dec 2 2024, 6:06 AM
Unknown Object (File)
Dec 2 2024, 12:49 AM
Unknown Object (File)
Nov 30 2024, 11:44 AM
Unknown Object (File)
Nov 8 2024, 3:16 AM
Subscribers

Details

Summary

POSIX requires that these functions have an unsigned int for their first
argument; not an unsigned long.

My reasoning is that we can safely change these functions without
breaking the ABI. As far as I know, our supported architectures either
use registers for passing function arguments that are at least as big as
long (e.g., amd64), or int and long are of the same size (e.g., i386).

Adding jhb@ to ask whether he can confirm this.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 4029
Build 4072: arc lint + arc unit

Event Timeline

ed retitled this revision from to Fix typing of srandom() and initstate()..
ed updated this object.
ed edited the test plan for this revision. (Show Details)
ed added reviewers: ache, jhb.

POSIX requires just "unsigned" arg without "int". IMHO it is better to stay with POSIX in both headers and code, because possible changed in POSIX arg types are determined easily by the eye without comparison, is the type name means the same or not.
Otherwise, OK from me.

In D6644#140250, @ache wrote:

POSIX requires just "unsigned" arg without "int". IMHO it is better to stay with POSIX in both headers and code, because possible changed in POSIX arg types are determined easily by the eye without comparison, is the type name means the same or not.
Otherwise, OK from me.

Though I agree with you on that matter entirely, I picked unsigned int explicitly, as it is more consistent with all of the other POSIX functions we declare in our headers. For example, sleep() is also support to take an unsigned and return it, while our header file, source file and man page both use unsigned int.

ed edited edge metadata.

While there, also make sure the last argument of initstate() is correct.

This revision was automatically updated to reflect the committed changes.