Go to the documentation of this file.
32 #include <sys/types.h>
38 #define SHM_HUGETLB 04000
41 #define LENGTH (256UL*1024*1024)
43 #define dprintf(x) printf(x)
47 #define ADDR (void *)(0x8000000000000000UL)
48 #define SHMAT_FLAGS (SHM_RND)
50 #define ADDR (void *)(0x0UL)
51 #define SHMAT_FLAGS (0)
65 printf(
"shmid: 0x%x\n", shmid);
68 if (shmaddr == (
char *)-1) {
69 perror(
"Shared memory attach failure");
73 printf(
"shmaddr: %p\n", shmaddr);
75 dprintf(
"Starting the writes:\n");
76 for (i = 0; i <
LENGTH; i++) {
77 shmaddr[
i] = (
char)(i);
78 if (!(i % (1024 * 1024)))
83 dprintf(
"Starting the Check...");
84 for (i = 0; i <
LENGTH; i++)
85 if (shmaddr[i] != (
char)i) {
86 printf(
"\nIndex %lu mismatched\n", i);
91 if (shmdt((
const void *)shmaddr) != 0) {
92 perror(
"Detach failure");