Back to index

glibc  2.9
Defines | Functions | Variables
strsignal.c File Reference
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libintl.h>
#include <bits/libc-lock.h>

Go to the source code of this file.


#define BUFFERSIZ   100


static void init (void)
static void free_key_mem (void *mem)
static char * getbuffer (void)
char * strsignal (int signum)


const char *const _sys_siglist []
const char *const
static __libc_key_t key
static char local_buf [BUFFERSIZ]
static char * static_buf

Define Documentation

#define BUFFERSIZ   100

Definition at line 34 of file strsignal.c.

Function Documentation

static void free_key_mem ( void *  mem) [static]

Definition at line 97 of file strsignal.c.

static char * getbuffer ( void  ) [static]

Definition at line 106 of file strsignal.c.

  char *result;

  if (static_buf != NULL)
    result = static_buf;
      /* We don't use the static buffer and so we have a key.  Use it
        to get the thread-specific buffer.  */
      result = __libc_getspecific (key);
      if (result == NULL)
         /* No buffer allocated so far.  */
         result = malloc (BUFFERSIZ);
         if (result == NULL)
           /* No more memory available.  We use the static buffer.  */
           result = local_buf;
           __libc_setspecific (key, result);

  return result;

Here is the caller graph for this function:

static void init ( void  ) [static]
char* strsignal ( int  signum)

Definition at line 46 of file strsignal.c.

  __libc_once_define (static, once);
  const char *desc;

  /* If we have not yet initialized the buffer do it now.  */
  __libc_once (once, init);

  if (
      (signum >= SIGRTMIN && signum <= SIGRTMAX) ||
      signum < 0 || signum >= NSIG
      || (desc = INTUSE(_sys_siglist)[signum]) == NULL)
      char *buffer = getbuffer ();
      int len;
      if (signum >= SIGRTMIN && signum <= SIGRTMAX)
       len = __snprintf (buffer, BUFFERSIZ - 1, _("Real-time signal %d"),
                       signum - SIGRTMIN);
       len = __snprintf (buffer, BUFFERSIZ - 1, _("Unknown signal %d"),
      if (len >= BUFFERSIZ)
       buffer = NULL;
       buffer[len] = '\0';

      return buffer;

  return (char *) _(desc);

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

Definition at line 24 of file siglist.c.

const char* const _sys_siglist_internal [] attribute_hidden

Definition at line 25 of file init-first.c.

__libc_key_t key [static]

Definition at line 30 of file strsignal.c.

char local_buf[BUFFERSIZ] [static]

Definition at line 35 of file strsignal.c.

char* static_buf [static]

Definition at line 36 of file strsignal.c.