info struct add padding pool
authorAndy Green <andy.green@linaro.org>
Fri, 25 Dec 2015 01:17:15 +0000 (09:17 +0800)
committerAndy Green <andy.green@linaro.org>
Fri, 25 Dec 2015 01:23:25 +0000 (09:23 +0800)
commita4244f08adee1fb7b04401c9108e7e218864e2c3
treec1e0f2887a500c605ff5644756d47a5d0a1f7695
parentc35b36b1cf5a00f244f2c176a301c60450230899
info struct add padding pool

The info struct is too fragile against additions being able to keep soname.

Because if we add something, the library can't count on the user code being
built against latest headers with largest info struct size.  Then the user
code may not have zeroed down enough of the struct and give us junk in the
new members.

Add a pool at the end of the info struct that exists so it will be zeroed
down even though no current use for those future members, then later
library versions can compatibly use them without breaking soname if it is
understood 0 means default.

Because keeping sizeof info straight if you add something is now a thing,
also add an lwsl_info letting you confirm it easily.

It's fine if the size of info differs on different platforms.  But when
we add things to the struct we need to balance the padding using a scheme
like

       short  new_member;
       unsigned char _padding1[sizeof(void *) - sizeof(short)];

which is immune to differences in platform differences in sizeof void *.

Signed-off-by: Andy Green <andy.green@linaro.org>
lib/context.c
lib/libwebsockets.h