Skip to contentSkip to conversation

Some systems have a dynamic PAGE_SIZE value and do not add a definition for PAGE_SIZE. This value will have to be retrieved using getpagesize() or sysconf().

PATCH In review Thierry FAUCK - IBM LTC 2 participants 3 messages Aug 6, 2014 – Aug 7, 2014 Kselftest

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Some systems have a dynamic PAGE_SIZE value and do not add a definition for PAGE_SIZE. This value will have to be retrieved using getpagesize() or sysconf().

From: Thierry Fauck <[email protected]>

---
 tools/testing/selftests/ptrace/peeksiginfo.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/testing/selftests/ptrace/peeksiginfo.c +4 -0
index d46558b..c34cd8a 100644
@@ -31,6 +31,10 @@ static int sys_ptrace(int request, pid_t pid, void *addr, void *data)
 #define TEST_SICODE_PRIV	-1
 #define TEST_SICODE_SHARE	-2
 
+#ifndef PAGE_SIZE
+#define PAGE_SIZE sysconf(_SC_PAGESIZE)
+#endif
+
 #define err(fmt, ...)						\
 		fprintf(stderr,					\
 			"Error (%s:%d): " fmt,			\
Signature · 1 line
2.0.0
#1 lore raw

tools/testing/selftests/ptrace/peeksiginfo.c static int sys_ptrace(int request, pid_t pid, void *addr, void *data) · line 40

Quoted 13 lines · On Wed, 6 Aug 2014 13:34:26 +0200 Thierry FAUCK - IBM LTC…
tools/testing/selftests/ptrace/peeksiginfo.c +4 -0
@@ -31,6 +31,10 @@ static int sys_ptrace(int request, pid_t pid, void *addr, void *data)
 #define TEST_SICODE_PRIV	-1
 #define TEST_SICODE_SHARE	-2
 
+#ifndef PAGE_SIZE
+#define PAGE_SIZE sysconf(_SC_PAGESIZE)
+#endif
+
 #define err(fmt, ...)						\
 		fprintf(stderr,					\
 			"Error (%s:%d): " fmt,			\

More details, please. What are "some systems"?

#2 lore raw
Quoted 8 lines · Andrew Morton
Quoted 6 lines · On Wed, 6 Aug 2014 13:34:26 +0200 Thierry FAUCK - IBM LTC…
tools/testing/selftests/ptrace/peeksiginfo.c +0 -0
@@ -31,6 +31,10 @@ static int sys_ptrace(int request, pid_t pid, void *addr, void *data)
 #define TEST_SICODE_PRIV	-1
 #define TEST_SICODE_SHARE	-2
 
Quoted 9 lines

tools/testing/selftests/ptrace/peeksiginfo.c static int sys_ptrace(int request, pid_t pid, void *addr, void *data) · line 40

Quoted 7 lines
tools/testing/selftests/ptrace/peeksiginfo.c +4 -0
+#ifndef PAGE_SIZE
+#define PAGE_SIZE sysconf(_SC_PAGESIZE)
+#endif
+
 #define err(fmt, ...)						\
 		fprintf(stderr,					\
 			"Error (%s:%d): " fmt,			\

More details, please. What are "some systems"?

Sorry, about that "common description".
A more appropriate one could be : On IBM powerpc where multiple page size value are supported, current ppc64 and ppc64el distro don't define the PAGE_SIZE variable in /usr/include as this is a dynamic value retrieved by the getpagesize() or sysconf() defined in unistd.h. The PAGE_SIZE variable sounds defined when only one value is supported by the kernel.
As such, when the PAGE_SIZE definition doesn't exist system should retrieve the dynamic value.

Is that a better explanation ?

Signature · 1 line
Thierry Fauck @ linux.vnet.ibm