bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH] Turn mach_msg_type_{name,size}_t into unsigned chars.


From: Justus Winter
Subject: Re: [PATCH] Turn mach_msg_type_{name,size}_t into unsigned chars.
Date: Mon, 04 Apr 2016 12:01:13 +0200
User-agent: alot/0.3.8.dev

Quoting Samuel Thibault (2016-04-04 09:16:17)
> Hello,
> 
> Flavio Cruz, on Sun 03 Apr 2016 16:12:48 +0200, wrote:
> > mach_msg_type_name_t and mach_msg_type_size_t are used as 8 bit fields in
> > mach_msg_type_t struct, therefore they should be treated as unsigned char's 
> > to
> > avoid warnings when using macros such as MACH_MSG_TYPE_POLYMORPIC.
> 
> Mmm, looking quickly at the mach code shows that there is a "long"
> variant of these fields, see for instance ipc_kmsg_clean_body() which
> uses a mach_msg_type_long_t

I don't see a problem with that for mach_msg_type_name_t.  The long
form is used if e.g. an array is transmitted with a size that cannot
be expressed with mach_msg_type_t, but there cannot be at type that
doesn't fit in 8 bits afaics.

If we restrict mach_msg_type_size_t to 8 bits, we limit the size a
single object in an array can have even for the long form.

(Obligatory rant: Why is the size of an element expressed in bits even
though the code everywhere in Mach assumes it to be a multiple of
eight and pads it accordingly?  Something to fix for Mach5...)

Justus



reply via email to

[Prev in Thread] Current Thread [Next in Thread]