OpenDNSSEC-signer  1.3.16
Macros | Typedefs | Functions
locks.h File Reference
#include "config.h"
#include "shared/log.h"
#include <errno.h>
#include <stdlib.h>
Include dependency graph for locks.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LOCKED_SIGNAL_ENGINE_INIT   1
 
#define LOCKED_SIGNAL_ENGINE_RUN   2
 
#define LOCKED_SIGNAL_ENGINE_CAPTURE   3
 
#define LOCKED_SIGNAL_ENGINE_SLEEP   4
 
#define LOCKED_SCHEDULE_ENGINE_DELZONE   5
 
#define LOCKED_SCHEDULE_ENGINE_ADDZONE   6
 
#define LOCKED_SCHEDULE_ENGINE_RESCHEDULE   7
 
#define LOCKED_SCHEDULE_ENGINE_RECOVER   8
 
#define LOCKED_SIGNAL_SIGHUP   9
 
#define LOCKED_SIGNAL_SIGTERM   10
 
#define LOCKED_SIGNAL_CMD_RELOAD   11
 
#define LOCKED_SIGNAL_CMD_STOP   12
 
#define LOCKED_ZL_CMD_ZONES   13
 
#define LOCKED_ZL_CMD_UPDATE   14
 
#define LOCKED_ZL_CMD_UPDATE_ALL   15
 
#define LOCKED_ZL_CMD_SIGN   16
 
#define LOCKED_ZL_CMD_CLEAR   17
 
#define LOCKED_SCHEDULE_CMD_UPDATE   18
 
#define LOCKED_SCHEDULE_CMD_SIGN   19
 
#define LOCKED_SCHEDULE_CMD_SIGN_ALL   20
 
#define LOCKED_SCHEDULE_CMD_QUEUE   21
 
#define LOCKED_SCHEDULE_CMD_FLUSH   22
 
#define LOCKED_STATS_RRSET_SIGN   23
 
#define LOCKED_STATS_TOOLS_INPUT_START   24
 
#define LOCKED_STATS_TOOLS_INPUT_STOP   25
 
#define LOCKED_STATS_TOOLS_NSECIFY_START   26
 
#define LOCKED_STATS_TOOLS_NSECIFY_STOP   27
 
#define LOCKED_STATS_TOOLS_AUDIT_START   28
 
#define LOCKED_STATS_TOOLS_AUDIT_STOP   29
 
#define LOCKED_STATS_TOOLS_OUTPUT_START   30
 
#define LOCKED_STATS_TOOLS_OUTPUT_STOP   31
 
#define LOCKED_STATS_TOOLS_LOG   32
 
#define LOCKED_STATS_ZONE_RECOVER   33
 
#define LOCKED_ZONE_CMD_UPDATE   34
 
#define LOCKED_ZONE_CMD_SIGN   35
 
#define LOCKED_ZONE_CMD_CLEAR   36
 
#define LOCKED_ZONE_ENGINE_DELZONE   37
 
#define LOCKED_ZONE_ENGINE_ADDZONE   38
 
#define LOCKED_ZONE_ENGINE_UPDZONE   39
 
#define LOCKED_WORKER_INIT   50
 
#define LOCKED_WORKER_SIGN   51
 
#define LOCKED_WORKER_SLEEP   52
 
#define LOCKED_WORKER_SLEEP_UNLESS   53
 
#define LOCKED_WORKER_WAKEUP   54
 
#define LOCKED_ZL_ENGINE_UPDATEZONES   60
 
#define LOCKED_ZL_ENGINE_RECOVER   61
 
#define LOCKED_Q_WORKER(x)   (300+x)
 
#define LOCKED_Q_DRUDGER(x)   (400+x)
 
#define LOCKED_SCHEDULE_WORKER(x)   (500+x)
 
#define LOCKED_WORKER_RRSET(x)   (600+x)
 
#define LOCKED_WORKER_DRUDGER(x)   (700+x)
 
#define LOCKED_ZONE_WORKER(x)   (800+x)
 
#define LOCKED_STATS_WORKER(x)   (900+x)
 
#define LOCKED_SLEEP_WORKER(x)   (1000+x)
 
#define LOCKED_SLEEP_DRUDGER(x)   (1100+x)
 
#define LOCKRET(func)
 
#define PTHREADS_DISABLED   1
 
#define lock_basic_init(lock)   /* nop */
 
#define lock_basic_destroy(lock)   /* nop */
 
#define lock_basic_lock(lock)   /* nop */
 
#define lock_basic_unlock(lock)   /* nop */
 
#define lock_basic_set(cond)   /* nop */
 
#define lock_basic_sleep(cond, lock, sleep)   /* nop */
 
#define lock_basic_alarm(cond)   /* nop */
 
#define lock_basic_broadcast(cond)   /* nop */
 
#define lock_basic_off(cond)   /* nop */
 
#define ods_thread_create(thr, func, arg)   ods_thr_fork_create(thr, func, arg)
 
#define ods_thread_detach(thr)   /* nop */
 
#define ods_thread_self()   getpid()
 
#define ods_thread_join(thr)   ods_thr_fork_wait(thr)
 

Typedefs

typedef int lock_basic_type
 
typedef pid_t ods_thread_type
 

Functions

void ods_thr_fork_create (ods_thread_type *thr, void *(*func)(void *), void *arg)
 
void ods_thr_fork_wait (ods_thread_type thread)
 
void ods_thread_blocksigs (void)
 

Macro Definition Documentation

#define lock_basic_alarm (   cond)    /* nop */

Definition at line 159 of file locks.h.

Referenced by signal_handler(), worker_notify(), and worker_wakeup().

#define lock_basic_broadcast (   cond)    /* nop */

Definition at line 160 of file locks.h.

Referenced by fifoq_pop(), fifoq_push(), and worker_notify_all().

#define lock_basic_destroy (   lock)    /* nop */
#define lock_basic_init (   lock)    /* nop */
#define lock_basic_lock (   lock)    /* nop */
#define lock_basic_off (   cond)    /* nop */

Definition at line 161 of file locks.h.

Referenced by engine_cleanup(), fifoq_cleanup(), and worker_cleanup().

#define lock_basic_set (   cond)    /* nop */

Definition at line 157 of file locks.h.

Referenced by fifoq_create(), and worker_create().

#define lock_basic_sleep (   cond,
  lock,
  sleep 
)    /* nop */
#define lock_basic_unlock (   lock)    /* nop */
#define LOCKED_Q_DRUDGER (   x)    (400+x)

Definition at line 93 of file locks.h.

#define LOCKED_Q_WORKER (   x)    (300+x)

Definition at line 92 of file locks.h.

Referenced by rrset_queue().

#define LOCKED_SCHEDULE_CMD_FLUSH   22

Definition at line 64 of file locks.h.

#define LOCKED_SCHEDULE_CMD_QUEUE   21

Definition at line 63 of file locks.h.

#define LOCKED_SCHEDULE_CMD_SIGN   19

Definition at line 61 of file locks.h.

#define LOCKED_SCHEDULE_CMD_SIGN_ALL   20

Definition at line 62 of file locks.h.

#define LOCKED_SCHEDULE_CMD_UPDATE   18

Definition at line 60 of file locks.h.

#define LOCKED_SCHEDULE_ENGINE_ADDZONE   6

Definition at line 48 of file locks.h.

Referenced by engine_update_zones().

#define LOCKED_SCHEDULE_ENGINE_DELZONE   5

Definition at line 47 of file locks.h.

Referenced by engine_update_zones().

#define LOCKED_SCHEDULE_ENGINE_RECOVER   8

Definition at line 50 of file locks.h.

#define LOCKED_SCHEDULE_ENGINE_RESCHEDULE   7

Definition at line 49 of file locks.h.

Referenced by engine_update_zones().

#define LOCKED_SCHEDULE_WORKER (   x)    (500+x)

Definition at line 94 of file locks.h.

#define LOCKED_SIGNAL_CMD_RELOAD   11

Definition at line 53 of file locks.h.

#define LOCKED_SIGNAL_CMD_STOP   12

Definition at line 54 of file locks.h.

#define LOCKED_SIGNAL_ENGINE_CAPTURE   3

Definition at line 45 of file locks.h.

#define LOCKED_SIGNAL_ENGINE_INIT   1

Threading and locking.

Definition at line 43 of file locks.h.

#define LOCKED_SIGNAL_ENGINE_RUN   2

Definition at line 44 of file locks.h.

#define LOCKED_SIGNAL_ENGINE_SLEEP   4

Definition at line 46 of file locks.h.

#define LOCKED_SIGNAL_SIGHUP   9

Definition at line 51 of file locks.h.

Referenced by signal_handler().

#define LOCKED_SIGNAL_SIGTERM   10

Definition at line 52 of file locks.h.

Referenced by signal_handler().

#define LOCKED_SLEEP_DRUDGER (   x)    (1100+x)

Definition at line 100 of file locks.h.

#define LOCKED_SLEEP_WORKER (   x)    (1000+x)

Definition at line 99 of file locks.h.

Referenced by rrset_queue().

#define LOCKED_STATS_RRSET_SIGN   23

Definition at line 65 of file locks.h.

Referenced by rrset_sign().

#define LOCKED_STATS_TOOLS_AUDIT_START   28

Definition at line 70 of file locks.h.

Referenced by tools_audit().

#define LOCKED_STATS_TOOLS_AUDIT_STOP   29

Definition at line 71 of file locks.h.

Referenced by tools_audit().

#define LOCKED_STATS_TOOLS_INPUT_START   24

Definition at line 66 of file locks.h.

Referenced by tools_input().

#define LOCKED_STATS_TOOLS_INPUT_STOP   25

Definition at line 67 of file locks.h.

Referenced by tools_input().

#define LOCKED_STATS_TOOLS_LOG   32

Definition at line 74 of file locks.h.

Referenced by tools_output().

#define LOCKED_STATS_TOOLS_NSECIFY_START   26

Definition at line 68 of file locks.h.

Referenced by tools_nsecify().

#define LOCKED_STATS_TOOLS_NSECIFY_STOP   27

Definition at line 69 of file locks.h.

Referenced by tools_nsecify().

#define LOCKED_STATS_TOOLS_OUTPUT_START   30

Definition at line 72 of file locks.h.

Referenced by tools_output().

#define LOCKED_STATS_TOOLS_OUTPUT_STOP   31

Definition at line 73 of file locks.h.

#define LOCKED_STATS_WORKER (   x)    (900+x)

Definition at line 98 of file locks.h.

#define LOCKED_STATS_ZONE_RECOVER   33

Definition at line 75 of file locks.h.

Referenced by zone_recover().

#define LOCKED_WORKER_DRUDGER (   x)    (700+x)

Definition at line 96 of file locks.h.

#define LOCKED_WORKER_INIT   50

Definition at line 83 of file locks.h.

Referenced by worker_create().

#define LOCKED_WORKER_RRSET (   x)    (600+x)

Definition at line 95 of file locks.h.

Referenced by rrset_queue().

#define LOCKED_WORKER_SIGN   51

Definition at line 84 of file locks.h.

#define LOCKED_WORKER_SLEEP   52

Definition at line 85 of file locks.h.

Referenced by worker_sleep().

#define LOCKED_WORKER_SLEEP_UNLESS   53

Definition at line 86 of file locks.h.

Referenced by worker_sleep_unless().

#define LOCKED_WORKER_WAKEUP   54

Definition at line 87 of file locks.h.

Referenced by worker_wakeup().

#define LOCKED_ZL_CMD_CLEAR   17

Definition at line 59 of file locks.h.

#define LOCKED_ZL_CMD_SIGN   16

Definition at line 58 of file locks.h.

#define LOCKED_ZL_CMD_UPDATE   14

Definition at line 56 of file locks.h.

#define LOCKED_ZL_CMD_UPDATE_ALL   15

Definition at line 57 of file locks.h.

#define LOCKED_ZL_CMD_ZONES   13

Definition at line 55 of file locks.h.

#define LOCKED_ZL_ENGINE_RECOVER   61

Definition at line 90 of file locks.h.

#define LOCKED_ZL_ENGINE_UPDATEZONES   60

Definition at line 89 of file locks.h.

Referenced by engine_update_zones().

#define LOCKED_ZONE_CMD_CLEAR   36

Definition at line 78 of file locks.h.

#define LOCKED_ZONE_CMD_SIGN   35

Definition at line 77 of file locks.h.

#define LOCKED_ZONE_CMD_UPDATE   34

Definition at line 76 of file locks.h.

#define LOCKED_ZONE_ENGINE_ADDZONE   38

Definition at line 80 of file locks.h.

Referenced by engine_update_zones().

#define LOCKED_ZONE_ENGINE_DELZONE   37

Definition at line 79 of file locks.h.

Referenced by engine_update_zones().

#define LOCKED_ZONE_ENGINE_UPDZONE   39

Definition at line 81 of file locks.h.

Referenced by engine_update_zones().

#define LOCKED_ZONE_WORKER (   x)    (800+x)

Definition at line 97 of file locks.h.

#define LOCKRET (   func)
Value:
do { \
int err; \
if ( (err=(func)) != 0) \
ods_log_error("%s at %d could not " #func ": %s", \
__FILE__, __LINE__, strerror(err)); \
} while(0)
void ods_log_error(const char *format,...)
Definition: log.c:349

Definition at line 104 of file locks.h.

#define ods_thread_create (   thr,
  func,
  arg 
)    ods_thr_fork_create(thr, func, arg)

Definition at line 164 of file locks.h.

Referenced by cmdhandler_start(), and engine_start_drudgers().

#define ods_thread_detach (   thr)    /* nop */

Definition at line 165 of file locks.h.

Referenced by cmdhandler_start().

#define ods_thread_join (   thr)    ods_thr_fork_wait(thr)

Definition at line 167 of file locks.h.

Referenced by engine_stop_drudgers().

#define ods_thread_self ( )    getpid()

Definition at line 166 of file locks.h.

#define PTHREADS_DISABLED   1

Definition at line 149 of file locks.h.

Typedef Documentation

typedef int lock_basic_type

Definition at line 151 of file locks.h.

typedef pid_t ods_thread_type

Definition at line 163 of file locks.h.

Function Documentation

void ods_thr_fork_create ( ods_thread_type thr,
void *(*)(void *)  func,
void *  arg 
)

No threading available: fork a new process. This means no shared data structure, and no locking. Only the main thread ever returns. Exits on errors.

Parameters
thr,:the location where to store the thread-id.
func,:function body of the thread. Return value of func is lost.
arg,:user argument to func.

Definition at line 65 of file locks.c.

References ods_fatal_exit().

void ods_thr_fork_wait ( ods_thread_type  thread)

There is no threading. Wait for a process to terminate. Note that ub_thread_t is defined as pid_t.

Parameters
thread,:the process id to wait for.

Definition at line 90 of file locks.c.

References ods_log_error(), and ods_log_warning().

void ods_thread_blocksigs ( void  )

Definition at line 150 of file locks.c.

References ods_fatal_exit().