最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

c - How do I modify every timestamp of file on unix EXT4? - Stack Overflow

matteradmin3PV0评论

I am writing a C program that requires me to change every timestamp of a file (aTime, mTime, cTime, and bTime/crTime) to nanosecond precision.

If I were to do this in terminal, I would run

debugfs -w -R "set_inode_field <[file_inode]> crtime @[time]" [dev_path]
debugfs -w -R "set_inode_field <[file_inode]> crtime_extra [extra]" [dev_path]

But I cannot find a good way to run debugfs in a C program.

I am aware of using utimensat to modify aTime and mTime in code, but do not know of anything for aTime or bTime/crTime.

Post a comment

comment list (0)

  1. No comments so far