[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v3 2/2] xl: Add escape character argument to xl console
Thanks for the feedback. On 10/07/2023 15:43, Anthony PERARD wrote: I looked into flexarray but didn't implement in v4 - as it stands, libxl_console_exec and libxl_vncviewer_exec are using the same pattern.On Thu, Jun 22, 2023 at 03:12:48PM +0100, Peter Hoyes wrote:/* libxl_primary_console_exec finds the domid and console number * corresponding to the primary console of the given vm, then calls * libxl_console_exec with the right arguments (domid might be different @@ -1968,9 +1969,12 @@ int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, * guests using pygrub. * If notify_fd is not -1, xenconsole will write 0x00 to it to nofity * the caller that it has connected to the guest console. + * If escape_character is not NULL, the provided value is used to exit + * the guest console. */ int libxl_primary_console_exec(libxl_ctx *ctx, uint32_t domid_vm, - int notify_fd); + int notify_fd, + char* escape_character);#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION < 0x040800 diff --git a/tools/libs/light/libxl_console.c b/tools/libs/light/libxl_console.cindex f497be141b..0b7293fe71 100644 --- a/tools/libs/light/libxl_console.c +++ b/tools/libs/light/libxl_console.c @@ -75,15 +76,26 @@ int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, goto out; }+ char *args[] = {+ p, domid_s, "--num", cons_num_s, "--type", cons_type_s, + NULL, NULL, NULL, NULL, // start-notify-fd, escape + NULL, // list terminator - do not use + }; + char **args_extra = args + 6; + if (notify_fd != -1) { notify_fd_s = GCSPRINTF("%d", notify_fd); - execl(p, p, domid_s, "--num", cons_num_s, "--type", cons_type_s, - "--start-notify-fd", notify_fd_s, (void *)NULL); - } else { - execl(p, p, domid_s, "--num", cons_num_s, "--type", cons_type_s, - (void *)NULL); + *args_extra++ = "--start-notify-fd"; + *args_extra++ = notify_fd_s; }+ if (escape_character) {+ *args_extra++ = "--escape"; + *args_extra++ = escape_character; + }There is flexarray_* that could be use, but I guess a preset `*args` kind of work here. Peter
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |