interfereproc ============= This suite contains two components: * a set of helper functions for manipulating programs using ptrace et al. * example programs based on the helper functions. Example 1: redirectfd Redirect a file descriptor of a running process Example 2: retronohup Retrospectively apply "nohup" to a running process Example 3: pfiles ... Show information about a process's open files Example 4: retrotee Copy the output of a given file descriptor The helper functions are similar in form to the standard unix function calls, except that there is a process handle as the first argument to each function. The first helper function must be proc_new or proc_init depending on whether you want to allocate the storage for the handle or have the helper function allocate the storage. You can then create a function containing the system calls that you want to execute. This procedure MUST begin PROC_BEGIN and end PROG_END: int myroutine(struct process *proc) { PROC_BEGIN(proc); [system calls] PROC_END(proc); } The system calls are actually macros that cause myroutine to return while system calls are in progress. See interfere.h for details. The public members of struct process are: pid - the process id of the process being manipulated retval - the return value of the system call (or -1 on error) last_error - the errno value from this system call (or 0 on success) error - the last non-zero errno value exitsig - the signal to send to the process when detaching The simplest example program is redirectfd.c. For an example showing multiple programs being traced, see pfiles.c. For installation instructions, see INSTALL. For copying permission, see COPYING. Copyright (C) 2002 Peter Benie