Reputation: 14603
This post:
Empty or "flush" a file descriptor without read()?
, says that it is possible to do a lseek()
on a fd you don't want to read from, thereby avoiding unnecessary copying, but this does not apply to fds I create with timerfd_create()
. Why is this so and does there exist a workaround (except to use read()
, which works).
I try to do lseek()
like this:
lseek(fd, 0, SEEK_END);
And strerror()
returned Illegal seek
. Again, read(fd, buffer, 8)
works.
Upvotes: 1
Views: 130
Reputation: 25129
timer_fd
s are not seekable. Not every fd
is. Use read
to read the relevant bytes.
Note that contrary to the POSIX
tag, these calls are Linux specific. From the man page:
CONFORMING TO
These system calls are Linux-specific.
Upvotes: 1