Hi Alex, On 2/7/21 1:57 PM, Alejandro Colomar wrote: > There are many slightly different prototypes for this syscall, > but none of them is like the documented one. > Of all the different prototypes, > let's document the asm-generic one. > > This manual page was actually using a prototype similar to > mmap(2), (Mea culpa...) > but there's no glibc wrapper function called mmap2(2), > as the wrapper for this syscall is mmap(2). Therefore, the > documented prototype should be the kernel one. Thanks! Patch applied. Cheers, Michael > ...... > > .../linux$ grep_syscall mmap2 > arch/csky/kernel/syscall.c:17: > SYSCALL_DEFINE6(mmap2, > unsigned long, addr, > unsigned long, len, > unsigned long, prot, > unsigned long, flags, > unsigned long, fd, > off_t, offset) > arch/microblaze/kernel/sys_microblaze.c:46: > SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, > unsigned long, prot, unsigned long, flags, unsigned long, fd, > unsigned long, pgoff) > arch/nds32/kernel/sys_nds32.c:12: > SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, > unsigned long, prot, unsigned long, flags, > unsigned long, fd, unsigned long, pgoff) > arch/powerpc/kernel/syscalls.c:60: > SYSCALL_DEFINE6(mmap2, unsigned long, addr, size_t, len, > unsigned long, prot, unsigned long, flags, > unsigned long, fd, unsigned long, pgoff) > arch/riscv/kernel/sys_riscv.c:37: > SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, > unsigned long, prot, unsigned long, flags, > unsigned long, fd, off_t, offset) > arch/s390/kernel/sys_s390.c:49: > SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg) > arch/sparc/kernel/sys_sparc_32.c:101: > SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, > unsigned long, prot, unsigned long, flags, unsigned long, fd, > unsigned long, pgoff) > arch/ia64/include/asm/unistd.h:30: > asmlinkage unsigned long sys_mmap2( > unsigned long addr, unsigned long len, > int prot, int flags, > int fd, long pgoff); > arch/ia64/kernel/sys_ia64.c:139: > asmlinkage unsigned long > sys_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, long pgoff) > arch/m68k/kernel/sys_m68k.c:40: > asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, > unsigned long prot, unsigned long flags, > unsigned long fd, unsigned long pgoff) > arch/parisc/kernel/sys_parisc.c:275: > asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, > unsigned long prot, unsigned long flags, unsigned long fd, > unsigned long pgoff) > arch/powerpc/include/asm/syscalls.h:15: > asmlinkage long sys_mmap2(unsigned long addr, size_t len, > unsigned long prot, unsigned long flags, > unsigned long fd, unsigned long pgoff); > arch/sh/include/asm/syscalls.h:8: > asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, > unsigned long prot, unsigned long flags, > unsigned long fd, unsigned long pgoff); > arch/sh/kernel/sys_sh.c:41: > asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, > unsigned long prot, unsigned long flags, > unsigned long fd, unsigned long pgoff) > arch/sparc/kernel/systbls.h:23: > asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, > unsigned long prot, unsigned long flags, > unsigned long fd, unsigned long pgoff); > include/asm-generic/syscalls.h:14: > asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, > unsigned long prot, unsigned long flags, > unsigned long fd, unsigned long pgoff); > .../linux$ > > function grep_syscall() > { > if ! [ -v 1 ]; then > >&2 echo "Usage: ${FUNCNAME[0]} <syscall>"; > return ${EX_USAGE}; > fi > > find * -type f \ > |grep '\.c$' \ > |sort -V \ > |xargs pcregrep -Mn "(?s)^\w*SYSCALL_DEFINE.\(${1},.*?\)" \ > |sed -E 's/^[^:]+:[0-9]+:/&\n/'; > > find * -type f \ > |grep '\.[ch]$' \ > |sort -V \ > |xargs pcregrep -Mn "(?s)^asmlinkage\s+[\w\s]+\**sys_${1}\s*\(.*?\)" \ > |sed -E 's/^[^:]+:[0-9]+:/&\n/'; > } > > Signed-off-by: Alejandro Colomar <alx.manpages@xxxxxxxxx> > --- > man2/mmap2.2 | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/man2/mmap2.2 b/man2/mmap2.2 > index 349ee45e5..f9f9e91cb 100644 > --- a/man2/mmap2.2 > +++ b/man2/mmap2.2 > @@ -33,8 +33,9 @@ mmap2 \- map files or devices into memory > .nf > .B #include <sys/mman.h> > .PP > -.BI "void *mmap2(void *" addr ", size_t " length ", int " prot , > -.BI " int " flags ", int " fd ", off_t " pgoffset ); > +.BI "void *mmap2(unsigned long " addr ", unsigned long " length , > +.BI " unsigned long " prot ", unsigned long " flags , > +.BI " unsigned long " fd ", unsigned long " pgoffset ); > .fi > .SH DESCRIPTION > This is probably not the system call that you are interested in; instead, see > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/