Subject: Re: building release on sparc fails
To: ks@ub.uni-mainz.de, Martin Husemann <martin@duskware.de>
From: Chris Ross <cross+netbsd@distal.com>
List: current-users
Date: 09/30/2007 23:15:08
--Apple-Mail-30-300427087
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed


On Sep 30, 2007, at 21:22, Chris Ross wrote:
> On Sep 30, 2007, at 17:29, KS wrote:
>> With the following patch machdep.c compiles on sparc and sparc64:
>>
>> --- /u/NetBSD/src/sys/arch/sparc64/sparc64/machdep.c.old	 
>> 2007-09-30 19:03:37.000000000 +0200
>> +++ /u/NetBSD/src/sys/arch/sparc64/sparc64/machdep.c	2007-09-30  
>> 23:11:48.000000000 +0200
>> @@ -770,7 +770,7 @@
>>
>>  			/* print out how many MBs we still have to dump */
>>  			if ((todo % (1024*1024)) == 0)
>> -				printf("\b\b\b\b\b\b\b%6ld ",
>> +				printf("\b\b\b\b\b\b\b%6" PRIu64 "d ",
>>  				    todo / (1024*1024));
>>  			pmap_kenter_pa(dumpspace, maddr, VM_PROT_READ);
>>  			pmap_update(pmap_kernel());
>
>   I think this may be slightly wrong.  Looking at the definition of  
> PRIu64 ("llu" or "lu" depending), "u" is a conversion specifier,  
> not a modifier to "d".  I think the "d" should be removed, and only  
> the trailing space placed after the PRIu64...  (Clearly it works/ 
> compiles, but according to printf(3), it shouldn't have the "d" at  
> the end, "u" carries the desired meaning.)

   Yup.  I was right.  The code as it is committed prints
a "d" after the number, and "walks right", due to the extra
character of output.  :-)

   Simply removing the d in the later string fixes both
issues.  Could someone commit this to -current?

                 - Chris


--Apple-Mail-30-300427087
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name=machdep.diff
Content-Disposition: attachment;
	filename=machdep.diff

Index: sys/arch/sparc64/sparc64/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/machdep.c,v
retrieving revision 1.205
diff -u -r1.205 machdep.c
--- sys/arch/sparc64/sparc64/machdep.c	30 Sep 2007 23:24:56 -0000	1.205
+++ sys/arch/sparc64/sparc64/machdep.c	1 Oct 2007 03:04:58 -0000
@@ -770,12 +770,12 @@
 
 			/* print out how many MBs we still have to dump */
 			if ((todo % (1024*1024)) == 0)
-				printf("\b\b\b\b\b\b\b%6" PRIu64 "d ",
+				printf("\b\b\b\b\b\b\b%6" PRIu64 " ",
 				    todo / (1024*1024));
 			pmap_kenter_pa(dumpspace, maddr, VM_PROT_READ);
 			pmap_update(pmap_kernel());
			error = (*dump)(dumpdev, blkno,
					(void *)dumpspace, (int)n);
 			pmap_kremove(dumpspace, n);
 			pmap_update(pmap_kernel());
 			if (error)

--Apple-Mail-30-300427087--