linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
To: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
Cc: linux-man <linux-man@vger.kernel.org>
Subject: Re: [PATCH] execveat.2: srcfix
Date: Tue, 2 Feb 2021 18:43:13 +0100	[thread overview]
Message-ID: <05c94edf-b532-f2a6-0681-0b700d833e52@gmail.com> (raw)
In-Reply-To: <6c9c593c-1e89-ce75-c1d0-41e61c98bad7@gmail.com>

On 12/31/20 4:26 PM, Michael Kerrisk (man-pages) wrote:
[...]
> 
> What do you think about the work-in-progess patch below? The following
> may be useful for review:
> 
> for p in $(git grep -l 'SYN' man[3-8]); do 
>     echo "===================== $p"; man -l $p  2> /dev/null  | 
>         sed -n '/^SYNOP/,/DESCR/p' | sed '/Feat/,$d';
> done | less
> 
> Cheers,
> 
> Michael
[...]

Hi Michael,

I developed a function for reviewing the prototypes of all functions and
comparing them easily against glibc and kernel sources.  It's based on
your code above.  You may find it useful (I made it generic enough to be
useful for other tasks) to include it in your .bash_aliases.

[[
EX_USAGE=64;
function man_section()
{
	if ! [ -v 2 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <dir> <section>";
		return ${EX_USAGE}
	fi

	find "${1}" -type f \
	|xargs grep -l "\.SH ${2}" \
	|sort -V \
	|while read -r manpage; do
		<${manpage} \
		sed -n \
			-e '/^\.TH/,/^\.SH/{/^\.SH/!p}' \
			-e "/^\.SH ${2}/p" \
			-e "/^\.SH ${2}/,/^\.SH/{/^\.SH/!p}" \
		|man -P cat -l - 2>/dev/null;
	done;
}
]]


Basically, at the root of man-pages, run the code below to see all
syscall prototypes.

Cheers,

Alex

---

$ man_section man2 SYN \
  |less;
ACCEPT(2)                  Linux Programmer's Manual
ACCEPT(2)

SYNOPSIS
       #include <sys/types.h>          /* See NOTES */
       #include <sys/socket.h>

       int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);

       #define _GNU_SOURCE             /* See feature_test_macros(7) */
       #include <sys/socket.h>

       int accept4(int sockfd, struct sockaddr *addr,
                   socklen_t *addrlen, int flags);

Linux                             2020-04-11
ACCEPT(2)
ACCESS(2)                  Linux Programmer's Manual
ACCESS(2)

SYNOPSIS
       #include <unistd.h>

       int access(const char *pathname, int mode);

       #include <fcntl.h>           /* Definition of AT_* constants */
       #include <unistd.h>

       int faccessat(int dirfd, const char *pathname, int mode, int flags);
                       /* But see C library/kernel differences, below */

       int faccessat2(int dirfd, const char *pathname, int mode, int flags);

   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

       faccessat():
           Since glibc 2.10:
               _POSIX_C_SOURCE >= 200809L
           Before glibc 2.10:
               _ATFILE_SOURCE

Linux                             2020-12-21
ACCESS(2)

[...]




-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

  parent reply	other threads:[~2021-02-02 17:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-30 21:41 [PATCH] execveat.2: srcfix Alejandro Colomar
2020-12-30 22:27 ` Michael Kerrisk (man-pages)
2020-12-30 23:28   ` Alejandro Colomar (man-pages)
2020-12-31 10:06     ` Michael Kerrisk (man-pages)
2020-12-31 12:28       ` Alejandro Colomar (man-pages)
2020-12-31 15:26         ` Michael Kerrisk (man-pages)
2020-12-31 18:55           ` Alejandro Colomar (man-pages)
2020-12-31 23:29             ` Alejandro Colomar (man-pages)
2021-01-01 11:43               ` Michael Kerrisk (man-pages)
2021-01-01 11:41             ` Michael Kerrisk (man-pages)
2021-01-01 13:49               ` Alejandro Colomar (man-pages)
2021-01-01 22:29                 ` Michael Kerrisk (man-pages)
2021-01-02 16:03                   ` Alejandro Colomar (man-pages)
2021-01-02 19:59                     ` Michael Kerrisk (man-pages)
2021-01-02 21:40                       ` Alejandro Colomar (man-pages)
2021-01-03 12:11                         ` Michael Kerrisk (man-pages)
2021-01-04 12:59                           ` Alejandro Colomar (man-pages)
2021-01-04 13:21                             ` Michael Kerrisk (man-pages)
2021-02-02 17:43           ` Alejandro Colomar (man-pages) [this message]
2021-02-13 19:15             ` Michael Kerrisk (man-pages)

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=05c94edf-b532-f2a6-0681-0b700d833e52@gmail.com \
    --to=alx.manpages@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).