Thread: "kill -l" ???????????

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    87

    "kill -l" ???????????

    We've been asked to program the kill -l linux command in C. Here's the passage

    kill -l
    list the signals sent by this command. Your version of kill should recognise SIGTERM, SIGKILL and SIGHUP. It should provide a list of both the name of the signals and their numbers.

    I understand what those signals are, and I'm presuming when the program is run output will be something similar to

    SIGTERM
    SIGKILL
    SIGHUP

    But when it says their numbers should be listed aswell, what in sam hell does that mean???
    PuterPaul.co.uk - Portfolio site

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    I would start by havng a look in the signal.h header file, you may see what you want there. Since these tend to be compiler specific, it would be dangerous for me to suggest otherwise.

    In general for portability, you should treat a signal as a signal and not assume anything about it's internals, (same is, of course true of other structures).
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    Well, if you have to print the numeric value of the signal (which is found in signal.h as Adrian pointed out), you could always do this:
    Code:
    printf( "SIGTERM: %d\n", SIGTERM );
    Jason Deckard

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Never "kill -9" again, psDoom your processes!
    By Perspective in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 08-05-2004, 09:25 AM