[Info-vax] QIO Writes to a mailbox
VAXman- at SendSpamHere.ORG
VAXman- at SendSpamHere.ORG
Wed Nov 9 09:18:25 EST 2011
In article <531039d1-7923-4751-81ad-ec707d299aec at u28g2000yqb.googlegroups.com>, Steve Bainbridge <stephen_bainbridge at yahoo.co.uk> writes:
>{...snip...}
>
>The buffer and IOSB are declared as static at the beginning of the
>routine and there is only one of them. The routine is called
>asynchronously, triggered by incoming messages - there could be a
>burst of messages in a very short space of time which may highlight
>issues of buffer re-use/corruption.
If I were you, I wouldn't hire that "programmer" write any multi-threaded
applications for you! :)
>Depending upon who you believe QIOs may or may not copy the data
>buffer before it returns - several people have said that mailboxes use
>buffered IO and the buffer is copied before it returns from the QIO.
>Everyone seems to agree that this is implementation specific and you
>can't rely upon it always being the case.
>
>I've since had a chance to look at more detail at this module and I've
>found about 15 similar cases of QIOs being used with single buffers -
>all don't bother to check the IOSB. I'm reluctant to make wholescale
>changes to the module as it's the most critical module in the system
>and testing will be a significant challenge. I'm considering changing
>the QIO to be a QIOW with the modifiers IO$_WRITEVBLK, IO$M_NOW and IO
>$M_NORSWAIT. Naturally checking the return code and IOSB return code.
>This should allow me to keep the single buffer, but also highlight if
>the process cannot immediately queue the data.
Assuming what you say about the buffer and IOSB, you can simply malloc()
enough memory to maintain the IOSB (2 longwords) and the buffer, copy the
data into the buffer and then, pass those addys along to the $QIO. Pass
the addy of what you've malloc()ed as the ASTPRM, so that an AST can both
check the IOSB and free() memory.
The general rule of thumb should be, never ASSUME (there's an Oscar Wilde
quotation WRT) anything until the status is available in the IOSB.
If it's the MOST critical module in the system, shouldn't it be written
as if it's the MOST critical module in the system? Attaching modifiers
to the IO$_WRITEVBLK might appear to fix your current issue but they're
not going to fix the problem of improper coding WRT the $QIO/IOSB/AST.
--
VAXman- A Bored Certified VMS Kernel Mode Hacker VAXman(at)TMESIS(dot)ORG
All your spirit rack abuses, come to haunt you back by day.
All your Byzantine excuses, given time, given you away.
More information about the Info-vax
mailing list