Article View: net.bugs.4bsd
Article #1610<sys/types.h> misdeclares "time_t" and "off_t"
From: Guy Harris
Date: Thu, 31 Jul 1986 05:01
Date: Thu, 31 Jul 1986 05:01
30 lines
1884 bytes
1884 bytes
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@sun.com (or guy@sun.arpa)
Technical Details
Message-ID:
<5682@sun.uucp>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!lll-lcc!pyramid!decwrl!sun!guyShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!lll-lcc!pyramid!decwrl!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.bugs.4bsd Subject: <sys/types.h> misdeclares "time_t" and "off_t" Message-ID: <5682@sun.uucp> Date: Thu, 31-Jul-86 01:01:59 EDT Article-I.D.: sun.5682 Posted: Thu Jul 31 01:01:59 1986 Date-Received: Fri, 1-Aug-86 01:10:45 EDT Distribution: net Organization: Sun Microsystems, Inc. Lines: 30