Example #1
0
int __lxstat(int ver, const char *path, struct stat *sb)
{
    int ret;

    init_syms();

    if (STRPREFIX(path, SYSFS_CGROUP_PREFIX)) {
        init_sysfs();
        char *newpath;
        if (asprintf(&newpath, "%s/%s",
                     fakesysfscgroupdir,
                     path + strlen(SYSFS_CGROUP_PREFIX)) < 0) {
            errno = ENOMEM;
            return -1;
        }
        ret = real___lxstat(ver, newpath, sb);
        free(newpath);
    } else if (STRPREFIX(path, fakedevicedir0)) {
        sb->st_mode = S_IFBLK;
        sb->st_rdev = makedev(8, 0);
        return 0;
    } else if (STRPREFIX(path, fakedevicedir1)) {
        sb->st_mode = S_IFBLK;
        sb->st_rdev = makedev(9, 0);
        return 0;
    } else {
        ret = real___lxstat(ver, path, sb);
    }
    return ret;
}
Example #2
0
int __lxstat(int ver, const char *pathname, struct stat *buf) {
    static int (*real___lxstat)(int ver, const char *pathname, struct stat *buf) = NULL;
    const char *p;
    int ret;

    GET_PATH(__lxstat);
    if (p) {
	ret = real___lxstat(ver, p, buf);
	PUT_PATH(-1);
    }
    return real___lxstat(ver, pathname, buf);
}
Example #3
0
int __lxstat(int __ver, const char *__filename, struct stat *__stat_buf)
{
	int ret;

	DBG("enter: filename=%s\n", __filename);
	ret = real___lxstat(__ver, __filename, __stat_buf);
	if (unlikely(-1 == ret)) {
		if (-1 == install_package_for(__filename))
			return -1;
		else
			return real___lxstat(__ver, __filename, __stat_buf);
	}

	return ret;
}
Example #4
0
int __lxstat(int ver, const char *path, struct stat *buf) {
	stat_init();
	return real___lxstat(ver, path, buf);
}