4 ms·
Now I wonder if my idea of having a muxcall or a batchcall as I thought about it a few years ago is something similar to io_uring, but on a lesser scale and wit
by hawski 5y ago
Now I wonder if my idea of having a muxcall or a batchcall as I thought about it a few years ago is something similar to io_uring, but on a lesser scale and without eBPF goodies.
My idea was to have a syscall like this:
struct batchvec {
unsigned long batchv_callnr;
unsigned long long batchv_argmask;
};
asmlinkage long sys_batchcall(struct batchvec *batchv, int batchvcnt,
long args[16], unsigned flags);
You were supposed to give in a batchvec a sequence of system call numbers and a little mapping to arguments you provided in args. batchv_argmask is a long long - 64 bit type, this mask is divided to 4 bit fields, every field can address a long from args table. AFAIR Linux syscalls have up to 6 arguments. 6 fields for arguments and one for return value, that gives 7 fields - 28 bits and now I don't remember why I thought I need a long long.
It would go like this pseudo code:
int i = 0;
for(; i < batchvcnt; i++) {
args[batchv[i].argmask[6]] = sys_call_table[batchv[i].callnr](args[batchv[i].argmask[0]], args[batchv[i].argmask[1]], args[batchv[i].argmask[2]], args[batchv[i].argmask[3]], args[batchv[i].argmask[4]], args[batchv[i].argmask[5]]);
if(args[batchv[i].argmask[6]] < 0) {
break;
}
}
return i;
It would return a number of successfully run syscalls. It would stop on first failed one. The user would have to pick up the error code out of args table.
I would be interested to know why it wouldn't work.
I started implementing it against Linux 4.15.12, but never went to test it. I have some code, but I don't believe it is my last version of the attempt.
- R0b0t1 5y agoI am hoping io_uring goes this way (maybe just call it uring). It would make people design APIs with a thought to how they could be async'd.
- moonchild 5y agoFwiw posix specifies readv and writev already; you may want to take a look at those. It's not really the same, though; readv and writev are still synchronous APIs, they just do more at once.
- hawski 5y agoI'm aware of readv/writev. This was supposed to cover much more, because it is with arbitrary syscalls. Open a file and if successful read from it - all with a single syscall. Another example: socket, setsockopt, bind, listen, accept in a single syscall.