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>
lwsl_info(" SPEC_LATEST_SUPPORTED: %u\n", SPEC_LATEST_SUPPORTED);
lwsl_info(" AWAITING_TIMEOUT: %u\n", AWAITING_TIMEOUT);
+ lwsl_info(" sizeof (*info): %u\n", sizeof(*info));
#if LWS_POSIX
lwsl_info(" SYSTEM_RANDOM_FILEPATH: '%s'\n", SYSTEM_RANDOM_FILEPATH);
lwsl_info(" LWS_MAX_ZLIB_CONN_BUFFER: %u\n", LWS_MAX_ZLIB_CONN_BUFFER);
#endif
/* Add new things just above here ---^
- * This is part of the ABI, don't needlessly break compatibilty */
+ * This is part of the ABI, don't needlessly break compatibility
+ *
+ * The below is to ensure later library versions with new
+ * members added above will see 0 (default) even if the app
+ * was not built against the newer headers.
+ */
+
+ void *_unused[9];
};
LWS_VISIBLE LWS_EXTERN void