diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-12-27 06:17:27 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-12-27 06:17:27 +0000 |
commit | cf15b874e8c9a0824f9425244b068ea7a4fa5fc8 (patch) | |
tree | 55fdfef3b868c7c2cb0a53c1e0b018e7c3ccc2d9 /llvm/lib | |
parent | d103e0851cebe1a3fb32f8a26464d6b859608af7 (diff) | |
download | bcm5719-llvm-cf15b874e8c9a0824f9425244b068ea7a4fa5fc8.tar.gz bcm5719-llvm-cf15b874e8c9a0824f9425244b068ea7a4fa5fc8.zip |
For PR351:
* Move implementation of sys::PreventCoreFiles function to this file from
the now defunct SysConfig abstraction.
llvm-svn: 19159
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/System/Unix/Process.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/System/Win32/Process.cpp | 9 |
2 files changed, 21 insertions, 0 deletions
diff --git a/llvm/lib/System/Unix/Process.cpp b/llvm/lib/System/Unix/Process.cpp index 1c203ab50c5..19533905175 100644 --- a/llvm/lib/System/Unix/Process.cpp +++ b/llvm/lib/System/Unix/Process.cpp @@ -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 diff --git a/llvm/lib/System/Win32/Process.cpp b/llvm/lib/System/Win32/Process.cpp index 00da74076b0..10fec05cb3d 100644 --- a/llvm/lib/System/Win32/Process.cpp +++ b/llvm/lib/System/Win32/Process.cpp @@ -90,5 +90,14 @@ Process::GetTimeUsage( sys_time.nanoseconds( unsigned(KernelTime % 10000000) * 100 ); } +// Some LLVM programs such as bugpoint produce core files as a normal part of +// their operation. To prevent the disk from filling up, this configuration item +// does what's necessary to prevent their generation. +void Process::PreventCoreFiles() { + // Windows doesn't do core files, so nothing to do. + // Although... it might be nice to prevent the do-you-want-to-debug + // dialog box from coming up. Or maybe not... +} + } // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab |