From: "John Z. Bohach" <jzb2@aexorsyst.com>
To: linux-kernel@vger.kernel.org
Subject: mode_t: linux/types.h vs. glibc's sys/types.h
Date: Thu, 23 Aug 2007 14:12:11 -0700 [thread overview]
Message-ID: <200708231412.11752.jzb2@aexorsyst.com> (raw)
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
reply other threads:[~2007-08-23 21:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200708231412.11752.jzb2@aexorsyst.com \
--to=jzb2@aexorsyst.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®