Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d94cda0 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds
Browse files

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: default avatarJeff Dike <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 48b20184
Loading
Loading
Loading
Loading
+25 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
#include <sys/time.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <sys/wait.h>
#include <sys/mman.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <asm/unistd.h>
#include <asm/unistd.h>
#include <asm/page.h>
#include <asm/page.h>
#include <sys/types.h>
#include <sys/types.h>
@@ -329,8 +330,32 @@ static void __init check_ptrace(void)


extern void check_tmpexec(void);
extern void check_tmpexec(void);


static void check_coredump_limit(void)
{
	struct rlimit lim;
	int err = getrlimit(RLIMIT_CORE, &lim);

	if(err){
		perror("Getting core dump limit");
		return;
	}

	printf("Core dump limits :\n\tsoft - ");
	if(lim.rlim_cur == RLIM_INFINITY)
		printf("NONE\n");
	else printf("%lu\n", lim.rlim_cur);

	printf("\thard - ");
	if(lim.rlim_max == RLIM_INFINITY)
		printf("NONE\n");
	else printf("%lu\n", lim.rlim_max);
}

void os_early_checks(void)
void os_early_checks(void)
{
{
	/* Print out the core dump limits early */
	check_coredump_limit();

	check_ptrace();
	check_ptrace();


	/* Need to check this early because mmapping happens before the
	/* Need to check this early because mmapping happens before the