ptrace(Operation not permitted)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi 
following is my ptrace program which is tracing
process
which is creating a file and opening it and then
writing some data to it
but constantly i am getting error that
ptrace:operation not permitted
sorry very less knowledge abt ptrace,
what's the problem
yes my filesystem which is AFS ,and this process is 
attached with client  side of AFS.
demo5 is just binary which is creating opening and
writing to file.
 
int main(void)
{  
long long counter = 0;  /*  machine instruction
counter */
        int wait_val;           /*  child's return
value        */
        int pid,pid1;                /*  child's
process id          */
	int status;
	int status1;
	char *a="/home/demo5";
        puts("Please wait");

                 if((pid = fork()==0)) {
                 
                        if (ptrace(PTRACE_TRACEME,
pid1, 0, 0) != 0)
                /*   
                 *   parent waits for child to stop at
next 
                 *   instruction (execve) 
                 */
		
			if((pid1=fork()==0)) {
                        if (ptrace(PTRACE_SINGLESTEP,
pid1, 0, 0) != 0)
                                perror("ptrace");

				execvp(a,NULL);/*this is execvp in child under
child*/
		
		
			exit(0);
                        /* 
                         *   switch to singlestep
tracing and 
                         *   release child
                         *   if unable call error.
                         */
				}
                   }
			wait(&status1);
			exit(0);
              }
		wait(&status);
}
thanks
Prasanna


		
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux