mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
For PR351:
* Move implementation of sys::PreventCoreFiles function to this file from the now defunct SysConfig abstraction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19159 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -63,6 +63,12 @@ namespace sys {
|
|||||||
///< Returns the current amount of system time for the process
|
///< Returns the current amount of system time for the process
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/// This function makes the necessary calls to the operating system to
|
||||||
|
/// prevent core files or any other kind of large memory dumps that can
|
||||||
|
/// occur when a program fails.
|
||||||
|
/// @brief Prevent core file generation.
|
||||||
|
static void PreventCoreFiles();
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -109,6 +109,18 @@ Process::GetTimeUsage(TimeValue& elapsed, TimeValue& user_time,
|
|||||||
#endif
|
#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
|
// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
|
||||||
|
@@ -109,6 +109,18 @@ Process::GetTimeUsage(TimeValue& elapsed, TimeValue& user_time,
|
|||||||
#endif
|
#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
|
// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
|
||||||
|
@@ -90,5 +90,14 @@ Process::GetTimeUsage(
|
|||||||
sys_time.nanoseconds( unsigned(KernelTime % 10000000) * 100 );
|
sys_time.nanoseconds( unsigned(KernelTime % 10000000) * 100 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some LLVM programs such as bugpoint produce core files as a normal part of
|
||||||
|
// their operation. To prevent the disk from filling up, this configuration item
|
||||||
|
// does what's necessary to prevent their generation.
|
||||||
|
void Process::PreventCoreFiles() {
|
||||||
|
// Windows doesn't do core files, so nothing to do.
|
||||||
|
// Although... it might be nice to prevent the do-you-want-to-debug
|
||||||
|
// dialog box from coming up. Or maybe not...
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
|
// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
|
||||||
|
@@ -90,5 +90,14 @@ Process::GetTimeUsage(
|
|||||||
sys_time.nanoseconds( unsigned(KernelTime % 10000000) * 100 );
|
sys_time.nanoseconds( unsigned(KernelTime % 10000000) * 100 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some LLVM programs such as bugpoint produce core files as a normal part of
|
||||||
|
// their operation. To prevent the disk from filling up, this configuration item
|
||||||
|
// does what's necessary to prevent their generation.
|
||||||
|
void Process::PreventCoreFiles() {
|
||||||
|
// Windows doesn't do core files, so nothing to do.
|
||||||
|
// Although... it might be nice to prevent the do-you-want-to-debug
|
||||||
|
// dialog box from coming up. Or maybe not...
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
|
// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab
|
||||||
|
Reference in New Issue
Block a user