LLVM API Documentation
00001 //===- SysConfig.cpp - Generic UNIX System Configuration --------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by Reid Spencer and is distributed under the 00006 // University of Illinois Open Source License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines some functions for managing system configuration on Unix 00011 // systems. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #include "Unix.h" 00016 #include <sys/resource.h> 00017 00018 namespace llvm { 00019 00020 // Some LLVM programs such as bugpoint produce core files as a normal part of 00021 // their operation. To prevent the disk from filling up, this configuration item 00022 // does what's necessary to prevent their generation. 00023 void sys::PreventCoreFiles() { 00024 struct rlimit rlim; 00025 rlim.rlim_cur = rlim.rlim_max = 0; 00026 int res = setrlimit(RLIMIT_CORE, &rlim); 00027 if (res != 0) 00028 ThrowErrno("Can't prevent core file generation"); 00029 } 00030 00031 } 00032 00033 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab