[LTP] [PATCH 2/3] syscalls/readahead01: Make use of tst_fd_iterate()
Jan Kara
jack@suse.cz
Wed Oct 4 16:52:29 CEST 2023
On Wed 04-10-23 16:24:30, Cyril Hrubis wrote:
> Hi!
> > > TODO: readahead() on /proc/self/maps seems to succeed is that to be
> > > expected?
> >
> > Not sure.
> > How does llseek() work on the same fd?
>
> Looks like we we can seek in that file as well, accordingly to man pages
> we cannot seek in pipe, socket, and fifo, which seems to match the
> reality. We can apparently seek in O_DIRECTORY fd as well, not sure if
> that is even useful.
Seeking on O_DIRECTORY fd is actually well defined by POSIX. You can store
current file position you've got back from lseek and you are guaranteed to
get back at the same position in the directory if you lseek to it (even if
there was a change to the directory, although effects on changed directory
entries is undefined). This is actually pretty tough to implement in
contemporary filesystems with non-trivial directory structure but that is
how POSIX defined it...
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
More information about the ltp
mailing list