machinekit/machinekit — pull request #179 by mhaberler (2014-05-07 06:11:13+00:00)
Title: RTAPI: retrieve the size when attaching a shared memory segment

this is a bit intrusive since it's an API change; there are several affected comps but the change per se is trivial - normally just add a 0 parameter to the rtapi_shm_getptr() call.

I nevertheless propose to merge this because sane interworking between RT and userland components based on shared memory segments will become important for the ringbuffer code - the scenario is: RT comp creates a shared memory segment, later a userland component attaches same segment and the segment is used for sending/receiving messages; without this patch the userland code only would get a pointer, but no indication of the size of the segment, and hence no way for a sanity test if the shared object actually fits. Also, the Python buffer/memoryview interface needs a size parameter; just guessing is not an option. The halmodule patch came from the probekins work way back; it turned out the HAL module shared memory interface was in place, but useless due to this RTAPI defect.

The code runtests fine, but I'd appreciate a critical look anyway.