Re: [patch 0/6] sys_indirect RFC - sys_indirect introduction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/29/07, Davide Libenzi <[email protected]> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux