[Openmcl-cvs-notifications] r10718 - in /trunk/source/lisp-kernel: image.c macros.h memory.c
gb at clozure.com
gb at clozure.com
Fri Sep 12 02:07:13 EDT 2008
Author: gb
Date: Fri Sep 12 02:07:13 2008
New Revision: 10718
Log:
Define and use LSEEK macro to force 64-bit lseek on Windows.
Modified:
trunk/source/lisp-kernel/image.c
trunk/source/lisp-kernel/macros.h
trunk/source/lisp-kernel/memory.c
Modified: trunk/source/lisp-kernel/image.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/image.c (original)
+++ trunk/source/lisp-kernel/image.c Fri Sep 12 02:07:13 2008
@@ -92,9 +92,9 @@
off_t
seek_to_next_page(int fd)
{
- off_t pos =3D lseek(fd, 0, SEEK_CUR);
+ off_t pos =3D LSEEK(fd, 0, SEEK_CUR);
pos =3D align_to_power_of_2(pos, log2_page_size);
- return lseek(fd, pos, SEEK_SET);
+ return LSEEK(fd, pos, SEEK_SET);
}
=
/*
@@ -110,13 +110,13 @@
off_t pos;
unsigned version, flags;
=
- pos =3D lseek(fd, 0, SEEK_END);
+ pos =3D LSEEK(fd, 0, SEEK_END);
if (pos < 0) {
return false;
}
pos -=3D sizeof(trailer);
=
- if (lseek(fd, pos, SEEK_SET) < 0) {
+ if (LSEEK(fd, pos, SEEK_SET) < 0) {
return false;
}
if (read(fd, &trailer, sizeof(trailer)) !=3D sizeof(trailer)) {
@@ -132,7 +132,7 @@
if (disp >=3D 0) {
return false;
}
- if (lseek(fd, disp, SEEK_CUR) < 0) {
+ if (LSEEK(fd, disp, SEEK_CUR) < 0) {
return false;
}
if (read(fd, header, sizeof(openmcl_image_file_header)) !=3D
@@ -226,7 +226,7 @@
return;
=
}
- lseek(fd, pos+advance, SEEK_SET);
+ LSEEK(fd, pos+advance, SEEK_SET);
}
=
LispObj
@@ -248,7 +248,7 @@
return 0;
}
#if WORD_SIZE =3D=3D 64
- lseek(fd, section_data_delta, SEEK_CUR);
+ LSEEK(fd, section_data_delta, SEEK_CUR);
#endif
for (i =3D 0; i < nsections; i++, sect++) {
load_image_section(fd, sect);
@@ -379,7 +379,7 @@
{
*header_pos =3D seek_to_next_page(fd);
=
- if (lseek (fd, *header_pos, SEEK_SET) < 0) {
+ if (LSEEK (fd, *header_pos, SEEK_SET) < 0) {
return errno;
}
if (write(fd, file_header, sizeof(*file_header)) !=3D sizeof(*file_heade=
r)) {
@@ -496,7 +496,7 @@
=
#if WORD_SIZE =3D=3D 64
seek_to_next_page(fd);
- section_data_delta =3D -((lseek(fd,0,SEEK_CUR)+sizeof(fh)+sizeof(section=
s)) -
+ section_data_delta =3D -((LSEEK(fd,0,SEEK_CUR)+sizeof(fh)+sizeof(section=
s)) -
image_data_pos);
fh.section_data_offset_high =3D (int)(section_data_delta>>32L);
fh.section_data_offset_low =3D (unsigned)section_data_delta;
@@ -509,7 +509,7 @@
trailer.sig0 =3D IMAGE_SIG0;
trailer.sig1 =3D IMAGE_SIG1;
trailer.sig2 =3D IMAGE_SIG2;
- eof_pos =3D lseek(fd, 0, SEEK_CUR) + sizeof(trailer);
+ eof_pos =3D LSEEK(fd, 0, SEEK_CUR) + sizeof(trailer);
trailer.delta =3D (int) (header_pos-eof_pos);
if (write(fd, &trailer, sizeof(trailer)) =3D=3D sizeof(trailer)) {
#ifndef WINDOWS
Modified: trunk/source/lisp-kernel/macros.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/macros.h (original)
+++ trunk/source/lisp-kernel/macros.h Fri Sep 12 02:07:13 2008
@@ -90,3 +90,9 @@
#define TCR_INTERRUPT_LEVEL(tcr) \
(((signed_natural *)((tcr)->tlb_pointer))[INTERRUPT_LEVEL_BINDING_INDEX])
#endif
+
+#ifdef WINDOWS
+#define LSEEK(fd,offset,how) _lseeki64(fd,offset,how)
+#else
+#define LSEEK(fd,offset,how) lseek(fd,offset,how)
+#endif
Modified: trunk/source/lisp-kernel/memory.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/memory.c (original)
+++ trunk/source/lisp-kernel/memory.c Fri Sep 12 02:07:13 2008
@@ -390,9 +390,9 @@
size_t count, total =3D 0;
size_t opos;
=
- opos =3D lseek(fd, 0, SEEK_CUR);
+ opos =3D LSEEK(fd, 0, SEEK_CUR);
CommitMemory(addr, nbytes);
- lseek(fd, pos, SEEK_SET);
+ LSEEK(fd, pos, SEEK_SET);
=
while (total < nbytes) {
count =3D read(fd, addr + total, nbytes - total);
@@ -402,7 +402,7 @@
return false;
}
=
- lseek(fd, opos, SEEK_SET);
+ LSEEK(fd, opos, SEEK_SET);
=
return true;
#endif
More information about the Openmcl-cvs-notifications
mailing list