Skip to content

Support trivially copyable return types for wrapper functions #38

@maxwellpirtle

Description

@maxwellpirtle

Discussion

McMini currently does not support returning custom values from wrapper functions. This poses a problem for a program which makes use of a function like sem_getvalue() since the shadow structures backing the data for the semaphore are contained in the parent "scheduler" process while the wrapper function is invoked in child processes forked from the parent.

Proposal

We need to add another callback similar to the one that is invoked when the program encounters a particular wrapper function (viz. the MCSharedMemoryHandler). The callback should return a value that McMini will write into a (another) spot into shared memory that the wrapper function will then return to the test program.

Challenges

If we are to make the callback support different return types, we probably will need to use some tricks with templates. This could be a bit tricky but would give us the most flexibility. We'd have to require that any templated types are "trivially copyable" i.e. that they can be memcpy()-ed around without any undefined behavior. See std::is_trivially_copyable for details

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort: 4Requires substantial effort to completetype: enhancementThe issue specifies a feature that should be added to the projectwork: complexCynefin complex: the work involves problems whose solutions will involve some experimentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions