static TACommandVerdict __xstat_cmd(TAThread thread,TAInputStream stream) { struct stat buffer; int res; char* path; // Prepare path = readString(&stream); START_TARGET_OPERATION(thread); errno=0; #if ( __i386__ || __powerpc__ || (__s390__ && !__s390x__)) res = __xstat(3, path, &buffer); #else res = __xstat(0, path, &buffer); #endif VERBOSE("after stat atime==%d\n", buffer.st_atime); END_TARGET_OPERATION(thread); // Response writeInt(thread, res); writeInt(thread, errno); writeFileStatus(thread, &buffer); sendResponse(thread); return taDefaultVerdict; }
// Address range: 0x804835c - 0x8048393 int main(int argc, char ** argv) { int32_t v1; int32_t result = __xstat(3, "test/source/stattest.c", (struct stat *)&v1); // 0x8048372 int32_t v2; printf("Stat returns %d; size of file is %d\n", result, v2); return result; }
int stat(char *name, void *st) { #if HAVE___XSTAT return __xstat(0, name, st); #else if (smbw_path(name)) { return smbw_stat(name, st); } return real_stat(name, st); #endif }
static int _xstat(const char *szPath, struct xstat *st, unsigned long dwType, BOOL bCache, BOOL bFollowSymlink) { PVOID pOldState; int iResult; pOldState = _push_64bitfs(); iResult = __xstat(szPath, st, dwType, bCache, bFollowSymlink); _pop_64bitfs(pOldState); return iResult; }
/* the glibc folks use wrappers, but forgot to put a compatibility function for non GCC compilers ! */ int stat (__const char *__path, struct stat *__statbuf) { return __xstat (_STAT_VER, __path, __statbuf); }
int attribute_hidden __stat (const char *file, struct stat *buf) { return __xstat (_STAT_VER, file, buf); }
int stat(const char *file_name, struct stat *buf) { return __xstat( 3, file_name, buf ); }
int __lxstat (int version, const char *file, struct stat *buf) { return __xstat (version, file, buf); }
// address: 0x100006dc __size32 stat() { __size32 g3; // r3 g3 = __xstat(); return g3; }
int __lxstat (int vers, const char *name, struct stat *buf) { return __xstat (vers, name, buf); }
__attribute__((weak)) int stat(const char *path, struct stat *buf) { return __xstat(1, path, buf); }