Hi Alex, On Sat, 8 Jan 2022 02:59:12 +0100, "Alejandro Colomar (man-pages)" <alx.manpages@xxxxxxxxx> wrote: > On 1/7/22 17:46, Stephen Kitt wrote: > > glibc 2.27 introduced support for the pkeys functions, but the glibc > > versions don't match those declared in the example. Update the example > > to match glibc, and avoid declaring the functions if glibc is new > > enough. > > > Signed-off-by: Stephen Kitt <steve@xxxxxxx> > > > There are a few problems with the prototypes. > > > alx@ady1:~/src/gnu/glibc$ grep_glibc_prototype wrpkru > alx@ady1:~/src/gnu/glibc$ grep -rn define.wrpkru > alx@ady1:~/src/gnu/glibc$ grep_glibc_prototype pkey_set > 60:int pkey_set (int __key, unsigned int __access_rights) __THROW; > alx@ady1:~/src/gnu/glibc$ grep_glibc_prototype pkey_mprotect > 72:int pkey_mprotect (void *__addr, size_t __len, int __prot, int > __pkey) __THROW; > alx@ady1:~/src/gnu/glibc$ grep_glibc_prototype pkey_alloc > 56:int pkey_alloc (unsigned int __flags, unsigned int __access_rights) > __THROW; > alx@ady1:~/src/gnu/glibc$ grep_glibc_prototype pkey_free > 68:int pkey_free (int __key) __THROW; > > > As you see above, I couldn't find wrpkru(). Are you sure it exists in > glibc? It doesn’t exist in glibc(), but if we use the glibc version of pkey_set(), it’s not needed in the example. In glibc, the equivalent function is pkey_write(), but that’s an implementation detail, it’s not part of the API. > pkey_mprotect(3) uses 'int' instead of 'unsigned long'. Would you mind > fixind that one too? > > pkey_set(3) uses 'unsigned int' instead of 'unsigned long'. Please fix > that one. > > pkey_free(3) uses 'int' instead of 'unsigned long'. Would you mind > fixing that one too? Right, I’ll take care of all that. > BTW, I need to modify grep_glibc_prototype() so that it always prints > the file name, even if only one file is passed to grep (adding /dev/null > to the file list). > > > A part from that, I prefer EXAMPLES to be as simple as possible, so I'd > do 2 patches. One to match the definitions to the glibc ones, and then > one commit removing old code, assuming glibc is new enough. Would you > mind sending a subsequent patch to remove everything under #if ... #endif? Right, will do! Regards, Stephen
Attachment:
pgpp3m3XJTKQd.pgp
Description: OpenPGP digital signature