Skip to content

Commit

Permalink
mingw: add minimum getrlimit() compatibility stub
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Erik Faye-Lund authored and Junio C Hamano committed Mar 2, 2011
1 parent c793430 commit 38abd9b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions compat/mingw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit 38abd9b

Please sign in to comment.