Re: Query about uname.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday 28 November 2008 15:00:23 Michael Kerrisk wrote:
> Rob,
>
> On Thu, Nov 27, 2008 at 8:35 AM, Rob Landley <rob@xxxxxxxxxxx> wrote:
> > http://kernel.org/doc/man-pages/online/pages/man2/uname.2.html
> >
> > It says the length of the fields was unspecified.
>
> Yup -- that's what POSIX says.

Posix doesn't specify init or mount either.  "Posix doesn't specify" doesn't 
forbid something else from specifying it.

> As noted in the first para of the description,
> the fields of the structure are null-terminated, which, in the typical
> case, makes it quite possible to use them without knowing their
> (maximum) lengths. 

Use a field, yes.  Iterate though the fields/find the next field, no.  (I 
suppose you can memset the memory block you feed to the syscall to "null" and 
iterate through to the next non-null character, as long there's a guarantee 
none of the fields will be zero length.)

> And indeed, a portable program should not care.

When I start writing portable programs that I intend to support on Dragonfly 
BSD, I'll let you know.  "Posix portable" includes Windows NT and strange IBM 
mainframes.

> > so leaving it unspecified is silly.  It's part of the current kernel's
> > binary abi, and the value is currently 65.
>
> And that last piece is exactly part of the problem, because once upon
> a time (okay: a long time ago, now), it was true that "the value is
> currently 9".
>
> It seems to me that all the info you needed was there in the page, but
> you didn't read the whole page.

True.  I didn't notice that there was a "notes" field (my screen ended with 
"return value", "errors", and "conforming to", didn't hit page down) that was 
larger than the rest of the page.  My bad.

> The question is, whether the page
> could/should provide more clues to make sure that the reader is
> pointed to the fine details (which, for the reasons I described above,
> are often not needed).

I thought the point of the man pages on kernel.org was to document the kernel 
API.  (If you're programming against glibc I assume that has its own 
documentation somewhere.)  I suppose those of us programming against uClibc or 
other low level interfaces can always just look at the kernel source code.

> Cheers,
>
> Michael

Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux