summaryrefslogtreecommitdiffstats
path: root/server/util/util.h
blob: bb5526e4860ecbad1d6e9e368410cd79fb804d23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef __SSSD_UTIL_H__
#define __SSSD_UTIL_H__

#include <stdio.h>
#include <stdbool.h>
#include "replace.h"
#include "talloc.h"

extern int debug_level;
void debug_fn(const char *format, ...);

#define DEBUG(level, body) do { \
    if (level <= debug_level) { \
        debug_fn("%s[%s]: ", __location__, __FUNCTION__); \
        debug_fn body; \
    } \
} while(0);
#define DEBUGADD(level, body)

#ifndef discard_const
#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
#endif

#ifndef NULL
#define NULL 0
#endif

#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))

#define PID_DIR "/var/run/sssd"

#define EOK 0

#include "util/dlinklist.h"

/* from become_daemon.c */
void become_daemon(bool Fork);

/* from signal.c */
#include <signal.h>
void BlockSignals(bool block, int signum);
void (*CatchSignal(int signum,void (*handler)(int )))(int);
void CatchChild(void);
void CatchChildLeaveStatus(void);

/* from memory.c */
TALLOC_CTX *sssd_mem_takeover(TALLOC_CTX *mem_ctx,
                              void *ptr,
                              int (*destructor)(void **));

#endif /* __SSSD_UTIL_H__ */