Hi, I have this build error: xl_cmdimpl.c:3724:40: error: declaration of ''reboot'' shadows a global declaration Renaming it to ''_reboot'' fixes this for me. Christoph -- ---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85689 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
On Wed, 2012-10-24 at 10:36 +0100, Christoph Egger wrote:> Hi, > > I have this build error: > > xl_cmdimpl.c:3724:40: error: declaration of ''reboot'' shadows a global > declarationDid gcc tell you where the other global definition was from? reboot(2) I suppose?> Renaming it to ''_reboot'' fixes this for me.Can you send a patch? I don''t think _reboot is a legal identifier (reserved for the implementation or POSIX or some such). do_reboot would be ok. So would changing main_shutdown_or_reboot to take the function pointer directly I think. Ian.
On 10/24/12 11:58, Ian Campbell wrote:> On Wed, 2012-10-24 at 10:36 +0100, Christoph Egger wrote: >> Hi, >> >> I have this build error: >> >> xl_cmdimpl.c:3724:40: error: declaration of ''reboot'' shadows a global >> declaration > > Did gcc tell you where the other global definition was from?No.> reboot(2) I suppose?Yes. <unistd.h> has the prototype.>> Renaming it to ''_reboot'' fixes this for me. > > Can you send a patch? > > I don''t think _reboot is a legal identifier (reserved for the > implementation or POSIX or some such). do_reboot would be ok. So would > changing main_shutdown_or_reboot to take the function pointer directly I > think.patch attached. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Christoph -- ---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85689 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
>>> On 24.10.12 at 12:50, Christoph Egger <Christoph.Egger@amd.com> wrote: > On 10/24/12 11:58, Ian Campbell wrote: >> On Wed, 2012-10-24 at 10:36 +0100, Christoph Egger wrote: >>> Hi, >>> >>> I have this build error: >>> >>> xl_cmdimpl.c:3724:40: error: declaration of ''reboot'' shadows a global >>> declaration >> >> Did gcc tell you where the other global definition was from? > > No. > >> reboot(2) I suppose? > > Yes. <unistd.h> has the prototype.Afaict that''s a mistake of whatever provides this header on your system - there''s no unconditionally visible "reboot" in the specs I have available. Jan
On Wed, 2012-10-24 at 12:16 +0100, Jan Beulich wrote:> >>> On 24.10.12 at 12:50, Christoph Egger <Christoph.Egger@amd.com> wrote: > > On 10/24/12 11:58, Ian Campbell wrote: > >> On Wed, 2012-10-24 at 10:36 +0100, Christoph Egger wrote: > >>> Hi, > >>> > >>> I have this build error: > >>> > >>> xl_cmdimpl.c:3724:40: error: declaration of ''reboot'' shadows a global > >>> declaration > >> > >> Did gcc tell you where the other global definition was from? > > > > No. > > > >> reboot(2) I suppose? > > > > Yes. <unistd.h> has the prototype. > > Afaict that''s a mistake of whatever provides this header on your > system - there''s no unconditionally visible "reboot" in the specs > I have available.Indeed, on Linux it is documented as requiring: #include <unistd.h> #include <sys/reboot.h> (or sometimes linux/reboot.h). Ian.
Christoph Egger writes ("Re: [Xen-devel] libxl: build error"):> patch attached.Thanks. I have applied this. NB in future it would be helpful for you to supply a suitable commit message. In this case I wrote one - see below. On Wed, 2012-10-24 at 12:16 +0100, Jan Beulich wrote:> Afaict that''s a mistake of whatever provides this header on your > system - there''s no unconditionally visible "reboot" in the specs > I have available.This is true, but I think it''s a very forgiveable error and we might well end up including various headers which import os-specific names. So Christoph''s patch is the right thing to do. Ian. # HG changeset patch # User Christoph Egger <Christoph.Egger@amd.com> # Date 1351165885 -3600 # Node ID 580aa3946f87eb56690671bf1aa0022228f59c8c # Parent 22e08c9ac770db07c3c3e7c844aa7153050939f3 xl: avoid shadowing reboot(2) On NetBSD <unistd.h> mistakenly exposes reboot(2). Work around this. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com> diff -r 22e08c9ac770 -r 580aa3946f87 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Wed Oct 24 17:51:48 2012 +0200 +++ b/tools/libxl/xl_cmdimpl.c Thu Oct 25 12:51:25 2012 +0100 @@ -3721,11 +3721,11 @@ int main_destroy(int argc, char **argv) return 0; } -static int main_shutdown_or_reboot(int reboot, int argc, char **argv) +static int main_shutdown_or_reboot(int do_reboot, int argc, char **argv) { void (*fn)(uint32_t domid, libxl_evgen_domain_death **, libxl_ev_user, int) - reboot ? &reboot_domain : &shutdown_domain; + do_reboot ? &reboot_domain : &shutdown_domain; int opt, i, nb_domain; int wait_for_it = 0, all =0; int fallback_trigger = 0;