blob: a1c037639b0f5e3ea64e5a6752f9ac034c97ffa6 [file] [log] [blame]
Reid Spencer387e5ec2004-08-31 17:43:29 +00001//===- SysConfig.cpp - Generic UNIX System Configuration --------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
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.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines some functions for managing system configuration on Unix
11// systems.
12//
13//===----------------------------------------------------------------------===//
14
15#include "Unix.h"
16#include <sys/resource.h>
17
18namespace llvm {
19using namespace sys;
20
21
22// Some LLVM programs such as bugpoint produce core files as a normal part of
23// their operation. To prevent the disk from filling up, this configuration item
24// does what's necessary to prevent their generation.
25void PreventCoreFiles() {
26 struct rlimit rlim;
27 rlim.rlim_cur = rlim.rlim_max = 0;
28 int res = setrlimit(RLIMIT_CORE, &rlim);
29 if (res != 0)
30 ThrowErrno("Can't prevent core file generation");
31}
32
33}
34
35// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab