search for: guestfs_int_cmd_set_child_rlimit

Displaying 5 results from an estimated 5 matches for "guestfs_int_cmd_set_child_rlimit".

2015 May 26
0
[PATCH] lib: Limit space and time used by 'qemu-img info' subprocess.
.../* Optional stdin forwarding to the child. */ int infd; }; @@ -329,6 +345,22 @@ guestfs_int_cmd_set_child_callback (struct command *cmd, cmd->child_callback_data = data; } +/* Set up child rlimits, in case the process we are running could + * consume lots of space or time. + */ +void +guestfs_int_cmd_set_child_rlimit (struct command *cmd, int resource, long limit) +{ + struct child_rlimits *p; + + p = safe_malloc (cmd->g, sizeof *p); + p->resource = resource; + p->limit = limit; + p->next = cmd->child_rlimits; + cmd->child_rlimits = p; +} + + /* Finish off the command by either NULL-ter...
2015 Oct 14
2
[PATCH 1/2] lib: info: Move common code for setting child rlimits.
..., const char *filename) @@ -276,12 +277,7 @@ get_json_output (guestfs_h *g, const char *filename) guestfs_int_cmd_add_arg (cmd, fdpath); guestfs_int_cmd_set_stdout_callback (cmd, parse_json, &tree, CMD_STDOUT_FLAG_WHOLE_BUFFER); -#ifdef RLIMIT_AS - guestfs_int_cmd_set_child_rlimit (cmd, RLIMIT_AS, 1000000000 /* 1GB */); -#endif -#ifdef RLIMIT_CPU - guestfs_int_cmd_set_child_rlimit (cmd, RLIMIT_CPU, 10 /* seconds */); -#endif + set_child_rlimits (cmd); r = guestfs_int_cmd_run (cmd); close (fd); if (r == -1) @@ -560,12 +556,7 @@ old_parser_run_qemu_img_info (guestfs...
2023 Jul 11
1
[libguestfs PATCH] lib: remove guestfs_int_cmd_clear_close_files()
...uestfs-internal.h index fb55e02614f5..c7ef32277e93 100644 --- a/lib/guestfs-internal.h +++ b/lib/guestfs-internal.h @@ -751,7 +751,6 @@ extern void guestfs_int_cmd_set_stdout_callback (struct command *, cmd_stdout_ca extern void guestfs_int_cmd_set_stderr_to_stdout (struct command *); extern void guestfs_int_cmd_set_child_rlimit (struct command *, int resource, long limit); extern void guestfs_int_cmd_clear_capture_errors (struct command *); -extern void guestfs_int_cmd_clear_close_files (struct command *); extern void guestfs_int_cmd_set_child_callback (struct command *, cmd_child_callback child_callback, void *data);...
2018 Sep 21
4
[PATCH v2] lib: Use qemu-img info -U option to avoid locking error.
...urn NULL; + case 0: break; + default: guestfs_int_cmd_add_arg (cmd, "-U"); + } guestfs_int_cmd_add_arg (cmd, "--output"); guestfs_int_cmd_add_arg (cmd, "json"); if (filename[0] == '/') @@ -218,3 +224,36 @@ set_child_rlimits (struct command *cmd) guestfs_int_cmd_set_child_rlimit (cmd, RLIMIT_CPU, 10 /* seconds */); #endif } + +/** + * Test if the qemu-img info command supports the C<-U> option to + * disable locking. The result is memoized in the handle. + * + * Note this option was added in qemu 2.11. We can remove this test + * when we can assume everyone is us...
2018 Oct 02
0
Re: [PATCH v2] lib: Use qemu-img info -U option to avoid locking error.
...default: guestfs_int_cmd_add_arg (cmd, "-U"); > + } > guestfs_int_cmd_add_arg (cmd, "--output"); > guestfs_int_cmd_add_arg (cmd, "json"); > if (filename[0] == '/') > @@ -218,3 +224,36 @@ set_child_rlimits (struct command *cmd) > guestfs_int_cmd_set_child_rlimit (cmd, RLIMIT_CPU, 10 /* seconds */); > #endif > } > + > +/** > + * Test if the qemu-img info command supports the C<-U> option to > + * disable locking. The result is memoized in the handle. > + * > + * Note this option was added in qemu 2.11. We can remove this te...