-
Notifications
You must be signed in to change notification settings - Fork 6
Description
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