Operating System - OpenVMS
1753814 Members
7840 Online
108805 Solutions
New Discussion юеВ

Re: sys$qiow(efn$c_enf,...,iosb,...) - must iosb be specified?

 
SOLVED
Go to solution
Jur van der Burg
Respected Contributor

Re: sys$qiow(efn$c_enf,...,iosb,...) - must iosb be specified?

>(besides, if it was not the case then the
>QIOW ought to return error. Which it does
>not).

How do you know if there was no error if you did not specify an iosb???? Just checking the $qio return status is by no means a complete check.

>In other words - if you don't specify an
>iosb then the qiow (notice the w) may
>complete prematurely?
>I wouldn't think so. Rephrase?

That's what may happen if another part of the software uses the same event flag.

>You mention $synch. Does the fact that $qiow
> = $qio + $synch include the condition code
>returned? Or should/must the condition code
>in the iosb be checked in addition to the
>condition code returned by $qiow (again
>please notice the w). I couldn't find the
>answer in the doc.

As said before, check both the $qio return status AND the iosb status. that's the ONLY way to be certain in all cases. If you want to write software that behaves predictable do it this way.

Jur.
Jon Pinkley
Honored Contributor

Re: sys$qiow(efn$c_enf,...,iosb,...) - must iosb be specified?

>>>You mention $synch. Does the fact that $qiow = $qio + $synch include the condition code returned?<<<

No, $qiow does not copy the value from the iosb into the value retuned as the $qio status. I suppose that would have been possible, but it would have made the behavior of $QIOW different than $QIO. But if you are put off by that, then you probably wouldn't be using $QIO in the first place, instead using something at a higher level.

Note that these are two types of errors.

The status returned by the $QUI is telling you whether VMS has accepted your request as valid. I.e. you have access to the buffer you specified, you have specified correct io function modifiers, etc.

The status returned in the IOSB is set after the IO is complete (or has failed). It reports things like insufficient buffer for the amount of data that was returned, or some error status from a device.

These are analogous to compile time errors vs. run time errors in a program.

>>>Or should/must the condition code in the iosb be checked in addition to the condition code returned by $qiow (again please notice the w). I couldn't find the answer in the doc.<<<

Yes, as Jur stated, you MUST check the condition code if you want to be able to handle errors that occur after the I/O request packet has been queued to the driver, regardless of whether it was a $qio or $qiow.

Jon
it depends
John Gillings
Honored Contributor

Re: sys$qiow(efn$c_enf,...,iosb,...) - must iosb be specified?

The IOSB might be documented to be "optional", but if you want your code to work, you will always specify an IOSB, stored in a place that will be in scope when the operation completes (not an issue with $QIOW, but worth reminding yourself of everytime - the IOSB is written asynchronously, possibly AFTER the service has returned). That's true of all system services that have an IOSB or analogous structure.

One way of thinking about it is, the definition of completion of the operation is when the IOSB is written. Without an IOSB you can't be certain the operation has completed at all, let alone know if it's completed successfully. As Jur has stressed, you should always check the IOSB to confirm success.

There are all kinds of circumstances under which you can get a spurious completions of asynch operations (and therefore also the synch operations). EFN$C_ENF eliminates overloaded event flags from causing issues, BUT also prevents the use of the event flag being used to signal completion. You're therefore left with ONLY the IOSB to tell you when the operation has completed.

So, the answer to your question "Must the iosb always be specified in (the wait form of) calls like the above when using EFN$C_ENF?" is YES.

If you've specified an event flag, you might get away without an IOSB most of the time, but I'm fairly sure when using ENF, it just plain won't work without an IOSB.

Regardless, as Hoff has said, ALWAYS, ALWAYS, ALWAYS use an IOSB.
A crucible of informative mistakes