From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SU0Cw-00031n-0l for qemu-devel@nongnu.org; Mon, 14 May 2012 14:41:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SU0Cu-0001wP-4g for qemu-devel@nongnu.org; Mon, 14 May 2012 14:41:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16622) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SU0Ct-0001wC-RY for qemu-devel@nongnu.org; Mon, 14 May 2012 14:41:20 -0400 Message-ID: <4FB151CC.2090007@redhat.com> Date: Mon, 14 May 2012 12:41:16 -0600 From: Eric Blake MIME-Version: 1.0 References: <20120514144058.2ffac223@doriath.home> <4FB14611.7090808@redhat.com> <20120514150117.1cc082a5@doriath.home> <20120514150358.6471534d@doriath.home> In-Reply-To: <20120514150358.6471534d@doriath.home> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig8D8DE45AA9ECC2C29F6CAC49" Subject: Re: [Qemu-devel] [PATCH] qemu-ga: guest-shutdown: use only async-signal-safe functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: qemu-devel , mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig8D8DE45AA9ECC2C29F6CAC49 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 05/14/2012 12:03 PM, Luiz Capitulino wrote: > On Mon, 14 May 2012 15:01:17 -0300 > Luiz Capitulino wrote: >=20 >>>> + >>>> + ret =3D execle("/sbin/shutdown", "shutdown", shutdown_flag,= "+0", >>>> + "hypervisor initiated shutdown", (char*)NULL, e= nviron); >>> >>> Where was 'environ' declared? POSIX says that environ must exist, bu= t >>> that it is the one variable where you must declare it yourself rather= >>> than getting it from a public header. (For convenience, glibc declar= es >>> environ in when using _GNU_SOURCE, but when you are asking= >>> for strict standards namespace compliance, it disappears.) >> >> I'll declare it then. >=20 > -Wredundant-decls doesn't like it: >=20 > /home/lcapitulino/work/src/qmp-unstable/qga/commands-posix.c:38:15: war= ning: redundant redeclaration of =E2=80=98environ=E2=80=99 [-Wredundant-d= ecls] > /usr/include/unistd.h:546:15: note: previous declaration of =E2=80=98en= viron=E2=80=99 was here > LINK qemu-ga Hmm, gnulib works around that by probing for whether environ was declared at configure time, in order to conditionalize whether to output a declaration of its own; but obviously we aren't using gnulib. Maybe, since we know that the glibc declaration is guarded by _GNU_SOURCE, we could likewise guard our declaration to only occur in the situations where glibc is not declaring it? Or maybe we can factor things into a common header used by other qemu files, where the header file itself is tagged in such a way to silence gcc warnings about any possible duplicate declaration, while still leaving the .c files that use this common header clean for use of -Wredundant-decls? --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig8D8DE45AA9ECC2C29F6CAC49 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJPsVHMAAoJEKeha0olJ0Nq4tcIAKSml39xp9sCSscL711KzVsA 1hq/b4U0Vqw7YfjViKzioIbeXfnLUm3on4fGx240J66hHzGK6oo6tUx6V3RgOPZJ rs9PA6O8cc36K86xiARJ2hxeU+0AKkfB9acLyg2SKiypipQTyYHH6//aghhMc4Ag Hi25G0P2OHRWl6jgGhKNW9XvugRN+KPjF8SDNnaLr0KpM6uKFzJr2Cwa2b6drD8+ phKi9SkUPZqX9+kqcZb2OstdkwIm++xv2dEgEBv+/VsozJF1TsK4l2vKahvSZ9dY I57KEZeWXv0+9ZlULXHPW8ZCeIVvSrJdXbC5+XZ4P/y7Ny1/i4wZ6x40F5TqxOY= =nGUG -----END PGP SIGNATURE----- --------------enig8D8DE45AA9ECC2C29F6CAC49--