<sys/types.h> misdeclares "time_t" and "off_t"
Guy Harris
guy at sun.uucp
Thu Jul 31 15:01:59 AEST 1986
Index: sys/h/types.h 4.3BSD
Description:
In every UNIX system except 4BSD (and maybe 32V), "time_t" and
"off_t" are declared as "long". In 4BSD, they are declared
as "int". This doesn't affect code on "typical" systems, but
it does give "lint" gastric distress. The manual page for
"time", for instance, says that it takes a pointer to a "long"
as an argument. However, the "lint" library says it takes a
pointer to a "time_t". This means that code written to conform
to the specifications of the 4BSD (and V7, and S3, and S5, and...)
manual doesn't pass "lint".
Furthermore, this means that programs that use "int" values where
a "time_t" or "off_t" is expected will pass "lint" on a 4BSD
system; they won't pass "lint" on other systems, and if "int"s
aren't the same size as "long"s they won't *work* there either.
Repeat-By:
Compare <sys/types.h> with any other UNIX variant's version.
Fix:
Change them to be "typedef"fed to "long" rather than "int".
This will cause some code in the kernel - and probably some
user code as well - not to "lint", but that can be fixed, and
should be, since the existing code is incorrect. (No, this
fix won't cause any incurable "lint" problems, I successfully
"lint"ed a version of our kernel with the correct "typedefs".)
--
Guy Harris
{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
guy at sun.com (or guy at sun.arpa)
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list