mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-25 20:52:22 +00:00
add too-many-file open warning when opening, too (but the underlying problem is fixed)
This was SVN commit r907.
This commit is contained in:
@@ -66,12 +66,13 @@ int open(const char* fn, int oflag, ...)
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
WIN_SAVE_LAST_ERROR;
|
||||
|
||||
WIN_SAVE_LAST_ERROR; // CreateFile
|
||||
int fd = _open(fn, oflag, mode);
|
||||
debug_out("open %s = %d\n", fn, fd);
|
||||
WIN_RESTORE_LAST_ERROR;
|
||||
|
||||
#ifdef PARANOIA
|
||||
debug_out("open %s = %d\n", fn, fd);
|
||||
#endif
|
||||
|
||||
// open it for async I/O as well (_open defaults to deny_none sharing)
|
||||
if(fd > 2)
|
||||
@@ -82,13 +83,21 @@ debug_out("open %s = %d\n", fn, fd);
|
||||
aio_reopen(fd, fn, oflag);
|
||||
}
|
||||
|
||||
// CRT doesn't like more than 255 files open.
|
||||
// warn now, so that we notice why so many are open
|
||||
if(fd > 256)
|
||||
debug_warn("wposix: too many files open (CRT limitation)");
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
int close(int fd)
|
||||
{
|
||||
#ifdef PARANOIA
|
||||
debug_out("close %d\n", fd);
|
||||
#endif
|
||||
|
||||
assert(3 <= fd && fd < 256);
|
||||
aio_close(fd);
|
||||
return _close(fd);
|
||||
|
||||
Reference in New Issue
Block a user