Re: stat(2)

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

 



Hello Jonny,

On 04/02/2015 06:59 PM, Jonny Grant wrote:
> Hello
> 
> I see:
> http://man7.org/linux/man-pages/man3/lseek64.3.html
> Grammar feedback, "the glibc", prefix word "the" is not needed.

Fixed. Thanks.

> http://man7.org/linux/man-pages/man2/fstat64.2.html
> Has page heading stat(2), 

The doc for stat/fstat/lstat is combined into a single page...

> and does not contain any information about fstat64()
> Any ideas?

See below.

> I saw this one looks as expected:
> http://man7.org/linux/man-pages/man3/lseek64.3.html

Actually, that page is a bit of an aberration that appeared 
before my time as maintainer.

> I saw this page has similar problem:
> http://man7.org/linux/man-pages/man2/stat64.2.html
> 
> No mention of stat64()

That's not precisely true. See the "C library/kernel ABI differences" at 
http://man7.org/linux/man-pages/man2/stat.2.html#NOTES. Note also
the sentence "Similar remarks apply for fstat() and lstat()."

That said, the details are thin, and I've written  some text to explain
things in a little more detail:

   C library/kernel ABI differences
       Over time, increases in the size of the stat structure  have  led
       to   three   successive  versions  of  stat():  sys_stat()  (slot
       __NR_oldstat), sys_newstat() (slot __NR_stat),  and  sys_stat64()
       (slot  __NR_stat64)  on 32-bit platforms such as i386.  The first
       two versions were already present in Linux 1.0 (albeit with  dif‐
       ferent  names); the last was added in Linux 2.4.  Similar remarks
       apply for fstat() and lstat().

       The kernel-internal versions of the stat structure dealt with  by
       the different versions are, respectively:

              __old_kernel_stat
                     The  original structure, with rather narrow fields,
                     and no padding.

              stat   Larger st_ino field and padding  added  to  various
                     parts  of  the structure to allow for future expan‐
                     sion.

              stat64 Even larger st_ino field, larger st_uid and  st_gid
                     fields  to  accommodate  the Linux-2.4 expansion of
                     UIDs  and  GIDs  to  32  bits,  and  various  other
                     enlarged  fields  and further padding in the struc‐
                     ture.  (Various padding bytes were eventually  con‐
                     sumed  in  Linux  2.6,  with  the  advent of 32-bit
                     device IDs and nanosecond components for the  time‐
                     stamp fields.)

       The glibc stat() wrapper function hides these details from appli‐
       cations, invoking the most recent version of the system call pro‐
       vided  by  the  kernel, and repacking the returned information if
       required for old binaries.

       On modern 64-bit systems, life is  simpler:  there  is  a  single
       stat()  system  call  and  the kernel deals with a stat structure
       that contains fields of a sufficient size.

Thanks,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux