Mon compilo ne semble pas "lire" #include <sys/reg.h>
Bonjour à tous!
Je voudrais suivre pas à pas l'article de linux magazine n°114 sur PTRACE et j'ai donc recopié l'exemple suivant:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| #include <sys/ptrace.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/reg.h>
#include <sys/unistd.h>
#include <stdio.h>
int main()
{
pid_t child;
int status;
if((child=fork())==0)
{
ptrace(PTRACE_TRACEME,0,NULL,NULL);
execl("/bin/ls","/bin/ls","/",NULL);
}
for(;;)
{
wait(&status);
if(WIFEXITED(status))break;
long orig_eax=ptrace(PTRACE_PEEKUSER,child,4*ORIG_EAX,NULL);
printf("Appel systeme numero: %ld\n",orig_eax);
ptrace(PTRACE_CONT,child,NULL,NULL);
}
return 0;
} |
lorsqu'ensuite je tape:
Citation:
gcc -o strace strace.c
voici la réponse du compilateur:
Citation:
/media/VGData1/1/Developpement/projets/cpp/strace.c||In function ‘main’:|
/media/VGData1/1/Developpement/projets/cpp/strace.c|24|erreur: ‘ORIG_EAX’ undeclared (first use in this function)|
/media/VGData1/1/Developpement/projets/cpp/strace.c|24|erreur: (Each undeclared identifier is reported only once|
/media/VGData1/1/Developpement/projets/cpp/strace.c|24|erreur: for each function it appears in.)|
||=== Build finished: 3 errors, 0 warnings ===|
Le fichier reg.h est bien présent sur mes machines (un portable sous open suse 11.0 et une tour avec fedora 10)
Quelqu'un aurait une idée?