MCPcopy Create free account
hub / github.com/SmingHub/Sming / fileStat

Function fileStat

samples/LiveDebug/app/application.cpp:237–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235}
236
237void fileStat(const char* filename)
238{
239 gdb_stat_t stat;
240 int res = gdb_syscall_stat(filename, &stat);
241 Serial << _F("gdb_syscall_stat(\"") << filename << _F("\") returned ") << res << endl;
242 if(res != 0) {
243 return;
244 }
245
246#define PRT(x) Serial << _F(" " #x " = ") << stat.x << endl
247#define PRT_HEX(x) Serial << _F(" " #x " = 0x") << String(stat.x, HEX) << endl
248#define PRT_TIME(x) Serial << _F(" " #x " = ") << DateTime(stat.x).toFullDateTimeString() << endl
249
250 PRT(st_dev);
251 PRT(st_ino);
252 PRT_HEX(st_mode);
253 PRT(st_nlink);
254 PRT_HEX(st_uid);
255 PRT_HEX(st_gid);
256 PRT(st_rdev);
257 PRT(st_size);
258 PRT(st_blksize);
259 PRT(st_blocks);
260 PRT_TIME(st_atime);
261 PRT_TIME(st_mtime);
262 PRT_TIME(st_ctime);
263#undef PRT
264#undef PRT_HEX
265#undef PRT_TIME
266}
267
268/*
269 * Keep commands and their description together to ensure 'help' is consistent.

Callers 1

COMMAND_HANDLERFunction · 0.85

Calls 1

gdb_syscall_statFunction · 0.85

Tested by

no test coverage detected