sheep/cluster: use pthread_cond instread of pthread_mutex to avoid panic

If we use pthread like this:

	pthread_mutex_t mt;
	pthread_mutex_init(&mt, NULL);
	pthread_mutex_unlock(&mt);
	pthread_mutex_destroy(&mt);

The last 'pthread_mutex_destroy()' will return EBUSY because the mutex has
been 'unlocked' even no one locked it.
(ref: https://bugzilla.redhat.com/show_bug.cgi?id=113588)

This will cause problem in cluster/zookeeper.c because any event from zk_watcher()
would unlocked the 'wait_wakeup' mutex. Therefore we need to use pthread-condition
to replace pthread-mutex.

Signed-off-by: Robin Dong <sanbai@taobao.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
sheep/cluster: re-create znode of 'lock-id' if it isn't exists

When a sheep daemon call zk_unlock(), it will remove the whole znode of 'lock-id' and
make zoo_create() fail in zk_lock() which called by another sheep daemon.
To avoid this, we should try to create a znode of 'lock-id' if zoo_create() fail.

Signed-off-by: Robin Dong <sanbai@taobao.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
logger: add a unified log destination option and syslog support

This patch adds a new parameter "dst=" to the "-l" option for
specifying logging destination. Possible parameters are below:
- default: a dedicated file under sheep's directory
- syslog: standard syslog
- stdout: standard output

In addition, this patch removes "-o" option and "-f" option, previous
options for logging with stdout and let sheep run as a foreground
process. Now it is replaced with "-l dst=stdout".

Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>