summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-12-27 06:17:27 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-12-27 06:17:27 +0000
commit68fdcc123b781fcea17f9c7bffdfdc8c41654324 (patch)
tree90f4daaf7c42a96cec97c72b351d32e18ec181a4 /lib
parentaf2f208e7c727f75ee279d63c6b722da0d75fced (diff)
downloadllvm-68fdcc123b781fcea17f9c7bffdfdc8c41654324.tar.gz
llvm-68fdcc123b781fcea17f9c7bffdfdc8c41654324.tar.bz2
llvm-68fdcc123b781fcea17f9c7bffdfdc8c41654324.tar.xz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/System/Unix/Process.cpp12
-rw-r--r--lib/System/Unix/Process.inc12
-rw-r--r--lib/System/Win32/Process.cpp9
-rw-r--r--lib/System/Win32/Process.inc9
4 files changed, 42 insertions, 0 deletions
diff --git a/lib/System/Unix/Process.cpp b/lib/System/Unix/Process.cpp
index 1c203ab50c..1953390517 100644
--- a/lib/System/Unix/Process.cpp
+++ b/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/lib/System/Unix/Process.inc b/lib/System/Unix/Process.inc
index 1c203ab50c..1953390517 100644
--- a/lib/System/Unix/Process.inc
+++ b/lib/System/Unix/Process.inc
@@ -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/lib/System/Win32/Process.cpp b/lib/System/Win32/Process.cpp
index 00da74076b..10fec05cb3 100644
--- a/lib/System/Win32/Process.cpp
+++ b/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
diff --git a/lib/System/Win32/Process.inc b/lib/System/Win32/Process.inc
index 00da74076b..10fec05cb3 100644
--- a/lib/System/Win32/Process.inc
+++ b/lib/System/Win32/Process.inc
@@ -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