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