RE: uid_t and gid_t vs. __kernel_uid_t and __kernel_gid_t

Chris Wing (wingc@engin.umich.edu)
Mon, 14 May 2001 15:49:51 -0400 (EDT)


Vassilii:

> I am trying to understand what's the cleanest coding that would allow
> 1) user code to just use uid/gid for interfacing the driver control
> structures
> 2) driver code to read/write the corresponding structure fields with minimum
> awareness of the actual difference between kernel and user uid_t/gid_t
> layout.

Just define a structure like:

struct user-to-kernel {
unsigned int uid;
unsigned int gid;
...
}

and copy the header into your user space program. The alignments may
differ between different Linux architectures, but that won't matter.
You aren't going to be running a program compiled on a sparc on an i386
anyway...

If you are writing a filesystem or sending data over the network directly
via the kernel (without going through the user space program), then you
will need to decide upon a fixed byte order and alignment. (but this
doesn't seem to be the case for you, right?)

-Chris
wingc@engin.umich.edu

-
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/