store hash index map in batch context

we'll build the next batch while the previous batch(es) are running,
must avoid overwriting the index map of other batches.
define _BSD_SOURCE to 1 to avoid some warnings