Set LUA_MASKCOUNT hook more selectively. Fixes issue #480.

An user reported a crash with Redis scripting (see issue #480 on
github), inspection of the kindly provided strack trace showed that
server.lua_caller was probably set to NULL. The stack trace also slowed
that the call to the hook was originating from a point where we just
used to set/get a few global variables in the Lua state.

What was happening is that we did not set the timeout hook selectively
only when the user script was called. Now we set it more selectively,
specifically only in the context of the lua_pcall() call, and make sure
to remove the hook when the call returns. Otherwise the hook can get
called in random contexts every time we do something with the Lua
state.
redis-cli commands description in help.h updated.
memtest.c fixed to actually use v1 and v2 in memtest_fill_value().
A more lightweight implementation of issue 141 regression test.
Properly wait the slave to sync with master in BRPOPLPUSH test.
Show problem with 'keys' command with specific command sequence.
Use safe dictionary iterator from KEYS

Every matched key in a KEYS call is checked for expiration. When the key
is set to expire, the call to `getExpire` will assert that the key also
exists in the main dictionary. This in turn causes a rehashing step to
be executed. Rehashing a dictionary when there is an iterator active may
result in the iterator emitting duplicate entries, or not emitting some
entries at all. By using a safe iterator, the rehash step is omitted.
Test "Turning off AOF kills the background writing child if any" is now more reliable.
Use specific error if master is down and slave-serve-stale-data is set to no.

We used to reply -ERR ... message ..., now the reply is
instead -MASTERDOWN ... message ... so that it can be distinguished
easily by the other error conditions.
Remove useless trailing space in SYNC command sent to master.
syncio.c read / write functions reworked for correctness and performance.

The new implementation start reading / writing before blocking with
aeWait(), likely the descriptor can accept writes or has buffered data
inside and we can go faster, otherwise we get an error and wait.

This change has effects on speed but also on correctness: on socket
errors when we perform non blocking connect(2) write is performed ASAP
and the error is returned ASAP before waiting.

So the practical effect is that now a Redis slave is more available if it
can not connect to the master, previously the slave continued to block on
syncWrite() trying to send SYNC, and serving commands very slowly.
fix several bugs of init.d scripts

- PIDFILE environ variable was not properly retrieved
- chkconfig command failed
Merge pull request #494 from quiver/init-fixes

fix several bugs of init.d scripts
Compare integers in ziplist regardless of encoding

Because of the introduction of new integer encoding types for ziplists
in the 2.6 tree, the same integer value may have a different encoding in
different versions of the ziplist implementation. This means that the
encoding can NOT be used as a fast path in comparing integers.
redis-cli --pipe for mass import.
Allow PREFIX to be overrided in Makefile.
Fix PREFIX typo in Makefile.
redis-cli pipe mode: handle EAGAIN while writing to socket.
redis-cli pipe mode: handle EINTR properly as well so that SIGSTOP/SIGCONT are handled correctly.
If the computer running the Redis test is slow, we revert to --clients 1 to avoid false positives.