Skip to contentSkip to conversation

libxl: build fix

PATCH Applied Christoph Egger 3 participants 4 messages May 16, 2012 – May 17, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: build fix

Fix this build error:

libxl_aoutils.c: In function 'libxl__openptys':
libxl_aoutils.c:281:13: error: passing argument 4 of 'openpty' discards qualifiers from pointer target type /usr/include/util.h:92:6: note: expected 'struct termios *' but argument is of type 'const struct termios *'
libxl_aoutils.c:281:13: error: passing argument 5 of 'openpty' discards qualifiers from pointer target type /usr/include/util.h:92:6: note: expected 'struct winsize *' but argument is of type 'const struct winsize *'

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
tools/libxl/libxl_aoutils.c +2 -2
diff -r 1463985435ba tools/libxl/libxl_aoutils.c
@@ -230,8 +230,8 @@ static void openpty_exited(libxl__egc *e
 }
 
 int libxl__openptys(libxl__openpty_state *op,
-                    const struct termios *termp,
-                    const struct winsize *winp) {
+                    struct termios *termp,
+                    struct winsize *winp) {
     /*
      * This is completely crazy.  openpty calls grantpt which the spec
      * says may fork, and may not be called with a SIGCHLD handler.
tools/libxl/libxl_internal.h +2 -2
diff -r 1463985435ba tools/libxl/libxl_internal.h
@@ -1739,8 +1739,8 @@ struct libxl__openpty_result {
 };
 
 int libxl__openptys(libxl__openpty_state *op,
-                    const struct termios *termp,
-                    const struct winsize *winp);
+                    struct termios *termp,
+                    struct winsize *winp);
 
 
 /*----- bootloader -----*/

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by on v1 1/1
#1 lore raw
Quoted 12 lines · Christoph Egger

Fix this build error:

libxl_aoutils.c: In function 'libxl__openptys':
libxl_aoutils.c:281:13: error: passing argument 4 of 'openpty' discards qualifiers from pointer target type /usr/include/util.h:92:6: note: expected 'struct termios *' but argument is of type 'const struct termios *'
libxl_aoutils.c:281:13: error: passing argument 5 of 'openpty' discards qualifiers from pointer target type /usr/include/util.h:92:6: note: expected 'struct winsize *' but argument is of type 'const struct winsize *'

Quoted 1 line

I've tested this on both NetBSD and Debian, and it fixes the problem, without introducing new ones. It's strange because these are BSD functions, but Linux implementation change the parameters...

Acked-by on v1 1/1
#2 lore raw
In reply to Christoph Egger
Quoted 1 line · Christoph Egger

Fix this build error:

on NetBSD I presume.

The Linux openpty(3) manpage also notes that the const was only added there in glibc 2.8. I note that CentOS 5 has 2.5 so this would presumably also happen on some old, but still supported, Linux distros.

So:

Quoted 15 lines

libxl_aoutils.c: In function 'libxl__openptys':
libxl_aoutils.c:281:13: error: passing argument 4 of 'openpty' discards qualifiers from pointer target type /usr/include/util.h:92:6: note: expected 'struct termios *' but argument is of type 'const struct termios *'
libxl_aoutils.c:281:13: error: passing argument 5 of 'openpty' discards qualifiers from pointer target type /usr/include/util.h:92:6: note: expected 'struct winsize *' but argument is of type 'const struct winsize *'

Applied
#3 lore raw
In reply to Christoph Egger
Quoted 12 lines · Christoph Egger

Fix this build error:

libxl_aoutils.c: In function 'libxl__openptys':
libxl_aoutils.c:281:13: error: passing argument 4 of 'openpty' discards qualifiers from pointer target type /usr/include/util.h:92:6: note: expected 'struct termios *' but argument is of type 'const struct termios *'
libxl_aoutils.c:281:13: error: passing argument 5 of 'openpty' discards qualifiers from pointer target type /usr/include/util.h:92:6: note: expected 'struct winsize *' but argument is of type 'const struct winsize *'

Quoted 1 line

Applied, thanks.

I improved your commit message to:

libxl: fix build on platforms where openpty's parameters are not const.

Such as NetBSD. Fixes this build error:

....

Please try and make the summary line contain some useful info, it's all you see in the default "hg log" etc.

Ian.