@matheusbsbs / matheus-bagliano / commits / 38abd9b8b4
Fork 0

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 <kusmabite@gmail.com>

Erik Faye-Lund committed Feb 28, 2011 at 22:13 UTC 38abd9b8b4e11aa0b4cdaa5c7b44e0c0ad06820b
1 file changed +16
compat/mingw.h
+16
@@ -233,6 +233,22 @@ int mingw_getpagesize(void);
233 #define getpagesize mingw_getpagesize
234 #endif
235
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 +
252 /* Use mingw_lstat() instead of lstat()/stat() and
253 * mingw_fstat() instead of fstat() on Windows.
254 */