[an error occurred while processing this directive]

HP OpenVMS Systems

ask the wizard
Content starts here

System Service Argument Processing?

» close window

The Question is:

 
I just verified that the function of sys$cantim() also includes cleanup in the
 AST queue using the following
 
void ProcTimer()
 
  printf( "ProcTimer\n" );
 
 
void ProcCancel()
 
  sleep(20);
  sys$cantim( 1, 0 );
 
 
main()
 
  int wait[2] = { -1e8, -1 );
 
  sys$setimr( 0, wait, ProcTimer, 1 );
  sys$dclast( ProcCancel, 0, 0 );
  sys$hiber();
 
 
Nice. But I also discovered that the trailing arguments to sys$cantim() and
 sys$dclast() are not optional as indicated by the online help.
 
 


The Answer is :

 
    "Optional" vs "Omitted" arguments...
 
    Note very carefully how the documentation displays the arguments:
 
             SYS$CANTIM  [reqidt] ,[acmode]
             SYS$DCLAST  astadr ,[astprm] ,[acmode]
 
 
    Note that the comma is OUTSIDE the square brackets. This indicates the
    argument is OPTIONAL, but the argument position MUST be filled with a
    zero passed by immediate value.
 
    Compare with:
 
               LIB$SPAWN  [command-string] [,input-file]
                          [,output-file] [,flags] [,process-name]
                          [,process-id] [,completion-status-address]
                          [,byte-integer-event-flag-num] [,AST-address]
                          [,varying-AST-argument] [,prompt-string] [,cli]
                          [,table]
 
 
    Here the comma is INSIDE the square brackets. This indicates the argument
    is optional and may be OMITTED altogether. That is, the argument list may
    be shortened to the last agument that was not omitted.
 
    As a general rule, OpenVMS system services (SYS$) typically require
    the explicit specification of all arguments.  (There are a few
    exceptions, usually in cases where arguments have been added as
    enhancements since the service was first defined.)  OpenVMS Run-Time
    Library (RTL) routines (LIB$, SMG$, etc) typically do have support
    for omitted arguments.
 
    When using system services, remember that the supporting operating
    system code executes in a privileged processor mode -- a mode where
    the consequences of a coding error can corrupt data or can crash the
    system, and particularly where memory allocation and deallocations
    occur from protected memory pools.  For these and other reasons,
    system services tend to verify the appropriate accessability of the
    arguments, and to perform minimal argument processing work beyond
    what is central to the operation.  Niceties such as processing
    variable length argument lists, and dynamic string operations such
    as trimming, extending, upper-casing or otherwise manipulating the
    strings (see the FAQ) that one can expect of an RTL routine are
    typically NOT performed by system service calls.
 
    Features of specific language constructs can also feature prominently
    here.  Please see your language-specific programming documentation,
    and please see the OpenVMS Calling Standard documentation, for
    additional details and requirements.
 

answer written or last revised on ( 4-DEC-2000 )

» close window