From: Diego Nieto Cid <[email protected]>
Hello,
The ext2fs side of the changes seems to be as strightforward
as calling setrlimit when the bootstraap port is null, given
the following lines of diskfs_init_main:
if (diskfs_boot_filesystem ())
/* We are the bootstrap filesystem. */
*bootstrap = MACH_PORT_NULL;
...
I'm not sure abount the bit declaring variables inside the if
block being conforming to the standards.
Now I'll look into using the RPC in GLIBC's implementation of
setrlimit. But I still need to figure out how to install the
headers with the new RPC routines.
Regards,
Diego
-- >8 -- >8 -- >8 --
* ext2fs/ext2fs.c(main): set current and max RLIMIT_AS to RLIM_INFINITY
when running as the root filesystem.
---
ext2fs/ext2fs.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/ext2fs/ext2fs.c b/ext2fs/ext2fs.c
index 3836bdf6..689e5e5b 100644
--- a/ext2fs/ext2fs.c
+++ b/ext2fs/ext2fs.c
@@ -22,6 +22,8 @@
#include <stdio.h>
#include <device/device.h>
#include <fcntl.h>
+#include <sys/time.h>
+#include <sys/resource.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
@@ -230,6 +232,15 @@ main (int argc, char **argv)
store = diskfs_init_main (&startup_argp, argc, argv,
&store_parsed, &bootstrap);
+ /* Lift default address space limits when we are the root filesystem */
+ if (bootstrap == MACH_PORT_NULL)
+ {
+ struct rlimit limits = { RLIM_INFINITY, RLIM_INFINITY };
+ int err = setrlimit (RLIMIT_AS, &limits);
+ if (err == -1)
+ perror ("error lifting address space limits");
+ }
+
if (store->size < SBLOCK_OFFS + SBLOCK_SIZE)
ext2_panic ("device too small for superblock (%" PRIi64 " bytes)",
store->size);
if (store->log2_blocks_per_page < 0)
--
2.47.1