public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <colomar.6.4.3@gmail.com>
To: mtk.manpages@gmail.com
Cc: linux-man <linux-man@vger.kernel.org>,
	Florian Weimer <fweimer@redhat.com>,
	libbsd@lists.freedesktop.org
Subject: Re: [IDEA] New pages for types: structs and typedfefs
Date: Sun, 13 Sep 2020 14:53:37 +0200	[thread overview]
Message-ID: <d093c1a5-b31a-1200-3cd6-6b5d2cf28ad3@gmail.com> (raw)
In-Reply-To: <CAKgNAkjys+LYn1qaSXhM2gJfkv_UOnpeNPyh3QCqNLcMNBKB+g@mail.gmail.com>

Hi Michael,

On 9/13/20 2:01 PM, Michael Kerrisk (man-pages) wrote:
> Hi Alex,
>
> On Sat, 12 Sep 2020 at 10:59, Alejandro Colomar
<colomar.6.4.3@gmail.com> wrote:
>>
>> Hi Michael,
>>
>> On 2020-09-12 08:33, Michael Kerrisk (man-pages) wrote:
>>  > Your not the first to suggest this. Most recently, if I recall
>>  > correctly, Florian also suggested it.
>>  >
>>  > The idea seems reasonable, but I wonder about the best way of
doing it.
>>
>> libbsd already provides a few pages on types.  Maybe we could have a
>> look at them.  At least I've seen 'man timespec' (which redirects to
>> timeval.3bsd):
>>
>>
https://gitlab.freedesktop.org/libbsd/libbsd/-/blob/master/man/timeval.3bsd
>>
>>  >
>>  > I propose the desired information for each type would be
>>  >
>>  > * Type name
>>  > * Short explanation of the type (often this mcould be just a
>>  >    few words, I think)
>>  > * Whether the type is specified in POSIX; POSIX requirements on
>>  >    the type.
>>  > * Header file that defines the type (in some cases, there
>>  >    may be more than one. This info can be discovered in the
>>  >    POSIX spec. (Alex, do you have a PDF of the POSIX spec?)
>>  > * Cross references to manual pages of relevant APIs that use the type.
>>
>> I think that would be reasonable.
>>
>> No, I don't have a PDF.  I usually search here:
>>
>> https://pubs.opengroup.org/onlinepubs/9699919799/
>
> You can get a PDF by registering as a member of The Open Group. I
> think the necessary info is here:
> https://www.opengroup.org/austin/lists.html
> (I find having everything in a single PDF is useful for searching.)

Thanks.

>
>>  > There are some weird corner cases. For example, clock_t:
>>  >
>>  > * times(2): clock_t == clock ticks (sysconf(_SC_CLK_TCK))
>>  > * clock(3): clock_t measures in CLOCKS_PER_SEC
>>
>> That would just be 1 or 2 more lines in the explanation, I guess.
>
> Yes, I guess.
>
>> That's also similar to the typical (mis?)use of size_t as a ptrdiff_t.
>>
>>  > Then, do we do one page per type? At first glance, that seems
>>  > unwieldy to me. (I could be wrong.) And it seems to me that
>>  > there might be benefits in having all of the information in
>>  > one place rather than spread across multiple pages. (For example
>>  > cantralizing the info would make it easier for the reader to
>>  > get an overview.)
>>
>> I agree in that everything should be centralized, at least in the
>> beginning.  That would make it much easier to maintain and find the
>> information.  If the future requires the information to be spread
>> across many pages, let the future solve that problem :)
>>
>>  >
>>  > Alternatively, we could have one big page that is a list of the
>>  > types with the above information. Say "system_data_types(7)".
>>  > That page might be an alphabetically ordered hanging list of
>>  > entries that look like this:
>>  >
>>  >      timer_t     <time.h> or <sys/types.h>
>>  >          POSIX timer ID.
>>  >
>>  >          Conforming to: POSIX.1-2008.
>>  >
>>  >          See: timer_create(2), timer_delete(2), timer_getoverrun(2),
>>  >          timer_settime(2)
>>
>> I'd say here is missing the POSIX requirements on the type.
>
> As far as I can tell, in the case of timer_t, I think there are no
> requirements in POSIX.
>
>> Is it a 32-bit or 64-bit or may vary? Is it signed or unsigned?
>
> POSIX doesn't specify, I think.>
> One other thing the page should show of course is definition of the
> structure types.

Yes.


    timer_t     <time.h> or <sys/types.h>
        POSIX timer ID.

        typedef void *timer_t;

        Conforming to: POSIX.1-2008.

        See: timer_create(2), timer_delete(2), timer_getoverrun(2),
        timer_settime(2)

Like this?  Should I specify somehow if the type definition
is so for Linux only, or for all POSIX, ...?

sources:
x86_64-linux-gnu/bits/types/timer_t.h:7:typedef __timer_t timer_t;
x86_64-linux-gnu/bits/types.h:171:__STD_TYPE __TIMER_T_TYPE __timer_t;
x86_64-linux-gnu/bits/types.h:126:# define __STD_TYPE		typedef
x86_64-linux-gnu/bits/typesizes.h:70:#define __TIMER_T_TYPE		void *

This is so for my Debian x86-64.

However, I don't know if this is the definition for all architectures.

I'll start with what I can do, and if you see any type that you know
has a different definition in other systems, I'll let that to you :)

>
>>  > Then of course, we'd need to have links to that page, so that
>>  > people could just type 'man timer_t'. What section should the links
>>  > be in? The reasonable candidates would be section 3 or 7. I'm not
>>  > yet sure which is better. But the point is that we'd have files
>>  > such as timer_t.3 (or timer_t.7) that are link pages containing the
>>  > line:
>>  >
>>  >      .so man7/system_data_types.7
>>
>> Sure.  And for the structs, I'd allow:
>>
>> 'man struct timespec'   (For simplicity)
>> 'man struct-timespec'   (Similar to the git man pages)
>> 'man timespec'          (For compatibility with libbsd)
>
> Mainly, I'm interested in the last case. That's the one I think that
> people would most likely use. In a follow-up mail, you expressed
> concern with conflicts with libbsd pages. I'm not too worried about
> that. There are already *many* conflicts between libbsd and man-pages.

I wasn't concerned about conflict with libbsd; that's the form libbsd
uses, and a good point for having that form would be for compatibility
(people will probably like having to write 'man timespec' in any
system and work).

I was instead concerned that some struct tag may have the same name as
some function, which I don't know for sure:

Let's say there exist a function 'int foo(void)', and a 'struct foo'.
If that is the case, which I ignore, you would need to either have
'foo.3' and 'foo.3t' or have 'foo.3' and 'struct-foo.3'.

Your thoughts?

>
>>  > For the moment at least, I'd favor the "one big page plus
>>  > links" approach.
>>
>> Yes.
>
> Would you like to take a shot at this? I'd suggest just a simple page
> covering just two or three types to start with. Maybe time_t and
> timer_t, or otherwise some types that seem good choices to you?

Yes, I'd like to.  It'll be my first page from scratch, though, so
don't expect it to be soon :-}

Maybe 'timer_t', 'time_t' and 'struct timespec' would be a good start.

Do you think there's any page that has a similar format to what we want
to base on it?

>
> Thanks,
>
> Michael
>
>

Thanks,

Alex

  reply	other threads:[~2020-09-13 12:53 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11 12:47 [IDEA] New pages for types: structs and typedfefs Alejandro Colomar
2020-09-12  6:33 ` Michael Kerrisk (man-pages)
2020-09-12  8:59   ` Alejandro Colomar
2020-09-12  9:26     ` Alejandro Colomar
2020-09-13 12:01     ` Michael Kerrisk (man-pages)
2020-09-13 12:53       ` Alejandro Colomar [this message]
2020-09-13 20:20         ` Michael Kerrisk (man-pages)
2020-09-13 21:29           ` Alejandro Colomar
2020-09-14  0:20             ` [RFC v1] system_data_types.7: Draft (and links to it: <type>.3) Alejandro Colomar
2020-09-14 10:37               ` Michael Kerrisk (man-pages)
2020-09-14 10:55                 ` Michael Kerrisk (man-pages)
2020-09-22 20:21             ` [IDEA] New pages for types: structs and typedfefs Michael Kerrisk (man-pages)
2020-09-22 20:38               ` Thorsten Glaser
2020-09-23  8:36                 ` Michael Kerrisk (man-pages)
2020-09-23 19:54                   ` Thorsten Glaser
2020-09-14  9:19       ` Jakub Wilk
2020-09-14  9:49         ` Alejandro Colomar
2020-09-18  2:16       ` Guillem Jover
2020-09-19  8:45         ` Michael Kerrisk (man-pages)
2020-09-14 10:22 ` Alejandro Colomar
2020-09-14 14:03   ` [RFC v2] system_data_types.7: Draft v2 Alejandro Colomar
2020-09-14 15:00     ` Michael Kerrisk (man-pages)
2020-09-14 15:52       ` Alejandro Colomar
2020-09-14 19:33         ` Michael Kerrisk (man-pages)
2020-09-15  0:47   ` [RFC v3] sigval.3, ssize_t.3, suseconds_t.3, time_t.3, timer_t.3, timespec.3, timeval.3, system_data_types.7: Document system types (draft v3) Alejandro Colomar
2020-09-15  6:22     ` Michael Kerrisk (man-pages)
2020-09-15 13:33   ` [RFC v4] system_data_types.7: Document sigval, ssize_t, suseconds_t, time_t, timer_t, timespec & timeval Alejandro Colomar
2020-09-15 21:30     ` Michael Kerrisk (man-pages)
2020-09-16  0:59       ` Thorsten Glaser
2020-09-16  8:03         ` Michael Kerrisk (man-pages)
2020-09-16 10:06           ` Andries E. Brouwer
2020-09-16 11:00             ` Michael Kerrisk (man-pages)
2020-09-16 10:52   ` [RFC v5] system_data_types.7: Document types: sigval, ssize_t, suseconds_t, time_t, timer_t, timespec, timeval Alejandro Colomar
2020-09-16 10:56     ` Alejandro Colomar
2020-09-16 11:01   ` [RFC v6] " Alejandro Colomar
2020-09-16 19:24     ` Michael Kerrisk (man-pages)
2020-09-16 19:51       ` Alejandro Colomar
2020-09-16 21:32         ` Thorsten Glaser
2020-09-17  9:23           ` Alejandro Colomar
2020-09-17 10:27         ` Michael Kerrisk (man-pages)
2020-09-17 10:42   ` [PATCH v7 0/8] Document system data types Alejandro Colomar
2020-09-17 21:05     ` Michael Kerrisk (man-pages)
2020-09-17 21:16       ` Alejandro Colomar
2020-09-17 10:42   ` [PATCH v7 1/8] system_data_types.7: Document types: sigval, ssize_t, suseconds_t, time_t, timer_t, timespec, timeval Alejandro Colomar
2020-09-17 10:43   ` [PATCH v7 2/8] sigval.3: Add link page Alejandro Colomar
2020-09-17 10:43   ` [PATCH v7 3/8] ssize_t.3: " Alejandro Colomar
2020-09-17 10:43   ` [PATCH v7 4/8] suseconds_t.3: " Alejandro Colomar
2020-09-17 10:43   ` [PATCH v7 5/8] time_t.3: " Alejandro Colomar
2020-09-17 10:43   ` [PATCH v7 6/8] timer_t.3: " Alejandro Colomar
2020-09-17 10:43   ` [PATCH v7 7/8] timespec.3: " Alejandro Colomar
2020-09-17 10:43   ` [PATCH v7 8/8] timeval.3: " Alejandro Colomar

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=d093c1a5-b31a-1200-3cd6-6b5d2cf28ad3@gmail.com \
    --to=colomar.6.4.3@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=libbsd@lists.freedesktop.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    /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