#include <stat.h> question answered

Guy Harris guy at rlgvax.UUCP
Thu Nov 10 11:24:43 AEST 1983


	Not true: as distributed, there is no <time.h> in 4.2, only
	a <sys/time.h>, which includes the tm struct along with the
	kernel time stuff.  There is no such symlink.  That is a damn
	good reason for not referencing <time.h>.  Don't ask me why it's
	not there; I'm sure it's no accident (I already asked them about it).

No, it's a damn good reason for Berkeley to put the include file back, unless
they are actively trying to discourage people from writing programs that
can be compiled, linked, and run on 4.2BSD as well as other flavors of
UNIX.  In V7 and 4.1BSD there was <time.h> that had the struct tm stuff
and nothing else, and <sys/timeb.h> which defined the structure filled in
by the "ftime" system call.  That structure contained, in effect, a time value
with a resolution greater than 1 second, as well as containing the time
zone and daylight savings time flag.  The information in the 4.2BSD <sys/time.h>
consists of the same sort of stuff the "timeb" structure had, as well as some
other stuff for the new timer facilities, *plus* the "struct tm" which is
not used anywhere in the kernel.  I think better choices would have been:

1) make a link, symbolic or hard, between <time.h> and <sys/time.h>

2) put only the "struct tm" in <time.h> and only the rest of the stuff in
   <sys/time.h>

3) put the "struct tm" stuff in <time.h> and leave <sys/time.h> alone

Either way, at least it would be compatible with other versions of UNIX.
They can stamp <time.h> with large red "backward compatibility only" labels
if they genuinely want to discourage people from using it.  However, not
supporting it is a minor pain for those of us who have to run programs
both under 4.2BSD and other UNIX systems (like the 4.2BSD UUCP, which does
*not* require 4.2BSD to run; we have it running on a 4.1BSD VAX and on a
MC68000-based micro running System III).  If their omission of <time.h>
was not an accident, either the fact that it makes some programs not compile
*was* an accident or was deliberate; in the latter case, the person responsible
needs to have their error pointed out to them.

4.2BSD may be just another step in the evolution of UNIX or it may be a total
departure; I think that's a judgement call.  However, it loses the point of
being a UNIX system if you can't move programs to it from other UNIX systems.
(Which is a good reason for every UNIX system out there to pick up the
Berkeley directory library; it hides the only user-visible file system
difference between 4.2BSD and other systems, as well as providing a lot of
functionality in a nice package - how many times have equivalents of those
routines been written?  Unfortunately, the include file names are different
between 4.2BSD and systems with a V7 file system, and the routines aren't in
libc.a, so that should probably be changed to make the conversion of programs
as transparent as possible.)  If a little bit of effort done once can obviate
the need for doing that same little bit of effort several times over, it's
worth doing.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy



More information about the Comp.unix.wizards mailing list