1
/* wantcore -- run a program with soft core file size limit set to hard limit
2
* Copyright � 2004 Matthias Andree
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or (at
7
your option) any later version.
9
This program is distributed in the hope that it will be useful, but
10
WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
General Public License for more details. The license is found in the file
18
#include <sys/resource.h>
23
static void barf(const char *e) __attribute__((noreturn));
24
static void barf(const char *e)
30
int main(int argc, char **argv) {
34
fprintf(stderr, "Usage: %s program [args]\n", argv[0]);
37
if (getrlimit(RLIMIT_CORE, &rl))
39
rl.rlim_cur = rl.rlim_max;
40
if (setrlimit(RLIMIT_CORE, &rl))
42
execv(argv[1], argv+1);
43
fprintf(stderr, "execv: ");