linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Jonny Grant <jg-hus3n9K41k0@public.gmane.org>,
	linux-man <linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: Re: stat(2)
Date: Sat, 11 Apr 2015 08:04:15 +0200	[thread overview]
Message-ID: <5528B95F.7010008@gmail.com> (raw)
In-Reply-To: <CAGc9Evd5yJ0jvMbwiQ2e0Obcj01srNxo2G3zUpub+4zfYATjBw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-04-11  6:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02 16:59 stat(2) Jonny Grant
     [not found] ` <CAGc9Evd5yJ0jvMbwiQ2e0Obcj01srNxo2G3zUpub+4zfYATjBw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-11  6:04   ` Michael Kerrisk (man-pages) [this message]
     [not found]     ` <55302846.5020506@jguk.org>
     [not found]       ` <55302846.5020506-hus3n9K41k0@public.gmane.org>
2015-04-30 22:21         ` stat(2) Jonny Grant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5528B95F.7010008@gmail.com \
    --to=mtk.manpages-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=jg-hus3n9K41k0@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).