Skip to content

Enable support for utimes and futimesat. #242

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

Merged
merged 1 commit into from
Mar 10, 2022
Merged

Conversation

sunfishcode
Copy link
Member

These can both be implemented in terms of utimensat.

These can both be implemented in terms of `utimensat`.
@sunfishcode
Copy link
Member Author

This is ready to go, and just needs a review.

@@ -11,7 +13,12 @@ int __futimesat(int dirfd, const char *pathname, const struct timeval times[2])
int i;
for (i=0; i<2; i++) {
if (times[i].tv_usec >= 1000000ULL)
#ifdef __wasilibc_unmodified_upstream // WASI has no syscall
return __syscall_ret(-EINVAL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this a common pattern if it would be worth at least defining __syscall_ret macro?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not necessarily opposed to it, but it feels a little awkward, because either:

  • It introduces the Linux-specific convention of using negative values in [-4095,0) to represent errors, or
  • It doesn't use this, which risks having it behave differently than the code calling it expects.

@sunfishcode sunfishcode merged commit 079adff into main Mar 10, 2022
@sunfishcode sunfishcode deleted the sunfishcode/utimes branch March 10, 2022 22:14
sunfishcode added a commit that referenced this pull request Mar 28, 2022
Fix a bug introduced in #242 noticed [here]: if `tv_usec` is out of
range, then properly return an error code.

[here]: 079adff#r69631767
sunfishcode added a commit that referenced this pull request Mar 28, 2022
Fix a bug introduced in #242 noticed [here]: if `tv_usec` is out of
range, then properly return an error code.

[here]: 079adff#r69631767
sunfishcode added a commit that referenced this pull request Mar 28, 2022
Fix a bug introduced in #242 noticed [here]: if `tv_usec` is out of
range, then properly return an error code.

[here]: 079adff#r69631767
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants