Commit Graph

72 Commits

Author SHA1 Message Date
Jan Friesse
caceb59f1e Remove duplicity in logsys code
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2185 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-05-18 09:42:57 +00:00
Fabio M. Di Nitto
8c7a454e2e Fix output to syslog
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2184 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-05-13 09:25:08 +00:00
Fabio M. Di Nitto
75c9085204 Fix logsys TAG handling
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2180 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-05-13 03:59:47 +00:00
Jim Meyering
fd20c4e799 logsys.c: avoid possibility of buffer overrun
* 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
2009-05-12 08:35:17 +00:00
Jim Meyering
d04702854b logsys.c: avoid redundant strlen in else-block
* 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
2009-05-12 08:35:09 +00:00
Jim Meyering
fbbc934196 logsys.c: factor out some duplication
* exec/logsys.c (log_printf_to_logs): Factor out repeated calls to
strcpy_cutoff.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2176 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-05-12 08:35:01 +00:00
Fabio M. Di Nitto
6a9ebd8297 Add debugging code to logsys.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2175 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-05-12 05:36:09 +00:00
Fabio M. Di Nitto
4572f1124a Fix logging date format and add missing daemon name
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2173 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-05-11 08:17:53 +00:00
Fabio M. Di Nitto
490c262b3e Fix debug: on option for logging purposes
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2160 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-27 11:37:59 +00:00
Fabio M. Di Nitto
21902efa1b add max limit error checks in logsys
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2159 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-27 11:36:53 +00:00
Jim Meyering
0b264ba292 logsys.c: avoid an unnecessary strlen call
* exec/logsys.c (strcpy_cutoff): Use strlen, then memcpy,
not strcpy, then strlen.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2143 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-24 09:55:21 +00:00
Steven Dake
2505b53703 Add logsys yield counter for the logsys thread.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2139 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-23 19:21:35 +00:00
Steven Dake
ed7d054e55 Remove priority inversion in logsys.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2130 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-23 15:24:29 +00:00
Jim Meyering
85d1e26bb1 logsys.c: indent consistently
* 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
2009-04-23 14:15:53 +00:00
Jan Friesse
0dc4aed441 Make ipc_log_printf function working by adding _logsys_log_vprintf, which
is mostly same as _logsys_log_printf but takes va_list as argument.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2127 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-23 12:29:26 +00:00
Fabio M. Di Nitto
230b85044f Kill all asserts from logsys and handle proper error return
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2121 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-22 09:14:23 +00:00
Jim Meyering
904a10ed38 remove all trailing blanks
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2117 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-22 08:03:55 +00:00
Fabio M. Di Nitto
c6a31d6145 Add logsys_flush logsys API call to signal the logging thread
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2103 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-21 04:38:49 +00:00
Fabio M. Di Nitto
1ecaa01b80 Fix output filtering when debug is enabled
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2101 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-21 04:02:19 +00:00
Fabio M. Di Nitto
0f942b2ed9 Improve logsys error handling in logsys_format_set
and logsys_config_file_set_unlocked.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2096 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-20 10:43:37 +00:00
Fabio M. Di Nitto
9b2dd8a43e readd early log level check for performance reasons.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2093 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-20 07:08:42 +00:00
Fabio M. Di Nitto
c3c75acfd2 Add logsys v3
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2091 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-20 04:28:33 +00:00
Jim Meyering
a549daedca logsys.h (logsys_format_set): Change return type, adjust param type.
* include/corosync/engine/logsys.h:
* exec/logsys.c (logsys_format_set): Return -1 upon strdup failure.
Change type of param to "const char *".
* exec/logsys.c (logsys_init): Adjust use.
* exec/mainconfig.c (corosync_main_config_read_logging): Adjust uses.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2009 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-07 13:01:55 +00:00
Fabio M. Di Nitto
243abac616 Drop unrequired struct
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1992 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-03 05:46:01 +00:00
Steven Dake
870046d065 Patch to use snprintf where appropriate to avoid buffer overrun.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1990 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-02 18:49:24 +00:00
Fabio M. Di Nitto
2a5bd53771 Fix internal API usage and add support for file_name
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1976 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-01 09:01:52 +00:00
Fabio M. Di Nitto
e770695cd0 Fix build warning
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1975 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-04-01 05:48:03 +00:00
Jim Meyering
588dd0b16d logsys.c: avoid 1 warning
* exec/logsys.c (logsys_conf): Add const.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1968 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-03-30 21:17:42 +00:00
Jim Meyering
7b73cfe841 logsys.c: avoid 1 warning
* exec/logsys.c (logsys_worker_thread): Mark function as "noreturn".

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1966 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-03-30 21:17:27 +00:00
Jim Meyering
1280f900cb logsys.c: fix two more warnings
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1945 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-03-30 21:14:08 +00:00
Jim Meyering
cc6eed7042 in progress: avoid warnings
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1943 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-03-30 21:13:47 +00:00
Jim Meyering
e487affc01 logsys_config_facility_set: make "name" parameter const
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1919 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-03-30 21:09:56 +00:00
Jim Meyering
217c5bed8d logsys: detect write failure and avoid a file descriptor leak
* exec/logsys.c (logsys_log_rec_store): Close output file descriptor
and detect any failure.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1915 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-03-30 14:33:49 +00:00
Steven Dake
1b1c0b657a Appears to fix compile errors on macosx.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1909 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-03-24 16:03:46 +00:00
Fabio M. Di Nitto
031c02f589 - Every .c file should include "config.h" to get the right defines...
- 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
2009-03-19 12:58:53 +00:00
Steven Dake
64aab2e950 Remove const warnings relating to logsys global definitions.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1806 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-03-10 09:48:34 +00:00
Steven Dake
b113dd2e19 Remove logsys warnings.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1805 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-03-10 09:40:54 +00:00
Fabio M. Di Nitto
8c4bcde5c2 Add logsys_format_get to logsys API.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1797 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-03-10 08:03:50 +00:00
Fabio M. Di Nitto
f7c4cea567 logsys_format_set should use its own internal copy of format_buffer
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1796 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-03-10 07:11:17 +00:00
Fabio M. Di Nitto
f83aa4f876 Allow logsys_format_set to reset to default.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1792 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-03-06 07:09:24 +00:00
Fabio M. Di Nitto
e0a74a08b3 Fix logsys_set_format by updating the right bits
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1789 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-03-04 10:13:26 +00:00
Fabio M. Di Nitto
d7024f53d6 don't keep logsys fd open unless it's required
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1739 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-01-23 14:25:30 +00:00
Fabio M. Di Nitto
02f9b8e19a Clean up tag handling and provide functions to match name with values and
viceversa.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1731 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-01-16 08:59:09 +00:00
Fabio M. Di Nitto
b2836a0fd4 Fix logsys write to file crash.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1727 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-01-14 11:00:23 +00:00
Steven Dake
6124b2a29a Fix deadlock in logsys during startup.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1703 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-12-02 15:51:03 +00:00
Angus Salkeld
17c0625160 LINT: fix "Assignment of ssize_t to int" warnings
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1696 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-11-11 18:13:47 +00:00
Angus Salkeld
fd25950970 LINT: fix or ignore unchecked return values.
If we don't care about the return value then typecase the return
value to void.
Else do something useful with the return value.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1693 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-11-11 17:25:22 +00:00
Steven Dake
418739f8f0 Null terminate string which resulted in failure of confdb during logging.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1687 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-11-06 00:17:01 +00:00
Steven Dake
0c631e24fc Logsys flight recorder.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1681 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-10-30 22:25:56 +00:00
Angus Salkeld
9655fa2fea If syslog() blocked, node-leave events were incorrectly reported
In some cases, the syslog() call may block. If this happened, the AIS worker
thread would block waiting on the syslog() call. However, the worker thread
is still holding a logsys mutex, which is needed to enqueue any more log
messages from the other AIS threads. So the main AIS thread blocks waiting
on the logsys mutex. This can then cause aisexec on other nodes to detect
the node as leaving the cluster.

Author: Tim Beale <tim.beale@alliedtelesis.co.nz>


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1665 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-09-17 18:22:58 +00:00