Bakul Shah wrote in list.freebsd-hackers:
 > [...]
 > Let me say it another way.  The bugfix should be accepted and
 > another PR be filed that says there needs to be a constant
 > defining the largest possible off_t value.  Also note that
 > traditionally Unix does not define max values for every
 > derived scalar type (ANSI C does, unix does not).

So the only problem is that there is no maximum value defined
for off_t?  The following piece of code will find the maximum
value for any (signed or unsigned) integer type:

    #include <limits.h>
    
    int i;
    
    max = ((type) -1 < 0) ? SCHAR_MAX : UCHAR_MAX;
    for (i = 1; i < sizeof(type); i++)
            max = (max << CHAR_BIT) + UCHAR_MAX;

It only works on two's-complement machines, though, but I'm not
aware of any FreeBSD port to an architecture that doesn't use
two's-complement numbers...

On the other hand, I wonder why dd needs to know the maxium
value of an off_t.  That sounds broken to me.  I haven't looked
at the patch, but if it's dependant on the exact size of an
off_t, then the patch is no good.

Regards
   Oliver

-- 
Oliver Fromme, Leibnizstr. 18/61, 38678 Clausthal, Germany
(Info: finger userinfo:[email protected])

"In jedem Stück Kohle wartet ein Diamant auf seine Geburt"
                                         (Terry Pratchett)


To Unsubscribe: send mail to [email protected]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to