summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorlhchavez <lhchavez@lhchavez.com>2020-02-08 20:47:24 +0000
committerlhchavez <lhchavez@lhchavez.com>2020-06-21 07:15:26 -0700
commit9679df573604571d1372d2850116e66e1f4cec23 (patch)
tree139b4b900749ffb0a62f8e358133f819ea9afb0b /include
parentd43d490c388f7279bceb85e07159aa386590f76b (diff)
downloadlibgit2-9679df573604571d1372d2850116e66e1f4cec23.tar.gz
mwindow: set limit on number of open files
There are some cases in which repositories accrue a large number of packfiles. The existing mwindow limit applies only to the total size of mmap'd files, not on their number. This leads to a situation in which having lots of small packfiles could exhaust the allowed number of open files, particularly on macOS, where the default ulimit is very low (256). This change adds a new configuration parameter (GIT_OPT_SET_MWINDOW_FILE_LIMIT) that sets the maximum number of open packfiles, with a default of 128. This is low enough so that even macOS users should not hit it during normal use. Based on PR #5386, originally written by @josharian. Fixes: #2758
Diffstat (limited to 'include')
-rw-r--r--include/git2/common.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/include/git2/common.h b/include/git2/common.h
index d6696061d..908bb61cc 100644
--- a/include/git2/common.h
+++ b/include/git2/common.h
@@ -205,7 +205,9 @@ typedef enum {
GIT_OPT_GET_PACK_MAX_OBJECTS,
GIT_OPT_SET_PACK_MAX_OBJECTS,
GIT_OPT_DISABLE_PACK_KEEP_FILE_CHECKS,
- GIT_OPT_ENABLE_HTTP_EXPECT_CONTINUE
+ GIT_OPT_ENABLE_HTTP_EXPECT_CONTINUE,
+ GIT_OPT_GET_MWINDOW_FILE_LIMIT,
+ GIT_OPT_SET_MWINDOW_FILE_LIMIT
} git_libgit2_opt_t;
/**
@@ -227,8 +229,18 @@ typedef enum {
*
* * opts(GIT_OPT_SET_MWINDOW_MAPPED_LIMIT, size_t):
*
- * >Set the maximum amount of memory that can be mapped at any time
- * by the library
+ * > Set the maximum amount of memory that can be mapped at any time
+ * > by the library
+ *
+ * * opts(GIT_OPT_GET_MWINDOW_FILE_LIMIT, size_t *):
+ *
+ * > Get the maximum number of files that will be mapped at any time by the
+ * > library
+ *
+ * * opts(GIT_OPT_SET_MWINDOW_FILE_LIMIT, size_t):
+ *
+ * > Set the maximum number of files that can be mapped at any time
+ * > by the library
*
* * opts(GIT_OPT_GET_SEARCH_PATH, int level, git_buf *buf)
*