Remove unnecessary call to pool_shmem_exit() which removes semaphore when it shouldn't.

exit_handler checks if the process is parent or not. This is
good. However, even if it is a child process, it calls
pool_shmem_exit() which removes semaphore and shmem when it should
not (it should be called only from parent process).

Per bug #102.
Add missing include file sys/wait.h.

Per bug #104.
Disbale statement_timeout while executing online recovery.

Online may take very long time and user may enable statement
timeout. To prevent online recovery canceled by statement timeout,
disable statement timeout in the connection used by online recovery.

See [pgpool-general: 2919] for whole story.
fix coverity issue:1223007 Use after free.

get_insert_command_table_name() function was using the
freed pointer in pool_debug() function call.
Fix pool_handle_query_cache() to not free NULL pointer.
Fix coverity issue:1223003 Uninitialized scalar variable.
Fix coverity issue:1223002 Uninitialized scalar variable.
Fix coverity issue:1223001 Resource leak.
Fix coverity issue:1223000 Resource leak.
Fix coverity issue:1222999 Resource leak.
Fix coverity issue:1222998 Resource leak.
Change connect() timeout longer (10 seconds) for flaky network.

Change connect() timeout in connect_inet_domain_socket_by_port() from
1 second to 10 seconds for flaky network such as AWS. This should help
reducing frequent failover. Pgpool-II 3.4 will have switch to control
the timeout value, rather than fixed value. However our policy does
not allow to add new feature like that. So I decided to just tweak the
fixed value.
Back porting coverity issues fix patch from master branch.
Fix coverity issue:1111387 Explicit null dereferenced
Fix coverity issue:1111388 Explicit null dereferenced
Fix coverity issue:1111411 Missing break in switch
Fix coverity issue:1111412 Missing break in switch
Fix coverity issue:1111450 Resource leak
Fix coverity issue:1111451 Resource leak
Fix coverity issue:1111472 Dereference before null check
Fix coverity issue:1111473 Dereference before null check
Fix coverity issue:1111474 Dereference before null check
Fix coverity issue:1111475 Wrong sizeof argument
Fix coverity issue:1111495 Use after free
Fix coverity issue:1111496 Use after free
Fix coverity issue:1222989 Bad bit shift operation
Fix coverity issue:1222990 Bad bit shift operation
Fix coverity issue:1222994 Explicit null dereferenced
Fix wrong error message.
Back porting coverity issues fix patch from master branch.

Fix coverity issue:1111380 Logically dead code
Fix coverity issue:1111382 Logically dead code
Fix coverity issue:1111402 Explicit null dereferenced
Fix coverity issue:1111405 Explicit null dereferenced
Fix coverity issue:1111407 Dereference after null check
Fix coverity issue:1111408 Explicit null dereferenced
Fix coverity issue:1111409 Dereference after null check
Fix coverity issue:1111383 Logically dead code
Fix coverity issue:1111492 Structurally dead code
Fix coverity issue:1111417 Nesting level does not match indentation
Fix coverity issue:1111379 Logically dead code
Fix coverity issue:1111406 Explicit null dereferenced
Fix coverity issue:1111396 Explicit null dereferenced
Fix coverity issue:1111397 Explicit null dereferenced
Fix reset query stuck problem.

It is reported that reset query (DISCARD ALL etc.) occasionally does
not finish and pgpool child remain waiting for reply from backend thus
client cannot connect to pgpool (for example
http://www.pgpool.net/mantisbt/view.php?id=107).  The cause of problem
is not identified yet but if client suddenly closes connection to
pgpool in the middle of query processing, backend may not accept the
reset queries because they are not ready for query.

The fix is, if frontend closes connection in unexpected way, query
process loop immediately returns with new state:
POOL_END_WITH_FRONTEND_ERROR and pgpool closes connection to
PostgreSQL then goes back to new connection request waiting loop.
Fix yet another reset query stuck problem.

If client_idle_limit is set and the idle limit reaches,
pool_process_query() returns and tries to execute reset query which
may not be acceptable by backend because it may not be in "ready for
query" state. The fix is, close connections to backend instead.

Per bug#107.
See also: http://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=52a3a8c6ab67be3e09db9a7bdfd8e74d81ae3687
Add a description that pcp_detach_node disconnects existing sessions.
Back porting coverity issues fix patch from master branch.

Fix coverity issue:1111394 Dereference after null check
Fix coverity issue:1111398 Dereference after null check
Fix coverity issue:1111399 Explicit null dereferenced
Fix coverity issue:1111400 Dereference after null check
Fix coverity issue:1111401 Explicit null dereferenced