|
From: Paul M. <pa...@sa...> - 2008-06-03 12:46:30
|
Julian Seward writes: > Anybody know anything about utimensat and timerfd_* ? utimensat is a fancy version of utime() or utimes() that takes timespecs for the times (i.e. seconds and nanoseconds) and also lets you specify a file descriptor that the kernel will use as the "current" directory if the filename you give is a relative path. The prototype is long utimensat(int dir_fd, char *filename, struct timespec *times, int flags) If dir_fd == AT_FDCWD (-100) then the process current directory is used. The only flag that is valid is AT_SYMLINK_NOFOLLOW (0x100). I don't see how it could block except possibly for disk I/O. The timerfd stuff lets you get a file descriptor that you can do poll or select on, which is associated with a timer and will become ready when the timer expires, as I understand it. timerfd_create creates one of these things, timerfd_settime sets how long before it expires, and timerfd_gettime tells you how much time is left. The prototypes are: long timerfd_create(int clockid, int flags); where clockid is CLOCK_MONOTONIC or CLOCK_REALTIME and flags currently has to be 0; long timerfd_settime(int fd, int flags, const struct itimerspec *itimer, struct itimerspec *otimer); long timerfd_gettime(int fd, struct itimerspec *otimer); and a struct itimerspec has an it_interval and it_value like a struct itimerval but with seconds and nanoseconds. Once again I don't see any way for these calls to block (though select, poll and read on the fd can, of course). Hope that helps, Paul. |