Fix safe_fd exhaustion in fork chain caused by non closing of shared_mem_fd 

Patch that fixes the problem reported by Christian Borntraeger.
The problem was created by keeping the shared memory mapped file opened
without reason till the process does an exec.
In case of a chain of forked processes (without exec), the range of safe_fd
reserved for Valgrind own usage becomes exhausted.

* coregrind/m_gdbserver/remote-utils.c :
   do not VG_(safe_fd) shared_mem_fd (as it is now closed directly)
   close shared_mem_fd once file is mmap-ed and written.
* gdbserver_tests/nlfork_chain.stderr.exp,nlfork_chain.vgtest,
               fork_chain.c,nlfork_chain.stdout.exp:
     new files
* gdbserver_tests/Makefile.am:
  modified for new nlfork_chain test

(patch from #214909 c 103,
Philippe Waroquiers, philippe.waroquiers@skynet.be)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11818 a5019735-40e9-0310-863c-91ae7b9d1cf9
6 files changed