// Copyright (C) 2014-2017 eWheeler, Inc. // // This file is part of Unbox. // // Unbox is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Unbox is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Unbox. If not, see . // gcc -shared -fPIC unbox.c -o unbox.so -ldl // LD_PRELOAD=`pwd`/unbox.so df -T # wow, its all ext4. #define _GNU_SOURCE #include #include #include #include typedef struct mntent*(*orig_getmntent_f_type)(FILE *fp); typedef const char*(*orig_gnu_get_libc_version_f_type)(void); typedef int (*orig_fstatfs_f_type)(int fd, struct statfs *buf); typedef int (*orig_fstatfs64_f_type)(int fd, struct statfs64 *buf); typedef int (*orig_statfs_f_type)(const char *path, struct statfs *buf); typedef int (*orig_statfs64_f_type)(const char *path, struct statfs64 *buf); const char* gnu_get_libc_version(void) { return "2.19"; } struct mntent* getmntent(FILE *fp) { struct mntent*ret; orig_getmntent_f_type orig_getmntent; orig_getmntent = (orig_getmntent_f_type)dlsym(RTLD_NEXT,"getmntent"); ret = orig_getmntent(fp); if (ret) ret->mnt_type = "ext4"; return ret; } int fstatfs64(int fd, struct statfs64 *buf) { int ret; orig_fstatfs64_f_type orig_fstatfs64; orig_fstatfs64 = (orig_fstatfs64_f_type)dlsym(RTLD_NEXT,"fstatfs64"); ret = orig_fstatfs64(fd, buf); buf->f_type=0xEF53; return ret; } int fstatfs(int fd, struct statfs *buf) { int ret; orig_fstatfs_f_type orig_fstatfs; orig_fstatfs = (orig_fstatfs_f_type)dlsym(RTLD_NEXT,"fstatfs"); ret = orig_fstatfs(fd, buf); buf->f_type=0xEF53; return ret; } int statfs(const char *path, struct statfs *buf) { int ret; orig_statfs_f_type orig_statfs; orig_statfs = (orig_statfs_f_type)dlsym(RTLD_NEXT,"statfs"); ret = orig_statfs(path, buf); buf->f_type=0xEF53; return ret; } int statfs64(const char *path, struct statfs64 *buf) { int ret; orig_statfs64_f_type orig_statfs64; orig_statfs64 = (orig_statfs64_f_type)dlsym(RTLD_NEXT,"statfs64"); ret = orig_statfs64(path, buf); buf->f_type=0xEF53; return ret; }