From 27d4ad91c8cd8c6c20ba7c3ac0db555e1c4df96b Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Tue, 7 Aug 2012 11:08:30 -0700 Subject: [PATCH] support for debug prints --- src/preload.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/preload.c b/src/preload.c index 33eb9a32..d1b6cffc 100644 --- a/src/preload.c +++ b/src/preload.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -98,6 +99,8 @@ static int rq_size; static int sq_inline; static int fork_support; +static FILE *fout; + enum fd_type { fd_normal, fd_rsocket, @@ -286,6 +289,7 @@ static void init_preload(void) rs.getsockopt = dlsym(RTLD_DEFAULT, "rgetsockopt"); rs.fcntl = dlsym(RTLD_DEFAULT, "rfcntl"); + fout = fopen("rs-out.txt", "w+"); getenv_options(); init = 1; out: @@ -964,16 +968,21 @@ int dup2(int oldfd, int newfd) return newfd; } -int fstat(int socket, struct stat *buf) +int __fxstat64(int ver, int socket, struct stat *buf) { int fd, ret; + init_preload(); + fprintf(fout, "fstat socket %d\n", socket); if (fd_get(socket, &fd) == fd_rsocket) { ret = real.fstat(socket, buf); + fprintf(fout, "fstat - rsocket %d\n", ret); if (!ret) buf->st_mode = (buf->st_mode & ~S_IFMT) | __S_IFSOCK; } else { ret = real.fstat(fd, buf); + fprintf(fout, "fstat - normal %d\n", ret); } + fflush(fout); return ret; } -- 2.45.2