* Use public functionality instead of private BeOS syscalls.

* Automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31039 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-06-14 10:57:09 +00:00
parent c8602bcd11
commit 6668455281
2 changed files with 103 additions and 91 deletions
+7 -2
View File
@@ -34,6 +34,8 @@ All rights reserved.
// Implementation for the public FilePanel object. // Implementation for the public FilePanel object.
#include <sys/resource.h>
#include <BeBuild.h> #include <BeBuild.h>
#include <Debug.h> #include <Debug.h>
#include <FilePanel.h> #include <FilePanel.h>
@@ -50,7 +52,6 @@ All rights reserved.
#ifndef _IMPEXP_TRACKER #ifndef _IMPEXP_TRACKER
# define _IMPEXP_TRACKER # define _IMPEXP_TRACKER
#endif #endif
extern "C" _IMPEXP_ROOT int _kset_fd_limit_(int num);
// these two calls are deprecated // these two calls are deprecated
extern _IMPEXP_TRACKER void run_open_panel(); extern _IMPEXP_TRACKER void run_open_panel();
@@ -80,7 +81,11 @@ BFilePanel::BFilePanel(file_panel_mode mode, BMessenger *target,
{ {
// boost file descriptor limit so file panels in other apps don't have // boost file descriptor limit so file panels in other apps don't have
// problems // problems
_kset_fd_limit_ (512); struct rlimit rl;
rl.rlim_cur = 512;
rl.rlim_max = RLIM_SAVED_MAX;
setrlimit(RLIMIT_NOFILE, &rl);
BEntry startDir(ref); BEntry startDir(ref);
fWindow = new TFilePanel(mode, target, &startDir, nodeFlavors, fWindow = new TFilePanel(mode, target, &startDir, nodeFlavors,
multipleSelection, message, filter, 0, B_DOCUMENT_WINDOW_LOOK, multipleSelection, message, filter, 0, B_DOCUMENT_WINDOW_LOOK,
+14 -7
View File
@@ -32,8 +32,10 @@ names are registered trademarks or trademarks of their respective holders.
All rights reserved. All rights reserved.
*/ */
#include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/resource.h>
#include <unistd.h> #include <unistd.h>
#include <Alert.h> #include <Alert.h>
@@ -90,9 +92,6 @@ All rights reserved.
#ifndef _IMPEXP_ROOT #ifndef _IMPEXP_ROOT
# define _IMPEXP_ROOT # define _IMPEXP_ROOT
#endif #endif
extern "C" _IMPEXP_ROOT int _kset_fd_limit_(int num);
extern "C" _IMPEXP_ROOT int _kset_mon_limit_(int num);
// from priv_syscalls.h
const int32 DEFAULT_MON_NUM = 4096; const int32 DEFAULT_MON_NUM = 4096;
// copied from fsil.c // copied from fsil.c
@@ -210,9 +209,11 @@ TTracker::TTracker()
if (find_directory(B_USER_DIRECTORY, &homePath) == B_OK) if (find_directory(B_USER_DIRECTORY, &homePath) == B_OK)
chdir(homePath.Path()); chdir(homePath.Path());
_kset_fd_limit_(512); // ask for a bunch more file descriptors so that nested copying works well
// ask for a bunch more file descriptors so that nested copying struct rlimit rl;
// works well rl.rlim_cur = 512;
rl.rlim_max = RLIM_SAVED_MAX;
setrlimit(RLIMIT_NOFILE, &rl);
fNodeMonitorCount = DEFAULT_MON_NUM; fNodeMonitorCount = DEFAULT_MON_NUM;
@@ -1527,7 +1528,13 @@ TTracker::NeedMoreNodeMonitors()
fNodeMonitorCount += kNodeMonitorBumpValue; fNodeMonitorCount += kNodeMonitorBumpValue;
PRINT(("bumping nodeMonitorCount to %d\n", fNodeMonitorCount)); PRINT(("bumping nodeMonitorCount to %d\n", fNodeMonitorCount));
return _kset_mon_limit_(fNodeMonitorCount); struct rlimit rl;
rl.rlim_cur = fNodeMonitorCount;
rl.rlim_max = RLIM_SAVED_MAX;
if (setrlimit(RLIMIT_NOVMON, &rl) < 0)
return errno;
return B_OK;
} }
status_t status_t