[comp.os.vms] c signals with VMS

jad@insyte.uucp (Jill Diewald) (01/20/88)

I have an application in c which I am trying to port from
UNIX to VMS.  I am running into problems with the 
signal handling.

The application starts a subprocess via a fork and an exec which
it talks to though pipes.  This part works fine.  Both the
parent and child use 'sigvec' ('sigvector' on UNIX) to setup their 
own specific signal handlers.  This part works fine too.  
The problem happens when I use LIB$SPAWN to temporarily allow the 
user to go to the DCL prompt (like a subshell).  When I do this 
the interrupt (^c) is turned off at the DCL level.  I tried resetting 
the parent's interrupts to SIGDFL before doing the spawn but it had 
no effect.

I'm not sure what is happening.  None of the documentation for
LIB$SPAWN mentions interrupts or signals.  Where is it setting them
from?  The child?  This seems unlikely.  When I wrote a test program 
which didn't set any signals and simply did a spawn, the interrupt 
(^c) was on at the DCL prompt level.

The second problem is when I return from the spawn.  Everything is 
fine except the interrupt (^c) to the child seems to be turned off.  
I dumped the settings for all of the c signals, in both the parent and 
child process, and they were all the same as before the spawn.  
There has to be some magic interaction between the c signals and the 
VMS ones.

I wrote a test program which set a handler for the interrupt signal, 
did a spawn.  When control returned back to the program from the spawn,
interrupts still worked!  I must assume that my problem has to do 
with it being a child process, or due to the fork and exec and/or the 
pipe interaction between the two processes? 

Does anyone know exactly how the c signals correspound and interact 
with the VMS system ones?  Can anyone explain this behavior or even 
better, tell me how to fix it?

I'd appreciate any help.

Jill Diewald
Innovative Systems
1 Gateway Center Suite 910
Newton, MA 02158
phone: 617-965-8450

email: ...harvard!axiom!insyte!jad

rikitake@wadalab.t.u-tokyo.JUNET (rikitake) (01/22/88)

>Does anyone know exactly how the c signals correspound and interact 
>with the VMS system ones?  Can anyone explain this behavior or even 
>better, tell me how to fix it?

Several thing I know about VAX C signals:

* VAX C signals are handled by C$SIGNAL run time module, and
  actually handled by LIB$SIGNAL library routine.
* VAX C signals acts like those in UNIX System V. Every time
  a signal accepted, the vectore of the signal will be reset
  to SIG_DFL. In the signal handling funtion. you have to
  rewrite the vector, if you are using other than SIG_DFL.

And about VMS signals:

* There's a LIB routine called LIB$DISABLE_CTRL and
  LIB$ENABLE_CTRL. This directly handle CTRL/T and
  CTRL/Y masks.

I don't know if the signal environment inherits...

-- Kenji
(Reference: VAX C 1.0 Japanese manual, DEC Japan)
(Please do NOT reply via JUNET: please send to KENJI@DCTWCS.DAS.NET.)

-- 
Kenji Rikitake / Studying instrumentation physics in Univ. of. Tokyo.
KENJI@DCTWCS.DAS.NET or ...!Sun!DCTWCS.DAS.NET!Kenji, for people overseas.
#102, 4-19-11, Sakurajousui, Setegaya-ku, Tokyo 156 JAPAN phone +81 3 306 0330
Also TWICS BeeLINE operation staff. Office +81 3 351 5977