[PATCH v5] cacheflush.2: Document __builtin___clear_cache() as a more portable alternative

2020-12-14 Thread Alejandro Colomar
Reported-by: Heinrich Schuchardt 
Signed-off-by: Alejandro Colomar 
---
 man2/cacheflush.2 | 24 
 1 file changed, 24 insertions(+)

diff --git a/man2/cacheflush.2 b/man2/cacheflush.2
index aba625721..7a2eed506 100644
--- a/man2/cacheflush.2
+++ b/man2/cacheflush.2
@@ -86,6 +86,30 @@ On Linux, this call first appeared on the MIPS architecture,
 but nowadays, Linux provides a
 .BR cacheflush ()
 system call on some other architectures, but with different arguments.
+.SH NOTES
+Unless you need the finer grained control that this system call provides,
+you probably want to use the GCC built-in function
+.BR __builtin___clear_cache (),
+which provides a portable interface
+across platforms supported by GCC and compatible compilers:
+.PP
+.in +4n
+.EX
+.BI "void __builtin___clear_cache(void *" begin ", void *" end );
+.EE
+.in
+.PP
+On platforms that don't require instruction cache flushes,
+.BR __builtin___clear_cache ()
+has no effect.
+.PP
+.IR Note :
+Until GCC 9.1.0,
+the prototype for this built-in function used
+.I char *
+instead of
+.I void *
+for the parameters.
 .SH BUGS
 Linux kernels older than version 2.6.11 ignore the
 .I addr
-- 
2.29.2


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] cacheflush.2: Document Architecture-specific variants

2020-12-14 Thread Alejandro Colomar
Signed-off-by: Alejandro Colomar 
---

Hi Michael,

Please apply this patch after
'[PATCH v5] cacheflush.2: Document __builtin___clear_cache() as a more
 portable alternative'.

Thanks,

Alex

 man2/cacheflush.2 | 42 ++
 1 file changed, 42 insertions(+)

diff --git a/man2/cacheflush.2 b/man2/cacheflush.2
index fc35f1a0b..0761b429a 100644
--- a/man2/cacheflush.2
+++ b/man2/cacheflush.2
@@ -31,6 +31,10 @@ cacheflush \- flush contents of instruction and/or data cache
 .PP
 .BI "int cacheflush(char *" addr ", int "nbytes ", int "cache );
 .fi
+.PP
+.IR Note :
+On some architectures,
+there is no glibc wrapper for this system call; see NOTES.
 .SH DESCRIPTION
 .BR cacheflush ()
 flushes the contents of the indicated cache(s) for the
@@ -87,6 +91,44 @@ but nowadays, Linux provides a
 .BR cacheflush ()
 system call on some other architectures, but with different arguments.
 .SH NOTES
+.SS Architecture-specific variants
+Glibc provides a wrapper for this system call,
+with the prototype shown in SYNOPSIS,
+for the following architectures:
+ARC, CSKY, MIPS, and NIOS2.
+.PP
+On some other architectures,
+Linux provides this system call, with different arguments:
+.TP
+M68K:
+.PP
+.in +4n
+.EX
+.BI "int cacheflush(unsigned long " addr ", int " scope ", int " cache ,
+.BI "   unsigned long " len );
+.EE
+.in
+.TP
+SH:
+.PP
+.in +4n
+.EX
+.BI "int cacheflush(unsigned long " addr ", unsigned long " len ", int " op );
+.EE
+.in
+.TP
+NDS32:
+.PP
+.in +4n
+.EX
+.BI "int cacheflush(unsigned int " start ", unsigned int " end ", int " cache 
);
+.EE
+.in
+.PP
+On the above architectures,
+glibc does not provide a wrapper for this system call; call it using
+.BR syscall (2).
+.SS GCC alternative
 Unless you need the finer grained control that this system call provides,
 you probably want to use the GCC built-in function
 .BR __builtin___clear_cache (),
-- 
2.29.2


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v6] cacheflush.2: Document __builtin___clear_cache() as a more portable alternative

2020-12-15 Thread Alejandro Colomar
Reported-by: Heinrich Schuchardt 
Signed-off-by: Alejandro Colomar 
Cc: Martin Sebor 
Cc: Dave Martin 
---

v6:
- GCC has always exposed 'void *', as Martin Sebor noted.
  It's Clang (and maybe others) that (following GCC's docs)
  exposed 'char *'.

 man2/cacheflush.2 | 24 
 1 file changed, 24 insertions(+)

diff --git a/man2/cacheflush.2 b/man2/cacheflush.2
index aba625721..7a2eed506 100644
--- a/man2/cacheflush.2
+++ b/man2/cacheflush.2
@@ -86,6 +86,30 @@ On Linux, this call first appeared on the MIPS architecture,
 but nowadays, Linux provides a
 .BR cacheflush ()
 system call on some other architectures, but with different arguments.
+.SH NOTES
+Unless you need the finer grained control that this system call provides,
+you probably want to use the GCC built-in function
+.BR __builtin___clear_cache (),
+which provides a portable interface
+across platforms supported by GCC and compatible compilers:
+.PP
+.in +4n
+.EX
+.BI "void __builtin___clear_cache(void *" begin ", void *" end );
+.EE
+.in
+.PP
+On platforms that don't require instruction cache flushes,
+.BR __builtin___clear_cache ()
+has no effect.
+.PP
+.IR Note :
+On some GCC-compatible compilers,
+the prototype for this built-in function uses
+.I char *
+instead of
+.I void *
+for the parameters.
 .SH BUGS
 Linux kernels older than version 2.6.11 ignore the
 .I addr
-- 
2.29.2


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] cacheflush.2: Update SYNOPSIS for glibc wrapper

2021-01-16 Thread Alejandro Colomar
Glibc uses 'void *' instead of 'char *'.
And the prototype is declared in .

..

$ syscall='cacheflush';
$ ret='int';
$ find glibc/ -type f -name '*.h' \
  |xargs pcregrep -Mn "(?s)^[\w\s]*${ret}\s*${syscall}\s*\(.*?;";
glibc/sysdeps/unix/sysv/linux/nios2/sys/cachectl.h:27:
extern int cacheflush (void *__addr, const int __nbytes, const int __op) 
__THROW;
glibc/sysdeps/unix/sysv/linux/mips/sys/cachectl.h:35:
extern int cacheflush (void *__addr, const int __nbytes, const int __op) 
__THROW;
glibc/sysdeps/unix/sysv/linux/arc/sys/cachectl.h:30:
extern int cacheflush (void *__addr, int __nbytes, int __op) __THROW;
glibc/sysdeps/unix/sysv/linux/csky/sys/cachectl.h:30:
extern int cacheflush (void *__addr, const int __nbytes,
       const int __op) __THROW;

Signed-off-by: Alejandro Colomar 
---
 man2/cacheflush.2 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/man2/cacheflush.2 b/man2/cacheflush.2
index 2cf624f3a..0496879ca 100644
--- a/man2/cacheflush.2
+++ b/man2/cacheflush.2
@@ -27,9 +27,9 @@
 cacheflush \- flush contents of instruction and/or data cache
 .SH SYNOPSIS
 .nf
-.B #include 
+.B #inlcude 
 .PP
-.BI "int cacheflush(char *" addr ", int "nbytes ", int "cache );
+.BI "int cacheflush(void *" addr ", int "nbytes ", int "cache );
 .fi
 .PP
 .IR Note :
-- 
2.30.0


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[RFC] cacheflush.2: Document different prototypes for different architectures

2020-12-11 Thread Alejandro Colomar (man-pages)
/sysv/linux/m68k/syscalls.list: Add cacheflush.
glibc/ChangeLog.old/ChangeLog.4:205:* sysdeps/mach/mips/cacheflush.c:
New file.
glibc/ChangeLog.old/ChangeLog.18:40858: *
sysdeps/unix/sysv/linux/nios2/cacheflush.c: New file.
glibc/ChangeLog.old/ChangeLog.ports-tile:700:   *
sysdeps/unix/sysv/linux/tile/cacheflush.c: New file.
grep: glibc/.git/index: binary file matches

$ grep -rn -e 'sys_cacheflush' -e 'SYSCALL_DEFINE.(cacheflush,' linux/ |
grep -v -e '/arc/' -e '/csky/' -e '/mips/' -e '/nios2/'
tools/testing/selftests/futex/functional/usr/include/linux/capability.h:251:/*
Allow flushing all cache on m68k (sys_cacheflush) */
include/uapi/linux/capability.h:253:/* Allow flushing all cache on m68k
(sys_cacheflush) */
arch/m68k/kernel/sys_m68k.c:376:/* sys_cacheflush -- flush (part of) the
processor cache.  */
arch/m68k/kernel/sys_m68k.c:378:sys_cacheflush (unsigned long addr, int
scope, int cache, unsigned long len)
arch/m68k/kernel/sys_m68k.c:531:/* sys_cacheflush -- flush (part of) the
processor cache.  */
arch/m68k/kernel/sys_m68k.c:533:sys_cacheflush (unsigned long addr, int
scope, int cache, unsigned long len)
arch/m68k/kernel/syscalls/syscall.tbl:133:123   common  cacheflush  
sys_cacheflush
arch/sh/kernel/sys_sh.c:57:/* sys_cacheflush -- flush (part of) the
processor cache.  */
arch/sh/kernel/sys_sh.c:58:asmlinkage int sys_cacheflush(unsigned long
addr, unsigned long len, int op)
arch/sh/kernel/syscalls/syscall.tbl:133:123 common  cacheflush  
sys_cacheflush
arch/arm/include/asm/cacheflush.h:263: * This is used for the ARM
private sys_cacheflush system call.
arch/nds32/include/uapi/asm/unistd.h:15:__SYSCALL(__NR_cacheflush,
sys_cacheflush)
arch/nds32/include/asm/syscalls.h:7:asmlinkage long
sys_cacheflush(unsigned long addr, unsigned long len, unsigned int op);
arch/nds32/kernel/sys_nds32.c:29:SYSCALL_DEFINE3(cacheflush, unsigned
int, start, unsigned int, end, int, cache)

Rendered page (NOTES only):

[
NOTES
   Architecture-specific variants
   Glibc  provides a wrapper for this system call, with the pro‐
   totype shown in SYNOPSIS, for  the  following  architectures:
   ARC, CSKY, MIPS, and NIOS2. // lowercase?

   On  some other architectures, Linux provides this system call
   with different arguments:

   M68K:

   int cacheflush(unsigned long addr, int scope, int cache,
  unsigned long len);

   SH:

   int cacheflush(unsigned long addr, unsigned long len, int op);

   NDS32:

   int cacheflush(unsigned int start, unsigned int end, int cache);

   // ARM??

   GCC alternative
   Unless you need the finer grained control  that  this  system
   call  provides,  you  probably  want  to use the GCC built-in
   function __builtin___clear_cache(), which provides a portable
   interface  across  platforms  supported by GCC and compatible
   compilers:

   void __builtin___clear_cache(void *begin, void *end);

   On platforms that don't require  instruction  cache  flushes,
   __builtin___clear_cache() has no effect.

   Note:  On  some  GCC-compatible compilers, such as clang, the
   prototype for this function uses char * instead of void * for
   the parameters.

]

'GCC alternative' is the name I gave to the NOTES from the other thread,
which aren't yet merged (I'll send the patches after the weekend, probably).

Subsections based on:
fadvise64(2)

Can you review this?

Thanks,

Alex

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

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [RFC] cacheflush.2: Document different prototypes for different architectures

2020-12-12 Thread Alejandro Colomar (man-pages)
Hi Heinrich,

Good.
BTW, it looks like internally LLVM uses 'void *'[1],
but Clang exposes 'char *'[2] in the prototype.  Weird...
I reported the bug yesterday: https://bugs.llvm.org/show_bug.cgi?id=48489

Thanks,

Alex

[1]:
https://github.com/llvm/llvm-project/blob/414d3dc62c706f41226b0d552210c79f5080df43/compiler-rt/lib/builtins/clear_cache.c#L59
[2]:
https://github.com/llvm/llvm-project/blob/7faf62a80bfc3a9dfe34133681fcc31f8e8d658b/clang/include/clang/Basic/Builtins.def#L583

On 12/12/20 12:52 AM, Heinrich Schuchardt wrote:
> On 12/11/20 10:09 PM, Alejandro Colomar (man-pages) wrote:
>> Hi Michael,
>>
>> Continuing with the changes in this thread:
>> https://lore.kernel.org/linux-man/747d56e0-c102-ab40-add4-530a48a43...@gmx.de/T/#t
>>
>>
>> I researched the architectures that have this syscall.  I found some
>> that clearly provide the syscall, and some that seem to have something,
>> but I didn't find a definition in the kernel (i.e., ARM, MicroBlaze
>> (glibc only)?)
> 
> arch/arm/include/uapi/asm/unistd.h:35:
> #define __ARM_NR_cacheflush   (__ARM_NR_BASE+2)
> 
> arch/arm64/include/asm/unistd.h:37:
> #define __ARM_NR_compat_cacheflush   (__ARM_NR_COMPAT_BASE + 2)
> 
> These syscalls are marked as private. So you should not use them from
> user space.
> 
> The compilers seem not to care about these syscalls being private:
> 
> https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/arm/lib1funcs.S#L1512
> 
> https://github.com/llvm-mirror/compiler-rt/blob/master/lib/builtins/clear_cache.c
> 
> 
> Best regards
> 
> Heinrich
[...]
>> Rendered page (NOTES only):
>>
>> [
>> NOTES
>>     Architecture-specific variants
>>     Glibc  provides a wrapper for this system call, with the pro‐
>>     totype shown in SYNOPSIS, for  the  following  architectures:
>>     ARC, CSKY, MIPS, and NIOS2. // lowercase?
>>
>>     On  some other architectures, Linux provides this system call
>>     with different arguments:
>>
>>     M68K:
>>
>>     int cacheflush(unsigned long addr, int scope, int cache,
>>    unsigned long len);
>>
>>     SH:
>>
>>     int cacheflush(unsigned long addr, unsigned long len, int
>> op);
>>
>>     NDS32:
>>
>>     int cacheflush(unsigned int start, unsigned int end, int
>> cache);
>>
>>     GCC alternative
>>     Unless you need the finer grained control  that  this  system
>>     call  provides,  you  probably  want  to use the GCC built-in
>>     function __builtin___clear_cache(), which provides a portable
>>     interface  across  platforms  supported by GCC and compatible
>>     compilers:
>>
>>     void __builtin___clear_cache(void *begin, void *end);
>>
>>     On platforms that don't require  instruction  cache  flushes,
>>     __builtin___clear_cache() has no effect.
>>
>>     Note:  On  some  GCC-compatible compilers, such as clang, the
>>     prototype for this function uses char * instead of void * for
>>     the parameters.
>>
>> ]
>>
>> 'GCC alternative' is the name I gave to the NOTES from the other thread,
>> which aren't yet merged (I'll send the patches after the weekend,
>> probably).
>>
>> Subsections based on:
>> fadvise64(2)
>>
>> Can you review this?
>>
>> Thanks,
>>
>> Alex
>>
> 

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Ping: [PATCH v6] cacheflush.2: Document __builtin___clear_cache() as a more portable alternative

2020-12-20 Thread Alejandro Colomar (man-pages)
Ping

On 12/15/20 2:30 PM, Alejandro Colomar wrote:
> Reported-by: Heinrich Schuchardt 
> Signed-off-by: Alejandro Colomar 
> Cc: Martin Sebor 
> Cc: Dave Martin 
> ---
> 
> v6:
> - GCC has always exposed 'void *', as Martin Sebor noted.
>   It's Clang (and maybe others) that (following GCC's docs)
>   exposed 'char *'.
> 
>  man2/cacheflush.2 | 24 
>  1 file changed, 24 insertions(+)
> 
> diff --git a/man2/cacheflush.2 b/man2/cacheflush.2
> index aba625721..7a2eed506 100644
> --- a/man2/cacheflush.2
> +++ b/man2/cacheflush.2
> @@ -86,6 +86,30 @@ On Linux, this call first appeared on the MIPS 
> architecture,
>  but nowadays, Linux provides a
>  .BR cacheflush ()
>  system call on some other architectures, but with different arguments.
> +.SH NOTES
> +Unless you need the finer grained control that this system call provides,
> +you probably want to use the GCC built-in function
> +.BR __builtin___clear_cache (),
> +which provides a portable interface
> +across platforms supported by GCC and compatible compilers:
> +.PP
> +.in +4n
> +.EX
> +.BI "void __builtin___clear_cache(void *" begin ", void *" end );
> +.EE
> +.in
> +.PP
> +On platforms that don't require instruction cache flushes,
> +.BR __builtin___clear_cache ()
> +has no effect.
> +.PP
> +.IR Note :
> +On some GCC-compatible compilers,
> +the prototype for this built-in function uses
> +.I char *
> +instead of
> +.I void *
> +for the parameters.
>  .SH BUGS
>  Linux kernels older than version 2.6.11 ignore the
>  .I addr
> 

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

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Ping: [PATCH] cacheflush.2: Document Architecture-specific variants

2020-12-20 Thread Alejandro Colomar (man-pages)
Ping

On 12/14/20 3:38 PM, Alejandro Colomar wrote:
> Signed-off-by: Alejandro Colomar 
> ---
> 
> Hi Michael,
> 
> Please apply this patch after
> '[PATCH v5] cacheflush.2: Document __builtin___clear_cache() as a more
>  portable alternative'.
> 
> Thanks,
> 
> Alex
> 
>  man2/cacheflush.2 | 42 ++
>  1 file changed, 42 insertions(+)
> 
> diff --git a/man2/cacheflush.2 b/man2/cacheflush.2
> index fc35f1a0b..0761b429a 100644
> --- a/man2/cacheflush.2
> +++ b/man2/cacheflush.2
> @@ -31,6 +31,10 @@ cacheflush \- flush contents of instruction and/or data 
> cache
>  .PP
>  .BI "int cacheflush(char *" addr ", int "nbytes ", int "cache );
>  .fi
> +.PP
> +.IR Note :
> +On some architectures,
> +there is no glibc wrapper for this system call; see NOTES.
>  .SH DESCRIPTION
>  .BR cacheflush ()
>  flushes the contents of the indicated cache(s) for the
> @@ -87,6 +91,44 @@ but nowadays, Linux provides a
>  .BR cacheflush ()
>  system call on some other architectures, but with different arguments.
>  .SH NOTES
> +.SS Architecture-specific variants
> +Glibc provides a wrapper for this system call,
> +with the prototype shown in SYNOPSIS,
> +for the following architectures:
> +ARC, CSKY, MIPS, and NIOS2.
> +.PP
> +On some other architectures,
> +Linux provides this system call, with different arguments:
> +.TP
> +M68K:
> +.PP
> +.in +4n
> +.EX
> +.BI "int cacheflush(unsigned long " addr ", int " scope ", int " cache ,
> +.BI "   unsigned long " len );
> +.EE
> +.in
> +.TP
> +SH:
> +.PP
> +.in +4n
> +.EX
> +.BI "int cacheflush(unsigned long " addr ", unsigned long " len ", int " op 
> );
> +.EE
> +.in
> +.TP
> +NDS32:
> +.PP
> +.in +4n
> +.EX
> +.BI "int cacheflush(unsigned int " start ", unsigned int " end ", int " 
> cache );
> +.EE
> +.in
> +.PP
> +On the above architectures,
> +glibc does not provide a wrapper for this system call; call it using
> +.BR syscall (2).
> +.SS GCC alternative
>  Unless you need the finer grained control that this system call provides,
>  you probably want to use the GCC built-in function
>  .BR __builtin___clear_cache (),
> 

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

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH] cacheflush.2: Document Architecture-specific variants

2020-12-21 Thread Alejandro Colomar (man-pages)



On 12/20/20 9:54 PM, Michael Kerrisk (man-pages) wrote:
> Hi Alex
> 
> On 12/14/20 3:38 PM, Alejandro Colomar wrote:
>> Signed-off-by: Alejandro Colomar 
>> ---
>>
>> Hi Michael,
>>
>> Please apply this patch after
>> '[PATCH v5] cacheflush.2: Document __builtin___clear_cache() as a more
>>  portable alternative'.
> 
> Thanks. Applied.
> 
>>  man2/cacheflush.2 | 42 ++
>>  1 file changed, 42 insertions(+)
>>
>> diff --git a/man2/cacheflush.2 b/man2/cacheflush.2
>> index fc35f1a0b..0761b429a 100644
>> --- a/man2/cacheflush.2
>> +++ b/man2/cacheflush.2
>> @@ -31,6 +31,10 @@ cacheflush \- flush contents of instruction and/or data 
>> cache
>>  .PP
>>  .BI "int cacheflush(char *" addr ", int "nbytes ", int "cache );
>>  .fi
>> +.PP
>> +.IR Note :
>> +On some architectures,
>> +there is no glibc wrapper for this system call; see NOTES.
>>  .SH DESCRIPTION
>>  .BR cacheflush ()
>>  flushes the contents of the indicated cache(s) for the
>> @@ -87,6 +91,44 @@ but nowadays, Linux provides a
>>  .BR cacheflush ()
>>  system call on some other architectures, but with different arguments.
>>  .SH NOTES
>> +.SS Architecture-specific variants
>> +Glibc provides a wrapper for this system call,
>> +with the prototype shown in SYNOPSIS,
>> +for the following architectures:
>> +ARC, CSKY, MIPS, and NIOS2.
>> +.PP
>> +On some other architectures,
>> +Linux provides this system call, with different arguments:
>> +.TP
>> +M68K:
>> +.PP
>> +.in +4n
>> +.EX
>> +.BI "int cacheflush(unsigned long " addr ", int " scope ", int " cache ,
>> +.BI "   unsigned long " len );
>> +.EE
>> +.in
> 
> I made the formatting rather:
> 
> [[
> .TP
> M68K:
> .nf
> .BI "int cacheflush(unsigned long " addr ", int " scope ", int " cache ,
> .BI "   unsigned long " len );
> .fi
> ]]
> 
> That's for consistency wqith the SYNOPSIS sections, where .EX/.EE 
> isn't used.

Ahh. Right!

Thanks,

Alex

> 
>> +.TP
>> +SH:
>> +.PP
>> +.in +4n
>> +.EX
>> +.BI "int cacheflush(unsigned long " addr ", unsigned long " len ", int " op 
>> );
>> +.EE
>> +.in
>> +.TP
>> +NDS32:
>> +.PP
>> +.in +4n
>> +.EX
>> +.BI "int cacheflush(unsigned int " start ", unsigned int " end ", int " 
>> cache );
>> +.EE
>> +.in
>> +.PP
>> +On the above architectures,
>> +glibc does not provide a wrapper for this system call; call it using
>> +.BR syscall (2).
>> +.SS GCC alternative
>>  Unless you need the finer grained control that this system call provides,
>>  you probably want to use the GCC built-in function
>>  .BR __builtin___clear_cache (),
> 
> 
> Cheers,
> 
> Michael
> 
> 
> 

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

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH] cacheflush.2: Update SYNOPSIS for glibc wrapper

2021-01-17 Thread Alejandro Colomar (man-pages)
Hi Michael,

On 1/17/21 9:34 PM, Michael Kerrisk (man-pages) wrote:
> Hi Alex,
> 
> On 1/16/21 3:56 PM, Alejandro Colomar wrote:
>> Glibc uses 'void *' instead of 'char *'.
>> And the prototype is declared in .

D'oh!

>>
>> ..
>>
>> $ syscall='cacheflush';
>> $ ret='int';
>> $ find glibc/ -type f -name '*.h' \
>>   |xargs pcregrep -Mn "(?s)^[\w\s]*${ret}\s*${syscall}\s*\(.*?;";
>> glibc/sysdeps/unix/sysv/linux/nios2/sys/cachectl.h:27:

It is defined in 

Please fix that.

Thanks,

Alex

>> extern int cacheflush (void *__addr, const int __nbytes, const int __op) 
>> __THROW;
>> glibc/sysdeps/unix/sysv/linux/mips/sys/cachectl.h:35:
>> extern int cacheflush (void *__addr, const int __nbytes, const int __op) 
>> __THROW;
>> glibc/sysdeps/unix/sysv/linux/arc/sys/cachectl.h:30:
>> extern int cacheflush (void *__addr, int __nbytes, int __op) __THROW;
>> glibc/sysdeps/unix/sysv/linux/csky/sys/cachectl.h:30:
>> extern int cacheflush (void *__addr, const int __nbytes,
>> const int __op) __THROW;
>>
>> Signed-off-by: Alejandro Colomar 
> 
> Thanks. Patch applied.
> 
> Cheers,
> 
> Michael
> 
>> ---
>>  man2/cacheflush.2 | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/man2/cacheflush.2 b/man2/cacheflush.2
>> index 2cf624f3a..0496879ca 100644
>> --- a/man2/cacheflush.2
>> +++ b/man2/cacheflush.2
>> @@ -27,9 +27,9 @@
>>  cacheflush \- flush contents of instruction and/or data cache
>>  .SH SYNOPSIS
>>  .nf
>> -.B #include 
>> +.B #inlcude 

s/cacheflush.h/cachectl.h/

>>  .PP
>> -.BI "int cacheflush(char *" addr ", int "nbytes ", int "cache );
>> +.BI "int cacheflush(void *" addr ", int "nbytes ", int "cache );
>>  .fi
>>  .PP
>>  .IR Note :
>>
> 
> 


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

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc