All of lore.kernel.org
 help / color / mirror / Atom feed
* libxl: build error
@ 2012-10-24  9:36 Christoph Egger
  2012-10-24  9:58 ` Ian Campbell
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Egger @ 2012-10-24  9:36 UTC (permalink / raw)
  To: xen-devel@lists.xen.org


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: libxl: build error
  2012-10-24  9:36 libxl: build error Christoph Egger
@ 2012-10-24  9:58 ` Ian Campbell
  2012-10-24 10:50   ` Christoph Egger
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Campbell @ 2012-10-24  9:58 UTC (permalink / raw)
  To: Christoph Egger; +Cc: xen-devel@lists.xen.org

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? 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: libxl: build error
  2012-10-24  9:58 ` Ian Campbell
@ 2012-10-24 10:50   ` Christoph Egger
  2012-10-24 11:16     ` Jan Beulich
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Egger @ 2012-10-24 10:50 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel@lists.xen.org

[-- Attachment #1: Type: text/plain, Size: 996 bytes --]

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

[-- Attachment #2: xen_tools_libxl.diff --]
[-- Type: text/plain, Size: 703 bytes --]

diff -r ac870df4f165 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Wed Oct 24 09:50:52 2012 +0200
+++ b/tools/libxl/xl_cmdimpl.c	Wed Oct 24 11:19:59 2012 +0200
@@ -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;

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: libxl: build error
  2012-10-24 10:50   ` Christoph Egger
@ 2012-10-24 11:16     ` Jan Beulich
  2012-10-24 11:28       ` Ian Campbell
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2012-10-24 11:16 UTC (permalink / raw)
  To: Christoph Egger; +Cc: Ian Campbell, xen-devel@lists.xen.org

>>> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: libxl: build error
  2012-10-24 11:16     ` Jan Beulich
@ 2012-10-24 11:28       ` Ian Campbell
  2012-10-25 11:53         ` libxl: build error [and 1 more messages] Ian Jackson
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Campbell @ 2012-10-24 11:28 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Christoph Egger, xen-devel@lists.xen.org

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: libxl: build error [and 1 more messages]
  2012-10-24 11:28       ` Ian Campbell
@ 2012-10-25 11:53         ` Ian Jackson
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Jackson @ 2012-10-25 11:53 UTC (permalink / raw)
  To: Ian Campbell, Christoph Egger; +Cc: Jan Beulich, xen-devel@lists.xen.org

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;

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-10-25 11:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-24  9:36 libxl: build error Christoph Egger
2012-10-24  9:58 ` Ian Campbell
2012-10-24 10:50   ` Christoph Egger
2012-10-24 11:16     ` Jan Beulich
2012-10-24 11:28       ` Ian Campbell
2012-10-25 11:53         ` libxl: build error [and 1 more messages] Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.