1 //===- SysConfig.cpp - Generic UNIX System Configuration --------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Reid Spencer and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines some functions for managing system configuration on Unix
13 //===----------------------------------------------------------------------===//
16 #include <sys/resource.h>
20 // Some LLVM programs such as bugpoint produce core files as a normal part of
21 // their operation. To prevent the disk from filling up, this configuration item
22 // does what's necessary to prevent their generation.
23 void sys::PreventCoreFiles() {
25 rlim.rlim_cur = rlim.rlim_max = 0;
26 int res = setrlimit(RLIMIT_CORE, &rlim);
28 ThrowErrno("Can't prevent core file generation");
33 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab