Hi,

On Sat, 2005-10-08 at 06:54 +1000, Peter Jeremy wrote:
> On Fri, 2005-Oct-07 20:17:43 +0200, Andreas Kohn wrote:
> >As SUSv2 wants tv_sec to be time_t[1], would it be possible to change
> >this to time_t on all but alpha? I guess alpha will not receive a switch
> >to long anymore[2]. 
> 
> tv_sec and time_t are int on Alpha for compatability with Tru64.  Since
> the Alpha is now a dead architecture and no longer a tier-1 FreeBSD
> platform, it's unlikely anyone will expend the effort to change them.

That's what I was implying, yes. So, is there any reason left (except
perhaps envious looks from the alpha guys :D) not to change it? 
Shall I open up a PR on this?

The only thing I'm currently wondering if it would be better to do 
--- sys/_timeval.h
#ifdef __alpha__
long tv_sec;
#else
time_t tv_sec;
#endif
---,

or creating a machine/_timeval.h.
#ifdef __alpha__ would probably okay, there are more files in sys/ that
do that.

I think this is an important issue, as it currently makes code not
compile on FreeBSD that uses standard interfaces. 

Attached is a patch to at least update gettimeofday(2) with the fact
that tv_usec is suseconds_t, and add a BUGS section to note the problem
with tv_sec. I was unsure whether to add the reasoning behind the
problem (alpha, tru64), so I left that out.

Best regards,
Andreas

-- 
<TalisA> was macht man eigentlich auf einer linux-gamer lan ? hl server
aufsetzen und freuen ? *duck* ^^
Index: gettimeofday.2
===================================================================
RCS file: /storage/freebsd/cvs/src/lib/libc/sys/gettimeofday.2,v
retrieving revision 1.25
diff -u -r1.25 gettimeofday.2
--- gettimeofday.2	2 Jul 2004 23:52:13 -0000	1.25
+++ gettimeofday.2	8 Oct 2005 16:27:40 -0000
@@ -82,8 +82,8 @@
 .Pp
 .Bd -literal
 struct timeval {
-	long	tv_sec;		/* seconds since Jan. 1, 1970 */
-	long	tv_usec;	/* and microseconds */
+	long		tv_sec;		/* seconds since Jan. 1, 1970 */
+	suseconds_t	tv_usec;	/* and microseconds */
 };
 
 struct timezone {
@@ -133,3 +133,5 @@
 .Fn gettimeofday
 system call appeared in
 .Bx 4.2 .
+.Sh BUGS
+The tv_sec member of struct timeval should be a time_t.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to