Skip to content

Commit 38abd9b

Browse files
kusmagitster
authored andcommitted
mingw: add minimum getrlimit() compatibility stub
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 <[email protected]>
1 parent c793430 commit 38abd9b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

compat/mingw.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,22 @@ int mingw_getpagesize(void);
233233
#define getpagesize mingw_getpagesize
234234
#endif
235235

236+
struct rlimit {
237+
unsigned int rlim_cur;
238+
};
239+
#define RLIMIT_NOFILE 0
240+
241+
static inline int getrlimit(int resource, struct rlimit *rlp)
242+
{
243+
if (resource != RLIMIT_NOFILE) {
244+
errno = EINVAL;
245+
return -1;
246+
}
247+
248+
rlp->rlim_cur = 2048;
249+
return 0;
250+
}
251+
236252
/* Use mingw_lstat() instead of lstat()/stat() and
237253
* mingw_fstat() instead of fstat() on Windows.
238254
*/

0 commit comments

Comments
 (0)