Skip to contentSkip to conversation

build fixes

PATCH NAK Christoph Egger 4 participants 8 messages Jan 11, 2010 – Jan 12, 2010

lore
Share & tools
lore
#0 lore raw

Hi!

Attached patch fixes Xen build on NetBSD.

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
tools/libxl/libxl.h +1 -0
diff -r a52925e1c292 tools/libxl/libxl.h
@@ -20,6 +20,7 @@
 #include <netinet/in.h>
 #include <xenctrl.h>
 #include <xs.h>
+#include <sys/wait.h> /* for pid_t */
 
 typedef void (*libxl_log_callback)(void *userdata, int loglevel, const char *file,
                                    int line, const char *func, char *s);
tools/libxl/xl.c +1 -1
diff -r a52925e1c292 tools/libxl/xl.c
@@ -53,7 +53,7 @@ static int domain_qualifier_to_domid(str
 
     alldigit = 1;
     for (i = 0; p[i]; i++) {
-        if (!isdigit(p[i])) {
+        if (!isdigit((uint8_t)p[i])) {
             alldigit = 0;
             break;
         }
tools/xenpaging/file_ops.c +1 -1
diff -r a52925e1c292 tools/xenpaging/file_ops.c
@@ -36,7 +36,7 @@ static int file_op(int fd, void *page, i
     int bytes;
     int ret;
 
-    seek_ret = lseek64(fd, i << PAGE_SHIFT, SEEK_SET);
+    seek_ret = lseek(fd, i << PAGE_SHIFT, SEEK_SET);
 
     total = 0;
     while ( total < PAGE_SIZE )

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

#1 lore raw

Christoph Egger writes ("[Xen-devel] build fixes"):

Quoted 1 line

Attached patch fixes Xen build on NetBSD.

Nack.

Quoted 1 line

+#include <sys/wait.h> /* for pid_t */

This is fine but should read:
#include <sys/wait.h>
as there is no point putting
/* for somethingorother */
after every #include.

tools/libxl/xl.c static int domain_qualifier_to_domid(str · line 56

Quoted 2 lines
tools/libxl/xl.c +1 -1
-        if (!isdigit(p[i])) {
+        if (!isdigit((uint8_t)p[i])) {

This is correct on all platforms. But it should be fixed by some more general approach, as it's needed for almost every call to a ctype macro.

tools/xenpaging/file_ops.c static int file_op(int fd, void *page, i · line 39

Quoted 2 lines
tools/xenpaging/file_ops.c +1 -1
-    seek_ret = lseek64(fd, i << PAGE_SHIFT, SEEK_SET);
+    seek_ret = lseek(fd, i << PAGE_SHIFT, SEEK_SET);

This is just wrong. It will break on >2G files.

Ian.

#2 lore raw
Quoted 4 lines · On Tuesday 12 January 2010 18:22:01 Ian Jackson wrote:

Christoph Egger writes ("[Xen-devel] build fixes"):

Quoted 1 line

Attached patch fixes Xen build on NetBSD.

Nack.

?

Quoted 8 lines
Quoted 1 line

+#include <sys/wait.h> /* for pid_t */

This is fine but should read:

   #include <sys/wait.h>

as there is no point putting
/* for somethingorother */
after every #include.

Quoted 6 lines

tools/libxl/xl.c static int domain_qualifier_to_domid(str · line 56

Quoted 2 lines
tools/libxl/xl.c +1 -1
-        if (!isdigit(p[i])) {
+        if (!isdigit((uint8_t)p[i])) {

This is correct on all platforms. But it should be fixed by some more general approach, as it's needed for almost every call to a ctype macro.

Any suggestions ?

Quoted 4 lines

tools/xenpaging/file_ops.c static int file_op(int fd, void *page, i · line 39

Quoted 2 lines
tools/xenpaging/file_ops.c +1 -1
-    seek_ret = lseek64(fd, i << PAGE_SHIFT, SEEK_SET);
+    seek_ret = lseek(fd, i << PAGE_SHIFT, SEEK_SET);

This is just wrong. It will break on >2G files.

No, lseek64() doesn't exist. lseek() works fine on files > 2GB on NetBSD. I think, on Linux you need to define LARGEFILES or something like that.

Christoph

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
#3 lore raw
In reply to Ian Jackson
Quoted 4 lines · Ian Jackson

tools/xenpaging/file_ops.c static int file_op(int fd, void *page, i · line 39

Quoted 2 lines
tools/xenpaging/file_ops.c +1 -1
-    seek_ret = lseek64(fd, i << PAGE_SHIFT, SEEK_SET);
+    seek_ret = lseek(fd, i << PAGE_SHIFT, SEEK_SET);

This is just wrong. It will break on >2G files.

We build everything under tools/ with LFS support enabled, so off_t is 64 bits even in 32-bit environments. FYI The bits to enable LFS support are in tools/Rules.mk.

-- Keir

#4 lore raw
Quoted 9 lines · Keir Fraser
Quoted 3 lines · Ian Jackson

tools/xenpaging/file_ops.c static int file_op(int fd, void *page, i · line 39

Quoted 2 lines
tools/xenpaging/file_ops.c +1 -1
-    seek_ret = lseek64(fd, i << PAGE_SHIFT, SEEK_SET);
+    seek_ret = lseek(fd, i << PAGE_SHIFT, SEEK_SET);

This is just wrong. It will break on >2G files.

We build everything under tools/ with LFS support enabled, so off_t is 64 bits even in 32-bit environments. FYI The bits to enable LFS support are in tools/Rules.mk.

According to the lseek64 man page, for 32-bit architectures to have 64-bit off_t, you need:

#define _FILE_OFFSET_BITS 64

Which, as far as I know, isn't set. LFS just makes lseek64 available (without it, the function doesn't exist).

Patrick

#5 lore raw
Quoted 11 lines · On Tuesday 12 January 2010 18:42:50 Patrick Colp wrote:
Quoted 9 lines · Keir Fraser
Quoted 4 lines · Ian Jackson

tools/xenpaging/file_ops.c static int file_op(int fd, void *page, i · line 39

Quoted 2 lines
tools/xenpaging/file_ops.c +1 -1
-    seek_ret = lseek64(fd, i << PAGE_SHIFT, SEEK_SET);
+    seek_ret = lseek(fd, i << PAGE_SHIFT, SEEK_SET);

This is just wrong. It will break on >2G files.

We build everything under tools/ with LFS support enabled, so off_t is 64 bits even in 32-bit environments. FYI The bits to enable LFS support are in tools/Rules.mk.

Quoted 7 lines

According to the lseek64 man page, for 32-bit architectures to have 64-bit off_t, you need:

#define _FILE_OFFSET_BITS 64

Which, as far as I know, isn't set. LFS just makes lseek64 available (without it, the function doesn't exist).

Ah, good to know. Since lseek64() isn't POSIX and therefore breaks build on non-Linux, LFS should be disabled and -D_FILE_OFFSET_BITS=64 should be used in CFLAGS under tools/ .

Christoph

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
#7 lore raw
In reply to Keir Fraser

Keir Fraser writes ("Re: [Xen-devel] build fixes"):

Quoted 9 lines · Ian Jackson
Quoted 4 lines

tools/xenpaging/file_ops.c static int file_op(int fd, void *page, i · line 39

Quoted 2 lines
tools/xenpaging/file_ops.c +1 -1
-    seek_ret = lseek64(fd, i << PAGE_SHIFT, SEEK_SET);
+    seek_ret = lseek(fd, i << PAGE_SHIFT, SEEK_SET);

This is just wrong. It will break on >2G files.

We build everything under tools/ with LFS support enabled, so off_t is 64 bits even in 32-bit environments. FYI The bits to enable LFS support are in tools/Rules.mk.

Oh, good, sorry for not spotting that.

Ian.

#6 lore raw
In reply to Patrick Colp
Quoted 11 lines · Patrick Colp
Quoted 3 lines

We build everything under tools/ with LFS support enabled, so off_t is 64 bits even in 32-bit environments. FYI The bits to enable LFS support are in tools/Rules.mk.

According to the lseek64 man page, for 32-bit architectures to have 64-bit off_t, you need:

#define _FILE_OFFSET_BITS 64

Which, as far as I know, isn't set. LFS just makes lseek64 available (without it, the function doesn't exist).

I don't think so. 'getconf LFS_CFLAGS' returns -D_FILE_OFFSET_BITS=64 on a 32-bit host. It's LFS64_CFLAGS that gets you the explicit model for large-file access (i.e., where you have to explicitly use the 64-bit off_t and lseek variants).

-- Keir