Received: from eggs.gnu.org ([208.118.235.92]:34277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SU1QE-0007Hq-Mw for qemu-devel@nongnu.org; Mon, 14 May 2012 15:59:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SU1QC-0000nQ-Up for qemu-devel@nongnu.org; Mon, 14 May 2012 15:59:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1736) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SU1QC-0000nE-LK for qemu-devel@nongnu.org; Mon, 14 May 2012 15:59:08 -0400 Date: Mon, 14 May 2012 16:59:00 -0300 From: Luiz Capitulino Message-ID: <20120514165900.27c215a2@doriath.home> In-Reply-To: <4FB151CC.2090007@redhat.com> References: <20120514144058.2ffac223@doriath.home> <4FB14611.7090808@redhat.com> <20120514150117.1cc082a5@doriath.home> <20120514150358.6471534d@doriath.home> <4FB151CC.2090007@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: Eric Blake Cc: qemu-devel , mdroth@linux.vnet.ibm.com On Mon, 14 May 2012 12:41:16 -0600 Eric Blake wrote: > 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, but > >>> 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-dec= ls] > > /usr/include/unistd.h:546:15: note: previous declaration of =E2=80=98en= viron=E2=80=99 was here > > LINK qemu-ga >=20 > 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? What's the worst case if we leave it as is? The build will brake if environ ends up not being declared by some arch, right? In that case we could leave= it as is and fix it when it brakes :)