Documented what bounds the size txm_module_object_allocate accepts - #50
Open
fdesbiens wants to merge 1 commit into
Open
Documented what bounds the size txm_module_object_allocate accepts#50fdesbiens wants to merge 1 commit into
fdesbiens wants to merge 1 commit into
Conversation
The service's return values listed three of the five it can produce. Missing were TXM_MODULE_INVALID_MEMORY, which a null object_ptr has always produced, and TX_SIZE_ERROR, which the object pool produces for a size larger than the whole pool -- the code a caller now sees where a size too large to add the manager's header to at all produces TXM_MODULE_MATH_OVERFLOW instead. That distinction is only readable if the header is mentioned, so the description now says the manager keeps one in front of the memory the module receives and that object_size is bounded by the pool less that header. TXM_MODULE_MATH_OVERFLOW also joins the chapter's list of module-specific error codes, which had every other code in its range and not that one. Matches the ThreadX change on fix/module-object-allocation-overflow. Assisted-by: Claude Code (Opus 5) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
txm_module_object_allocatedocumented three of the five status codes it can return.Two were already produced and undocumented:
object_ptris NULL and there is nowhere to put the allocation._txe_byte_allocatebounds every request bytx_byte_pool_size, so this is the code a caller sees for a size the pool cannot serve at all, as distinct from TX_NO_MEMORY for a pool that is merely too full right now.One is new: TXM_MODULE_MATH_OVERFLOW (0xF8), for an
object_sizeso large that adding the Module Manager's own object header to it would not be representable.That distinction is only readable if the header is mentioned at all, so the description now says the manager keeps a header in front of the memory the module receives -- recording the owning module, the size, and the links that let the allocation be reclaimed when the module is unloaded -- and that
object_sizeis therefore bounded by what the pool holds, less that header.TXM_MODULE_MATH_OVERFLOW also joins the chapter's list of module-specific error codes at the top, which carried TXM_MODULE_INVALID_PROPERTIES, TXM_MODULE_INVALID_MEMORY and TXM_MODULE_INVALID_CALLBACK but not this one.
Verified by building the site with Antora; the three new mentions render as expected in
threadx-modules/chapter4.html.Matches a ThreadX change on
fix/module-object-allocation-overflow.