Permalink
Browse files

OS-1163 force qemu cores out of zoneroot and into cores dataset.

  • Loading branch information...
1 parent 9ddb9ad commit 99b29e2864b3427d382de336c74ef5f93155358d @joshwilsdon joshwilsdon committed Jun 6, 2012
Showing with 16 additions and 0 deletions.
  1. +16 −0 src/qemu-exec.c
View
@@ -8,6 +8,7 @@
*/
+#include <sys/resource.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -20,6 +21,7 @@
#define LOG_FILE "/tmp/vm.log"
#define LOG_FILE_PATTERN "/tmp/vm.log.%u"
+void disable_cores(void);
void dump_args(int argc, char **argv);
void dump_privs(void);
void exec_next(int argc, char **argv);
@@ -36,6 +38,7 @@ main(int argc, char **argv)
rotate_logs();
redirect_output();
+ disable_cores();
dump_privs();
dump_args(argc, argv);
@@ -54,6 +57,19 @@ main(int argc, char **argv)
}
void
+disable_cores(void)
+{
+ struct rlimit rlp;
+
+ rlp.rlim_cur = 0;
+ rlp.rlim_max = 0;
+
+ if (setrlimit(RLIMIT_CORE, &rlp) < 0) {
+ perror("Warning, failed to set rlimit for cores");
+ }
+}
+
+void
rotate_logs(void)
{
unsigned int i;

0 comments on commit 99b29e2

Please sign in to comment.