HP OpenVMS Systems

ask the wizard
Content starts here

using lock files? (application status)

» close window

The Question is:

 
I am using a dummy flag file to signal Pathworks 6.0a PCs that a process is
up and running on my VAX.  The application is written using VAXC.  I have
used the "fop=dlt" keyword in the open to mark the file for delete when the
application closes.  The file
 deletes when the application exits or crashes, but not when the process is
stopped or the system shuts down.  Is there another way to handle this or
another option to let my DOS PC know that the process is up?
 
 


The Answer is :

 
  One could obviously maintain a TCP/IP or DECnet link between the
  applications.  Without the creation of the static object (the file),
  there is no need for a cleanup.
 
  Stopping a process is a rather harsh mechanism, and is explicitly
  intended to bypass things like this cleanup operation as well as
  opertions such as application exit handlers.  As an alternative to
  STOP (or sys$delrpc) one could use an application based on the
  sys$forcex service for this task.  (See below for an example of
  this.)
 
  And the system startup could locate and delete any older (node-specific)
  lock files found during the system startup.
 
 
/*
** COPYRIGHT (c) 1992, 1996 BY
** DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS.
** ALL RIGHTS RESERVED.
**
** THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
** ONLY  IN  ACCORDANCE  OF  THE  TERMS  OF  SUCH  LICENSE  AND WITH THE
** INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR  ANY  OTHER
** COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
** OTHER PERSON.  NO TITLE TO AND  OWNERSHIP OF THE  SOFTWARE IS  HEREBY
** TRANSFERRED.
**
** THE INFORMATION IN THIS SOFTWARE IS  SUBJECT TO CHANGE WITHOUT NOTICE
** AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
** CORPORATION.
**
** DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE  OR  RELIABILITY OF ITS
** SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
*/
 
/*
**++
**  Facility:
**
**	Examples
**
**  Version: V1.0
**
**  Abstract:
**
**	Performs a $FORCEX on the specified target.  Set up to
**	be called as a foreign command.
**
**  Author:
**	Steve Hoffman
**
**  Creation Date:  1-Jan-1990
**
**  Modification History:
**--
*/
 
/*
/*  Example/test program that performs a $FORCEX on the specified
/*  process.  Called as a foreign command, with one argument, the
/*  hexidecimal PID of the target process.  May require GROUP or
/*  WORLD privilege.
*/
 
#include <ssdef.h>
#include <starlet.h>
#include <stdio.h>
 
main( int argc, char **argv )
    {
    unsigned long int retstat;
    unsigned long int pid;
    unsigned long int finalstat = SS$_BUGCHECK;
    char hex[12];
 
    if (( argc != 2 ) && ( argc != 3 ))
	{
	printf("this is a foreign command; usage: fx pid exitstat\n");
	return SS$_BADPARAM;
	}
 
    sscanf( argv[1], "%x", &pid );
    if ( argc == 3 )
	sscanf( argv[1], "%x", &finalstat );
 
    retstat = sys$forcex( &pid, 0, finalstat );
 
    return retstat;
    }
 
 

answer written or last revised on ( 17-SEP-1998 )

» close window