[PATCH] mlock, mlock2, munlock: Use __attr_access_none macro

Sam James sam@gentoo.org
Thu Jan 2 17:29:12 GMT 2025


This fixes build failures using GCC 7.5.0 against glibc headers,
see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118194#c5.

Followup to 013106ae677af9836614ace1a01d25b63fa555a7.

Reported-by: <vvinayag@arm.com>
---
I'm going to check this in.

 misc/sys/mman.h                            | 4 ++--
 sysdeps/unix/sysv/linux/bits/mman-shared.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/misc/sys/mman.h b/misc/sys/mman.h
index a2eaf69c82..de5cb8976f 100644
--- a/misc/sys/mman.h
+++ b/misc/sys/mman.h
@@ -101,11 +101,11 @@ extern int posix_madvise (void *__addr, size_t __len, int __advice) __THROW;
 /* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to
    be memory resident.  */
 extern int mlock (const void *__addr, size_t __len) __THROW
-    __attr_access ((__none__, 1));
+    __attr_access_none (1);
 
 /* Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN).  */
 extern int munlock (const void *__addr, size_t __len) __THROW
-    __attr_access ((__none__, 1));
+    __attr_access_none (1);
 
 /* Cause all currently mapped pages of the process to be memory resident
    until unlocked by a call to the `munlockall', until the process exits,
diff --git a/sysdeps/unix/sysv/linux/bits/mman-shared.h b/sysdeps/unix/sysv/linux/bits/mman-shared.h
index bfbccc14d6..31590979b9 100644
--- a/sysdeps/unix/sysv/linux/bits/mman-shared.h
+++ b/sysdeps/unix/sysv/linux/bits/mman-shared.h
@@ -57,7 +57,7 @@ int memfd_create (const char *__name, unsigned int __flags) __THROW;
 /* Lock pages from ADDR (inclusive) to ADDR + LENGTH (exclusive) into
    memory.  FLAGS is a combination of the MLOCK_* flags above.  */
 int mlock2 (const void *__addr, size_t __length, unsigned int __flags) __THROW
-    __attr_access ((__none__, 1));
+    __attr_access_none (1);
 
 /* Allocate a new protection key, with the PKEY_DISABLE_* bits
    specified in ACCESS_RESTRICTIONS.  The protection key mask for the

base-commit: d5bceac99d24af1131b90027dab267e437b65cd1
prerequisite-patch-id: 3044b25707135b795279fffad16c051ac8b11f02
-- 
2.47.1



More information about the Libc-alpha mailing list