jeudi 13 août 2015

Understand VSYSCALL_ADDR and function pointer

I came across the following code. I have two questions here. 1. where to find this __NR_vgetcpu? What other values could I get by callign VSYSCALL_ADDR? 2. What does this line "my_getpuc =( int(*)) .....)" do?

int (*my_getcpu)(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache);
char *addr3 = (char *)VSYSCALL_ADDR(__NR_vgetcpu);
printf("vgetcpu addr is %p \n", addr3);
my_getcpu = (int (*)(unsigned *, unsigned *, struct getcpu_cache *))addr3;
my_getcpu(&cpu, &node, &cache);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire