[RFC] server-private and public header separation

Chase Douglas chase.douglas at canonical.com
Fri Mar 23 07:45:31 PDT 2012


On 03/23/2012 07:14 AM, Jamey Sharp wrote:
> On 3/22/12, Chase Douglas <chase.douglas at canonical.com> wrote:
>> On 03/22/2012 09:25 PM, Peter Hutterer wrote:
>>> This patch introduces a new define __XSERVER__ that we can use in the sdk
>>> headers. Obviously the real integration will be a tad harder as there are
>>> other headers that are installed outside of include/. But the gist is that
>>> anything between ifdef __XSERVER__ disappears on install, (in)effectively
>>> hiding it.
>>
>> This implementation would make the struct size look different between
>> the server and the client. I think that would likely end up causing some
>> bad memory corruption bugs sometime down the line.
> 
> These aren't protocol-visible structs, so clients aren't affected.
> Unless you meant drivers? Clearly any struct that drivers allocate
> directly, or that drivers do pointer math on such as array indexing,
> can't get this treatment. Those are the only bad cases though, I
> think?

I did mean drivers, not clients. Sorry!

If you apply this to some structs but not others based on a rule like:
"if the driver allocates the struct directly, then don't", you'll likely
screw up at some point.

That rule alone isn't enough though. If any structures are in arrays,
like input valuator classes for example, they must have the correct size
in the public ABI too.

-- Chase


More information about the xorg-devel mailing list