From: Dario Faggioli <raistlin@linux.it>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: "Ian.Campbell" <Ian.Campbell@eu.citrix.com>,
xen-devel <xen-devel@lists.xensource.com>
Subject: Re: [PATCH 1 of 3] libxl: extend pCPUs specification for vcpu-pin.
Date: Thu, 12 Jan 2012 23:12:17 +0000 [thread overview]
Message-ID: <1326409937.4494.22.camel@Abyss> (raw)
In-Reply-To: <20239.6553.110187.528841@mariner.uk.xensource.com>
[-- Attachment #1.1: Type: text/plain, Size: 2239 bytes --]
On Thu, 2012-01-12 at 17:34 +0000, Ian Jackson wrote:
> Dario Faggioli writes ("[Xen-devel] [PATCH 1 of 3] libxl: extend pCPUs specification for vcpu-pin."):
> > Allow for "^<cpuid>" syntax while specifying the pCPUs list
> > during a vcpu-pin. This enables doing the following:
> >
> > xl vcpu-pin 1 1 0-4,^2
> ...
> > + if (strcmp(cpu, "all")) {
> > + for (toka = strtok(cpu, ","), i = 0; toka; toka = strtok(NULL, ","), ++i) {
>
> OMG you used strtok. strtok is not thread-safe.
>
Well, that's not properly me, is it that?
hg annotate tools/libxl/xl_cmdimpl.c
...
21247: if (strcmp(cpu, "all")) {
21247: for (toka = strtok(cpu, ","), i = 0; toka; toka = strtok(NULL, ","), ++i) {
21247: cpuida = strtoul(toka, &endptr, 10);
21247: if (toka == endptr) {
...
> strtok_r is but
> still modifies its input string - hence your need to strdup. If you
> do want to do it this way IMO the strdup should be in vcpupin_parse
> which should take a const char*. Are you sure this is the right
> approach to parsing this ?
>
Again, I know that's probably not an alibi, but that's not my code! :-P
What I did is just move this from the body of vcpupin() to an helper
function, and try to add as _less_ thing as I can to support a slightly
improved syntax.
That being said, if you think I should rewrite the parsing from scratch,
I can think about it, just wanted to clarify my position. :-)
> <record type="broken">
> Your patch 2 has a number of overly long lines.
> </record>
>
I know. What I usually do is try to comply with the coding style I find
in a file. Thus, if there are, from time to time, lines overcoming
col80, I tend to relax such constrain a bit (especially when I change
one of those lines). Anyway, for v2 I'll double check that, as I don't
like long lines either. :-)
Thanks,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-------------------------------------------------------------------
Dario Faggioli, http://retis.sssup.it/people/faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
PhD Candidate, ReTiS Lab, Scuola Superiore Sant'Anna, Pisa (Italy)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2012-01-12 23:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-11 17:49 [PATCH 0 of 3] libxl: Extend CPU affinity specification and enable it in config file Dario Faggioli
2012-01-11 17:58 ` [PATCH 1 of 3] libxl: extend pCPUs specification for vcpu-pin Dario Faggioli
2012-01-12 8:38 ` Ian Campbell
2012-01-12 17:34 ` Ian Jackson
2012-01-12 23:12 ` Dario Faggioli [this message]
2012-01-13 13:34 ` Ian Jackson
2012-01-13 16:45 ` Dario Faggioli
2012-01-13 16:48 ` Ian Jackson
2012-01-23 10:21 ` Ian Campbell
2012-01-23 10:27 ` Dario Faggioli
2012-01-23 10:50 ` Ian Campbell
2012-01-11 18:00 ` [PATCH 2 of 3] libxl: allow for specifying the CPU affinity in the config file Dario Faggioli
2012-01-12 8:43 ` Ian Campbell
2012-01-12 22:56 ` Dario Faggioli
2012-01-13 8:09 ` Ian Campbell
2012-01-13 9:13 ` Dario Faggioli
2012-01-11 18:01 ` [PATCH 3 of 3] libxl: Align examples with current code Dario Faggioli
2012-01-12 8:37 ` Ian Campbell
2012-01-12 22:45 ` Dario Faggioli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1326409937.4494.22.camel@Abyss \
--to=raistlin@linux.it \
--cc=Ian.Campbell@eu.citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).