MistServer  2.5.3-Pro-19-gf5e75b1 ( Generic_64)
defines.h
Go to the documentation of this file.
1 #pragma once
2 // Defines to print debug messages.
3 #ifndef MIST_DEBUG
4 #define MIST_DEBUG 1
5 #define DLVL_NONE 0 // All debugging disabled.
6 #define DLVL_FAIL 1 // Only messages about failed operations.
7 #define DLVL_ERROR 2 // Only messages about errors and failed operations.
8 #define DLVL_WARN 3 // Warnings, errors, and fail messages.
9 #define DLVL_DEVEL 4 // All of the above, plus status messages handy during development.
10 #define DLVL_INFO 4 // All of the above, plus status messages handy during development.
11 #define DLVL_MEDIUM 5 // Slightly more than just development-level messages.
12 #define DLVL_HIGH 6 // Verbose debugging messages.
13 #define DLVL_VERYHIGH 7 // Very verbose debugging messages.
14 #define DLVL_EXTREME 8 // Everything is reported in extreme detail.
15 #define DLVL_INSANE 9 // Everything is reported in insane detail.
16 #define DLVL_DONTEVEN 10 // All messages enabled, even pointless ones.
17 #if DEBUG > -1
18 
19 #include <stdio.h>
20 #include <unistd.h>
21 #include "config.h"
22 static const char * DBG_LVL_LIST[] = {"NONE", "FAIL", "ERROR", "WARN", "INFO", "MEDIUM", "HIGH", "VERYHIGH", "EXTREME", "INSANE", "DONTEVEN"};
23 
24 #if !defined(__APPLE__) && !defined(__MACH__) && defined(__GNUC__)
25 #include <errno.h>
26 
27 #if DEBUG >= DLVL_DEVEL
28 #define DEBUG_MSG(lvl, msg, ...) if (Util::Config::printDebugLevel >= lvl){fprintf(stderr, "%s|%s|%d|%s:%d|" msg "\n", DBG_LVL_LIST[lvl], program_invocation_short_name, getpid(), __FILE__, __LINE__, ##__VA_ARGS__);}
29 #else
30 #define DEBUG_MSG(lvl, msg, ...) if (Util::Config::printDebugLevel >= lvl){fprintf(stderr, "%s|%s|%d||" msg "\n", DBG_LVL_LIST[lvl], program_invocation_short_name, getpid(), ##__VA_ARGS__);}
31 #endif
32 #else
33 #if DEBUG >= DLVL_DEVEL
34 #define DEBUG_MSG(lvl, msg, ...) if (Util::Config::printDebugLevel >= lvl){fprintf(stderr, "%s||%d|%s:%d|" msg "\n", DBG_LVL_LIST[lvl], getpid(), __FILE__, __LINE__, ##__VA_ARGS__);}
35 #else
36 #define DEBUG_MSG(lvl, msg, ...) if (Util::Config::printDebugLevel >= lvl){fprintf(stderr, "%s||%d||" msg "\n", DBG_LVL_LIST[lvl], getpid(), ##__VA_ARGS__);}
37 #endif
38 #endif
39 
40 #else
41 
42 #define DEBUG_MSG(lvl, msg, ...) // Debugging disabled.
43 
44 #endif
45 
46 #define FAIL_MSG(msg, ...) DEBUG_MSG(DLVL_FAIL, msg, ##__VA_ARGS__)
47 #define ERROR_MSG(msg, ...) DEBUG_MSG(DLVL_ERROR, msg, ##__VA_ARGS__)
48 #define WARN_MSG(msg, ...) DEBUG_MSG(DLVL_WARN, msg, ##__VA_ARGS__)
49 #define DEVEL_MSG(msg, ...) DEBUG_MSG(DLVL_DEVEL, msg, ##__VA_ARGS__)
50 #define INFO_MSG(msg, ...) DEBUG_MSG(DLVL_DEVEL, msg, ##__VA_ARGS__)
51 #define MEDIUM_MSG(msg, ...) DEBUG_MSG(DLVL_MEDIUM, msg, ##__VA_ARGS__)
52 #define HIGH_MSG(msg, ...) DEBUG_MSG(DLVL_HIGH, msg, ##__VA_ARGS__)
53 #define VERYHIGH_MSG(msg, ...) DEBUG_MSG(DLVL_VERYHIGH, msg, ##__VA_ARGS__)
54 #define EXTREME_MSG(msg, ...) DEBUG_MSG(DLVL_EXTREME, msg, ##__VA_ARGS__)
55 #define INSANE_MSG(msg, ...) DEBUG_MSG(DLVL_INSANE, msg, ##__VA_ARGS__)
56 #define DONTEVEN_MSG(msg, ...) DEBUG_MSG(DLVL_DONTEVEN, msg, ##__VA_ARGS__)
57 
58 #endif
59 
61 #define DEFAULT_META_PAGE_SIZE 16 * 1024 * 1024
62 
64 #define DEFAULT_DATA_PAGE_SIZE 25 * 1024 * 1024
65 
67 #define DEFAULT_CONF_PAGE_SIZE 4 * 1024 * 1024
68 
70 #define FLIP_DATA_PAGE_SIZE 8 * 1024 * 1024
71 
72 #define SHM_STREAM_INDEX "MstSTRM%s" //%s stream name
73 #define SHM_TRACK_META "MstTRAK%s@%lu" //%s stream name, %lu track ID
74 #define SHM_TRACK_INDEX "MstTRID%s@%lu" //%s stream name, %lu track ID
75 #define SHM_TRACK_DATA "MstDATA%s@%lu_%lu" //%s stream name, %lu track ID, %lu page #
76 #define SHM_STATISTICS "MstSTAT"
77 #define SHM_USERS "MstUSER%s" //%s stream name
78 #define SHM_TRIGGER "MstTRIG%s" //%s trigger name
79 #define SEM_LIVE "MstLIVE%s" //%s stream name
80 #define NAME_BUFFER_SIZE 200 //char buffer size for snprintf'ing shm filenames
81 
82 #define SHM_STREAM_ENCRYPT "MstCRYP%s" //%s stream name
83 
84 #define SIMUL_TRACKS 10
85 
static const char * DBG_LVL_LIST[]
Definition: defines.h:22