blob: 45b1f7d6f05a51953c5f29af4e4dbfa0e90a6d93 [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 {
Reid Spencer387e5ec2004-08-31 17:43:29 +000019
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.
Reid Spenceref6efab2004-08-31 17:53:41 +000023void sys::PreventCoreFiles() {
Reid Spencer387e5ec2004-08-31 17:43:29 +000024 struct rlimit rlim;
25 rlim.rlim_cur = rlim.rlim_max = 0;
26 int res = setrlimit(RLIMIT_CORE, &rlim);
27 if (res != 0)
28 ThrowErrno("Can't prevent core file generation");
29}
30
31}
32
33// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab