Messages in this thread | | | Date | Fri, 29 Jun 2007 18:48:07 -0700 | From | "Ulrich Drepper" <> | Subject | Re: [patch 0/6] sys_indirect RFC - sys_indirect introduction |
| |
On 6/29/07, Davide Libenzi <davidel@xmailserver.org> wrote: > [include/linux/indirect.h] > #define SYSIND_CTX_OPENFLAGS 0 > struct sysind_ctx_OPENFLAGS { > __u32 ctx; > __u32 flags;
I agree that this interface is more than any other in danger of needing an interface change. But I think your solution is a bit too expensive and complex. You need two reads from userlevel.
The standard way to handle this is a versioned struct. I.e., define a struct for the current needs, define an initial version. To use the syscall pass the version number and the struct pointer to the syscall. If the kernel doesn't know the version number it fails. Otherwise it might have to read old versions of the struct which is trivial to do. E.g.:
#define SYSIND_VERSION 1 #define SYSIND_CTX_OPENFLAGS 0 #define SYSIND_CTX_SIGMASK 1 struct sysind_ctx { int ctx; union { int flags; kernel_sigset_t sset; }; };
long sys_indirect(unsigned int nr, int ctx_version, const struct indirect_ctx *ctx, const unsigned long *params);
This reduces the number of accesses to userlevel data to one and still has all the flexibility needed. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |