Date: Wed, 15 Sep 1999 21:28:18 +0200 (CEST) From: Oliver Fromme <olli@dorifer.heim3.tu-clausthal.de> To: freebsd-hackers@FreeBSD.ORG Subject: Re: Bug in dd seeking beyond 2G Message-ID: <199909151928.VAA26499@dorifer.heim3.tu-clausthal.de>
index | next in thread | raw e-mail
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:olli@dorifer.heim3.tu-clausthal.de)
"In jedem Stück Kohle wartet ein Diamant auf seine Geburt"
(Terry Pratchett)
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199909151928.VAA26499>
