Hi Alex, On 2/2/21 6:43 PM, Alejandro Colomar (man-pages) wrote: > 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. Perhaps we better add something in scripts/ with all of these aliases and functions that you find useful. Then you (and maybe I) could . (dot) that in our .bashrc or so. Would you send a patch? Thanks, Michael > $ 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) > > [...] > > > > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/