Loading...
Searching...
No Matches
Intra-application signals

Generic signalling/notification infrastructure. More...

## Files

file | signal.h
file | signal.c
| Generic signalling/notification infrastructure.

## Data Structures

struct | signal_handler

## Macros

#define | OSMO_SIGNAL_SS_APPS 0
| subsystem signaling numbers: we split the numberspace for applications and libraries: from 0 to UINT_MAX/2 for applications, from UINT_MAX/2 to UINT_MAX for libraries.
#define | OSMO_SIGNAL_SS_RESERVED 2147483648u
#define | OSMO_SIGNAL_T_APPS 0
#define | OSMO_SIGNAL_T_RESERVED 2147483648u

## Typedefs

typedef int | osmo_signal_cbfn(unsigned int subsys, unsigned int signal, void *handler_data, void *signal_data)
| signal callback function type

## Enumerations

enum | { SS_L_GLOBAL = OSMO_SIGNAL_SS_RESERVED , SS_L_INPUT , SS_L_NS , SS_L_VTY }
| signal subsystems More...
enum | { S_L_GLOBAL_SHUTDOWN = OSMO_SIGNAL_T_RESERVED }
| signal types. More...

## Functions

void * | osmo_signal_talloc_ctx_init (void *root_ctx)
| Initialize a signal_handler talloc context for osmo_signal_register_handler.
int | osmo_signal_register_handler (unsigned int subsys, osmo_signal_cbfn *cbfn, void *data)
| Register a new signal handler.
void | osmo_signal_unregister_handler (unsigned int subsys, osmo_signal_cbfn *cbfn, void *data)
| Unregister signal handler.
void | osmo_signal_dispatch (unsigned int subsys, unsigned int signal, void *signal_data)
| dispatch (deliver) a new signal to all registered handlers
static | LLIST_HEAD (signal_handler_list)

## Variables

void * | tall_sigh_ctx

## Detailed Description

Generic signalling/notification infrastructure.

## Macro Definition Documentation

## OSMO_SIGNAL_SS_APPS

#define OSMO_SIGNAL_SS_APPS 0

subsystem signaling numbers: we split the numberspace for applications and libraries: from 0 to UINT_MAX/2 for applications, from UINT_MAX/2 to UINT_MAX for libraries.

## OSMO_SIGNAL_SS_RESERVED

#define OSMO_SIGNAL_SS_RESERVED 2147483648u

## OSMO_SIGNAL_T_APPS

#define OSMO_SIGNAL_T_APPS 0

## OSMO_SIGNAL_T_RESERVED

#define OSMO_SIGNAL_T_RESERVED 2147483648u

## Typedef Documentation

## osmo_signal_cbfn

typedef int osmo_signal_cbfn(unsigned int subsys, unsigned int signal, void *handler_data, void *signal_data)

signal callback function type

## Enumeration Type Documentation

## anonymous enum

anonymous enum

signal subsystems

Enumerator
SS_L_GLOBAL |
SS_L_INPUT |
SS_L_NS |
SS_L_VTY |

## anonymous enum

anonymous enum

signal types.

Enumerator
S_L_GLOBAL_SHUTDOWN |

## Function Documentation

## LLIST_HEAD()

LLIST_HEAD | ( | signal_handler_list |  | ) |

static

## osmo_signal_dispatch()

void osmo_signal_dispatch | ( | unsigned int | subsys,
|  | unsigned int | signal,
|  | void * | signal_data )

dispatch (deliver) a new signal to all registered handlers

Parameters

  [in] | subsys | Subsystem number
  [in] | signal | Signal number,
  [in] | signal_data | Data to be passed along to handlers

References signal_handler::cbfn, signal_handler::data, signal_handler::entry, llist_for_each_entry, signal_handler::subsys, and subsys.

## osmo_signal_register_handler()

int osmo_signal_register_handler | ( | unsigned int | subsys,
|  | osmo_signal_cbfn * | cbfn,
|  | void * | data )

Register a new signal handler.

Parameters

  [in] | subsys | Subsystem number
  [in] | cbfn | Callback function
  [in] | data | Data passed through to callback

Returns
  0 on success; negative in case of error

References signal_handler::cbfn, signal_handler::data, signal_handler::entry, llist_add_tail(), signal_handler::subsys, subsys, and tall_sigh_ctx.

## osmo_signal_talloc_ctx_init()

void * osmo_signal_talloc_ctx_init | ( | void * | root_ctx | ) |

Initialize a signal_handler talloc context for osmo_signal_register_handler.

Create a talloc context called "osmo_signal".

Parameters

  [in] | root_ctx | talloc context used as parent for the new "osmo_signal" ctx.

Returns
  the new osmo_signal talloc context, e.g. for reporting

References tall_sigh_ctx.

## osmo_signal_unregister_handler()

void osmo_signal_unregister_handler | ( | unsigned int | subsys,
|  | osmo_signal_cbfn * | cbfn,
|  | void * | data )

Unregister signal handler.

Parameters

  [in] | subsys | Subsystem number
  [in] | cbfn | Callback function
  [in] | data | Data passed through to callback

References signal_handler::cbfn, signal_handler::data, signal_handler::entry, llist_del(), llist_for_each_entry, signal_handler::subsys, and subsys.

## Variable Documentation

## tall_sigh_ctx

void* tall_sigh_ctx

Referenced by osmo_signal_register_handler(), and osmo_signal_talloc_ctx_init().