//https://gist.github.com/2930467
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
int main (int argc, char *argv[])
{
/*
int res;
int *ptr[10] ;
int iflag[10] ;
int idx ;
for(idx=0;idx<10;idx++)
{
res = posix_memalign((void **)&(ptr[idx]) , 64, 64);
if (NULL != ptr[idx]){
iflag[idx]=idx ;
*ptr[idx] = (int)(iflag[idx]) ;
printf("idx%d=(%d)\n",idx,(int)*(ptr[idx])) ;
}
} //for
*/
int res;
int *ptr ;
int iflag[10] ;
res = posix_memalign((void **)&(ptr) , 64, 10*64);
if (NULL != ptr){
int idx ;
for(idx=0;idx<10;idx++)
{
iflag[idx]=idx ;
*(ptr+idx) = (int)(iflag[idx]) ;
printf("idx%d=(%d)\n",idx,(int)*(ptr+idx)) ;
} //for
}
}
留言列表