summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6f10c41)
raw | patch | inline | side by side (parent: 6f10c41)
author | Jonathan Nieder <jrnieder@gmail.com> | |
Sat, 6 Nov 2010 11:44:11 +0000 (06:44 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 10 Nov 2010 19:03:13 +0000 (11:03 -0800) |
wrapper.o depends on sha1_file.o for a number of reasons. One is
release_pack_memory().
xmmap function calls mmap, discarding unused pack windows when
necessary to relieve memory pressure. Simple git programs using
wrapper.o as a friendly libc do not need this functionality.
So move xmmap to sha1_file.o, where release_pack_memory() is.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
release_pack_memory().
xmmap function calls mmap, discarding unused pack windows when
necessary to relieve memory pressure. Simple git programs using
wrapper.o as a friendly libc do not need this functionality.
So move xmmap to sha1_file.o, where release_pack_memory() is.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_file.c | patch | blob | history | |
wrapper.c | patch | blob | history |
diff --git a/sha1_file.c b/sha1_file.c
index 0cd9435619f1e0637584289b45d52c1cdd8a9460..8e299ae85cf614e17a9571d60e6ab2a92f081eb3 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
; /* nothing */
}
+void *xmmap(void *start, size_t length,
+ int prot, int flags, int fd, off_t offset)
+{
+ void *ret = mmap(start, length, prot, flags, fd, offset);
+ if (ret == MAP_FAILED) {
+ if (!length)
+ return NULL;
+ release_pack_memory(length, fd);
+ ret = mmap(start, length, prot, flags, fd, offset);
+ if (ret == MAP_FAILED)
+ die_errno("Out of memory? mmap failed");
+ }
+ return ret;
+}
+
void close_pack_windows(struct packed_git *p)
{
while (p->windows) {
diff --git a/wrapper.c b/wrapper.c
index fd8ead33ed72c37e690ee1fc5b8568f629c95145..3195ef32b766a57f655e761aa89d01155eb34e29 100644 (file)
--- a/wrapper.c
+++ b/wrapper.c
return ret;
}
-void *xmmap(void *start, size_t length,
- int prot, int flags, int fd, off_t offset)
-{
- void *ret = mmap(start, length, prot, flags, fd, offset);
- if (ret == MAP_FAILED) {
- if (!length)
- return NULL;
- release_pack_memory(length, fd);
- ret = mmap(start, length, prot, flags, fd, offset);
- if (ret == MAP_FAILED)
- die_errno("Out of memory? mmap failed");
- }
- return ret;
-}
-
/*
* xread() is the same a read(), but it automatically restarts read()
* operations with a recoverable error (EAGAIN and EINTR). xread()