Re: [PATCHv3 0/4] sys_indirect system call

From: Eric Dumazet
Date: Mon Nov 19 2007 - 09:18:19 EST


On Sat, 17 Nov 2007 00:31:36 -0500
Ulrich Drepper <drepper@xxxxxxxxxx> wrote:


>
> union indirect_params i;
> i.file_flags.flags = O_CLOEXEC;

This setup forbids future addons to file_flags

In three years, when we want to add a new indirect feature to socket()
call, do we need a new indirect2() syscall ?

So I suggest using :

union indirect_params i = {
.file_flags.flags = O_CLOEXEC,
};
fd = syscall (__NR_indirect, &r, &i, sizeof (i));

Or better, you could avoid using 'union indirect_params' in user code, and
only use the substructs for each function.
/* define this in some include file of course */
struct file_flags {
int flags;
};
/* use it */
struct file_flags ff = { .flags = O_CLOEXEC};
fd = syscall (__NR_indirect, &r, &ff, sizeof(ff));

This to avoid to copy to kernel un-necessary data, and permitting futures changes.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/