From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH 1 of 3] libxl: extend pCPUs specification for vcpu-pin. Date: Thu, 12 Jan 2012 23:12:17 +0000 Message-ID: <1326409937.4494.22.camel@Abyss> References: <1326304198.2401.6.camel@Abyss> <1326304739.12973.1.camel@Abyss> <20239.6553.110187.528841@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0028480868016067256==" Return-path: In-Reply-To: <20239.6553.110187.528841@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson Cc: "Ian.Campbell" , xen-devel List-Id: xen-devel@lists.xenproject.org --===============0028480868016067256== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-MspcEc8rB+z4/L+eH8DX" --=-MspcEc8rB+z4/L+eH8DX Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2012-01-12 at 17:34 +0000, Ian Jackson wrote:=20 > Dario Faggioli writes ("[Xen-devel] [PATCH 1 of 3] libxl: extend pCPUs sp= ecification for vcpu-pin."): > > Allow for "^" syntax while specifying the pCPUs list > > during a vcpu-pin. This enables doing the following: > >=20 > > xl vcpu-pin 1 1 0-4,^2 > ... > > + if (strcmp(cpu, "all")) { > > + for (toka =3D strtok(cpu, ","), i =3D 0; toka; toka =3D strtok= (NULL, ","), ++i) { >=20 > OMG you used strtok. strtok is not thread-safe. =20 > Well, that's not properly me, is it that? hg annotate tools/libxl/xl_cmdimpl.c ... 21247: if (strcmp(cpu, "all")) {=20 21247: for (toka =3D strtok(cpu, ","), i =3D 0; toka; toka =3D strt= ok(NULL, ","), ++i) { 21247: cpuida =3D strtoul(toka, &endptr, 10); 21247: if (toka =3D=3D 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 ? >=20 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. :-) > > Your patch 2 has a number of overly long lines. > >=20 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 --=20 <> (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) --=-MspcEc8rB+z4/L+eH8DX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEABECAAYFAk8PaNEACgkQk4XaBE3IOsS9IwCfRZSAUK0G+5+lcwgnxjO7kQzQ mTkAoITn2T2ubXHjI2a1Niakc9UBk4kO =Cx6n -----END PGP SIGNATURE----- --=-MspcEc8rB+z4/L+eH8DX-- --===============0028480868016067256== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0028480868016067256==--