Without difficultly I was able to create real C vs. stubber FFI versions of set-errno and %utimensat, the C interface of Chibi Scheme is very clean.
That brings up some extra options
. I'm going to add something named like timespec/now
, a magic UTIME_NOW define in the system call, to specify the current time, allowing you to set both atime and mtime to the same time without requiring a round trip etc. first calling (posix-time).
And something like timespec/omit
, which allows you to not change that particular time field.
A potential option is to add a port/fd argument, which uses that location instead of the current working directory if the system call is handed a relative path, that's were the "at" suffix must come from. There's also a fuimens system call which takes a file descriptor instead of a path. I don't immediately see use cases for the former, but the latter sounds useful, and is trivial to implement once you have the currently defined set-file-timespecs done.
While I'm at it, I'd like to bring up again the topic of timespec arithmetic; I'll add a comparator as John suggested, but to make that easier to use, and to help the user as well, as previously described I'd like to add addition, subtraction, multiplication, and division, and constants for the number of seconds in a hour, day and week, and I might as well be complete and include in a minute. And the number of nanoseconds in a millisecond, but I don't think microseconds are worth including.