HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

DCLAST routine doesn't run at AST level?

 
SOLVED
Go to solution
Richard Whalen
Honored Contributor

DCLAST routine doesn't run at AST level?

On a RX2600 with VMS 8.3-1H1 and all patches available (as of yesterday) it appears that the routine specified in $DCLAST does NOT execute at AST level.

I was testing that some code would properly complete in AST mode yesterday and figured that the easiest was was to write a test program that called the routine by doing a SYS$DCLAST. After a bit of finding bugs in the code that I was testing I determined that the routine called by the "AST" passed to DCLAST was NOT executing at AST level. I pared the program down to the minimum and used SYS$SETAST to make sure that it was at AST level and display what it was before disabling ASTs.

http://www.openvms.compaq.com/doc/83FINAL/4527/4527pro_034.html#jun_174

http://www.openvms.compaq.com/doc/83FINAL/4527/4527pro_100.html#jun_473

#include
#include
#include

void ast(int *foo)
{
int ast_status;

ast_status = sys$setast(0);
printf("ast_status = %x, wasclr = %x, wasset = %x\n", ast_status, SS$_WASCLR, SS$_WASSET);
if (SS$_WASSET == ast_status) sys$setast(1);
*foo = 1;
}
main()
{
int bar = 0;
int status;
status = sys$dclast(&ast, &bar, 0);
printf("bar = %x, status = %x\n", bar, status);
}

$ cc/version
HP C V7.1-011 on OpenVMS IA64 V8.3-1H1

$ r dclast_test
ast_status = 9, wasclr = 1, wasset = 9
bar = 1, status = 1
6 REPLIES
Robert Gezelter
Honored Contributor
Solution

Re: DCLAST routine doesn't run at AST level?

Richard,

Reading your citations from the manuals, it is not clear to me from the documentation how SYS$SETAST behaves from with AST state.

Have you tried LIB$AST_IN_PROG? [see
http://h71000.www7.hp.com/doc/82final/5932/5932pro_002.html#index_x_19 ]

- Bob Gezelter, http://www.rlgsc.com
Hein van den Heuvel
Honored Contributor

Re: DCLAST routine doesn't run at AST level?

Oh, yeah of little faith !
This stuff works.
The OpenVMS world would fall apart if it did not.

Just bad documentation interpretation.

setast only enables and disables, and reports the prior enabling state.
It does not report on the current run state.

You may want to look GETJPI : JPI$_ASTACT

Of course it is a rather nasty test program in that it requests an async service but the subsequent coding relies on synchroneous completion without synchronization. Yuck.

It may be more fun to do in the main line:

$SETAST 0
print "about to DCLAST"
$DCLAST
print "AST declared"
$SETAST 1
print "AST Enabled"

The message from the AST function should come between AST enabled and declared.

fwiw,
Hein.
Richard Whalen
Honored Contributor

Re: DCLAST routine doesn't run at AST level?

I expected DCLAST to make the routine run at AST level, and I would expect many things to be wrong if it didn't.

Thanks for the pointers to the what I really want to determine whether or not my code is at AST level.

Maybe someone will improve the documentation.
Robert Brooks_1
Honored Contributor

Re: DCLAST routine doesn't run at AST level?

Maybe someone will improve the documentation.

--

Only if you make it formally known that there's a problem.

Given the lack of resources, it would help if you sent in a suggested clarification or modification to the section(s) that need help.

That way, the few documentation writers that are left won't have to badger already-overworked engineers to spend time researching, testing, etc . . .

Yeah, that sounds pretty harsh, but it's the reality of the situation.

-- Rob
John Gillings
Honored Contributor

Re: DCLAST routine doesn't run at AST level?

Richard,

As Robert suggested, LIB$AST_IN_PROG is the routine to use to determine AST status.

Just a comment on debugging with these routines. As your code shows, the value of SS$_WASSET is 9. In hindsight, this was a very silly choice. I've seen many cases where people test return status against SS$_NORMAL, assuming anything else is a failure. They then translate SS$_WASSET as if it were an error, and get SYSTEM-S-ACCVIO! The "S" is very easy to overlook.
A crucible of informative mistakes
Richard Whalen
Honored Contributor

Re: DCLAST routine doesn't run at AST level?

Thanks to all.

I'll see what I can do about submitting some improved wording for the documentation, but resources are tight here too, so it may take a while.