#include "daprobe.h"
#include "probeinfo.h"
#include "dautil.h"
+#include "dahelper.h"
#include "da_io.h"
#include <fcntl.h>
static int (*openp)(const char* path, int oflag, ...);
int mode = 0;
- BEFORE_ORIGINAL_FILE_NOFILTER(open, libc.so.6);
+ BEFORE_ORIGINAL_FILE_NOFILTER(open, LIBC);
_filepath = (char*)path;
if(oflag & O_CREAT)
static int (*openatp)(int fd, const char* path, int oflag, ...);
int mode = 0;
- BEFORE_ORIGINAL_FILE_NOFILTER(openat, libc.so.6);
+ BEFORE_ORIGINAL_FILE_NOFILTER(openat, LIBC);
_filepath = (char*)path;
if(oflag & O_CREAT)
{
static int (*creatp)(const char* path, mode_t mode);
- BEFORE_ORIGINAL_FILE_NOFILTER(creat, libc.so.6);
+ BEFORE_ORIGINAL_FILE_NOFILTER(creat, LIBC);
_filepath = (char*)path;
ret = creatp(path, mode);
static int (*closep)(int fd);
DECLARE_VARIABLE_FD;
- GET_REAL_FUNC(close, libc.so.6);
+ GET_REAL_FUNC(close, LIBC);
bfiltering = false;
PRE_PROBEBLOCK_BEGIN();
{
static int (*accessp)(const char *path, int amode);
- BEFORE_ORIGINAL_FILE(access, libc.so.6);
+ BEFORE_ORIGINAL_FILE(access, LIBC);
_filepath = (char*)path;
ret = accessp(path, amode);
{
static int (*faccessatp)(int fd, const char *path, int amode, int flag);
- BEFORE_ORIGINAL_FILE(faccessat, libc.so.6);
+ BEFORE_ORIGINAL_FILE(faccessat, LIBC);
_filepath = (char*)path;
ret = faccessatp(fd, path, amode, flag);
static int (*lseekp)(int fd, off_t offset, int whence);
off_t offret;
- BEFORE_ORIGINAL_FILE(lseek, libc.so.6);
+ BEFORE_ORIGINAL_FILE(lseek, LIBC);
offret = lseekp(fd, offset, whence);
{
static int (*fsyncp)(int fd);
- BEFORE_ORIGINAL_FILE(fsync, libc.so.6);
+ BEFORE_ORIGINAL_FILE(fsync, LIBC);
ret = fsyncp(fd);
{
static int (*fdatasyncp)(int fd);
- BEFORE_ORIGINAL_FILE(fdatasync, libc.so.6);
+ BEFORE_ORIGINAL_FILE(fdatasync, LIBC);
ret = fdatasyncp(fd);
{
static int (*truncatep)(const char *path, off_t length);
- BEFORE_ORIGINAL_FILE(truncate, libc.so.6);
+ BEFORE_ORIGINAL_FILE(truncate, LIBC);
_filepath = (char*)path;
ret = truncatep(path, length);
{
static int (*ftruncatep)(int fd, off_t length);
- BEFORE_ORIGINAL_FILE(ftruncate, libc.so.6);
+ BEFORE_ORIGINAL_FILE(ftruncate, LIBC);
ret = ftruncatep(fd, length);
{
static int (*mkfifop)(const char *path, mode_t mode);
- BEFORE_ORIGINAL_FILE(mkfifo, libc.so.6);
+ BEFORE_ORIGINAL_FILE(mkfifo, LIBC);
_filepath = (char*)path;
ret = mkfifop(path, mode);
{
static int (*mkfifoatp)(int fd, const char *path, mode_t mode);
- BEFORE_ORIGINAL_FILE(mkfifoat, libc.so.6);
+ BEFORE_ORIGINAL_FILE(mkfifoat, LIBC);
_filepath = (char*)path;
ret = mkfifoatp(fd, path, mode);
{
static int (*mknodp)(const char *path, mode_t mode, dev_t dev);
- BEFORE_ORIGINAL_FILE(mknod, libc.so.6);
+ BEFORE_ORIGINAL_FILE(mknod, LIBC);
_filepath = (char*)path;
ret = mknodp(path, mode, dev);
{
static int (*mknodatp)(int fd, const char *path, mode_t mode, dev_t dev);
- BEFORE_ORIGINAL_FILE(mknodat, libc.so.6);
+ BEFORE_ORIGINAL_FILE(mknodat, LIBC);
_filepath = (char*)path;
ret = mknodatp(fd,path, mode,dev);
{
static int (*chownp)(const char *path, uid_t owner, gid_t group);
- BEFORE_ORIGINAL_FILE(chown, libc.so.6);
+ BEFORE_ORIGINAL_FILE(chown, LIBC);
_filepath = (char*)path;
ret = chownp(path, owner, group);
AFTER_ORIGINAL_NOFD(0, FD_API_PERMISSION, "%s, %u, %u", path, owner, group);
{
static int (*fchownatp)(int fd, const char *path, uid_t owner, gid_t group, int flag);
- BEFORE_ORIGINAL_FILE(fchownat, libc.so.6);
+ BEFORE_ORIGINAL_FILE(fchownat, LIBC);
_filepath = (char*)path;
ret = fchownatp(fd, path, owner, group, flag);
AFTER_ORIGINAL_FD(0, fd, FD_API_PERMISSION,
{
static int (*fchownp)(int fd, uid_t owner, gid_t group);
- BEFORE_ORIGINAL_FILE(fchown, libc.so.6);
+ BEFORE_ORIGINAL_FILE(fchown, LIBC);
ret = fchownp(fd, owner, group);
AFTER_ORIGINAL_FD(0, fd, FD_API_PERMISSION, "%d, %u, %u", fd, owner, group);
return ret;
{
static int (*lchownp)(const char *path, uid_t owner, gid_t group);
- BEFORE_ORIGINAL_FILE(lchown, libc.so.6);
+ BEFORE_ORIGINAL_FILE(lchown, LIBC);
_filepath = (char*)path;
ret = lchownp(path, owner, group);
AFTER_ORIGINAL_NOFD(0, FD_API_PERMISSION, "%s, %u, %u", path, owner, group);
{
static int (*lockfp)(int fd, int function, off_t size);
- BEFORE_ORIGINAL_FILE(lockf, libc.so.6);
+ BEFORE_ORIGINAL_FILE(lockf, LIBC);
ret = lockfp(fd, function, size);
AFTER_ORIGINAL_FD((unsigned int)size, fd, FD_API_PERMISSION,
"%d, %d, %ld", fd, function, size);
{
static int (*chmodp)(const char *path, mode_t mode);
- BEFORE_ORIGINAL_FILE(chmod, libc.so.6);
+ BEFORE_ORIGINAL_FILE(chmod, LIBC);
_filepath = (char*)path;
ret = chmodp(path, mode);
AFTER_ORIGINAL_NOFD(0, FD_API_PERMISSION, "%s, %u", path, mode);
{
static int (*fchmodatp)(int fd, const char *path, mode_t mode, int flag);
- BEFORE_ORIGINAL_FILE(fchmodat, libc.so.6);
+ BEFORE_ORIGINAL_FILE(fchmodat, LIBC);
_filepath = (char*)path;
ret = fchmodatp(fd, path, mode, flag);
AFTER_ORIGINAL_FD(0, fd, FD_API_PERMISSION,
{
static int (*fchmodp)(int fd, mode_t mode);
- BEFORE_ORIGINAL_FILE(fchmod, libc.so.6);
+ BEFORE_ORIGINAL_FILE(fchmod, LIBC);
ret = fchmodp(fd, mode);
AFTER_ORIGINAL_FD(0, fd, FD_API_PERMISSION, "%d, %u", fd, mode);
return ret;
static ssize_t (*preadp)(int fd, void *buf, size_t nbyte, off_t offset);
ssize_t sret;
- BEFORE_ORIGINAL_FILE(pread, libc.so.6);
+ BEFORE_ORIGINAL_FILE(pread, LIBC);
sret = preadp(fd, buf, nbyte, offset);
static ssize_t (*readp)(int fildes, void *buf, size_t nbyte);
ssize_t sret;
- BEFORE_ORIGINAL_FILE(read, libc.so.6);
+ BEFORE_ORIGINAL_FILE(read, LIBC);
sret = readp(fd, buf, nbyte);
static ssize_t (*pwritep)(int fd, const void *buf, size_t nbyte, off_t offset);
ssize_t sret;
- BEFORE_ORIGINAL_FILE(pwrite, libc.so.6);
+ BEFORE_ORIGINAL_FILE(pwrite, LIBC);
sret = pwritep(fd, buf, nbyte, offset);
static ssize_t (*writep)(int fildes, const void *buf, size_t nbyte);
ssize_t sret;
- BEFORE_ORIGINAL_FILE(write, libc.so.6);
+ BEFORE_ORIGINAL_FILE(write, LIBC);
sret = writep(fd, buf, nbyte);
static ssize_t (*readvp)(int fd, const struct iovec *iov, int iovcnt);
ssize_t sret;
- BEFORE_ORIGINAL_FILE(readv, libc.so.6);
+ BEFORE_ORIGINAL_FILE(readv, LIBC);
sret = readvp(fd,iov,iovcnt);
AFTER_ORIGINAL_FD_RET(VT_SSIZE_T, sret, (unsigned int)sret, fd, FD_API_READ,
{
static ssize_t (*writevp)(int fd, const struct iovec *iov, int iovcnt);
- MAKE_RESOURCE_PREBLOCK(writev, libc.so.6,3,VT_INT,fd,VT_PTR,iov,VT_INT,iovcnt);
+ MAKE_RESOURCE_PREBLOCK(writev, LIBC,3,VT_INT,fd,VT_PTR,iov,VT_INT,iovcnt);
ssize_t ret;
ret = writevp(fd,iov,iovcnt);
MAKE_RESOURCE_POSTBLOCK(VT_SSIZE_T,ret,VT_SSIZE_T,ret,VT_INT,fd, FD_API_WRITE);
{
static int (*rmdirp)(const char *path);
- BEFORE_ORIGINAL_FILE(rmdir, libc.so.6);
+ BEFORE_ORIGINAL_FILE(rmdir, LIBC);
_filepath = (char*)path;
ret = rmdirp(path);
AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%s", path);
{
static int (*fchdirp)(int fd);
- BEFORE_ORIGINAL_FILE(fchdir, libc.so.6);
+ BEFORE_ORIGINAL_FILE(fchdir, LIBC);
ret = fchdirp(fd);
AFTER_ORIGINAL_FD(0, fd, FD_API_DIRECTORY, "%d", fd);
return ret;
{
static int (*chdirp)(const char *path);
- BEFORE_ORIGINAL_FILE(chdir, libc.so.6);
+ BEFORE_ORIGINAL_FILE(chdir, LIBC);
_filepath = (char*)path;
ret = chdirp(path);
AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%s", path);
{
static int (*linkp)(const char *path1, const char *path2);
- BEFORE_ORIGINAL_FILE(link, libc.so.6);
+ BEFORE_ORIGINAL_FILE(link, LIBC);
_filepath = (char*)path1;
ret = linkp(path1, path2);
AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%s, %s", path1, path2);
{
static int (*linkatp)(int fd1, const char *path1, int fd2, const char *path2, int flag);
- BEFORE_ORIGINAL_FILE(linkat, libc.so.6);
+ BEFORE_ORIGINAL_FILE(linkat, LIBC);
_filepath = (char*)path1;
ret = linkatp(fd1, path1, fd2, path2, flag);
AFTER_ORIGINAL_FD(0, fd2, FD_API_DIRECTORY,
{
static int (*unlinkp)(const char *path);
- BEFORE_ORIGINAL_FILE(unlink, libc.so.6);
+ BEFORE_ORIGINAL_FILE(unlink, LIBC);
_filepath = (char*)path;
ret = unlinkp(path);
AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%s", path);
{
static int (*unlinkatp)(int fd, const char *path, int flag);
- BEFORE_ORIGINAL_FILE(unlinkat, libc.so.6);
+ BEFORE_ORIGINAL_FILE(unlinkat, LIBC);
_filepath = (char*)path;
ret = unlinkatp(fd, path, flag);
AFTER_ORIGINAL_FD(0, fd, FD_API_DIRECTORY, "%d, %s, %d", fd, path, flag);
{
static int (*symlinkp)(const char *path1, const char *path2);
- BEFORE_ORIGINAL_FILE(symlink, libc.so.6);
+ BEFORE_ORIGINAL_FILE(symlink, LIBC);
_filepath = (char*)path1;
ret = symlinkp(path1, path2);
AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%s, %s", path1, path2);
{
static int (*symlinkatp)(const char *path1, int fd, const char *path2);
- BEFORE_ORIGINAL_FILE(symlinkat, libc.so.6);
+ BEFORE_ORIGINAL_FILE(symlinkat, LIBC);
_filepath = (char*)path1;
ret = symlinkatp(path1, fd, path2);
AFTER_ORIGINAL_FD(0, fd, FD_API_DIRECTORY, "%s, %d, %s", path1, fd, path2);
static int (*readlinkp)(const char* path, char* buf, size_t bufsize);
ssize_t sret;
- BEFORE_ORIGINAL_FILE(readlink, libc.so.6);
+ BEFORE_ORIGINAL_FILE(readlink, LIBC);
_filepath = (char*)path;
sret = readlinkp(path, buf, bufsize);
static int (*readlinkatp)(int fd, const char * path, char * buf, size_t bufsize);
ssize_t sret;
- BEFORE_ORIGINAL_FILE(readlinkat, libc.so.6);
+ BEFORE_ORIGINAL_FILE(readlinkat, LIBC);
_filepath = (char*)path;
sret = readlinkatp(fd, path, buf, bufsize);
{
static int (*mkdirp)(const char *path, mode_t mode);
- BEFORE_ORIGINAL_FILE(mkdir, libc.so.6);
+ BEFORE_ORIGINAL_FILE(mkdir, LIBC);
_filepath = (char*)path;
ret = mkdirp(path, mode);
AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%s, %u", path, mode);
{
static int (*mkdiratp)(int fd, const char *path, mode_t mode);
- BEFORE_ORIGINAL_FILE(mkdirat, libc.so.6);
+ BEFORE_ORIGINAL_FILE(mkdirat, LIBC);
_filepath = (char*)path;
ret = mkdiratp(fd, path, mode);
AFTER_ORIGINAL_FD(0, fd, FD_API_DIRECTORY, "%d, %s, %u", fd, path, mode);
{
static int (*closedirp)(DIR *dirp);
- BEFORE_ORIGINAL_FILE(closedir, libc.so.6);
+ BEFORE_ORIGINAL_FILE(closedir, LIBC);
ret = closedirp(dirp);
AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%p", dirp);
return ret;
static DIR* (*fdopendirp)(int fd);
DIR* dret;
- BEFORE_ORIGINAL_FILE(fdopendir, libc.so.6);
+ BEFORE_ORIGINAL_FILE(fdopendir, LIBC);
dret = fdopendirp(fd);
static DIR* (*opendirp)(const char *dirname);
DIR* dret;
- BEFORE_ORIGINAL_FILE(opendir, libc.so.6);
+ BEFORE_ORIGINAL_FILE(opendir, LIBC);
_filepath = (char*)dirname;
dret = opendirp(dirname);
static struct dirent* (*readdirp)(DIR *dirp);
struct dirent* dret;
- BEFORE_ORIGINAL_FILE(readdir, libc.so.6);
+ BEFORE_ORIGINAL_FILE(readdir, LIBC);
dret = readdirp(dirp);
{
static int (*readdir_rp)(DIR * dirp, struct dirent * entry, struct dirent ** result);
- BEFORE_ORIGINAL_FILE(readdir_r, libc.so.6);
+ BEFORE_ORIGINAL_FILE(readdir_r, LIBC);
ret = readdir_rp(dirp, entry, result);
AFTER_ORIGINAL_NOFD(0, FD_API_DIRECTORY, "%p, %p, %p", dirp, entry, result);
return ret;
{
static void (*rewinddirp)(DIR *dirp);
- BEFORE_ORIGINAL_FILE(rewinddir, libc.so.6);
+ BEFORE_ORIGINAL_FILE(rewinddir, LIBC);
rewinddirp(dirp);
{
static void (*seekdirp)(DIR *dirp, long loc);
- BEFORE_ORIGINAL_FILE(seekdir, libc.so.6);
+ BEFORE_ORIGINAL_FILE(seekdir, LIBC);
seekdirp(dirp, loc);
static int (*telldirp)(DIR *dirp);
long lret;
- BEFORE_ORIGINAL_FILE(telldir, libc.so.6);
+ BEFORE_ORIGINAL_FILE(telldir, LIBC);
lret = telldirp(dirp);
static int (*fcntlp)(int fd, int cmd, ...);
int arg = 0;
- BEFORE_ORIGINAL_FILE(fcntl, libc.so.6);
+ BEFORE_ORIGINAL_FILE(fcntl, LIBC);
va_list argl;
va_start(argl, cmd);
{
static int (*dupp)(int fd);
- BEFORE_ORIGINAL_FILE_NOFILTER(dup, libc.so.6);
+ BEFORE_ORIGINAL_FILE_NOFILTER(dup, LIBC);
ret = dupp(fd);
{
static int (*dup2p)(int fd, int fd2);
- BEFORE_ORIGINAL_FILE_NOFILTER(dup2, libc.so.6);
+ BEFORE_ORIGINAL_FILE_NOFILTER(dup2, LIBC);
ret = dup2p(fd, fd2);
}
//FIXME dlsym error
-// fstat is not in libc.so.6
+// fstat is not in LIBC
#if 0
int fstat(int fd, struct stat *buf)
{
static int (*fstatp)(int fd, struct stat *buf);
- BEFORE_ORIGINAL_FILE(fstat, libc.so.6);
+ BEFORE_ORIGINAL_FILE(fstat, LIBC);
ret = fstatp(fd, buf);
AFTER_ORIGINAL_FD(0, fd, FD_API_OTHER, "%d, %p", fd, buf);
return ret;
{
static int (*statp)(const char * path, struct stat * buf);
- BEFORE_ORIGINAL_FILE(stat, libc.so.6);
+ BEFORE_ORIGINAL_FILE(stat, LIBC);
_filepath = (char*)path;
ret = statp(path, buf);
AFTER_ORIGINAL_NOFD(0, FD_API_OTHER, "%s, %p", path, buf);
{
static int (*fstatatp)(int fd, const char * path, struct stat * buf, int flag);
- BEFORE_ORIGINAL_FILE(fstatat, libc.so.6);
+ BEFORE_ORIGINAL_FILE(fstatat, LIBC);
_filepath = (char*)path;
ret = fstatatp(fd, path, buf, flag);
AFTER_ORIGINAL_FD(0, fd, FD_API_OTHER, "%d, %s, %p, %d", fd, path, buf, flag);
{
static int (*lstatp)(const char * path, struct stat * buf);
- BEFORE_ORIGINAL_FILE(lstat, libc.so.6);
+ BEFORE_ORIGINAL_FILE(lstat, LIBC);
_filepath = (char*)path;
ret = lstatp(path, buf);
AFTER_ORIGINAL_NOFD(0, FD_API_OTHER, "%s, %p", path, buf);
{
static int (*futimensp)(int fd, const struct timespec times[2]);
- BEFORE_ORIGINAL_FILE(futimens, libc.so.6);
+ BEFORE_ORIGINAL_FILE(futimens, LIBC);
ret = futimensp(fd, times);
AFTER_ORIGINAL_FD(0, fd, FD_API_OTHER, "%d, %p", fd, times);
return ret;
{
static int (*utimensatp)(int fd, const char *path, const struct timespec times[2], int flag);
- BEFORE_ORIGINAL_FILE(utimensat, libc.so.6);
+ BEFORE_ORIGINAL_FILE(utimensat, LIBC);
_filepath = (char*)path;
ret = utimensatp(fd, path, times, flag);
AFTER_ORIGINAL_FD(0, fd, FD_API_OTHER,
{
static int (*utimesp)(const char *path, const struct timeval times[2]);
- BEFORE_ORIGINAL_FILE(utimes, libc.so.6);
+ BEFORE_ORIGINAL_FILE(utimes, LIBC);
_filepath = (char*)path;
ret = utimesp(path, times);
AFTER_ORIGINAL_NOFD(0, FD_API_OTHER, "%s, %p", path, times);
{
static int (*utimep)(const char *path, const struct utimbuf *times);
- BEFORE_ORIGINAL_FILE(utime, libc.so.6);
+ BEFORE_ORIGINAL_FILE(utime, LIBC);
_filepath = (char*)path;
ret = utimep(path, times);
AFTER_ORIGINAL_NOFD(0, FD_API_OTHER, "%s, %p", path, times);