Queue: validate if queue is empty when requesting last first/last entry

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Merge branch 'master' of ssh://git.monkey-project.com/srv/git/duda
Response: fix problem introduced when formatting with vsnprintf()

Signed-off-by: Eduardo Silva <edsiper@gmail.com>
Conf: new bind_messages() method and related core fixes

1) This patch fixes a problem where the process context hook was
   not triggered as expected. It renames the function from _mkp_prctx()
   to _mkp_core_prctx(). So the core works properly.

2) When initiating mem_init, it invokes the Monkey API to obtain a GMT
   time format string (RFC 1123) out of thread context. This ends in
   mk_bug() routine as that specific call is not designed to be used
   from a process context. Now the routine uses gmtime() and strftime()
   in place to create the same data.

   Cookies support are fixed with this change.

3) New bind_messages(): this new method instruct Duda core to redirect
   al stdout information from the stack to the web service file console,
   so any debug information or stack trace will be visible under the
   path /tmp/webservicename.duda.messages or through the console messages
   address: http://host:port/webservicename/console/messages, e.g:

   [2013/00/31 12:59:02] Duda I/O > 'somewebservice' Started
       version          : 1.2.0
       server port      : 2001
       number of workers: 4
   [2013/01/31 12:59:02] [   Info] HTTP Server started
   [stack trace]
     #0  0x000000000040bc9b in ???????()
     #1  0x00007fe9ddc8fcb0 in ???????()
     #2  0x00007fe9dd9b6a1f in accept4() from /lib/x86_64-linux-gnu/libc.so.6
     #3  0x00007fe9db98eee5 in _mkp_network_io_accept() from /home/edsiper/coding/monkey/plugins/liana/monkey-liana.so
     #4  0x000000000041225e in mk_socket_accept() from bin/monkey
     #5  0x0000000000412ad8 in mk_server_loop() from bin/monkey
     #6  0x0000000000406301 in main() from bin/monkey
     #7  0x00007fe9dd8e276d in __libc_start_main() from /lib/x86_64-linux-gnu/libc.so.6
     #8  0x0000000000405cf9 in ???????()
   [2013/01/31 12:59:12] [  Error] Segmentation fault (11), code=0, addr=0x3e800002e56

 the stack shown is generated by a kill -11 PID (segfault) for demostrative
 purposes.

Signed-off-by: Eduardo Silva <edsiper@gmail.com>