mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* mode_t:  linux/types.h vs. glibc's sys/types.h
@ 2007-08-23 21:12 John Z. Bohach
  0 siblings, 0 replies; only message in thread
From: John Z. Bohach @ 2007-08-23 21:12 UTC (permalink / raw)
  To: linux-kernel

Howdy,

I've tried googling for this, and searched the archives as well, but I 
haven't found a satisfactory answer.  My apologies if this is covered 
somewhere...

The kernel's linux/types.h resolves mode_t to __kernel_mode_t which is 
then defined as:

typedef unsigned short  __kernel_mode_t;

in linux/posix_types.h.

However, glibc's sys/types.h eventually (in bits/typesizes.h) resolves 
mode_t to:

#define __MODE_T_TYPE           __U32_TYPE

So, when I try to pass a mode_t type from kernel space to user space, 
the kernel sends a short when the user space expects an int.  I of 
course declare my variable as 'mode_t' both in my kernel module and in 
my user-space app., with the above inconsistency.

I can get around this easily enough by sending/receiving __u32, but I'm 
trying to be a little more type-safe...

Is this something that is intentional, or is this an inconsistency 
between linux and glibc?  I've verified this both on 2.6.16.47 and 
2.6.20.6.  Any ideas?

Thanks,
John

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-08-23 21:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-23 21:12 mode_t: linux/types.h vs. glibc's sys/types.h John Z. Bohach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®