Back to index

php5  5.3.10
Functions | Variables
fpm_trace_ptrace.c File Reference
#include "fpm_config.h"
#include <sys/wait.h>
#include <sys/ptrace.h>
#include <unistd.h>
#include <errno.h>
#include "fpm_trace.h"
#include "zlog.h"

Go to the source code of this file.

Functions

int fpm_trace_signal (pid_t pid)
int fpm_trace_ready (pid_t pid)
int fpm_trace_close (pid_t pid)
int fpm_trace_get_long (long addr, long *data)

Variables

static pid_t traced_pid

Function Documentation

Definition at line 46 of file fpm_trace_ptrace.c.

{
       if (0 > ptrace(PTRACE_DETACH, pid, (void *) 1, 0)) {
              zlog(ZLOG_SYSERROR, "failed to ptrace(DETACH) child %d", pid);
              return -1;
       }
       traced_pid = 0;
       return 0;
}
int fpm_trace_get_long ( long  addr,
long *  data 
)

Definition at line 57 of file fpm_trace_ptrace.c.

{
#ifdef PT_IO
       struct ptrace_io_desc ptio = {
              .piod_op = PIOD_READ_D,
              .piod_offs = (void *) addr,
              .piod_addr = (void *) data,
              .piod_len = sizeof(long)
       };

       if (0 > ptrace(PT_IO, traced_pid, (void *) &ptio, 0)) {
              zlog(ZLOG_SYSERROR, "failed to ptrace(PT_IO) pid %d", traced_pid);
              return -1;
       }
#else
       errno = 0;
       *data = ptrace(PTRACE_PEEKDATA, traced_pid, (void *) addr, 0);
       if (errno) {
              zlog(ZLOG_SYSERROR, "failed to ptrace(PEEKDATA) pid %d", traced_pid);
              return -1;
       }
#endif
       return 0;
}

Here is the caller graph for this function:

Definition at line 39 of file fpm_trace_ptrace.c.

{
       traced_pid = pid;
       return 0;
}

Definition at line 29 of file fpm_trace_ptrace.c.

{
       if (0 > ptrace(PTRACE_ATTACH, pid, 0, 0)) {
              zlog(ZLOG_SYSERROR, "failed to ptrace(ATTACH) child %d", pid);
              return -1;
       }
       return 0;
}

Here is the caller graph for this function:


Variable Documentation

pid_t traced_pid [static]

Definition at line 27 of file fpm_trace_ptrace.c.