MCPcopy Create free account
hub / github.com/Inori/GPCS4 / sceKernelFstat

Function sceKernelFstat

GPCS4/SceModules/SceLibkernel/sce_kernel_file.cpp:280–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278
279
280int PS4API sceKernelFstat(int fd, SceKernelStat *sb)
281{
282 LOG_SCE_TRACE("fd %d sb %p", fd, sb);
283
284#ifdef GPCS4_WINDOWS
285 int ret = -1;
286 FdItem& item = g_fdSlots[fd];
287 if (item.type == FD_TYPE_DIRECTORY)
288 {
289 char dir_path[SCE_MAX_PATH] = { 0 };
290 getDirName((DIR*)item.fd, dir_path, SCE_MAX_PATH);
291 struct _stat stat;
292 ret = _stat(dir_path, &stat);
293 sb->st_mode = getSceFileMode(stat.st_mode);
294
295 //sb->st_atim = stat.st_atime;
296 //sb->st_mtim = stat.st_mtime;
297 //sb->st_ctim = stat.st_ctime;
298 sb->st_size = stat.st_size;
299 //sb->st_birthtim = stat.st_ctime; //?
300 sb->st_blocks = plat::FileCountInDirectory(dir_path);
301 sb->st_blksize = sizeof(SceKernelDirent);
302 }
303 else
304 {
305 int pcFd = item.fd;
306 struct _stat stat;
307 ret = _fstat(pcFd, &stat);
308 sb->st_mode = getSceFileMode(stat.st_mode);
309
310 //sb->st_atim = stat.st_atime;
311 //sb->st_mtim = stat.st_mtime;
312 //sb->st_ctim = stat.st_ctime;
313 sb->st_size = stat.st_size;
314 //sb->st_birthtim = stat.st_ctime; //?
315 sb->st_blocks = stat.st_size / SSD_BLOCK_SIZE + (stat.st_size % SSD_BLOCK_SIZE) ? 1 : 0;
316 sb->st_blksize = SSD_BLOCK_SIZE;
317 }
318
319 return ret;
320#endif //GPCS4_WINDOWS
321}
322
323
324int PS4API sceKernelFsync(void)

Callers

nothing calls this directly

Calls 4

getDirNameFunction · 0.85
_statClass · 0.85
getSceFileModeFunction · 0.85
FileCountInDirectoryFunction · 0.85

Tested by

no test coverage detected