[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

393.0. "Need help to emulate "power-fail"." by 42413::KOSKUBA (Karel_the_cotton_fist) Fri Jan 30 1987 13:36

I need help emulating power_fail in a VAX (BASIC) program. I need my program to 
fail without closing files. The only way I know how to do it is to pull the 
plug out. That is too time consuming - so can anyone think of a way to crash my 
program bypassing the normal exception handlers?
Thanks - Karel.
T.RTitleUserPersonal
Name
DateLines
393.1Perhaps SYS$DELPRC is good enough?BISTRO::HEINIf We don't Have it,You don't Need it!Fri Jan 30 1987 14:121
    
393.2CHOVAX::YOUNGBack from the Shadows Again,Sat Jan 31 1987 20:456
    Re .1:
    
    I think that it used to be good enough, but that it was 'fixed'
    so that it flushes & closes files for you.  I'm not certain though.
    
    --  Barry
393.3EXEC mode crash?CHOVAX::YOUNGBack from the Shadows Again,Sat Jan 31 1987 20:5731
    On thinking about this some more, I now believe that you could get
    what you want with an EXEC mode bugcheck.  This will cause your
    process to be deleted, and will probably result in not closing your
    files.
    
    Add the following code to your BASIC program at the appropiate place:
    
    .
    .
    External long by_bugcheck
    .
    .
    Call sys$cmexec (by_bugcheck, )
    .
    .
    
    
    Now, LINK with the following subroutine:
    

1	Subroutine by_bugcheck (long bad_argument)
    
    	Bad_argument	=	1%
    
    	End

    
    This should crash & burn very nicely.
    
    
    --  Barry
393.4DCL STOP?BCSE::BULKAnick bulkaMon Feb 02 1987 12:301
Why can't you just log in again and stop the process from DCL?
393.5Crash VMS!HOW::EVANSRobert N. Evans DTN-225-6946 HLO2-3/P4Mon Feb 02 1987 16:4411
Any way you choose to stop the process and leave VMS running, as suggested above
allows VMS to potentially do some cleanup for you.  Doing something that 
actually crashes VMS will prevent this cleanup.

How about calling (from BASIC) a kernel-mode Macro routine which simply halts
the CPU?  On most VAX models, the console can be set to provide an automatic
reboot.  It is their problem if you have other users on your VAX ;-).

Seriously, this method should mimic a powerfail provided that there is no 
battery-backup provided restart.  In the case of a restart, an application 
should not be able to detect that the power failed.
393.6I'm happy now.42413::KOSKUBAKarel_the_cotton_fistWed Feb 04 1987 11:135
    Thanks to all contributors. I have so far tried only sys$delprc
    and it works OK for what I want. I'll try the other suggestions
    in due course (apart from crashing VMS - that's what I want to avoid).
    Thanks again,
    Karel.