For PR351:

* Move implementation of sys::PreventCoreFiles function to this file from
  the now defunct SysConfig abstraction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19159 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer
2004-12-27 06:17:27 +00:00
parent af2f208e7c
commit 68fdcc123b
5 changed files with 48 additions and 0 deletions
+12
View File
@@ -109,6 +109,18 @@ Process::GetTimeUsage(TimeValue& elapsed, TimeValue& user_time,
#endif
}
// Some LLVM programs such as bugpoint produce core files as a normal part of
// their operation. To prevent the disk from filling up, this function
// does what's necessary to prevent their generation.
void Process::PreventCoreFiles() {
#if HAVE_SETRLIMIT
struct rlimit rlim;
rlim.rlim_cur = rlim.rlim_max = 0;
int res = setrlimit(RLIMIT_CORE, &rlim);
if (res != 0)
ThrowErrno("Can't prevent core file generation");
#endif
}
}
// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab