path: root/compat/mmap.c
AgeCommit message (Collapse)Author
2007-06-07War on whitespaceJunio C Hamano
This uses "git-apply --whitespace=strip" to fix whitespace errors that have crept in to our source files over time. There are a few files that need to have trailing whitespaces (most notably, test vectors). The results still passes the test, and build result in Documentation/ area is unchanged. Signed-off-by: Junio C Hamano <>
2006-12-24Switch git_mmap to use pread.Shawn O. Pearce
Now that Git depends on pread in index-pack its safe to say we can also depend on it within the git_mmap emulation we activate when NO_MMAP is set. On most systems pread should be slightly faster than an lseek/read/lseek sequence as its one system call vs. three system calls. We also now honor EAGAIN and EINTR error codes from pread and restart the prior read. Signed-off-by: Shawn O. Pearce <> Signed-off-by: Junio C Hamano <>
2006-12-24Rename gitfakemmap to git_mmap.Shawn O. Pearce
This minor cleanup was suggested by Johannes Schindelin. The mmap is still fake in the sense that we don't support PROT_WRITE or MAP_SHARED with external modification at all, but that hasn't stopped us from using mmap() thoughout the Git code. Signed-off-by: Shawn O. Pearce <> Signed-off-by: Junio C Hamano <>
2006-12-20simplify inclusion of system header files.Junio C Hamano
This is a mechanical clean-up of the way *.c files include system header files. (1) sources under compat/, platform sha-1 implementations, and xdelta code are exempt from the following rules; (2) the first #include must be "git-compat-util.h" or one of our own header file that includes it first (e.g. config.h, builtin.h, pkt-line.h); (3) system headers that are included in "git-compat-util.h" need not be included in individual C source files. (4) "git-compat-util.h" does not have to include subsystem specific header files (e.g. expat.h). Signed-off-by: Junio C Hamano <>
2006-11-15Seek back to current filepos when mmap()ing with NO_MMAPJohannes Schindelin
"git-index-pack --fix-thin" relies on mmap() not changing the current file position (otherwise the pack will be corrupted when writing the final SHA1). Meet that expectation. Signed-off-by: Johannes Schindelin <> Signed-off-by: Junio C Hamano <>
2005-12-05Clean up compatibility definitions.Junio C Hamano
This attempts to clean up the way various compatibility functions are defined and used. - A new header file, git-compat-util.h, is introduced. This looks at various NO_XXX and does necessary function name replacements, equivalent of -Dstrcasestr=gitstrcasestr in the Makefile. - Those function name replacements are removed from the Makefile. - Common features such as usage(), die(), xmalloc() are moved from cache.h to git-compat-util.h; cache.h includes git-compat-util.h itself. Signed-off-by: Junio C Hamano <>
2005-10-08Yank writing-back support from gitfakemmap.Junio C Hamano
We do not write through our use of mmap(), so make sure callers pass MAP_PRIVATE and remove support for writing changes back. Signed-off-by: Junio C Hamano <>
2005-10-08[PATCH] If NO_MMAP is defined, fake mmap() and munmap()Johannes Schindelin
Since some platforms do not support mmap() at all, and others do only just so, this patch introduces the option to fake mmap() and munmap() by malloc()ing and read()ing explicitely. Signed-off-by: Johannes Schindelin <>