redmine

Code cleaning

* "#ifdef PARANOID" is used to isolate too paranoid code
* Added instant thread_gc after any thread exit
* doxygen support improved
* "DEVELOPING" is updated due to doxygen support
... ... @@ -115,7 +115,7 @@ ALWAYS_DETAILED_SEC = NO
# members were ordinary class members. Constructors, destructors and assignment
# operators of the base classes will not be shown.
INLINE_INHERITED_MEMB = NO
INLINE_INHERITED_MEMB = YES
# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
# path before files name in the file list and in the header files. If set
... ... @@ -356,17 +356,17 @@ EXTRACT_ALL = YES
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
EXTRACT_PRIVATE = NO
EXTRACT_PRIVATE = YES
# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
# scope will be included in the documentation.
EXTRACT_PACKAGE = NO
EXTRACT_PACKAGE = YES
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC = NO
EXTRACT_STATIC = YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
... ... @@ -379,7 +379,7 @@ EXTRACT_LOCAL_CLASSES = YES
# the interface are included in the documentation.
# If set to NO (the default) only methods in the interface are included.
EXTRACT_LOCAL_METHODS = NO
EXTRACT_LOCAL_METHODS = YES
# If this flag is set to YES, the members of anonymous namespaces will be
# extracted and appear in the documentation as a namespace called
... ... @@ -387,7 +387,7 @@ EXTRACT_LOCAL_METHODS = NO
# name of the file that contains the anonymous namespace. By default
# anonymous namespaces are hidden.
EXTRACT_ANON_NSPACES = NO
EXTRACT_ANON_NSPACES = YES
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
... ... @@ -423,7 +423,7 @@ HIDE_IN_BODY_DOCS = NO
# to NO (the default) then the documentation will be excluded.
# Set it to YES to include the internal documentation.
INTERNAL_DOCS = NO
INTERNAL_DOCS = YES
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
# file names in lower-case letters. If set to YES upper-case letters are also
... ... @@ -708,7 +708,7 @@ EXCLUDE_PATTERNS =
# wildcard * is used, a substring. Examples: ANamespace, AClass,
# AClass::ANamespace, ANamespace::*Test
EXCLUDE_SYMBOLS =
EXCLUDE_SYMBOLS = printf_e xmalloc xcalloc xrealloc
# The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see
... ... @@ -1573,7 +1573,7 @@ MACRO_EXPANSION = YES
# then the macro expansion is limited to the macros specified with the
# PREDEFINED and EXPAND_AS_DEFINED tags.
EXPAND_ONLY_PREDEF = YES
EXPAND_ONLY_PREDEF = NO
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
# pointed to by INCLUDE_PATH will be searched when a #include is found.
... ... @@ -1584,7 +1584,7 @@ SEARCH_INCLUDES = YES
# contain include files that are not input files but should be processed by
# the preprocessor.
INCLUDE_PATH =
INCLUDE_PATH =
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
... ... @@ -1616,7 +1616,7 @@ EXPAND_AS_DEFINED =
# that are alone on a line, have an all uppercase name, and do not end with a
# semicolon, because these will confuse the parser if not removed.
SKIP_FUNCTION_MACROS = YES
SKIP_FUNCTION_MACROS = NO
#---------------------------------------------------------------------------
# Configuration::additions related to external references
... ... @@ -1690,14 +1690,14 @@ MSCGEN_PATH =
# inheritance and usage relations if the target is undocumented
# or is not a class.
HIDE_UNDOC_RELATIONS = YES
HIDE_UNDOC_RELATIONS = NO
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
# available from the path. This tool is part of Graphviz, a graph visualization
# toolkit from AT&T and Lucent Bell Labs. The other options in this section
# have no effect if this option is set to NO (the default)
HAVE_DOT = NO
HAVE_DOT = YES
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
# allowed to run in parallel. When set to 0 (the default) doxygen will
... ... @@ -1786,7 +1786,7 @@ INCLUDED_BY_GRAPH = YES
# the time of a run. So in most cases it will be better to enable call graphs
# for selected functions only using the \callgraph command.
CALL_GRAPH = NO
CALL_GRAPH = YES
# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
# doxygen will generate a caller dependency graph for every global function
... ... @@ -1794,7 +1794,7 @@ CALL_GRAPH = NO
# the time of a run. So in most cases it will be better to enable caller
# graphs for selected functions only using the \callergraph command.
CALLER_GRAPH = NO
CALLER_GRAPH = YES
# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
# will generate a graphical hierarchy of all classes instead of a textual one.
... ... @@ -1823,7 +1823,7 @@ DOT_IMAGE_FORMAT = png
# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
# visible. Older versions of IE do not have SVG support.
INTERACTIVE_SVG = NO
INTERACTIVE_SVG = YES
# The tag DOT_PATH can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found in the path.
... ... @@ -1868,7 +1868,7 @@ MAX_DOT_GRAPH_DEPTH = 0
# enabling this option may lead to badly anti-aliased labels on the edges of
# a graph (i.e. they become hard to read).
DOT_TRANSPARENT = NO
DOT_TRANSPARENT = YES
# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
# files in one run (i.e. multiple -o and -T options on the command line). This
... ...
... ... @@ -2,6 +2,16 @@
This documentation may be outdated. Sorry if it's so :(
First of all, I recommend you to read the manpage
with "man ./man/man1/clsync.1".
After that, I recommend you to run command "make doc" and look at images
"./doc/html/main_8c_a0ddf1224851353fc92bfbff6f499fa97_cgraph.png" and
"./doc/html/sync_8c_a17e305f0a75e2fe51192f250ef9c4d80_icgraph.png"
The syncing is proceeding on "__sync_exec()" on this image. ;)
Here's very short description of how the program works:
... ...
... ... @@ -2,9 +2,9 @@
DESTDIR ?=
PREFIX ?= /usr
CSECFLAGS ?= -fstack-protector-all -Wall --param ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fstack-check
CSECFLAGS ?= -fstack-protector-all -Wall --param ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fstack-check -DPARANOID
CFLAGS := -pipe -O2 $(CSECFLAGS) $(CFLAGS)
DEBUGCFLAGS ?= -pipe -Wall -Werror -ggdb3 -Wno-error=unused-variable $(CSECFLAGS)
DEBUGCFLAGS ?= -pipe -Wall -Werror -ggdb3 -Wno-error=unused-variable $(CSECFLAGS) -D_DEBUG
CARCHFLAGS ?= -march=native
... ...
1. Remove pthreads metainfo GC
2. Replace g_hash_table* with "tsearch" and so on.
3. Remove all code with "#ifdef DOXYGEN"
4. Find-out is "pthread_tryjoin_np()" really required? Can we remove all this
"threadsinfo" mechanism?
... ...
... ... @@ -107,6 +107,11 @@ enum ruleaction_enum {
};
typedef enum ruleaction_enum ruleaction_t;
// signals (man 7 signal)
enum sigusr_enum {
SIGUSR_PTHREAD_GC = 10
};
struct rule {
regex_t expr;
mode_t objtype;
... ... @@ -150,7 +155,8 @@ enum state_enum {
STATE_EXIT = 0,
STATE_RUNNING,
STATE_REHASH,
STATE_TERM
STATE_TERM,
STATE_PTHREAD_GC
};
typedef enum state_enum state_t;
... ... @@ -179,10 +185,12 @@ typedef struct indexes indexes_t;
typedef int (*thread_callbackfunct_t)(options_t *options_p, char **argv);
struct threadinfo {
int thread_num;
thread_callbackfunct_t callback;
char **argv;
pthread_t pthread;
int exitcode;
state_t state;
};
typedef struct threadinfo threadinfo_t;
... ...
... ... @@ -31,7 +31,9 @@ char *xmalloc(size_t size) {
exit(errno);
}
memset(ret, 0, size); // Just in case
#ifdef PARANOID
memset(ret, 0, size);
#endif
return ret;
}
... ... @@ -46,7 +48,7 @@ char *xcalloc(size_t nmemb, size_t size) {
exit(errno);
}
memset(ret, 0, nmemb*size); // Just in case
// memset(ret, 0, nmemb*size); // Just in case
return ret;
}
... ...
This diff is collapsed. Click to expand it.