search for: run_child

Displaying 9 results from an estimated 9 matches for "run_child".

Did you mean: run_build
2017 Oct 06
0
[PATCH v2 1/2] lib: command: If command fails, exit with 126 or 127 as defined by POSIX.
...ptor, failing and overwriting errno. That took some time to debug. --- lib/command.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/command.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_EXE...
2020 Feb 26
2
[PATCH] lib: command: switch from select() to poll()
...command.c @@ -89,9 +89,8 @@ #include <signal.h> #include <errno.h> #include <assert.h> -#include <sys/types.h> #include <sys/stat.h> -#include <sys/select.h> +#include <poll.h> #ifdef HAVE_SYS_TIME_H #include <sys/time.h> @@ -650,37 +649,41 @@ run_child (struct command *cmd) static int loop (struct command *cmd) { - fd_set rset, rset2; - int maxfd = -1, r; + struct pollfd fds[2]; + int r; size_t nr_fds = 0; CLEANUP_FREE char *buf = safe_malloc (cmd->g, BUFSIZ); ssize_t n; - FD_ZERO (&rset); + memset (&fds, 0, sizeof...
2023 Jul 11
1
[libguestfs PATCH] lib: remove guestfs_int_cmd_clear_close_files()
...s to be sent to child process. - */ -void -guestfs_int_cmd_clear_close_files (struct command *cmd) -{ - cmd->close_files = false; -} - /** * Set a function to be executed in the child, right before the * execution. Can be used to setup the child, for example changing @@ -564,18 +549,16 @@ run_child (struct command *cmd, char **env) for (i = 1; i < NSIG; ++i) sigaction (i, &sa, NULL); - if (cmd->close_files) { - /* Close all other file descriptors. This ensures that we don't - * hold open (eg) pipes from the parent process. - */ - max_fd = sysconf (_SC_O...
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
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:
2020 Feb 26
1
Re: [PATCH] lib: command: switch from select() to poll()
...#include <assert.h> > > -#include <sys/types.h> > > #include <sys/stat.h> > > -#include <sys/select.h> > > +#include <poll.h> > > > > #ifdef HAVE_SYS_TIME_H > > #include <sys/time.h> > > @@ -650,37 +649,41 @@ run_child (struct command *cmd) > > static int > > loop (struct command *cmd) > > { > > - fd_set rset, rset2; > > - int maxfd = -1, r; > > + struct pollfd fds[2]; > > + int r; > > size_t nr_fds = 0; > > CLEANUP_FREE char *buf = safe_malloc (c...
2020 Feb 26
0
Re: [PATCH] lib: command: switch from select() to poll()
...> > #include <errno.h> > #include <assert.h> > -#include <sys/types.h> > #include <sys/stat.h> > -#include <sys/select.h> > +#include <poll.h> > > #ifdef HAVE_SYS_TIME_H > #include <sys/time.h> > @@ -650,37 +649,41 @@ run_child (struct command *cmd) > static int > loop (struct command *cmd) > { > - fd_set rset, rset2; > - int maxfd = -1, r; > + struct pollfd fds[2]; > + int r; > size_t nr_fds = 0; > CLEANUP_FREE char *buf = safe_malloc (cmd->g, BUFSIZ); > ssize_t n; >...
2015 Oct 14
0
[PATCH 2/2] lib: Add comment and regression test for case where main process has large heap.
...ut /tests/regressions/rhbz1055452 +/tests/regressions/test-big-heap /tests/rsync/rsyncd.pid /tests/syslinux/extlinux-guest.img /tests/syslinux/syslinux-guest.img diff --git a/src/command.c b/src/command.c index 0547111..e9f357a 100644 --- a/src/command.c +++ b/src/command.c @@ -558,6 +558,17 @@ run_child (struct command *cmd) } #endif /* HAVE_SETRLIMIT */ + /* NB: If the main process (which we have forked a copy of) uses + * more heap than the RLIMIT_AS we set above, then any call to + * malloc or any extension of the stack will fail with ENOMEM or + * SIGSEGV respectively. Luckily we...
2015 Oct 14
2
[PATCH 1/2] lib: info: Move common code for setting child rlimits.
This is almost just refactoring, but I also set the memory limit to really 1 GB, and not 1×10⁹. --- src/info.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/info.c b/src/info.c index d7f45f0..616ef50 100644 --- a/src/info.c +++ b/src/info.c @@ -56,6 +56,7 @@ static yajl_val get_json_output (guestfs_h *g, const char *filename); static char