Subject: disklabel behaving badly (i386)
To: None <current-users@netbsd.org>
From: walt <wa1ter@myrealbox.com>
List: current-users
Date: 08/03/2003 23:06:47
I have NetBSD -current on wd1 and FreeBSD -current on wd0.

I can read the NetBSD disklabel from wd1 with no problems, but the
FreeBSD disklabel seems to be causing a problem on wd0:  when I
try 'disklabel wd0' the program lands in an infinite loop trying
to read the same sector endlessly.

Here is part of 'ktruss disklabel wd0' :

  1366 disklabel open("/dev/rwd0d", 0, 0x64)       = 3
  1366 disklabel pread(0x3, 0xbfbff95c, 0x200, 0, 0) = 512
 
"\M-kH\<90>\<D0>\<BC>\0|\M-{P\aP\^_\M-|\M->\^[|\<BF>\^[\^FPW\<B9>\M-e\^A\M-s\<A4>\M-K\<BD>\M->\a\<B1>\^D8n\0|\tu\^S\M^C\<C5>\^P\M-b\M-t\<CD>\^X\<8B>\M-u\M^C"

  1366 disklabel pread(0x3, 0xbfbff95c, 0x200, 0, 0x6c1a7600) = 512
       "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
  1366 disklabel pread(0x3, 0xbfbff95c, 0x200, 0, 0x6c1a7600) = 512
       "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
  1366 disklabel pread(0x3, 0xbfbff95c, 0x200, 0, 0x6c1a7600) = 512
       "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
<much more of the same>

So why is disklabel trying to read the same sector over and over?
And what is the number 0x6c1a7600 ?  Is that an offset?

 From the pread manpage:
pread(int d, void *buf, size_t nbytes, off_t offset);

I'm confused about how many arguments pread needs -- is
it four or five, and what is the fifth argument?