mingw: add minimum getrlimit() compatibility stub
authorErik Faye-Lund <kusmabite@gmail.com>
Mon, 28 Feb 2011 21:13:22 +0000 (22:13 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 2 Mar 2011 19:24:20 +0000 (11:24 -0800)
We don't have getrlimit on Windows :( Limit of 2048 taken from MSDN:

http://msdn.microsoft.com/en-us/library/6e3b887c(v=vs.71).aspx

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
compat/mingw.h
index cafc1eb08a71dd60566a7389ed606e777cf17fc8..14211c6214ea4654e0bb9dd25b29d7b28ac6141d 100644 (file)
@@ -233,6 +233,22 @@ int mingw_getpagesize(void);
 #define getpagesize mingw_getpagesize
 #endif
 
+struct rlimit {
+       unsigned int rlim_cur;
+};
+#define RLIMIT_NOFILE 0
+
+static inline int getrlimit(int resource, struct rlimit *rlp)
+{
+       if (resource != RLIMIT_NOFILE) {
+               errno = EINVAL;
+               return -1;
+       }
+
+       rlp->rlim_cur = 2048;
+       return 0;
+}
+
 /* Use mingw_lstat() instead of lstat()/stat() and
  * mingw_fstat() instead of fstat() on Windows.
  */