aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/start_up.c
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-05-06 17:51:00 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:13:00 -0400
commit1d94cda04eb82feb87c932ac3d4aef1e9dc78a43 (patch)
tree38883b3d8a45013ab58eacad7b85ad079f2cdcf9 /arch/um/os-Linux/start_up.c
parent48b201846901c1780fbc7ea779dcc8aa8ab8e16b (diff)
uml: print coredump limits
Print out core dump limits at boot time. This is to allow core dumps to be collected if something goes very wrong and to tell if a core dump isn't going to happen because of a resource limit. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/os-Linux/start_up.c')
-rw-r--r--arch/um/os-Linux/start_up.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 5178eba9afa5..1244179e6c83 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -17,6 +17,7 @@
17#include <sys/time.h> 17#include <sys/time.h>
18#include <sys/wait.h> 18#include <sys/wait.h>
19#include <sys/mman.h> 19#include <sys/mman.h>
20#include <sys/resource.h>
20#include <asm/unistd.h> 21#include <asm/unistd.h>
21#include <asm/page.h> 22#include <asm/page.h>
22#include <sys/types.h> 23#include <sys/types.h>
@@ -329,8 +330,32 @@ static void __init check_ptrace(void)
329 330
330extern void check_tmpexec(void); 331extern void check_tmpexec(void);
331 332
333static void check_coredump_limit(void)
334{
335 struct rlimit lim;
336 int err = getrlimit(RLIMIT_CORE, &lim);
337
338 if(err){
339 perror("Getting core dump limit");
340 return;
341 }
342
343 printf("Core dump limits :\n\tsoft - ");
344 if(lim.rlim_cur == RLIM_INFINITY)
345 printf("NONE\n");
346 else printf("%lu\n", lim.rlim_cur);
347
348 printf("\thard - ");
349 if(lim.rlim_max == RLIM_INFINITY)
350 printf("NONE\n");
351 else printf("%lu\n", lim.rlim_max);
352}
353
332void os_early_checks(void) 354void os_early_checks(void)
333{ 355{
356 /* Print out the core dump limits early */
357 check_coredump_limit();
358
334 check_ptrace(); 359 check_ptrace();
335 360
336 /* Need to check this early because mmapping happens before the 361 /* Need to check this early because mmapping happens before the