Re: Use pread and pwrite instead of lseek + write and read

Поиск
Список
Период
Сортировка
От ilmari@ilmari.org (Dagfinn Ilmari Mannsåker)
Тема Re: Use pread and pwrite instead of lseek + write and read
Дата
Msg-id d8jwpjf4qzf.fsf@dalvik.ping.uio.no
обсуждение исходный текст
Ответ на Re: Use pread and pwrite instead of lseek + write and read  (Magnus Hagander <magnus@hagander.net>)
Ответы Re: Use pread and pwrite instead of lseek + write and read  (Magnus Hagander <magnus@hagander.net>)
Список pgsql-hackers
Magnus Hagander <magnus@hagander.net> writes:

[pread/pwrite]

> Yeah, Windows does not have those API calls, but it shouldn't be rocket
> science to write a wrapper for it. The standard windows APIs can do the
> same thing -- but they'll need access to the HANDLE for the file and not
> the posix file descriptor.
>
> It also has things like ReadFileScatter() (
> https://msdn.microsoft.com/en-us/library/windows/desktop/aa365469(v=vs.85).aspx)
> which is not the same, but might also be interesting as a future
> improvement.

That looks a lot like POSIX readv()
(http://pubs.opengroup.org/onlinepubs/9699919799/functions/readv.html),
and as far as I can tell it has the same issue as it in that it doesn't
take an offset argument, but requires you to seek first.

Linux and modern BSDs however have preadv()
(http://manpages.ubuntu.com/manpages/xenial/en/man2/preadv.2.html),
which takes an offset and an iovec array.  I don't know if Windows and
other platforms have anything similar.

-- 
- Twitter seems more influential [than blogs] in the 'gets reported in the mainstream press' sense at least.
  - Matt McLeod
 
- That'd be because the content of a tweet is easier to condense down to a mainstream media article.
 - Calle Dybedahl
 



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: Use pread and pwrite instead of lseek + write and read
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: Use pread and pwrite instead of lseek + write and read