[sheepdog] [PATCH v2] sheep: new assert() for better error messages

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Sat Oct 6 12:43:20 CEST 2012


At Fri,  5 Oct 2012 20:51:12 +0900,
Hitoshi Mitake wrote:
> 
> This patch removes direct usage of assert() in sheep. assert() in
> daemon process causes problem because assert() writes its error
> message to stderr. In addition, typical daemon processes including
> sheep close stderr and dup() other fd. Actually, logger process of
> sheep dup() /dev/null for stderr.
> 
> From my experience, using assert() directly in daemon processes makes
> debugging hard. So this patch adds assert() as a wrapper of
> panic(). With this patch, assert() can find suitable output fd for
> error messages with vprintf() and the error messages can appear in a
> log file of sheep.
> 
> Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> ---
>  include/strbuf.h          |    1 -
>  include/util.h            |   18 ++++++++++++++++++
>  sheep/cluster/accord.c    |    2 +-
>  sheep/cluster/local.c     |    2 +-
>  sheep/cluster/zookeeper.c |    2 +-
>  sheep/group.c             |    1 -
>  sheep/request.c           |    2 +-
>  sheep/sheep.c             |    1 +
>  sheep/trace/graph.c       |    1 -
>  9 files changed, 23 insertions(+), 7 deletions(-)

Applied, thanks.



More information about the sheepdog mailing list