|
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. |
It's not really the same, though; readv and writev are still synchronous APIs, they just do more at once.