mode_t: linux/types.h vs. glibc's sys/types.h

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

 



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