If you want to set the mtime/atime
fields, you can use the utime()
function. Use it after creating the file/directory.
The mode
field is set with chmod()
The uid/gid
, if you are root, are set with chown()
.
The fields size
and nlinks
will have the correct value if you set the information they refer to (the data of the file and the directory structure that contains the file).
But the ino
, dev
and ctime
fields are set internally by the system and cannot be changed. No reason you would like to set them, anyway.