Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: christos-time_t has been merged



christos%zoulas.com@localhost wrote:

> | Maybe libsa sources should be updated?
> | 
> | I'm afraid 64bit ops might cause bootloader size overflows,
> | as 64bit daddr_t.
> | 
> | I guess time_t in standalone programs is used only to check timeout
> | in network code and they require only time difference (not absolute time),
> | so it's easier to replace time_t with int (or long)?
> 
> int32_t, but it is better to typedef it to something like stand_time_t?

I have not checked whole libsa sources, but I think current
time_t values in libsa are used to see timeout.
In most case the timeout value is small enough to represent it
even in short. (MAXTMO is 20 in sys/lib/libsa/net.h)

On the other hand, MD sources must provide the getsecs() function
to see relative time and it currently also returns time_t, 
but it might be better to use unsigned (and smaller) types
to allow ignoring wraparound.

Actually there are few MD getsecs() which return full 32bit values,
and some of them just returns 0~59 using "sec" of TOD clock device
to simplify code.

So how about the following types for libsa?

1) use uint16_t for getsecs()

 65536 secs == ~18 hours are enough for boot, and
 only three files in sys/lib/libsa refer it.
 (not sure how many MD drivers also use it though)

2) use int for all other functions which use time_t for timeout seconds

 Then mechanical replacements time_t -> int will work.
 (I guess most backend drivers implicitly convert it to int or u_int
  via their prototype)

Comments?
---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index