In logsys there are a number of XYZ_unlocked() functions that are called
like this:
pthread_mutex_lock (&logsys_config_mutex);
XYZ_unlocked();
pthread_mutex_unlock (&logsys_config_mutex);
The XYZ_unlocked() functions should not do any (un)locking.
But _logsys_config_subsys_get_unlocked() unlocks if it finds the subsys.
This means that there is 1 lock and 2 unlocks.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2404 fd59a12c-fef9-0310-b244-a6a79926bd2f
logsys_thread_priority_set expects that wthread is already running
but doesn't perform any check if it is.
if logsys_thread_priority_set is invoked before forking the thread,
a segfault is guaranteed.
this changes to logsys_thread_priority_set ensure that a request
for a new scheduler priority is queued if the wthread is not
created yet and the new scheduler parameters are applied as early
as possible after the thread is created.
At the same time:
- add a few comments on clean up that needs to be done
- remove a redundant check for policy != SCHED_OTHER as that's
corosync need specific. logsys should simply accept the request
and apply it.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2382 fd59a12c-fef9-0310-b244-a6a79926bd2f
The flight recoder doesn't handle a 0 byte allocation properly
and it would fail miserably by allocating a single PAGE_SIZE
to handle the logging. That means an enormous performance hit
because of the constant wrapping around the buffer.
If any requested buffer is < 64000 bytes, then force to at least
64000.
In future we will be able to handle small buffers properly, but
for now enable a simple workaround to protect us and the user.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2256 fd59a12c-fef9-0310-b244-a6a79926bd2f
The flight recoder buffer size as specified in LOGSYS_DECLARE_SYSTEM
or _logsys_rec_init was expressed in number of ints. A developer asking
to allocate 512K would get a 2M allocation on a machine with sizeof(int) = 4.
This is confusing and the patch addresses it:
- rename rec_size to fltsize for external API (no type change),
because rec_size is used many times internally for other reasons
and it can be confusing.
- rename size to fltsize in _logsys_rec_init.
- document what we allocate and why.
- swap comments around to match the code.
- introduce a simple macro to perform rounding (stolen from linux-2.6.git).
- start shaping fdata header to better handle dynamic values:
* write the flt_data_size as first unsigned int the header.
* change corosync-fplay to read the value and alloc the right amount
of memory instead of hardcoding it again.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2255 fd59a12c-fef9-0310-b244-a6a79926bd2f
* exec/logsys.c (strcpy_cutoff): Add buf_len parameter, and never
write more than this number of bytes into "dest".
Change type of "cutoff" parameter from int to size_t.
Sentinel value changes from -1 to 0.
(log_printf_to_logs): Adapt to those changes.
Reverse condition of test so the much-shorter block is the "if-block".
Factor out a common subexpression for readability.
Exit the loop if output_buffer_idx ever reaches sizeof(output_buffer).
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2178 fd59a12c-fef9-0310-b244-a6a79926bd2f
* exec/logsys.c (strcpy_cutoff): Also, with a field width (aka cutoff),
and a shorter-than-field-width string, don't write the same memory
twice: once with strncpy using NUL bytes, then again with spaces
via the memset.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2177 fd59a12c-fef9-0310-b244-a6a79926bd2f
* exec/logsys.c (_logsys_log_printf): Indent with TABs to be
consistent with copied-from function, _logsys_log_vprintf.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2128 fd59a12c-fef9-0310-b244-a6a79926bd2f
- services/Makefile.am: add include search paths for config.h
- include/corosync/cs_config.h.in exports LCRSODIR and SOCKETDIR
- tools/Makefile.am: drop -D defines for dirs that are now in
cs_config.h or config.h
- configure.ac: sanitize prefix and exec_prefix paths. Export DIRS in
*config.h
- lib/Makefile.am: : drop -D defines for dirs that are now in
cs_config.h or config.h. Add rule to build lcr_ifact.o or building from
lib/ fails miserably
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1877 fd59a12c-fef9-0310-b244-a6a79926bd2f