Changeset d3ce33fa in mainline for uspace/lib/posix/string.c


Ignore:
Timestamp:
2011-07-05T19:01:18Z (13 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d9eaa43
Parents:
4f86fa3
Message:

signal.h: Add some functions and implementations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/string.c

    r4f86fa3 rd3ce33fa  
    4343#include "limits.h"
    4444#include "stdlib.h"
     45#include "signal.h"
    4546
    4647#include "libc/str_error.h"
     
    570571}
    571572
     573/**
     574 *
     575 * @param signum
     576 * @return
     577 */
     578char *posix_strsignal(int signum)
     579{
     580        static const char *const sigstrings[] = {
     581                [SIGABRT] = "SIGABRT (Process abort signal)",
     582                [SIGALRM] = "SIGALRM (Alarm clock)",
     583                [SIGBUS] = "SIGBUS (Access to an undefined portion of a memory object)",
     584                [SIGCHLD] = "SIGCHLD (Child process terminated, stopped, or continued)",
     585                [SIGCONT] = "SIGCONT (Continue executing, if stopped)",
     586                [SIGFPE] = "SIGFPE (Erroneous arithmetic operation)",
     587                [SIGHUP] = "SIGHUP (Hangup)",
     588                [SIGILL] = "SIGILL (Illegal instruction)",
     589                [SIGINT] = "SIGINT (Terminal interrupt signal)",
     590                [SIGKILL] = "SIGKILL (Kill process)",
     591                [SIGPIPE] = "SIGPIPE (Write on a pipe with no one to read it)",
     592                [SIGQUIT] = "SIGQUIT (Terminal quit signal)",
     593                [SIGSEGV] = "SIGSEGV (Invalid memory reference)",
     594                [SIGSTOP] = "SIGSTOP (Stop executing)",
     595                [SIGTERM] = "SIGTERM (Termination signal)",
     596                [SIGTSTP] = "SIGTSTP (Terminal stop signal)",
     597                [SIGTTIN] = "SIGTTIN (Background process attempting read)",
     598                [SIGTTOU] = "SIGTTOU (Background process attempting write)",
     599                [SIGUSR1] = "SIGUSR1 (User-defined signal 1)",
     600                [SIGUSR2] = "SIGUSR2 (User-defined signal 2)",
     601                [SIGPOLL] = "SIGPOLL (Pollable event)",
     602                [SIGPROF] = "SIGPROF (Profiling timer expired)",
     603                [SIGSYS] = "SIGSYS (Bad system call)",
     604                [SIGTRAP] = "SIGTRAP (Trace/breakpoint trap)",
     605                [SIGURG] = "SIGURG (High bandwidth data is available at a socket)",
     606                [SIGVTALRM] = "SIGVTALRM (Virtual timer expired)",
     607                [SIGXCPU] = "SIGXCPU (CPU time limit exceeded)",
     608                [SIGXFSZ] = "SIGXFSZ (File size limit exceeded)"
     609        };
     610
     611        if (signum <= _TOP_SIGNAL) {
     612                return (char *) sigstrings[signum];
     613        }
     614
     615        return (char *) "ERROR, Invalid signal number";
     616}
     617
    572618/** @}
    573619 */
Note: See TracChangeset for help on using the changeset viewer.