search for: outfd

Displaying 20 results from an estimated 46 matches for "outfd".

2020 Feb 26
2
[PATCH] lib: command: switch from select() to poll()
...{ - 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 fds); + + fds[0].fd = cmd->errorfd; + fds[1].fd = cmd->outfd; if (cmd->errorfd >= 0) { - FD_SET (cmd->errorfd, &rset); - maxfd = MAX (cmd->errorfd, maxfd); + fds[0].events = POLLIN; nr_fds++; } if (cmd->outfd >= 0) { - FD_SET (cmd->outfd, &rset); - maxfd = MAX (cmd->outfd, maxfd); + fds[1].e...
2020 Feb 26
0
Re: [PATCH] lib: command: switch from select() to poll()
...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 fds); > + > + fds[0].fd = cmd->errorfd; > + fds[1].fd = cmd->outfd; > > if (cmd->errorfd >= 0) { > - FD_SET (cmd->errorfd, &rset); > - maxfd = MAX (cmd->errorfd, maxfd); > + fds[0].events = POLLIN; > nr_fds++; > } > > if (cmd->outfd >= 0) { > - FD_SET (cmd->outfd, &rset); >...
2017 Jun 20
2
[PATCH v2 1/2] mllib: add new Common_utils.run_commands
...gs); +let rec run_commands ?(echo_cmd = true) cmds = + let res = Array.make (List.length cmds) 0 in + let pids = + mapi ( + fun i (args, stdout_chan, stderr_chan) -> + let run_res = do_run args ?stdout_chan ?stderr_chan in + match run_res with + | Either (pid, app, outfd, errfd) -> + Some (i, pid, app, outfd, errfd) + | Or code -> + res.(i) <- code; + None + ) cmds in + let pids = filter_map identity pids in + let pids = ref pids in + while !pids <> [] do + let pid, stat = Unix.waitpid [] 0 in + let match...
2017 Jun 20
0
[PATCH v2 2/2] dib: use Common_utils.run_commands
...un fn -> message (f_"Generating checksums for %s") fn; - let pids = + let cmds = List.map ( fun csum -> let csum_fn = fn ^ "." ^ csum in let csum_tool = tool_of_checksum csum in let outfd = Unix.openfile csum_fn file_flags 0o640 in - Unix.set_close_on_exec outfd; - let args = [| csum_tool; fn; |] in - Common_utils.debug "%s" (stringify_args (Array.to_list args)); - let pid = Unix.create_process csum_tool args Unix.stdin -...
2017 Apr 07
1
[PATCH 1/2] mllib: add new Common_utils.run_commands
...nix.set_close_on_exec fd; + fd + in + let pids = + mapi ( + fun i (args, out, err) -> + let app = List.hd args in + try + let app = + if Filename.is_relative app then which app + else (Unix.access app [Unix.X_OK]; app) in + let outfd = get_fd Unix.stdout out in + let errfd = get_fd Unix.stderr err in + if echo_cmd then + debug "%s" (stringify_args args); + let pid = Unix.create_process app (Array.of_list args) Unix.stdin + outfd errfd in + Some (i, pi...
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()
...t; size_t nr_fds = 0; > > CLEANUP_FREE char *buf = safe_malloc (cmd->g, BUFSIZ); > > ssize_t n; > > > > - FD_ZERO (&rset); > > + memset (&fds, 0, sizeof fds); > > + > > + fds[0].fd = cmd->errorfd; > > + fds[1].fd = cmd->outfd; > > > > if (cmd->errorfd >= 0) { > > - FD_SET (cmd->errorfd, &rset); > > - maxfd = MAX (cmd->errorfd, maxfd); > > + fds[0].events = POLLIN; > > nr_fds++; > > } > > > > if (cmd->outfd >= 0) { >...
2012 Oct 18
10
[PATCH 0/10] Add a mini-library for running external commands.
Inspired by libvirt's virCommand* internal mini-library, this adds some internal APIs for running commands. The first patch contains the new APIs. The subsequent patches change various parts of the library over to use it. Rich.
2015 Feb 02
8
[PATCH 0/7 v2] Make copy_in & copy_out APIs, and use copy_in in customize
Hi, attached there is the second version of the patch series adding copy_in and copy_out in the library, mostly moving them from guestfish. It also adds the copy_in usage in virt-customize, as aid in a new image building. Thanks, Pino Toscano (7): cmd: add a way to run (and wait) asynchronously commands cmd: add a child-setup callback cmd: add the possibility to get a fd to the process
2015 Jan 26
6
[PATCH 1/6] cmd: add a way to run (and wait) asynchronously commands
....c @@ -360,7 +360,7 @@ debug_command (struct command *cmd) } static int -run_command (struct command *cmd) +run_command (struct command *cmd, bool get_stdout_fd, bool get_stderr_fd) { struct sigaction sa; int i, fd, max_fd, r; @@ -368,8 +368,11 @@ run_command (struct command *cmd) int outfd[2] = { -1, -1 }; char status_string[80]; + get_stdout_fd = get_stdout_fd || cmd->stdout_callback != NULL; + get_stderr_fd = get_stderr_fd || cmd->capture_errors; + /* Set up a pipe to capture command output and send it to the error log. */ - if (cmd->capture_errors) { + if (get...
2008 Oct 13
1
Need help for debuging
...for over hundred agents. #> thread apply all bt ........ ........ Thread 6 (process 20135): #0 0x00fc17a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2 #1 0x002dfdf4 in poll () from /lib/tls/libc.so.6 #2 0x080675a7 in ast_waitfor_nandfds (c=0xb7469b80, n=2, fds=0x0, nfds=0, exception=0x0, outfd=0x0, ms=0xb7469b4c) at channel.c:1644 #3 0x08069d86 in ast_channel_bridge (c0=0xb22bf9a8, c1=0xa2ae648, config=0xb746a7a0, fo=0xb7469c40, rc=0xb7469c44) at channel.c:1721 #4 0x00548f65 in ast_bridge_call (chan=0xb22bf9a8, peer=0xa2ae648, config=0xb746a7a0) at res_features.c:1365 #5 0x005...
2019 Jan 16
0
[PATCH 1/5] mltools: split helper do_check_exitcode
...+), 1 deletion(-) diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml index 24641369e..3b1554c5a 100644 --- a/common/mltools/tools_utils.ml +++ b/common/mltools/tools_utils.ml @@ -427,7 +427,9 @@ and do_run ?(echo_cmd = true) ?stdout_fd ?stderr_fd args = and do_teardown app outfd errfd exitstat = Option.may Unix.close outfd; Option.may Unix.close errfd; - match exitstat with + do_check_exitcode app exitstat + +and do_check_exitcode app = function | Unix.WEXITED i -> i | Unix.WSIGNALED i -> -- 2.20.1
2017 Nov 14
1
Re: [PATCH v12 3/3] New tool: virt-builder-repository
.../ocaml/blob/c5fe6932b2151d0e4426072b4df3510318bc4edc/stdlib/pervasives.ml#L477 > + let cmd = [ "xz"; "-f"; "--best"; "--block-size=16777216"; "-c"; file ] in > + let file_flags = [ Unix.O_WRONLY; Unix.O_CREAT; Unix.O_TRUNC; ] in > + let outfd = Unix.openfile outimg file_flags 0o666 in > + let res = run_command cmd ~stdout_chan:outfd in I read the code of run_command but I don't think it closes outfd, and so outfd would be leaked here. Also it'd be nice to use with_openfile, if it was upstream. https://www.redhat.com/arc...
2007 Dec 04
0
Queue App - crash (1.4.15)
...ffffff) at utils.c:843 #3 0xb7f7f13d in pthread_start_thread () from /lib/libpthread.so.0 #4 0xb7ea81ba in clone () from /lib/libc.so.6 Thread 5 (process 8480): #0 0xb7e9f90a in poll () from /lib/libc.so.6 #1 0x0807c583 in ast_waitfor_nandfds (c=0xb71d6a94, n=0, fds=0x0, nfds=0, exception=0x0, outfd=0x0, ms=0xb71d6a90) at channel.c:1982 #2 0x08082797 in ast_waitfor_n (c=0xfffffffc, n=-4, ms=0xfffffffc) at channel.c:2044 #3 0x080718ac in autoservice_run (ign=0x0) at autoservice.c:89 #4 0x080f7e99 in dummy_start (data=0x1f4) at utils.c:843 #5 0xb7f7f13d in pthread_start_thread () from /l...
2008 Oct 10
3
Question about echo cancelation
Hi, I'm using the following setup : Alice ---- IPPhone ------<LAN>----- Media gateway ----<PSTN> ------- Phone ---- Bob For certain calls, users complains about echo : they can ear their own voice in their handset, though media gateway echo cancel is turned on. I'm wondering how this echo cancelation engine is supposed to work. My understanding of echo is that most probably,
2006 Sep 06
7
[RFC PATCH] allow connecting to xenconsole from remote hosts
...if (discard) { + dbg("discard set, queueing %p for discard check\n", + pmsg->data); + __queue_msg(discard, pmsg); + } else + destroy_msg(pmsg); + } while (1); + + free_msg: + destroy_msg(pmsg); + done: + return ret; +} + +static int console_loop(int conspty, int infd, int outfd, int noecho) +{ + int ret; + int max; + + struct queue console = { + .head = NULL, + .tail = NULL, + }; + + struct queue out = { + .head = NULL, + .tail = NULL, + }; + + struct queue discard_queue = { + .head = NULL, + .tail = NULL, + }; + + struct queue *discard = (noecho ? &discard_queu...
2018 Aug 17
8
[PATCH v3 4/4] v2v: Add --print-estimate option to print copy size
I rethought this again, as I think that it's a dangerous assumption to bake qemu-img measure output into our API. This patch series runs qemu-img measure behind the scenes, but then parses the output and sums it to a single number which we print. Doing that required a bit of reworking, moving the Jansson [JSON parser] bindings from virt-builder into the common directory and a couple of other
2018 Nov 19
2
[PATCH] common/mltools: Add a debug statement when we try to run a non-existent program.
...ror (errcode, _, _) when errcode = Unix.ENOENT -> - Or 127 + debug "%s: executable not found" app; + Or 127 + | Unix.Unix_error (errcode, fn, _) when errcode = Unix.ENOENT -> + debug "%s: %s: executable not found" app fn; + Or 127 and do_teardown app outfd errfd exitstat = Option.may Unix.close outfd; -- 2.19.0.rc0
2023 Jul 11
1
[libguestfs PATCH] lib: remove guestfs_int_cmd_clear_close_files()
...eceive stdout. */ cmd_stdout_callback stdout_callback; void *stdout_data; @@ -186,7 +183,6 @@ guestfs_int_new_command (guestfs_h *g) cmd = safe_calloc (g, 1, sizeof *cmd); cmd->g = g; cmd->capture_errors = true; - cmd->close_files = true; cmd->errorfd = -1; cmd->outfd = -1; return cmd; @@ -358,17 +354,6 @@ guestfs_int_cmd_clear_capture_errors (struct command *cmd) cmd->capture_errors = false; } -/** - * Don't close file descriptors after the fork. - * - * XXX Should allow single fds to be sent to child process. - */ -void -guestfs_int_cmd_clear_c...
2019 Jan 16
10
[PATCH 0/5] [RFC] builder: handle unavailable repos
In case a repository of virt-builder references files (e.g. the index) that cannot be downloaded (network issues, 404, etc) then virt-builder errors out on this situation. This is not a nice situation, from an user POV. This series does some refactoring to allow to better handle downloading failures, and handle the failures gracefully in virt-builder. RFC because I'm not yet too convinced