Ruby  2.5.0dev(2017-10-22revision60238)
Data Structures | Macros | Typedefs | Functions | Variables
signal.c File Reference
#include "internal.h"
#include "vm_core.h"
#include <signal.h>
#include <stdio.h>
#include <errno.h>
#include "ruby_atomic.h"
#include "eval_intern.h"

Go to the source code of this file.

Data Structures

struct  signals
 

Macros

#define VALGRIND_MAKE_MEM_DEFINED(p, n)   0
 
#define VALGRIND_MAKE_MEM_UNDEFINED(p, n)   0
 
#define id_signo   ruby_static_id_signo
 
#define killpg(pg, sig)   kill(-(pg), (sig))
 
#define sighandler_t   ruby_sighandler_t
 
#define SIGINFO_ARG
 
#define SIGINFO_CTX   0
 
#define ruby_signal(sig, handler)   (/* rb_trap_accept_nativethreads[(sig)] = 0,*/ signal((sig),(handler)))
 
#define clear_received_signal()   ((void)0)
 
#define CHECK_STACK_OVERFLOW()   (void)0
 
#define MESSAGE_FAULT_ADDRESS
 
#define INSTALL_SIGHANDLER(cond, signame, signum)
 
#define install_sighandler(signum, handler)   INSTALL_SIGHANDLER(install_sighandler(signum, handler), #signum, signum)
 

Typedefs

typedef RETSIGTYPE(* sighandler_t) (int)
 
typedef RETSIGTYPE ruby_sigaction_t(int)
 

Functions

rb_atomic_t ruby_atomic_exchange (rb_atomic_t *ptr, rb_atomic_t val)
 
rb_atomic_t ruby_atomic_compare_and_swap (rb_atomic_t *ptr, rb_atomic_t cmp, rb_atomic_t newval)
 
const char * ruby_signal_name (int no)
 
void ruby_default_signal (int sig)
 
VALUE rb_f_kill (int argc, const VALUE *argv)
 
int rb_signal_buff_size (void)
 
int rb_get_next_signal (void)
 
void rb_trap_exit (void)
 
void rb_signal_exec (rb_thread_t *th, int sig)
 
void ruby_sig_finalize (void)
 
void Init_signal (void)
 

Variables

ID ruby_static_id_signo
 
int ruby_enable_coredump = 0
 

Macro Definition Documentation

◆ CHECK_STACK_OVERFLOW

#define CHECK_STACK_OVERFLOW ( )    (void)0

Definition at line 882 of file signal.c.

◆ clear_received_signal

#define clear_received_signal ( )    ((void)0)

Definition at line 762 of file signal.c.

◆ id_signo

#define id_signo   ruby_static_id_signo

Definition at line 49 of file signal.c.

◆ INSTALL_SIGHANDLER

#define INSTALL_SIGHANDLER (   cond,
  signame,
  signum 
)
Value:
do { \
static const char failed[] = "failed to install "signame" handler"; \
if (!(cond)) break; \
if (reserved_signal_p(signum)) rb_bug(failed); \
perror(failed); \
} while (0)
void rb_bug(const char *fmt,...)
Definition: error.c:521
#define cond(node, column)
Definition: ripper.c:653

Definition at line 1391 of file signal.c.

◆ install_sighandler

#define install_sighandler (   signum,
  handler 
)    INSTALL_SIGHANDLER(install_sighandler(signum, handler), #signum, signum)

Definition at line 1411 of file signal.c.

◆ killpg

#define killpg (   pg,
  sig 
)    kill(-(pg), (sig))

◆ MESSAGE_FAULT_ADDRESS

#define MESSAGE_FAULT_ADDRESS

Definition at line 885 of file signal.c.

◆ ruby_signal

#define ruby_signal (   sig,
  handler 
)    (/* rb_trap_accept_nativethreads[(sig)] = 0,*/ signal((sig),(handler)))

Definition at line 657 of file signal.c.

Referenced by ruby_sig_finalize().

◆ sighandler_t

#define sighandler_t   ruby_sighandler_t

Definition at line 532 of file signal.c.

Referenced by ruby_sig_finalize().

◆ SIGINFO_ARG

#define SIGINFO_ARG

Definition at line 542 of file signal.c.

◆ SIGINFO_CTX

#define SIGINFO_CTX   0

Definition at line 543 of file signal.c.

◆ VALGRIND_MAKE_MEM_DEFINED

#define VALGRIND_MAKE_MEM_DEFINED (   p,
 
)    0

Definition at line 40 of file signal.c.

◆ VALGRIND_MAKE_MEM_UNDEFINED

#define VALGRIND_MAKE_MEM_UNDEFINED (   p,
 
)    0

Definition at line 41 of file signal.c.

Typedef Documentation

◆ ruby_sigaction_t

typedef RETSIGTYPE ruby_sigaction_t(int)

Definition at line 541 of file signal.c.

◆ sighandler_t

typedef RETSIGTYPE(* sighandler_t) (int)

Definition at line 535 of file signal.c.

Function Documentation

◆ Init_signal()

void Init_signal ( void  )

Definition at line 1489 of file signal.c.

References rb_define_global_function(), and rb_define_module().

◆ rb_f_kill()

VALUE rb_f_kill ( int  argc,
const VALUE argv 
)

◆ rb_get_next_signal()

int rb_get_next_signal ( void  )

Definition at line 741 of file signal.c.

◆ rb_signal_buff_size()

int rb_signal_buff_size ( void  )

Definition at line 711 of file signal.c.

Referenced by rb_thread_check_trap_pending(), and rb_threadptr_check_signal().

◆ rb_signal_exec()

void rb_signal_exec ( rb_thread_t th,
int  sig 
)

◆ rb_trap_exit()

void rb_trap_exit ( void  )

Definition at line 1024 of file signal.c.

References rb_vm_struct::cmd, GET_VM, and rb_vm_struct::trap_list.

◆ ruby_atomic_compare_and_swap()

rb_atomic_t ruby_atomic_compare_and_swap ( rb_atomic_t ptr,
rb_atomic_t  cmp,
rb_atomic_t  newval 
)

Definition at line 61 of file signal.c.

◆ ruby_atomic_exchange()

rb_atomic_t ruby_atomic_exchange ( rb_atomic_t ptr,
rb_atomic_t  val 
)

Definition at line 53 of file signal.c.

References val.

◆ ruby_default_signal()

void ruby_default_signal ( int  sig)

Definition at line 360 of file signal.c.

◆ ruby_signal_name()

const char* ruby_signal_name ( int  no)

Definition at line 262 of file signal.c.

Variable Documentation

◆ cnt

◆ ruby_enable_coredump

int ruby_enable_coredump = 0

Definition at line 1449 of file signal.c.

Referenced by ruby_env_debug_option().

◆ ruby_static_id_signo

ID ruby_static_id_signo

Definition at line 27 of file eval.c.

◆ size

Definition at line 526 of file signal.c.