Use pbd/resource.h in PBD::FileManager
This commit is contained in:
parent
4eff7b4e82
commit
d7b7953705
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user