linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* man 2 stat
@ 2014-03-09 20:21 Marius Gaubas
       [not found] ` <20140309202120.GA2447-/zl7Sl5F5BR9OMYREy7PttBPR1lH4CV8@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Marius Gaubas @ 2014-03-09 20:21 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

1. nlink_t st_nlink member goes after mode_t st_mode, not before @struct stat
--
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: man 2 stat
       [not found] ` <20140309202120.GA2447-/zl7Sl5F5BR9OMYREy7PttBPR1lH4CV8@public.gmane.org>
@ 2014-03-09 20:24   ` Marius Gaubas
       [not found]     ` <20140309202449.GB2447-/zl7Sl5F5BR9OMYREy7PttBPR1lH4CV8@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Marius Gaubas @ 2014-03-09 20:24 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

On Sun, Mar 09, 2014 at 08:21:20PM +0000, Marius Gaubas wrote:
> 1. nlink_t st_nlink member goes after mode_t st_mode, not before @struct stat
Apologies, the correct statement is:

  nlink_t st_nlink member is before mode_t st_mode, not after @struct stat
--
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: man 2 stat
       [not found]     ` <20140309202449.GB2447-/zl7Sl5F5BR9OMYREy7PttBPR1lH4CV8@public.gmane.org>
@ 2014-03-10  7:56       ` Michael Kerrisk (man-pages)
       [not found]         ` <CAKgNAkjcvRBqXC-Zemwap0Kt5PJLBL4SXA0ZOGYPOYSgqmvqoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Kerrisk (man-pages) @ 2014-03-10  7:56 UTC (permalink / raw)
  To: Marius Gaubas; +Cc: linux-man

On Sun, Mar 9, 2014 at 9:24 PM, Marius Gaubas <marius-PI1xv8u4z2FbJaZ9Qiajs9BPR1lH4CV8@public.gmane.org> wrote:
> On Sun, Mar 09, 2014 at 08:21:20PM +0000, Marius Gaubas wrote:
>> 1. nlink_t st_nlink member goes after mode_t st_mode, not before @struct stat
> Apologies, the correct statement is:
>
>   nlink_t st_nlink member is before mode_t st_mode, not after @struct stat

"I'm sorry HAL, what are are you trying to tell me?"

Translation: Could you _please_ communicate as though there are human
beings on this list? What are you trying to tell us, and what is your
evidence?

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: man 2 stat
       [not found]         ` <CAKgNAkjcvRBqXC-Zemwap0Kt5PJLBL4SXA0ZOGYPOYSgqmvqoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-03-10 10:01           ` Marius Gaubas
       [not found]             ` <20140310100110.GA7155-/zl7Sl5F5BR9OMYREy7PttBPR1lH4CV8@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Marius Gaubas @ 2014-03-10 10:01 UTC (permalink / raw)
  To: Michael Kerrisk (man-pages); +Cc: linux-man

On Mon, Mar 10, 2014 at 08:56:16AM +0100, Michael Kerrisk (man-pages) wrote:
> On Sun, Mar 9, 2014 at 9:24 PM, Marius Gaubas <marius-PI1xv8u4z2FbJaZ9Qiajs9BPR1lH4CV8@public.gmane.org> wrote:
> > On Sun, Mar 09, 2014 at 08:21:20PM +0000, Marius Gaubas wrote:
> >> 1. nlink_t st_nlink member goes after mode_t st_mode, not before @struct stat
> > Apologies, the correct statement is:
> >
> >   nlink_t st_nlink member is before mode_t st_mode, not after @struct stat
> 
> "I'm sorry HAL, what are are you trying to tell me?"
> 
> Translation: Could you _please_ communicate as though there are human
> beings on this list? What are you trying to tell us, and what is your
> evidence?
> 
> Thanks,
> 
> Michael
> 
> 
> -- 
> Michael Kerrisk
> Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
> Linux/UNIX System Programming Training: http://man7.org/training/

Hello Michael,

Please accept my apologies for a BOT-like e-mail.

My name is Marius Gaubas
(http://www.linkedin.com/pub/marius-gaubas/5b/63b/3a4).

The evicence is very clear. I invoke syscall:stat directly from assembly
code and in the debugger I clearly see see that st_nlink (==2) goes
before st_mode (==040700). It clearly makes sense: 8 8 4 8 is not
aligned. The series reflects the sizes of the first for structure
members. st_nlink/st_mode values are clearly specific to my test, I hope
that's clear.

Kind regards,
Marius
--
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: man 2 stat
       [not found]             ` <20140310100110.GA7155-/zl7Sl5F5BR9OMYREy7PttBPR1lH4CV8@public.gmane.org>
@ 2014-03-10 10:06               ` walter harms
       [not found]                 ` <531D8EB5.7090305-fPG8STNUNVg@public.gmane.org>
  2014-03-10 11:03               ` Michael Kerrisk (man-pages)
  1 sibling, 1 reply; 9+ messages in thread
From: walter harms @ 2014-03-10 10:06 UTC (permalink / raw)
  To: Marius Gaubas; +Cc: linux-man



Am 10.03.2014 11:01, schrieb Marius Gaubas:
> On Mon, Mar 10, 2014 at 08:56:16AM +0100, Michael Kerrisk (man-pages) wrote:
>> On Sun, Mar 9, 2014 at 9:24 PM, Marius Gaubas <marius-PI1xv8u4z2FbJaZ9Qiajs9BPR1lH4CV8@public.gmane.org> wrote:
>>> On Sun, Mar 09, 2014 at 08:21:20PM +0000, Marius Gaubas wrote:
>>>> 1. nlink_t st_nlink member goes after mode_t st_mode, not before @struct stat
>>> Apologies, the correct statement is:
>>>
>>>   nlink_t st_nlink member is before mode_t st_mode, not after @struct stat
>>
>> "I'm sorry HAL, what are are you trying to tell me?"
>>
>> Translation: Could you _please_ communicate as though there are human
>> beings on this list? What are you trying to tell us, and what is your
>> evidence?
>>
>> Thanks,
>>
>> Michael
>>
>>
>> -- 
>> Michael Kerrisk
>> Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
>> Linux/UNIX System Programming Training: http://man7.org/training/
> 
> Hello Michael,
> 
> Please accept my apologies for a BOT-like e-mail.
> 
> My name is Marius Gaubas
> (http://www.linkedin.com/pub/marius-gaubas/5b/63b/3a4).
> 
hello nice to meet you.

> The evicence is very clear. I invoke syscall:stat directly from assembly
> code and in the debugger I clearly see see that st_nlink (==2) goes
> before st_mode (==040700). It clearly makes sense: 8 8 4 8 is not
> aligned. The series reflects the sizes of the first for structure
> members. st_nlink/st_mode values are clearly specific to my test, I hope
> that's clear.

Ok,
you are talking about the sequence the fields are stored in the structure ?

re,
 wh

> Kind regards,
> Marius
> --
> 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
--
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: man 2 stat
       [not found]                 ` <531D8EB5.7090305-fPG8STNUNVg@public.gmane.org>
@ 2014-03-10 10:22                   ` Marius Gaubas
  0 siblings, 0 replies; 9+ messages in thread
From: Marius Gaubas @ 2014-03-10 10:22 UTC (permalink / raw)
  To: walter harms; +Cc: linux-man

On Mon, Mar 10, 2014 at 11:06:45AM +0100, walter harms wrote:
> 
> 
> Am 10.03.2014 11:01, schrieb Marius Gaubas:
> > On Mon, Mar 10, 2014 at 08:56:16AM +0100, Michael Kerrisk (man-pages) wrote:
> >> On Sun, Mar 9, 2014 at 9:24 PM, Marius Gaubas <marius-PI1xv8u4z2FbJaZ9Qiajs9BPR1lH4CV8@public.gmane.org> wrote:
> >>> On Sun, Mar 09, 2014 at 08:21:20PM +0000, Marius Gaubas wrote:
> >>>> 1. nlink_t st_nlink member goes after mode_t st_mode, not before @struct stat
> >>> Apologies, the correct statement is:
> >>>
> >>>   nlink_t st_nlink member is before mode_t st_mode, not after @struct stat
> >>
> >> "I'm sorry HAL, what are are you trying to tell me?"
> >>
> >> Translation: Could you _please_ communicate as though there are human
> >> beings on this list? What are you trying to tell us, and what is your
> >> evidence?
> >>
> >> Thanks,
> >>
> >> Michael
> >>
> >>
> >> -- 
> >> Michael Kerrisk
> >> Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
> >> Linux/UNIX System Programming Training: http://man7.org/training/
> > 
> > Hello Michael,
> > 
> > Please accept my apologies for a BOT-like e-mail.
> > 
> > My name is Marius Gaubas
> > (http://www.linkedin.com/pub/marius-gaubas/5b/63b/3a4).
> > 
> hello nice to meet you.
> 
> > The evicence is very clear. I invoke syscall:stat directly from assembly
> > code and in the debugger I clearly see see that st_nlink (==2) goes
> > before st_mode (==040700). It clearly makes sense: 8 8 4 8 is not
> > aligned. The series reflects the sizes of the first for structure
> > members. st_nlink/st_mode values are clearly specific to my test, I hope
> > that's clear.
> 
> Ok,
> you are talking about the sequence the fields are stored in the structure ?
> 
> re,
>  wh
> 
> > Kind regards,
> > Marius
> > --
> > 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

Yes, st_mode and st_nlink are in a reverse order. Very simple to test from
C with offsetof macro. I can quickly write it if it is needed for the
prove.

M.
--
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: man 2 stat
       [not found]             ` <20140310100110.GA7155-/zl7Sl5F5BR9OMYREy7PttBPR1lH4CV8@public.gmane.org>
  2014-03-10 10:06               ` walter harms
@ 2014-03-10 11:03               ` Michael Kerrisk (man-pages)
       [not found]                 ` <CAKgNAkiNYcL2rcmRm=PTGC76PhevQaYgZMERg9tYkmszmsx8+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 9+ messages in thread
From: Michael Kerrisk (man-pages) @ 2014-03-10 11:03 UTC (permalink / raw)
  To: Marius Gaubas; +Cc: linux-man

Hello Marius!

On Mon, Mar 10, 2014 at 11:01 AM, Marius Gaubas
<marius-PI1xv8u4z2FbJaZ9Qiajs9BPR1lH4CV8@public.gmane.org> wrote:
> On Mon, Mar 10, 2014 at 08:56:16AM +0100, Michael Kerrisk (man-pages) wrote:
>> On Sun, Mar 9, 2014 at 9:24 PM, Marius Gaubas <marius-PI1xv8u4z2FbJaZ9Qiajs9BPR1lH4CV8@public.gmane.org> wrote:
>> > On Sun, Mar 09, 2014 at 08:21:20PM +0000, Marius Gaubas wrote:
>> >> 1. nlink_t st_nlink member goes after mode_t st_mode, not before @struct stat
>> > Apologies, the correct statement is:
>> >
>> >   nlink_t st_nlink member is before mode_t st_mode, not after @struct stat
>
> Please accept my apologies for a BOT-like e-mail.

;-). Accepted.

> My name is Marius Gaubas
> (http://www.linkedin.com/pub/marius-gaubas/5b/63b/3a4).
>
> The evicence is very clear. I invoke syscall:stat directly from assembly
> code and in the debugger I clearly see see that st_nlink (==2) goes
> before st_mode (==040700). It clearly makes sense: 8 8 4 8 is not
> aligned. The series reflects the sizes of the first for structure
> members. st_nlink/st_mode values are clearly specific to my test, I hope
> that's clear.

It's clear, but it's also a very narrow field of view. On the
particular architecture (I guess x86-64) you are using, it appears to
be true. But, there is much more to consider. See, for example
<bits/stat.h> and the kernel source file
arch/x86/include/uapi/asm/stat.h. On x86-32, the order is as shown in
the man page; it looks as though the same is true on ARM. Furthermore,
on various architectures, there are padding fields at different
places, and glibc under the covers does a lot of magic to present
something sane (and portable across kernel versions) to user space.

Now, trying to document all of the architecture-specific details in
the man page is difficult, and would probably be confusing to the
reader. But, a warning to the reader is probably in order. I've added
the following text below the structure definition:

       Note: the order of fields in the stat structure varies somewhat
       across  architectures.   In addition, the definition above does
       not show the padding bytes that may  be  present  between  some
       fields  on  various  architectures.   Consult the the glibc and
       kernel source code if you need to know the details.

Seem okay to you?

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: man 2 stat
       [not found]                 ` <CAKgNAkiNYcL2rcmRm=PTGC76PhevQaYgZMERg9tYkmszmsx8+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-03-10 11:15                   ` Marius Gaubas
       [not found]                     ` <20140310111526.GC7263-/zl7Sl5F5BR9OMYREy7PttBPR1lH4CV8@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Marius Gaubas @ 2014-03-10 11:15 UTC (permalink / raw)
  To: Michael Kerrisk (man-pages); +Cc: linux-man

On Mon, Mar 10, 2014 at 12:03:09PM +0100, Michael Kerrisk (man-pages) wrote:
> Hello Marius!
> 
> On Mon, Mar 10, 2014 at 11:01 AM, Marius Gaubas
> <marius-PI1xv8u4z2FbJaZ9Qiajs9BPR1lH4CV8@public.gmane.org> wrote:
> > On Mon, Mar 10, 2014 at 08:56:16AM +0100, Michael Kerrisk (man-pages) wrote:
> >> On Sun, Mar 9, 2014 at 9:24 PM, Marius Gaubas <marius-PI1xv8u4z2FbJaZ9Qiajs9BPR1lH4CV8@public.gmane.org> wrote:
> >> > On Sun, Mar 09, 2014 at 08:21:20PM +0000, Marius Gaubas wrote:
> >> >> 1. nlink_t st_nlink member goes after mode_t st_mode, not before @struct stat
> >> > Apologies, the correct statement is:
> >> >
> >> >   nlink_t st_nlink member is before mode_t st_mode, not after @struct stat
> >
> > Please accept my apologies for a BOT-like e-mail.
> 
> ;-). Accepted.
> 
> > My name is Marius Gaubas
> > (http://www.linkedin.com/pub/marius-gaubas/5b/63b/3a4).
> >
> > The evicence is very clear. I invoke syscall:stat directly from assembly
> > code and in the debugger I clearly see see that st_nlink (==2) goes
> > before st_mode (==040700). It clearly makes sense: 8 8 4 8 is not
> > aligned. The series reflects the sizes of the first for structure
> > members. st_nlink/st_mode values are clearly specific to my test, I hope
> > that's clear.
> 
> It's clear, but it's also a very narrow field of view. On the
> particular architecture (I guess x86-64) you are using, it appears to
> be true. But, there is much more to consider. See, for example
> <bits/stat.h> and the kernel source file
> arch/x86/include/uapi/asm/stat.h. On x86-32, the order is as shown in
> the man page; it looks as though the same is true on ARM. Furthermore,
> on various architectures, there are padding fields at different
> places, and glibc under the covers does a lot of magic to present
> something sane (and portable across kernel versions) to user space.
> 
> Now, trying to document all of the architecture-specific details in
> the man page is difficult, and would probably be confusing to the
> reader. But, a warning to the reader is probably in order. I've added
> the following text below the structure definition:
> 
>        Note: the order of fields in the stat structure varies somewhat
>        across  architectures.   In addition, the definition above does
>        not show the padding bytes that may  be  present  between  some
>        fields  on  various  architectures.   Consult the the glibc and
>        kernel source code if you need to know the details.
> 
> Seem okay to you?
> 
> Thanks,
> 
> Michael
> 
> -- 
> Michael Kerrisk
> Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
> Linux/UNIX System Programming Training: http://man7.org/training/

Hello Michael,

I do appreciate your point. And I agree it is very valid. Man page is
not and should not become an overloaded document with all the platform
specific caveats. But I also see it valuable to clearly explain where
the document is not absolutely precise and what sources should be
further consulted for the details.

Your proposed change looks perfect to me.

Thank you very much for you time!

Kind regards,
Marius
--
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: man 2 stat
       [not found]                     ` <20140310111526.GC7263-/zl7Sl5F5BR9OMYREy7PttBPR1lH4CV8@public.gmane.org>
@ 2014-03-10 11:23                       ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Kerrisk (man-pages) @ 2014-03-10 11:23 UTC (permalink / raw)
  To: Marius Gaubas; +Cc: linux-man

>> Now, trying to document all of the architecture-specific details in
>> the man page is difficult, and would probably be confusing to the
>> reader. But, a warning to the reader is probably in order. I've added
>> the following text below the structure definition:
>>
>>        Note: the order of fields in the stat structure varies somewhat
>>        across  architectures.   In addition, the definition above does
>>        not show the padding bytes that may  be  present  between  some
>>        fields  on  various  architectures.   Consult the the glibc and
>>        kernel source code if you need to know the details.
>>
>> Seem okay to you?

> I do appreciate your point. And I agree it is very valid. Man page is
> not and should not become an overloaded document with all the platform
> specific caveats. But I also see it valuable to clearly explain where
> the document is not absolutely precise and what sources should be
> further consulted for the details.
>
> Your proposed change looks perfect to me.
>
> Thank you very much for you time!

Your welcome. Thanks for the report.

Cheers,

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-03-10 11:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-09 20:21 man 2 stat Marius Gaubas
     [not found] ` <20140309202120.GA2447-/zl7Sl5F5BR9OMYREy7PttBPR1lH4CV8@public.gmane.org>
2014-03-09 20:24   ` Marius Gaubas
     [not found]     ` <20140309202449.GB2447-/zl7Sl5F5BR9OMYREy7PttBPR1lH4CV8@public.gmane.org>
2014-03-10  7:56       ` Michael Kerrisk (man-pages)
     [not found]         ` <CAKgNAkjcvRBqXC-Zemwap0Kt5PJLBL4SXA0ZOGYPOYSgqmvqoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-03-10 10:01           ` Marius Gaubas
     [not found]             ` <20140310100110.GA7155-/zl7Sl5F5BR9OMYREy7PttBPR1lH4CV8@public.gmane.org>
2014-03-10 10:06               ` walter harms
     [not found]                 ` <531D8EB5.7090305-fPG8STNUNVg@public.gmane.org>
2014-03-10 10:22                   ` Marius Gaubas
2014-03-10 11:03               ` Michael Kerrisk (man-pages)
     [not found]                 ` <CAKgNAkiNYcL2rcmRm=PTGC76PhevQaYgZMERg9tYkmszmsx8+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-03-10 11:15                   ` Marius Gaubas
     [not found]                     ` <20140310111526.GC7263-/zl7Sl5F5BR9OMYREy7PttBPR1lH4CV8@public.gmane.org>
2014-03-10 11:23                       ` Michael Kerrisk (man-pages)

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).