Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support syscall utimes #57

Closed
rick-masters opened this issue Dec 26, 2023 · 1 comment · Fixed by #58
Closed

Support syscall utimes #57

rick-masters opened this issue Dec 26, 2023 · 1 comment · Fixed by #58
Labels
enhancement New feature or request

Comments

@rick-masters
Copy link
Contributor

The utimes syscall is needed for musl support because musl defaults to using the utimes system call rather than utime.
The musl library maps utime library call to the utimes system call.

The utimes syscall uses a timeval structures which support microseconds, which is different from utime which only supports seconds.

The forthcoming PR is mostly a copy of utime with small modifications.
Since the current Fiwix file systems do not support microseconds that field is currently ignored.

A test program is attached. The following output shows the file time being updated with the test program.

[(root) ~]# cc -m32 testutimes.c -o testutimes
[(root) ~]# rm testfile
rm: remove regular empty file 'testfile'? y
[(root) ~]# touch testfile;date
Tue Dec 26 19:25:43 GMT 2023
[(root) ~]# sleep 5   
[(root) ~]# date;./testutimes;stat testfile
Tue Dec 26 19:26:27 GMT 2023
  File: testfile
  Size: 0               Blocks: 1          IO Block: 1024   regular empty file
Device: 302h/770d       Inode: 17978       Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-12-26 19:26:27.000000000 +0000
Modify: 2023-12-26 19:26:27.000000000 +0000
Change: 2023-12-26 19:26:27.000000000 +0000
 Birth: -
[(root) ~]# 

testutimes.c.gz

@mikaku
Copy link
Owner

mikaku commented Dec 27, 2023

Thank you very much.

@mikaku mikaku added the enhancement New feature or request label Dec 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants