* Interested to participate in Outreachy Program @ 2016-03-05 18:29 sabiya kazi 2016-03-11 16:59 ` sabiya kazi 2016-03-15 13:44 ` Doug Goldstein 0 siblings, 2 replies; 10+ messages in thread From: sabiya kazi @ 2016-03-05 18:29 UTC (permalink / raw) To: Doug Goldstein; +Cc: xen-devel [-- Attachment #1.1: Type: text/plain, Size: 528 bytes --] Hi Doug, I would like to work on the project *Rust Bindings for libxl *as a part of Outreachy Program 2016. I have completed my B.E in Computer engineering from Pune Institute Of Computer Technology, Pune, India. I am using opensource software and I would like to contribute to opensource community. I am interested in learning system programming and virtualization concepts. Can you please suggest me how to go ahead for this project and for submitting my first patch, can you assign a task to work upon? Regards, -Sabiya [-- Attachment #1.2: Type: text/html, Size: 818 bytes --] [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Interested to participate in Outreachy Program 2016-03-05 18:29 Interested to participate in Outreachy Program sabiya kazi @ 2016-03-11 16:59 ` sabiya kazi 2016-03-15 13:44 ` Doug Goldstein 1 sibling, 0 replies; 10+ messages in thread From: sabiya kazi @ 2016-03-11 16:59 UTC (permalink / raw) To: Doug Goldstein; +Cc: xen-devel [-- Attachment #1.1: Type: text/plain, Size: 723 bytes --] Hi Doug, Can you tell me what steps I should follow for this project? Regards, Sabiya On Mar 5, 2016 11:59 PM, "sabiya kazi" <sabiyafk@gmail.com> wrote: > > Hi Doug, > > I would like to work on the project *Rust Bindings for libxl *as a part > of Outreachy Program 2016. > > I have completed my B.E in Computer engineering from Pune Institute Of > Computer Technology, Pune, India. > > I am using opensource software and I would like to contribute to > opensource community. I am interested in learning system programming and > virtualization concepts. > > Can you please suggest me how to go ahead for this project and > for submitting my first patch, can you assign a task to work upon? > > Regards, > -Sabiya > > > > > [-- Attachment #1.2: Type: text/html, Size: 1206 bytes --] [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Interested to participate in Outreachy Program 2016-03-05 18:29 Interested to participate in Outreachy Program sabiya kazi 2016-03-11 16:59 ` sabiya kazi @ 2016-03-15 13:44 ` Doug Goldstein [not found] ` <CAGxmxE0rqnJzW6xUEVQDvxxP+u9ZY9dpVZhNoJD1tcTRAWkWYA@mail.gmail.com> 1 sibling, 1 reply; 10+ messages in thread From: Doug Goldstein @ 2016-03-15 13:44 UTC (permalink / raw) To: sabiya kazi; +Cc: xen-devel [-- Attachment #1.1.1: Type: text/plain, Size: 1187 bytes --] On 3/5/16 12:29 PM, sabiya kazi wrote: > Hi Doug, > > I would like to work on the project *Rust Bindings for libxl *as a part of > Outreachy Program 2016. > > I have completed my B.E in Computer engineering from Pune Institute Of > Computer Technology, Pune, India. > > I am using opensource software and I would like to contribute to opensource > community. I am interested in learning system programming and > virtualization concepts. > > Can you please suggest me how to go ahead for this project and > for submitting my first patch, can you assign a task to work upon? > > Regards, > -Sabiya > Hi Sabiya, I discussed some ideas with the Xen developers and a good project we came up with was extending the "xl console" command to take a "-e" option that allows the user to change the escape character. Currently the escape sequence is hardcoded to "Ctrl-]". The input should be "-e escapechar" where the new escape sequence is "Ctrl-escapechar". Let me know if this makes sense and if it sounds like something you'd like to tackle and I can follow up with your further on a test environment and getting setup to proceed. -- Doug Goldstein [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 959 bytes --] [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <CAGxmxE0rqnJzW6xUEVQDvxxP+u9ZY9dpVZhNoJD1tcTRAWkWYA@mail.gmail.com>]
[parent not found: <56EA3513.2060700@cardoe.com>]
[parent not found: <56EAB99C.5030901@cardoe.com>]
[parent not found: <CAGxmxE14GH6hBGWJJhug5gmQs=s9t=68P1tqhjSOeJTacU6M2g@mail.gmail.com>]
[parent not found: <CAGxmxE2y815wVHR10FjSM175kgWRHDD+Hws_5q9==azpjxc9Bg@mail.gmail.com>]
[parent not found: <CAGxmxE1cxGc6PY3ZWRPfOfamBH6UyyUmLVO3iDSAkeMi_RLWPQ@mail.gmail.com>]
[parent not found: <CAGxmxE0wVfii1K61NXYdLK+d0wiYrobya+jOf-VX=Xzo3AfYog@mail.gmail.com>]
* Re: Interested to participate in Outreachy Program [not found] ` <CAGxmxE0wVfii1K61NXYdLK+d0wiYrobya+jOf-VX=Xzo3AfYog@mail.gmail.com> @ 2016-03-20 19:10 ` sabiya kazi 2016-03-21 12:12 ` sabiya kazi 0 siblings, 1 reply; 10+ messages in thread From: sabiya kazi @ 2016-03-20 19:10 UTC (permalink / raw) To: Doug Goldstein; +Cc: xen-devel [-- Attachment #1.1: Type: text/plain, Size: 2179 bytes --] Hi Doug, I am done with building of xen source.Now, I have started looking at source files and identifying changes required for given task. As you suggested, I went through virsh command source to get idea how escape sequence char option is implemented. Based on that,I came up with following findings: *To complete this task, Steps will be* 1. Do help related change in libxl/xl_cmdtable.c 2. Add handling of one more option for command 'xl console' in file xl_cmdimpl.c in method main_console. From this method, call is delegated to libxl_console_exec() in libxl.c 3. libxl_console_exec delegates to execl(), Do some changes in this method. *Question/Doubts:* - Where I need to use this escape char? - libxl_console_exec() is called by many methods Will it affect other flows as well? - Could not find execl method implementation where it actually prints data - Changes for handling escape char are not cleared Can you please help me on this? Regards, -Sabiya On Sat, Mar 19, 2016 at 11:31 PM, sabiya kazi <sabiyafk@gmail.com> wrote: > Hi Doug, > I have started building xen source. > Can you help me on issue of creating guest domain? > > > Regards, > -Sabiya > > On Fri, Mar 18, 2016 at 1:18 AM, sabiya kazi <sabiyafk@gmail.com> wrote: > >> Hi Doug, >> >> I have proceeded on xen installation. I have configured grub to use xen, >> I could see xl command and tried it's few options. >> >> However, I am getting failure while creating a Debian PV Guest using >> >> xen-create-image --hostname=tutorial-pv-guest \ >> --memory=512mb \ >> --vcpus=2 \ >> --lvm=vg0 \ >> --dhcp \ >> --pygrub \ >> --dist=wheezy >> >> I have attached logs for reference. >> Before this step, I could not setup Linux Bridge Network for Guest >> networking. >> I am using my router for internet connection.Can this will be problem? >> Can you please have a look and let me know. >> Now, One more question to make changes for "Xl command" I need to >> check it's source, I have checked out source from xen repository. >> Can you share path of xl and virsh command source, I can start looking at >> source.. >> >> Rega >> > [-- Attachment #1.2: Type: text/html, Size: 3973 bytes --] [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Interested to participate in Outreachy Program 2016-03-20 19:10 ` sabiya kazi @ 2016-03-21 12:12 ` sabiya kazi 2016-03-22 15:49 ` Doug Goldstein 0 siblings, 1 reply; 10+ messages in thread From: sabiya kazi @ 2016-03-21 12:12 UTC (permalink / raw) To: Doug Goldstein; +Cc: xen-devel [-- Attachment #1.1: Type: text/plain, Size: 2319 bytes --] Hi Doug, Can you please help on questions/problems where I am stuck? Deadline for applying for outreachy is coming closer. Regards, Sabiya Hi Doug, I am done with building of xen source.Now, I have started looking at source files and identifying changes required for given task. As you suggested, I went through virsh command source to get idea how escape sequence char option is implemented. Based on that,I came up with following findings: *To complete this task, Steps will be* 1. Do help related change in libxl/xl_cmdtable.c 2. Add handling of one more option for command 'xl console' in file xl_cmdimpl.c in method main_console. From this method, call is delegated to libxl_console_exec() in libxl.c 3. libxl_console_exec delegates to execl(), Do some changes in this method. *Question/Doubts:* - Where I need to use this escape char? - libxl_console_exec() is called by many methods Will it affect other flows as well? - Could not find execl method implementation where it actually prints data - Changes for handling escape char are not cleared Can you please help me on this? Regards, -Sabiya On Sat, Mar 19, 2016 at 11:31 PM, sabiya kazi <sabiyafk@gmail.com> wrote: > Hi Doug, > I have started building xen source. > Can you help me on issue of creating guest domain? > > > Regards, > -Sabiya > > On Fri, Mar 18, 2016 at 1:18 AM, sabiya kazi <sabiyafk@gmail.com> wrote: > >> Hi Doug, >> >> I have proceeded on xen installation. I have configured grub to use xen, >> I could see xl command and tried it's few options. >> >> However, I am getting failure while creating a Debian PV Guest using >> >> xen-create-image --hostname=tutorial-pv-guest \ >> --memory=512mb \ >> --vcpus=2 \ >> --lvm=vg0 \ >> --dhcp \ >> --pygrub \ >> --dist=wheezy >> >> I have attached logs for reference. >> Before this step, I could not setup Linux Bridge Network for Guest >> networking. >> I am using my router for internet connection.Can this will be problem? >> Can you please have a look and let me know. >> Now, One more question to make changes for "Xl command" I need to >> check it's source, I have checked out source from xen repository. >> Can you share path of xl and virsh command source, I can start looking at >> source.. >> >> Rega >> > [-- Attachment #1.2: Type: text/html, Size: 4262 bytes --] [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Interested to participate in Outreachy Program 2016-03-21 12:12 ` sabiya kazi @ 2016-03-22 15:49 ` Doug Goldstein [not found] ` <CAGxmxE0Ocq0WU4RGYj=_00y1vt_nXg9g9LwFZMd=CxF6DvDHDA@mail.gmail.com> 0 siblings, 1 reply; 10+ messages in thread From: Doug Goldstein @ 2016-03-22 15:49 UTC (permalink / raw) To: sabiya kazi; +Cc: xen-devel [-- Attachment #1.1.1: Type: text/plain, Size: 3320 bytes --] On 3/21/16 7:12 AM, sabiya kazi wrote: > Hi Doug, > Can you please help on questions/problems where I am stuck? > Deadline for applying for outreachy is coming closer. > Regards, > Sabiya > > Hi Doug, > I am done with building of xen source.Now, I have started looking > at source files and identifying changes required for given task. > > As you suggested, I went through virsh command source to get idea how > escape sequence char option is implemented. Based on that,I came up with > following findings: > *To complete this task, Steps will be* > > > 1. Do help related change in libxl/xl_cmdtable.c yes > 2. Add handling of one more option for command 'xl console' in file > xl_cmdimpl.c in method main_console. From this method, call is delegated > to libxl_console_exec() in libxl.c yes or libxl_primary_console_exec() so if the -e arg is specified you'll need it to go into libxl_console_exec() as well. > 3. libxl_console_exec delegates to execl(), Do some changes in this > method. yes. > > > *Question/Doubts:* > > - Where I need to use this escape char? it will be passed to the xenconsole program from step 3 above. > - libxl_console_exec() is called by many methods Will it affect other > flows as well? You will have to add a parameter and default it to NULL and that will cause the underlying call to execl() to not specify that option. > - Could not find execl method implementation where it actually prints > data Not sure I understand. > - Changes for handling escape char are not cleared tools/console/client/main.c you'll find ESCAPE_CHARACTER hard coded. You'll have to add an option here that execl() above in step 3 will specify to pass the argument and utilize it. > > Can you please help me on this? Hopefully my comments above made sense. I'll be in the office the rest of the week so I should be able to help if you run into any other roadblocks. > Regards, > -Sabiya > > > > On Sat, Mar 19, 2016 at 11:31 PM, sabiya kazi <sabiyafk@gmail.com> wrote: > >> Hi Doug, >> I have started building xen source. >> Can you help me on issue of creating guest domain? >> >> >> Regards, >> -Sabiya >> >> On Fri, Mar 18, 2016 at 1:18 AM, sabiya kazi <sabiyafk@gmail.com> wrote: >> >>> Hi Doug, >>> >>> I have proceeded on xen installation. I have configured grub to use xen, >>> I could see xl command and tried it's few options. >>> >>> However, I am getting failure while creating a Debian PV Guest using >>> >>> xen-create-image --hostname=tutorial-pv-guest \ >>> --memory=512mb \ >>> --vcpus=2 \ >>> --lvm=vg0 \ >>> --dhcp \ >>> --pygrub \ >>> --dist=wheezy >>> >>> I have attached logs for reference. >>> Before this step, I could not setup Linux Bridge Network for Guest >>> networking. >>> I am using my router for internet connection.Can this will be problem? >>> Can you please have a look and let me know. >>> Now, One more question to make changes for "Xl command" I need to >>> check it's source, I have checked out source from xen repository. >>> Can you share path of xl and virsh command source, I can start looking at >>> source.. >>> >>> Rega >>> >> > -- Doug Goldstein [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 959 bytes --] [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <CAGxmxE0Ocq0WU4RGYj=_00y1vt_nXg9g9LwFZMd=CxF6DvDHDA@mail.gmail.com>]
* Re: Interested to participate in Outreachy Program [not found] ` <CAGxmxE0Ocq0WU4RGYj=_00y1vt_nXg9g9LwFZMd=CxF6DvDHDA@mail.gmail.com> @ 2016-03-23 16:34 ` sabiya kazi 2016-03-23 18:40 ` Doug Goldstein 2016-03-23 19:05 ` Doug Goldstein 0 siblings, 2 replies; 10+ messages in thread From: sabiya kazi @ 2016-03-23 16:34 UTC (permalink / raw) To: Doug Goldstein; +Cc: xen-devel [-- Attachment #1.1: Type: text/plain, Size: 278 bytes --] Hi Doug, Can you have a look at patch and let me know if everything is correct, I think things are good. I would also like to have a word with you for deciding timeline for project. Meantime, I have started reading stuff about rust language. Regards, -Sabiya [-- Attachment #1.2: Type: text/html, Size: 336 bytes --] [-- Attachment #2: Extend_XL_COmmand_with_Escapechar_Option.patch --] [-- Type: text/x-patch, Size: 8764 bytes --] diff --git a/tools/Makefile b/tools/Makefile index 3f45fb9..1c2fb79 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,4 +1,4 @@ -XEN_ROOT = $(CURDIR)/.. + XEN_ROOT = $(CURDIR)/.. include $(XEN_ROOT)/tools/Rules.mk SUBDIRS-y := diff --git a/tools/console/client/main.c b/tools/console/client/main.c index d006fdc..199432c 100644 --- a/tools/console/client/main.c +++ b/tools/console/client/main.c @@ -35,6 +35,7 @@ #include <sys/select.h> #include <err.h> #include <string.h> +#include <ctype.h> #ifdef __sun__ #include <sys/stropts.h> #endif @@ -45,10 +46,12 @@ #define ESCAPE_CHARACTER 0x1d +# define CONTROL(c) ((c) ^ 0x40) + static volatile sig_atomic_t received_signal = 0; static char lockfile[sizeof (XEN_LOCK_DIR "/xenconsole.") + 8] = { 0 }; static int lockfd = -1; - +static char escapechar = ESCAPE_CHARACTER; static void sighandler(int signum) { received_signal = 1; @@ -214,7 +217,7 @@ static int console_loop(int fd, struct xs_handle *xs, char *pty_path, char msg[60]; len = read(STDIN_FILENO, msg, sizeof(msg)); - if (len == 1 && msg[0] == ESCAPE_CHARACTER) { + if (len == 1 && msg[0] == escapechar) { return 0; } @@ -318,6 +321,14 @@ static void console_unlock(void) } } +char getEscapeChar(const char *s) +{ + if (*s == '^') + return CONTROL(toupper(s[1])); + + return *s; +} + int main(int argc, char **argv) { struct termios attr; @@ -329,6 +340,7 @@ int main(int argc, char **argv) struct option lopt[] = { { "type", 1, 0, 't' }, { "num", 1, 0, 'n' }, + { "escapechar", 1, 0, 'n' }, { "help", 0, 0, 'h' }, { 0 }, @@ -363,6 +375,11 @@ int main(int argc, char **argv) exit(EINVAL); } break; + case 'e' : + escapechar = getEscapeChar(optarg); + break; + + default: fprintf(stderr, "Invalid argument\n"); fprintf(stderr, "Try `%s --help' for more information.\n", diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 4cdc169..86ee670 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -1715,14 +1715,16 @@ static void domain_destroy_domid_cb(libxl__egc *egc, } int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, - libxl_console_type type) + libxl_console_type type, char escapechar) { + + GC_INIT(ctx); char *p = GCSPRINTF("%s/xenconsole", libxl__private_bindir_path()); char *domid_s = GCSPRINTF("%d", domid); char *cons_num_s = GCSPRINTF("%d", cons_num); char *cons_type_s; - + char *cons_escape_char = GCSPRINTF("%c", escapechar); switch (type) { case LIBXL_CONSOLE_TYPE_PV: cons_type_s = "pv"; @@ -1734,13 +1736,17 @@ int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, goto out; } - execl(p, p, domid_s, "--num", cons_num_s, "--type", cons_type_s, (void *)NULL); + if(cons_escape_char == NULL) + execl(p, p, domid_s, "--num", cons_num_s, "--type", cons_type_s,(void *)NULL); + else + execl(p, p, domid_s, "--num", cons_num_s, "--type", cons_type_s, "--escapechar", cons_escape_char, (void *)NULL); out: GC_FREE; return ERROR_FAIL; } + int libxl_console_get_tty(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_console_type type, char **path) { @@ -1823,7 +1829,7 @@ out: return rc; } -int libxl_primary_console_exec(libxl_ctx *ctx, uint32_t domid_vm) +int libxl_primary_console_exec(libxl_ctx *ctx, uint32_t domid_vm, char escapechar) { uint32_t domid; int cons_num; @@ -1832,7 +1838,7 @@ int libxl_primary_console_exec(libxl_ctx *ctx, uint32_t domid_vm) rc = libxl__primary_console_find(ctx, domid_vm, &domid, &cons_num, &type); if ( rc ) return rc; - return libxl_console_exec(ctx, domid, cons_num, type); + return libxl_console_exec(ctx, domid, cons_num, type, escapechar); } int libxl_primary_console_get_tty(libxl_ctx *ctx, uint32_t domid_vm, diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index f9e3ef5..4ac8cfd 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -218,6 +218,12 @@ #define LIBXL_HAVE_SOFT_RESET 1 /* + if user does not specify any escape character sequence then + Default escape character will be ^] + */ + +#define CTRL_CLOSE_BRACKET '\e' +/* * libxl ABI compatibility * * The only guarantee which libxl makes regarding ABI compatibility @@ -1317,15 +1323,26 @@ int libxl_wait_for_free_memory(libxl_ctx *ctx, uint32_t domid, uint32_t memory_k int libxl_wait_for_memory_target(libxl_ctx *ctx, uint32_t domid, int wait_secs); int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass); -int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_console_type type); + + +/* + * Escapechar can be specified , If specified given escape char will + * be used for terminating logging. Otherwise default Ctrl-] will be used, + */ +int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_console_type type, char escapechar); /* 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 * if the guest is using stubdoms). * This function can be called after creating the device model, in * case of HVM guests, and before libxl_run_bootloader in case of PV - * guests using pygrub. */ -int libxl_primary_console_exec(libxl_ctx *ctx, uint32_t domid_vm); + * guests using pygrub. + * + * Escapechar can be specified , If specified given escape char will + * be used for terminating logging. Otherwise default Ctrl-] will be used, + */ + +int libxl_primary_console_exec(libxl_ctx *ctx, uint32_t domid_vm, char escapechar); /* libxl_console_get_tty retrieves the specified domain's console tty path * and stores it in path. Caller is responsible for freeing the memory. diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 990d3c9..fa87f8d 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -1,3 +1,4 @@ + /* * Copyright (C) 2009 Citrix Ltd. * Author Stefano Stabellini <stefano.stabellini@eu.citrix.com> @@ -41,7 +42,8 @@ #include "libxl_json.h" #include "libxlutil.h" #include "xl.h" - +# define CONTROL(c) ((c) ^ 0x40) + char getEscapeChar(const char *s); /* For calls which return an errno on failure */ #define CHK_ERRNOVAL( call ) ({ \ int chk_errnoval = (call); \ @@ -2623,7 +2625,7 @@ static void autoconnect_console(libxl_ctx *ctx_ignored, postfork(); sleep(1); - libxl_primary_console_exec(ctx, bldomid); + libxl_primary_console_exec(ctx, bldomid, 0); /* Do not return. xl continued in child process */ perror("xl: unable to exec console client"); _exit(1); @@ -3411,14 +3413,21 @@ int main_cd_insert(int argc, char **argv) cd_insert(domid, virtdev, file); return 0; } +char getEscapeChar(const char *s) +{ + if (*s == '^') + return CONTROL(toupper(s[1])); + return *s; +} int main_console(int argc, char **argv) { uint32_t domid; int opt = 0, num = 0; + char escapechar = 0; libxl_console_type type = 0; - SWITCH_FOREACH_OPT(opt, "n:t:", NULL, "console", 1) { + SWITCH_FOREACH_OPT(opt, "n:t:e", NULL, "console", 1) { case 't': if (!strcmp(optarg, "pv")) type = LIBXL_CONSOLE_TYPE_PV; @@ -3432,13 +3441,18 @@ int main_console(int argc, char **argv) case 'n': num = atoi(optarg); break; + case 'e': + escapechar = getEscapeChar(optarg); + break; } domid = find_domain(argv[optind]); if (!type) - libxl_primary_console_exec(ctx, domid); - else - libxl_console_exec(ctx, domid, num, type); + libxl_primary_console_exec(ctx, domid, escapechar); + else + libxl_console_exec(ctx, domid, num, type, escapechar); + + fprintf(stderr, "Unable to attach console\n"); return 1; } diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c index fdc1ac6..794c7c1 100644 --- a/tools/libxl/xl_cmdtable.c +++ b/tools/libxl/xl_cmdtable.c @@ -133,8 +133,9 @@ struct cmd_spec cmd_table[] = { &main_console, 0, 0, "Attach to domain's console", "[options] <Domain>\n" - "-t <type> console type, pv or serial\n" - "-n <number> console number" + "-t <type> console type, pv or serial\n" + "-n <number> console number\n" + "-e <escapechar> escape character" }, { "vncviewer", &main_vncviewer, 0, 0, [-- Attachment #3: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: Interested to participate in Outreachy Program 2016-03-23 16:34 ` sabiya kazi @ 2016-03-23 18:40 ` Doug Goldstein 2016-03-23 19:05 ` Doug Goldstein 1 sibling, 0 replies; 10+ messages in thread From: Doug Goldstein @ 2016-03-23 18:40 UTC (permalink / raw) To: sabiya kazi; +Cc: xen-devel [-- Attachment #1.1.1: Type: text/plain, Size: 624 bytes --] On 3/23/16 11:34 AM, sabiya kazi wrote: > Hi Doug, > Can you have a look at patch and let me know if everything > is correct, I think things are good. > > I would also like to have a word with you for deciding timeline for > project. Meantime, I have started reading stuff about rust language. > > > Regards, > -Sabiya > > Sabiya, I'll take a look but you will definitely want to take a look at the contributing guidelines [1] and resubmit the patch following the guidelines so that we can include it. [1] http://www.xenproject.org/help/contribution-guidelines.html -- Doug Goldstein [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 959 bytes --] [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Interested to participate in Outreachy Program 2016-03-23 16:34 ` sabiya kazi 2016-03-23 18:40 ` Doug Goldstein @ 2016-03-23 19:05 ` Doug Goldstein 2016-03-24 22:29 ` Wei Liu 1 sibling, 1 reply; 10+ messages in thread From: Doug Goldstein @ 2016-03-23 19:05 UTC (permalink / raw) To: sabiya kazi; +Cc: xen-devel [-- Attachment #1.1.1: Type: text/plain, Size: 11087 bytes --] On 3/23/16 11:34 AM, sabiya kazi wrote: > Hi Doug, > Can you have a look at patch and let me know if everything > is correct, I think things are good. > > I would also like to have a word with you for deciding timeline for > project. Meantime, I have started reading stuff about rust language. > > > Regards, > -Sabiya > > Inlining the patch since it was sent as an attachment.. > diff --git a/tools/Makefile b/tools/Makefile > index 3f45fb9..1c2fb79 100644 > --- a/tools/Makefile > +++ b/tools/Makefile > @@ -1,4 +1,4 @@ > -XEN_ROOT = $(CURDIR)/.. > + XEN_ROOT = $(CURDIR)/.. > include $(XEN_ROOT)/tools/Rules.mk drop this change > > SUBDIRS-y := > diff --git a/tools/console/client/main.c b/tools/console/client/main.c > index d006fdc..199432c 100644 > --- a/tools/console/client/main.c > +++ b/tools/console/client/main.c > @@ -35,6 +35,7 @@ > #include <sys/select.h> > #include <err.h> > #include <string.h> > +#include <ctype.h> > #ifdef __sun__ > #include <sys/stropts.h> > #endif > @@ -45,10 +46,12 @@ > > #define ESCAPE_CHARACTER 0x1d > > +# define CONTROL(c) ((c) ^ 0x40) not really necessary as a define. this can just go into the function with a comment > + > static volatile sig_atomic_t received_signal = 0; > static char lockfile[sizeof (XEN_LOCK_DIR "/xenconsole.") + 8] = { 0 }; > static int lockfd = -1; > - > +static char escapechar = ESCAPE_CHARACTER; > static void sighandler(int signum) > { > received_signal = 1; > @@ -214,7 +217,7 @@ static int console_loop(int fd, struct xs_handle *xs, char *pty_path, > char msg[60]; > > len = read(STDIN_FILENO, msg, sizeof(msg)); > - if (len == 1 && msg[0] == ESCAPE_CHARACTER) { > + if (len == 1 && msg[0] == escapechar) { > return 0; > } > > @@ -318,6 +321,14 @@ static void console_unlock(void) > } > } > > +char getEscapeChar(const char *s) > +{ > + if (*s == '^') > + return CONTROL(toupper(s[1])); This has the possibility to crash. Not really sure why we would want this at all tbh. The valid range of escape characters should be "a-z A-Z @ [ \ ] ^ _" so really we should only ever deal with 1 character and that character needs to be in the range of: if ( s <= 'a' && s <= 'z' || s <= '@' && s <= '_' ) escapechar = s; else tell_the_user_they_did_wrong(); > + > + return *s; > +} > + > int main(int argc, char **argv) > { > struct termios attr; > @@ -329,6 +340,7 @@ int main(int argc, char **argv) > struct option lopt[] = { > { "type", 1, 0, 't' }, > { "num", 1, 0, 'n' }, > + { "escapechar", 1, 0, 'n' }, the last field should be 'e' > { "help", 0, 0, 'h' }, > { 0 }, > > @@ -363,6 +375,11 @@ int main(int argc, char **argv) > exit(EINVAL); > } > break; > + case 'e' : > + escapechar = getEscapeChar(optarg); > + break; white space is off here > + > + > default: > fprintf(stderr, "Invalid argument\n"); > fprintf(stderr, "Try `%s --help' for more information.\n", > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > index 4cdc169..86ee670 100644 > --- a/tools/libxl/libxl.c > +++ b/tools/libxl/libxl.c > @@ -1715,14 +1715,16 @@ static void domain_destroy_domid_cb(libxl__egc *egc, > } > > int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, > - libxl_console_type type) > + libxl_console_type type, char escapechar) > { > + > + > GC_INIT(ctx); > char *p = GCSPRINTF("%s/xenconsole", libxl__private_bindir_path()); > char *domid_s = GCSPRINTF("%d", domid); > char *cons_num_s = GCSPRINTF("%d", cons_num); > char *cons_type_s; > - > + char *cons_escape_char = GCSPRINTF("%c", escapechar); > switch (type) { > case LIBXL_CONSOLE_TYPE_PV: > cons_type_s = "pv"; > @@ -1734,13 +1736,17 @@ int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, > goto out; > } > > - execl(p, p, domid_s, "--num", cons_num_s, "--type", cons_type_s, (void *)NULL); > + if(cons_escape_char == NULL) this won't ever be true because of the GCSPRINTF() above. I think you mean to check if escapechar == 0 > + execl(p, p, domid_s, "--num", cons_num_s, "--type", cons_type_s,(void *)NULL); > + else > + execl(p, p, domid_s, "--num", cons_num_s, "--type", cons_type_s, "--escapechar", cons_escape_char, (void *)NULL); > > out: > GC_FREE; > return ERROR_FAIL; > } > > + unnecessary white space change > int libxl_console_get_tty(libxl_ctx *ctx, uint32_t domid, int cons_num, > libxl_console_type type, char **path) > { > @@ -1823,7 +1829,7 @@ out: > return rc; > } > > -int libxl_primary_console_exec(libxl_ctx *ctx, uint32_t domid_vm) > +int libxl_primary_console_exec(libxl_ctx *ctx, uint32_t domid_vm, char escapechar) > { > uint32_t domid; > int cons_num; > @@ -1832,7 +1838,7 @@ int libxl_primary_console_exec(libxl_ctx *ctx, uint32_t domid_vm) > > rc = libxl__primary_console_find(ctx, domid_vm, &domid, &cons_num, &type); > if ( rc ) return rc; > - return libxl_console_exec(ctx, domid, cons_num, type); > + return libxl_console_exec(ctx, domid, cons_num, type, escapechar); > } > > int libxl_primary_console_get_tty(libxl_ctx *ctx, uint32_t domid_vm, > diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h > index f9e3ef5..4ac8cfd 100644 > --- a/tools/libxl/libxl.h > +++ b/tools/libxl/libxl.h > @@ -218,6 +218,12 @@ > #define LIBXL_HAVE_SOFT_RESET 1 > > /* > + if user does not specify any escape character sequence then > + Default escape character will be ^] > + */ > + > +#define CTRL_CLOSE_BRACKET '\e' > +/* > * libxl ABI compatibility > * > * The only guarantee which libxl makes regarding ABI compatibility > @@ -1317,15 +1323,26 @@ int libxl_wait_for_free_memory(libxl_ctx *ctx, uint32_t domid, uint32_t memory_k > int libxl_wait_for_memory_target(libxl_ctx *ctx, uint32_t domid, int wait_secs); > > int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass); > -int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_console_type type); > + > + > +/* > + * Escapechar can be specified , If specified given escape char will > + * be used for terminating logging. Otherwise default Ctrl-] will be used, > + */ > +int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_console_type type, char escapechar); > /* 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 > * if the guest is using stubdoms). > * This function can be called after creating the device model, in > * case of HVM guests, and before libxl_run_bootloader in case of PV > - * guests using pygrub. */ > -int libxl_primary_console_exec(libxl_ctx *ctx, uint32_t domid_vm); > + * guests using pygrub. > + * > + * Escapechar can be specified , If specified given escape char will > + * be used for terminating logging. Otherwise default Ctrl-] will be used, > + */ > + > +int libxl_primary_console_exec(libxl_ctx *ctx, uint32_t domid_vm, char escapechar); > > /* libxl_console_get_tty retrieves the specified domain's console tty path > * and stores it in path. Caller is responsible for freeing the memory. > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c > index 990d3c9..fa87f8d 100644 > --- a/tools/libxl/xl_cmdimpl.c > +++ b/tools/libxl/xl_cmdimpl.c > @@ -1,3 +1,4 @@ > + > /* > * Copyright (C) 2009 Citrix Ltd. > * Author Stefano Stabellini <stefano.stabellini@eu.citrix.com> > @@ -41,7 +42,8 @@ > #include "libxl_json.h" > #include "libxlutil.h" > #include "xl.h" > - > +# define CONTROL(c) ((c) ^ 0x40) > + char getEscapeChar(const char *s); Let's drop this given my above comments > /* For calls which return an errno on failure */ > #define CHK_ERRNOVAL( call ) ({ \ > int chk_errnoval = (call); \ > @@ -2623,7 +2625,7 @@ static void autoconnect_console(libxl_ctx *ctx_ignored, > postfork(); > > sleep(1); > - libxl_primary_console_exec(ctx, bldomid); > + libxl_primary_console_exec(ctx, bldomid, 0); We probably should just bring the ESCAPE_CHARACTER #define into libxl and just supply that here by default. > /* Do not return. xl continued in child process */ > perror("xl: unable to exec console client"); > _exit(1); > @@ -3411,14 +3413,21 @@ int main_cd_insert(int argc, char **argv) > cd_insert(domid, virtdev, file); > return 0; > } > +char getEscapeChar(const char *s) > +{ > + if (*s == '^') > + return CONTROL(toupper(s[1])); see above comments > > + return *s; > +} > int main_console(int argc, char **argv) > { > uint32_t domid; > int opt = 0, num = 0; > + char escapechar = 0; > libxl_console_type type = 0; > > - SWITCH_FOREACH_OPT(opt, "n:t:", NULL, "console", 1) { > + SWITCH_FOREACH_OPT(opt, "n:t:e", NULL, "console", 1) { > case 't': > if (!strcmp(optarg, "pv")) > type = LIBXL_CONSOLE_TYPE_PV; > @@ -3432,13 +3441,18 @@ int main_console(int argc, char **argv) > case 'n': > num = atoi(optarg); > break; > + case 'e': > + escapechar = getEscapeChar(optarg); > + break; > } > > domid = find_domain(argv[optind]); > if (!type) > - libxl_primary_console_exec(ctx, domid); > - else > - libxl_console_exec(ctx, domid, num, type); > + libxl_primary_console_exec(ctx, domid, escapechar); > + else > + libxl_console_exec(ctx, domid, num, type, escapechar); > + > + > fprintf(stderr, "Unable to attach console\n"); > return 1; > } > diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c > index fdc1ac6..794c7c1 100644 > --- a/tools/libxl/xl_cmdtable.c > +++ b/tools/libxl/xl_cmdtable.c > @@ -133,8 +133,9 @@ struct cmd_spec cmd_table[] = { > &main_console, 0, 0, > "Attach to domain's console", > "[options] <Domain>\n" > - "-t <type> console type, pv or serial\n" > - "-n <number> console number" > + "-t <type> console type, pv or serial\n" > + "-n <number> console number\n" > + "-e <escapechar> escape character" > }, > { "vncviewer", > &main_vncviewer, 0, 0, Overall this change makes me think about some rough edges of the libxl API but I think this is the minimum amount to get the feature working without worrying about API bits. -- Doug Goldstein [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 959 bytes --] [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Interested to participate in Outreachy Program 2016-03-23 19:05 ` Doug Goldstein @ 2016-03-24 22:29 ` Wei Liu 0 siblings, 0 replies; 10+ messages in thread From: Wei Liu @ 2016-03-24 22:29 UTC (permalink / raw) To: Doug Goldstein; +Cc: xen-devel, Wei Liu, sabiya kazi On Wed, Mar 23, 2016 at 02:05:42PM -0500, Doug Goldstein wrote: [...] > > > > domid = find_domain(argv[optind]); > > if (!type) > > - libxl_primary_console_exec(ctx, domid); > > - else > > - libxl_console_exec(ctx, domid, num, type); > > + libxl_primary_console_exec(ctx, domid, escapechar); > > + else > > + libxl_console_exec(ctx, domid, num, type, escapechar); > > + Urgh... Handling API backward compatibility is really too much for a small contribution. I'm really sorry for not having noticed this touches stable API when I suggested this project. I would be quite happy if you only modify tools/console/client/main.c and teach it -t option and leave xl command and libxl API to me (or other aspired people who wants to work on this). In the context of Doug's project I think you have more important stuff to do. Doug has the final say on what kind of contribution is appropriate, of course. Wei. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-03-24 22:29 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-03-05 18:29 Interested to participate in Outreachy Program sabiya kazi 2016-03-11 16:59 ` sabiya kazi 2016-03-15 13:44 ` Doug Goldstein [not found] ` <CAGxmxE0rqnJzW6xUEVQDvxxP+u9ZY9dpVZhNoJD1tcTRAWkWYA@mail.gmail.com> [not found] ` <56EA3513.2060700@cardoe.com> [not found] ` <56EAB99C.5030901@cardoe.com> [not found] ` <CAGxmxE14GH6hBGWJJhug5gmQs=s9t=68P1tqhjSOeJTacU6M2g@mail.gmail.com> [not found] ` <CAGxmxE2y815wVHR10FjSM175kgWRHDD+Hws_5q9==azpjxc9Bg@mail.gmail.com> [not found] ` <CAGxmxE1cxGc6PY3ZWRPfOfamBH6UyyUmLVO3iDSAkeMi_RLWPQ@mail.gmail.com> [not found] ` <CAGxmxE0wVfii1K61NXYdLK+d0wiYrobya+jOf-VX=Xzo3AfYog@mail.gmail.com> 2016-03-20 19:10 ` sabiya kazi 2016-03-21 12:12 ` sabiya kazi 2016-03-22 15:49 ` Doug Goldstein [not found] ` <CAGxmxE0Ocq0WU4RGYj=_00y1vt_nXg9g9LwFZMd=CxF6DvDHDA@mail.gmail.com> 2016-03-23 16:34 ` sabiya kazi 2016-03-23 18:40 ` Doug Goldstein 2016-03-23 19:05 ` Doug Goldstein 2016-03-24 22:29 ` Wei Liu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).