Fixes a concurrency issue in semctl01. This test was using usleep to synchronize tasks. On a heavily loaded system, this synchronization is not enough to ensure execution correctness.
This patch is a bit more intrusive than my previous ones.
Patch content :
* Define 2 new functions in kernel/syscalls/lib/libtestsuite.c, used to synchronize a father and a son using pipes.
    - create_sync_pipes: create a pair of pipes used for the synchronization,
    - wait_son_startup: function used in the father to wait for its son to start ts execution,
    - notify_startup: function used in the son to notify it has started its execution,
* Add a kernel/syscalls/lib/libtestsuite.h file to cleanly export newly defines functions,
* Fix the semctl01test. The idea used to synchronize :
   - For each task created, the father waits for the son to start its execution using the newly define functions,
   - After the last son has been created, the father do a sleep(1) to give time to the sons to execute the semop function,
The final sleep does not guaranty the sons will have time to do the semop. On a REALLY heavily loaded system, this will still fail...
The only solution I see to be sure the son is really blocked on the semop before the father continue its execution it to use the wchan info from /proc/<pid>/wchan file..., by, Renaud Lottiaux <Renaud.Lottiaux@kerlabs.com>
3 files changed