Skip to contentSkip to conversation

sizeof problem in pSOS skin

Xenomai-core Thomas Necker 2 participants 2 messages Sep 18, 2006

lore
Share & tools
lore
#0 lore raw

I encountered a problem with the use of "sizeof" in the pSOS skin. E.g., in q_send the last parameter is "u_long msgbuf[4]" and its size is passed to q_send_internal as "sizeof(msgbuf)". However, since arrays are always passed by reference this sizeof call yields 4 instead of the expected
16. This results in only 4 bytes being sent instead of the whole message. The call must be changed, e.g., to "sizeof(u_long[4])".
The same problem exists for the following calls: q_receive, q_broadcast, q_urgent.

Thomas

#1 lore raw
Quoted 9 lines · Thomas Necker

I encountered a problem with the use of "sizeof" in the pSOS skin. E.g., in q_send the last parameter is "u_long msgbuf[4]" and its size is passed to q_send_internal as "sizeof(msgbuf)". However, since arrays are always passed by reference this sizeof call yields 4 instead of the expected
16. This results in only 4 bytes being sent instead of the whole message. The call must be changed, e.g., to "sizeof(u_long[4])".
The same problem exists for the following calls: q_receive, q_broadcast, q_urgent.

Fixed, thanks.

Quoted 6 lines

Thomas

_______________________________________________
Xenomai-core mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-core

Signature · 1 line
Philippe.