public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] mlock.2: mlock2(): Fix prototype parameter types
@ 2021-02-04 11:17 Alejandro Colomar
  2021-02-07 12:46 ` [PATCH v2] " Alejandro Colomar
  0 siblings, 1 reply; 3+ messages in thread
From: Alejandro Colomar @ 2021-02-04 11:17 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

.../glibc$ grep_syscall_wrapper mlock2
sysdeps/unix/sysv/linux/bits/mman-shared.h:55:
int mlock2 (const void *__addr, size_t __length, unsigned int __flags) __THROW;
.../glibc$

function grep_syscall_wrapper()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.h$' \
	|sort -V \
	|xargs pcregrep -Mn \
	  "(?s)^[^\s#][\w\s]+\s+\**${1}\s*\([\w\s()[\]*,]*?(...)?\)[\w\s()]*;" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man2/mlock.2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man2/mlock.2 b/man2/mlock.2
index 2822df7cf..f48d632c4 100644
--- a/man2/mlock.2
+++ b/man2/mlock.2
@@ -31,7 +31,7 @@ mlock, mlock2, munlock, mlockall, munlockall \- lock and unlock memory
 .B #include <sys/mman.h>
 .PP
 .BI "int mlock(const void *" addr ", size_t " len );
-.BI "int mlock2(const void *" addr ", size_t " len ", int " flags );
+.BI "int mlock2(const void *" addr ", size_t " len ", unsigned int " flags );
 .BI "int munlock(const void *" addr ", size_t " len );
 .PP
 .BI "int mlockall(int " flags );
-- 
2.30.0


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

* [PATCH v2] mlock.2: mlock2(): Fix prototype parameter types
  2021-02-04 11:17 [PATCH] mlock.2: mlock2(): Fix prototype parameter types Alejandro Colomar
@ 2021-02-07 12:46 ` Alejandro Colomar
  2021-02-09 19:00   ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 3+ messages in thread
From: Alejandro Colomar @ 2021-02-07 12:46 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man, libc-alpha

The documented prototype for mlock2() was a mix of the
glibc wrapper prototype and the kernel syscall prototype.
Let's document the glibc wrapper prototype, which is shown below.

......

.../glibc$ grep_glibc_prototype mlock2
sysdeps/unix/sysv/linux/bits/mman-shared.h:55:
int mlock2 (const void *__addr, size_t __length, unsigned int __flags) __THROW;
.../glibc$

function grep_glibc_prototype()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <func>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.h$' \
	|sort -V \
	|xargs pcregrep -Mn \
	  "(?s)^[^\s#][\w\s]+\s+\**${1}\s*\([\w\s()[\]*,]*?(...)?\)[\w\s()]*;" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
 man2/mlock.2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man2/mlock.2 b/man2/mlock.2
index 2822df7cf..f48d632c4 100644
--- a/man2/mlock.2
+++ b/man2/mlock.2
@@ -31,7 +31,7 @@ mlock, mlock2, munlock, mlockall, munlockall \- lock and unlock memory
 .B #include <sys/mman.h>
 .PP
 .BI "int mlock(const void *" addr ", size_t " len );
-.BI "int mlock2(const void *" addr ", size_t " len ", int " flags );
+.BI "int mlock2(const void *" addr ", size_t " len ", unsigned int " flags );
 .BI "int munlock(const void *" addr ", size_t " len );
 .PP
 .BI "int mlockall(int " flags );
-- 
2.30.0


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

* Re: [PATCH v2] mlock.2: mlock2(): Fix prototype parameter types
  2021-02-07 12:46 ` [PATCH v2] " Alejandro Colomar
@ 2021-02-09 19:00   ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Kerrisk (man-pages) @ 2021-02-09 19:00 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: mtk.manpages, linux-man, libc-alpha

Hello Alex

On 2/7/21 1:46 PM, Alejandro Colomar wrote:
> The documented prototype for mlock2() was a mix of the
> glibc wrapper prototype and the kernel syscall prototype.
> Let's document the glibc wrapper prototype, which is shown below.

Thanks. Patch applied.

Cheers,

Michael

> ......
> 
> .../glibc$ grep_glibc_prototype mlock2
> sysdeps/unix/sysv/linux/bits/mman-shared.h:55:
> int mlock2 (const void *__addr, size_t __length, unsigned int __flags) __THROW;
> .../glibc$
> 
> function grep_glibc_prototype()
> {
> 	if ! [ -v 1 ]; then
> 		>&2 echo "Usage: ${FUNCNAME[0]} <func>";
> 		return ${EX_USAGE};
> 	fi
> 
> 	find * -type f \
> 	|grep '\.h$' \
> 	|sort -V \
> 	|xargs pcregrep -Mn \
> 	  "(?s)^[^\s#][\w\s]+\s+\**${1}\s*\([\w\s()[\]*,]*?(...)?\)[\w\s()]*;" \
> 	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
> }
> 
> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
> ---
>  man2/mlock.2 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/man2/mlock.2 b/man2/mlock.2
> index 2822df7cf..f48d632c4 100644
> --- a/man2/mlock.2
> +++ b/man2/mlock.2
> @@ -31,7 +31,7 @@ mlock, mlock2, munlock, mlockall, munlockall \- lock and unlock memory
>  .B #include <sys/mman.h>
>  .PP
>  .BI "int mlock(const void *" addr ", size_t " len );
> -.BI "int mlock2(const void *" addr ", size_t " len ", int " flags );
> +.BI "int mlock2(const void *" addr ", size_t " len ", unsigned int " flags );
>  .BI "int munlock(const void *" addr ", size_t " len );
>  .PP
>  .BI "int mlockall(int " flags );
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

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

end of thread, other threads:[~2021-02-09 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 11:17 [PATCH] mlock.2: mlock2(): Fix prototype parameter types Alejandro Colomar
2021-02-07 12:46 ` [PATCH v2] " Alejandro Colomar
2021-02-09 19:00   ` 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 read-only IMAP folder(s) and NNTP newsgroup(s).