1
read-cache: allow to keep mmap'd memory after reading
daemonize(): set a flag before exiting the main process

This allows signal handlers and atexit functions to realize this
situation and not clean up.
Add read-cache--daemon for caching index and related stuff

On platforms with POSIX shared memory support, the name of the shared
memory folows the template "/git-index-<SHA1>" where <SHA1> is the
trailing SHA-1 of the index file. If such shared memory exists, it
contains the same index content as on disk. The content is already
validated by the daemon and git won't validate it again. Note that it
does not necessarily use the same format as the on-disk version. The
content could be in a format that can be parsed much faster, or even
reused without parsing).

While preparing the shm object, the daemon would keep the shm object
"/git-index-<SHA1>.lock". After "git-index-<SHA1>" is ready, the
".lock" object is removed. A shared object must not be updated
afterwards. So if ".lock" does not exist, it's safe to assume that the
associated shm object is ready.

Other info could also by cached if it's tied to the index. For
example, name hash could be stored in "/git-namehash-<SHA1>"..

Git can poke the daemon to tell it to refresh the index cache, or to
not exit for another some minutes via UNIX signals. It can't give any
real data directly to the daemon. Real data goes to disk first, then
the daemon reads and verifies it from there.

On Windows, the similar shared memory mechanism is used. UNIX signals
are replaced by PostMessage'ing to a window created by the daemon.
read-cache: try index data from shared memory
1
2
compat
3
read-cache--daemon: do not read index from shared memory

It does not hurt doing that. But it does not help anybody either.
read-cache: skip verifying trailing SHA-1 on cached index

The daemon is responsible for verifying the index before putting it in
the shared memory. No need to redo it again.
read-cache: inform the daemon that the index has been updated

The daemon would immediately load the new index in memory in
background. Next time Git needs to read the index again, everything is
ready.