13
0

Use pbd/resource.h in PBD::FileManager

This commit is contained in:
Paul Davis 2013-07-11 12:42:53 -04:00
parent 4eff7b4e82
commit d7b7953705

View File

@ -18,7 +18,6 @@
*/ */
#include <sys/time.h> #include <sys/time.h>
#include <sys/resource.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
@ -31,6 +30,7 @@
#include "pbd/compose.h" #include "pbd/compose.h"
#include "pbd/file_manager.h" #include "pbd/file_manager.h"
#include "pbd/resource.h"
#include "pbd/debug.h" #include "pbd/debug.h"
using namespace std; using namespace std;
@ -41,12 +41,11 @@ FileManager* FileDescriptor::_manager;
FileManager::FileManager () FileManager::FileManager ()
: _open (0) : _open (0)
{ {
struct rlimit rl; struct ResourceLimit rl;
int const r = getrlimit (RLIMIT_NOFILE, &rl);
/* XXX: this is a bit arbitrary */ /* XXX: this is a bit arbitrary */
if (r == 0) { if (get_resource_limit (OpenFiles, rl)) {
_max_open = rl.rlim_cur - 64; _max_open = rl.current_limit - 64;
} else { } else {
_max_open = 256; _max_open = 256;
} }