fs-tracking

Updates https://github.com/kripken/emscripten/pull/1673 and adds the suggested code review changes and an unit test.