search for: child_rlimits

Displaying 6 results from an estimated 6 matches for "child_rlimits".

2015 May 26
0
[PATCH] lib: Limit space and time used by 'qemu-img info' subprocess.
...f HAVE_SYS_TIME_H +#include <sys/time.h> +#endif +#ifdef HAVE_SYS_RESOURCE_H +#include <sys/resource.h> +#endif + #include "guestfs.h" #include "guestfs-internal.h" @@ -101,6 +108,12 @@ struct buffering { void (*close_data) (struct command *cmd); }; +struct child_rlimits { + struct child_rlimits *next; + int resource; + long limit; +}; + struct command { guestfs_h *g; @@ -139,6 +152,9 @@ struct command cmd_child_callback child_callback; void *child_callback_data; + /* Optional child limits. */ + struct child_rlimits *child_rlimits; + /* Optiona...
2016 Apr 14
0
[PATCH] Add safe wrapper around waitpid which deals with EINTR correctly.
...t;) == -1) return -1; - } cmd->pid = 0; @@ -902,7 +899,7 @@ guestfs_int_cmd_close (struct command *cmd) free (cmd->outbuf.buffer); if (cmd->pid > 0) - waitpid (cmd->pid, NULL, 0); + guestfs_int_waitpid_noerror (cmd->pid); for (child_rlimit = cmd->child_rlimits; child_rlimit != NULL; child_rlimit = child_rlimit_next) { diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h index bf107d0..7b3927b 100644 --- a/src/guestfs-internal.h +++ b/src/guestfs-internal.h @@ -918,4 +918,8 @@ extern int guestfs_int_validate_guid (const char *); /* umask....
2016 Apr 14
2
[PATCH] Add safe wrapper around waitpid which deals with EINTR correctly.
As Eric Blake noted in: https://www.redhat.com/archives/libguestfs/2016-April/msg00154.html libguestfs doesn't correctly handle the case where waitpid receives a SIGCHLD signal and the main program has registered a non-restartable signal handler. In this case waitpid would return -EINTR and we would print an error, but actually we should retry this case. This adds two new internal functions,
2015 Sep 29
8
[PATCH 0/7] copy-in/copy-out: Capture errors from tar subprocess (RHBZ#1267032).
Commits 3c27f3d91e1566854747bbe844186783fc84f3a8 and 1b6f0daa9ae7fcc94e389232d0c397816cda973d added an internal API for running commands asynchronously. It is only used by the copy-in and copy-out APIs. Unfortunately this made the command code very complex: it was almost impossible to redirect stderr to a file, and there were a lot of long-range dependencies through the file. It was also buggy:
2017 Oct 06
0
[PATCH v2 1/2] lib: command: If command fails, exit with 126 or 127 as defined by POSIX.
....c b/lib/command.c index 3d8bc7dbf..36f953dcf 100644 --- a/lib/command.c +++ b/lib/command.c @@ -539,7 +539,7 @@ static void run_child (struct command *cmd) { struct sigaction sa; - int i, fd, max_fd, r; + int i, err, fd, max_fd, r; char status_string[80]; #ifdef HAVE_SETRLIMIT struct child_rlimits *child_rlimit; @@ -614,8 +614,12 @@ run_child (struct command *cmd) switch (cmd->style) { case COMMAND_STYLE_EXECV: execvp (cmd->argv.argv[0], cmd->argv.argv); + err = errno; perror (cmd->argv.argv[0]); - _exit (EXIT_FAILURE); + /* These error codes are defined...
2017 Oct 06
3
[PATCH v2 0/2] lib: Allow db_dump package to be a weak dependency
Previously posted: https://www.redhat.com/archives/libguestfs/2017-October/msg00032.html This takes a completely different approach. It turns out that POSIX / the shell already defines a special exit code 127 for ‘command not found’. We can make a small adjustment to lib/command.c to return this exit code in that case. Then we just have to modify the db_dump code to test for this exit code. I