문제

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.

도움이 되었습니까?

해결책

timer_fds 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.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top