Welcome to mirror list, hosted at ThFree Co, Russian Federation.

strsignal.c « linux « sys « libc « newlib - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3f95e18a786b63c1194172311b99f71ccfbf455b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <string.h>
#include <signal.h>
#include <stdio.h>
#include <reent.h>

static const char *sigstring[] =
  {
    "Signal 0",
    "Hangup",
    "Interrupt",
    "Quit",
    "Illegal instruction",
    "Trace/breakpoint trap",
    "IOT trap",
    "EMT trap",
    "Floating point exception",
    "Killed",
    "Bus error",
    "Segmentation fault",
    "Bad system call",
    "Broken pipe",
    "Alarm clock",
    "Terminated",
    "Urgent I/O condition",
    "Stopped (signal)",
    "Stopped",
    "Continued",
    "Child exited",
    "Stopped (tty input)",
    "Stopped (tty output)",
    "I/O possible",
    "CPU time limit exceeded",
    "File size limit exceeded",
    "Virtual timer expired",
    "Profiling timer expired",
    "Window changed",
    "Resource lost",
    "User defined signal 1",
    "User defined signal 2"
  };

char *
strsignal (int sig)
{
  if (sig < 0 || sig >= __SIGRTMIN)
    {
      char *buffer;
      struct _reent *ptr;

      ptr = _REENT;

      _REENT_CHECK_SIGNAL_BUF(ptr);
      buffer = _REENT_SIGNAL_BUF(ptr);

      if (sig < 0 || sig > __SIGRTMAX)
        siprintf (buffer, "Unknown signal %d", sig);
      else
        siprintf (buffer, "Real-time signal %d", sig - __SIGRTMIN);
      return buffer;
    }
  else
    return sigstring[sig];
}