info

intercept.c

A fun piece of code to compile into a shared library and then use with LD_PRELOAD. Last modified Mar 9, 2001.

#include <unistd.h> #include <syscall.h> ssize_t read(int fd, void* buf, size_t count) { printf("read from %d\n", fd); return syscall(__NR_read, fd, buf, count); } int brk(void* e) { printf("brk!\n"); return syscall(__NR_brk, e); }