[llvm-commits] CVS: llvm/lib/System/Unix/Process.cpp

Reid Spencer reid at x10sys.com
Sun Dec 26 22:17:38 PST 2004


Changes in directory llvm/lib/System/Unix:

Process.cpp updated: 1.5 -> 1.6
---
Log message:

For PR351: http://llvm.cs.uiuc.edu/PR351 :
* Move implementation of sys::PreventCoreFiles function to this file from
  the now defunct SysConfig abstraction.


---
Diffs of the changes:  (+12 -0)

Index: llvm/lib/System/Unix/Process.cpp
diff -u llvm/lib/System/Unix/Process.cpp:1.5 llvm/lib/System/Unix/Process.cpp:1.6
--- llvm/lib/System/Unix/Process.cpp:1.5	Mon Dec 20 15:43:33 2004
+++ llvm/lib/System/Unix/Process.cpp	Mon Dec 27 00:17:26 2004
@@ -109,6 +109,18 @@
 #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






More information about the llvm-commits mailing list