Cleanup TS SRT output code
This commit is contained in:
parent
1ec18d83b8
commit
840a1f5f4e
5 changed files with 154 additions and 156 deletions
20
lib/util.cpp
20
lib/util.cpp
|
@ -16,6 +16,7 @@
|
|||
#include <direct.h> // _mkdir
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#define RAXHDR_FIELDOFFSET p[1]
|
||||
#define RAX_REQDFIELDS_LEN 36
|
||||
|
@ -969,4 +970,23 @@ namespace Util{
|
|||
if (!fields.count(fName)){return RelAccXFieldData();}
|
||||
return fields.at(fName);
|
||||
}
|
||||
|
||||
bool sysSetNrOpenFiles(int n){
|
||||
struct rlimit limit;
|
||||
if (getrlimit(RLIMIT_NOFILE, &limit) != 0) {
|
||||
FAIL_MSG("Could not get open file limit: %s", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
int currLimit = limit.rlim_cur;
|
||||
if(limit.rlim_cur < n){
|
||||
limit.rlim_cur = n;
|
||||
if (setrlimit(RLIMIT_NOFILE, &limit) != 0) {
|
||||
FAIL_MSG("Could not set open file limit from %d to %d: %s", currLimit, n, strerror(errno));
|
||||
return false;
|
||||
}
|
||||
HIGH_MSG("Open file limit increased from %d to %d", currLimit, n)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}// namespace Util
|
||||
|
|
|
@ -19,6 +19,8 @@ namespace Util{
|
|||
uint64_t ftell(FILE *stream);
|
||||
uint64_t fseek(FILE *stream, uint64_t offset, int whence);
|
||||
|
||||
bool sysSetNrOpenFiles(int n);
|
||||
|
||||
class DataCallback{
|
||||
public:
|
||||
virtual void dataCallback(const char *ptr, size_t size){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue