LWN.net Logo

System calls and 64-bit architectures

System calls and 64-bit architectures

Posted Dec 18, 2008 9:51 UTC (Thu) by meuh (subscriber, #22042)
Parent article: System calls and 64-bit architectures

Why not extend struct iovec with an offset field:

struct iovecs
{
  void  *iovs_base;
  size_t iovs_len;
  off_t  iovs_off;
};
ssize_t preadv(int d, const struct iovecs *iovs, int iovcnt);
ssize_t pwritev(int d, const struct iovecs *iovs, int iovcnt);
Bad things could happen if offsets are going backward:performance penality or data overlapping. And this kind of interface are not the best regarding to error report. So the kernel would have to enforce (iovs[n].iovs_off + iovs[n].iovs_len) < iovs[n+1].iovs_off


(Log in to post comments)

System calls and 64-bit architectures

Posted Dec 18, 2008 13:40 UTC (Thu) by abatters (✭ supporter ✭, #6932) [Link]

While you are at it, put a direction flag in each vector so that you can submit reads and writes at the same time. And put the file descriptor in each vector too so that you can submit I/O to different files with one syscall. Then make it asynchronous and add in an optional signal upon completion. Oh wait, io_submit() already does all that.

System calls and 64-bit architectures

Posted Dec 21, 2008 22:51 UTC (Sun) by jlokier (guest, #52227) [Link]

Except that Linux AIO (io_submit) isn't always asynchronous, and you can't easily tell when it will block the caller.

Some folks asking for preadv/pwritev are actually doing so because they rejected Linux AIO for being too broken to use.

They are preferring to use preadv/pwritev in userspace helper threads, than Linux AIO, because at least with threads it is always asynchronous.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds