From owner-freebsd-hackers Wed Sep 15 12:28:27 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from dorifer.heim3.tu-clausthal.de (dorifer.heim3.tu-clausthal.de [139.174.243.252]) by hub.freebsd.org (Postfix) with ESMTP id DD9F515311 for ; Wed, 15 Sep 1999 12:28:20 -0700 (PDT) (envelope-from olli@dorifer.heim3.tu-clausthal.de) Received: (from olli@localhost) by dorifer.heim3.tu-clausthal.de (8.8.8/8.8.8) id VAA26499 for freebsd-hackers@FreeBSD.ORG; Wed, 15 Sep 1999 21:28:18 +0200 (CEST) (envelope-from olli) Date: Wed, 15 Sep 1999 21:28:18 +0200 (CEST) From: Oliver Fromme Message-Id: <199909151928.VAA26499@dorifer.heim3.tu-clausthal.de> To: freebsd-hackers@FreeBSD.ORG Subject: Re: Bug in dd seeking beyond 2G Organization: Administration Heim 3 Reply-To: freebsd-hackers@FreeBSD.ORG MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Newsreader: TIN [version 1.2 RZTUC(3) PL2] Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 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