eCosTM Reference Manual
Prev | Chapter 19. Package: C Library | Next

# Component: Signals

#### Macro name

CYGPKG_LIBC_SIGNALS

#### Type

Boolean

#### Description

This component controls signal functionality, as implemented in ISO C chapter 7.7 with the signal() and raise() functions. As well as allowing a program to send itself signals, it is also possible to cause hardware exceptions to be signalled to the program in a similar way.

## Option: Thread safe signals

#### Macro name

CYGSEM_LIBC_SIGNALS_THREAD_SAFE

#### Type

Boolean

#### Description

Because signal handlers are global, and not thread-specific (as mandated by POSIX 1003.1) it is possible for multiple threads to clash and corrupt data if setting the same signal handler at the same time. With this option enabled, a kernel mutex will be used to protect the shared data.

## Component: Hardware exceptions cause signals

#### Macro name

CYGSEM_LIBC_SIGNALS_HWEXCEPTIONS

#### Type

Boolean

#### Description

This causes hardware exceptions like arithmetic exceptions (e.g. divide by zero) or bad memory accesses to be passed through as signals. It is thus possible for a program to handle these exceptions in a generic way using the appropriate signal handlers. The details of exactly which exceptions are passed through under what circumstances depend on the underlying HAL implementation. Consequently it must be remembered that signal handlers cannot be guaranteed to be invoked in the expected circumstances if you do not know about the underlying HAL implementation - it is possible that the architecture is unable to detect that exception.

### Option: Chain old exception handlers

#### Macro name

CYGSEM_LIBC_SIGNALS_CHAIN_HWEXCEPTIONS

#### Type

Boolean

#### Description

When hardware exceptions are generated, it is possible to chain into the old kernel exception handler before calling any registered signal handler. If this is not required, disable this option and only the signal handler will be called when this exception occurs. Disabling this option will also save some space and code usage.

## Component: Inline versions of functions

#### Macro name

CYGPKG_LIBC_SIGNALS_INLINE

#### Type

Dummy

#### Description

Some functions can be made inline instead of being function calls. These can be set here.

### Option: raise()

#### Macro name

CYGIMP_LIBC_SIGNALS_RAISE_INLINE

#### Type

Boolean

#### Description

Enabling this option makes raise() an inline function.

### Option: signal()

#### Macro name

CYGIMP_LIBC_SIGNALS_SIGNAL_INLINE

#### Type

Boolean

#### Description

Enabling this option makes signal() an inline function.

## Component: Error handling

#### Macro name

CYGPKG_LIBC_SIGNALS_ERROR_HANDLING

#### Type

Dummy

#### Description

You may or may not want errno to be set by certain functions. Not using errno could save both space, code, and avoid worrying about interactions between multiple threads when setting it.

### Option: Bad signal fatal

#### Macro name

CYGSEM_LIBC_SIGNALS_BAD_SIGNAL_FATAL

#### Type

Boolean

#### Description

Enabling this option will cause an assertion failure if the signal handling code is passed a bad signal. Otherwise an error will be returned, or in the case of a hardware-generated exception it will be silently ignored.

### Option: raise() sets errno

#### Macro name

CYGSEM_LIBC_SIGNALS_RAISE_SETS_ERRNO

#### Type

Boolean

#### Description

You may or may not want errno to be set by raise() on error conditions. Not using errno could save both space, code, and avoid worrying about interactions between multiple threads when setting it. Strictly ISO C does not mandate that errno be set by raise().

### Option: signal() sets errno

#### Macro name

CYGSEM_LIBC_SIGNALS_SIGNAL_SETS_ERRNO

#### Type

Boolean

#### Description

You may or may not want errno to be set by signal() on error conditions. Not using errno could save both space, code, and avoid worrying about interactions between multiple threads when setting it. Strictly ISO C mandates that errno be set by signal().

## Component: Tracing

#### Macro name

CYGPKG_LIBC_SIGNALS_TRACING

#### Type

Dummy

#### Description

These options control the trace output for the C library internal signal implementation.

### Option: Default trace level for raise()

#### Macro name

CYGNUM_LIBC_SIGNALS_RAISE_TRACE_LEVEL

#### Type

Count

#### Description

This gives the default tracing level for the raise() function. Higher numbers are more verbose.

### Option: Default hardware exception handler trace level

#### Macro name

CYGNUM_LIBC_SIGNALS_HWHANDLER_TRACE_LEVEL

#### Type

Count

#### Description

This gives the default tracing level for the hardware exception handler function (if enabled). Higher numbers are more verbose.

Prev | Home | Next
Option: Size of locale name strings | Up | Component: ISO C startup/termination