home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / perl / 8002 < prev    next >
Encoding:
Text File  |  1993-01-27  |  1.4 KB  |  35 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!hubcap!ncrcae!ncrhub2!ncrgw2!psinntp!newstand.syr.edu!npac.syr.edu!chicken
  3. From: chicken@npac.syr.edu (Mark R. Levinson)
  4. Subject: Signal names vs. signal numbers
  5. Message-ID: <chicken.728062442@npac.syr.edu>
  6. Organization: NPAC, Syracuse University - Syracuse, New York
  7. Date: Tue, 26 Jan 93 11:03:00 EST
  8. Lines: 25
  9.  
  10.  
  11. I'm writing a script in which I use perl's kill function to send signals to a
  12. process group, which has led to a bit of a dilemma. Generally kill can take a
  13. signal name (rather than a number) as its first argument, e.g.:
  14.  
  15.     kill 'STOP', $$;
  16.  
  17. But in order to signal a process group rather than a single process, the
  18. signal must be negative. This seems to imply that for this purpose signals
  19. _must_ be given as numbers rather than names. Unfortunately, the signal
  20. numbers I'm interested in are not portable across the different operating
  21. systems I'm using, so it would be vastly preferable to refer to the signals by
  22. name instead.
  23.  
  24. Is there some trick that allows the use of "negative" signal names with kill?
  25. Failing that, is there any easy way to convert a signal name to its
  26. corresponding number within a script? (I suppose I could always search through
  27. /usr/include/{sys/,}signal.h, but that seems rather ugly.)
  28.  
  29. Thanks for any thoughts....
  30.  
  31. --
  32. Mark R. Levinson
  33. Northeast Parallel Architectures Center
  34. Syracuse University
  35.