Changeset 10718


Ignore:
Timestamp:
Sep 12, 2008, 6:07:13 AM (11 years ago)
Author:
gb
Message:

Define and use LSEEK macro to force 64-bit lseek on Windows.

Location:
trunk/source/lisp-kernel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/image.c

    r10565 r10718  
    9393seek_to_next_page(int fd)
    9494{
    95   off_t pos = lseek(fd, 0, SEEK_CUR);
     95  off_t pos = LSEEK(fd, 0, SEEK_CUR);
    9696  pos = align_to_power_of_2(pos, log2_page_size);
    97   return lseek(fd, pos, SEEK_SET);
     97  return LSEEK(fd, pos, SEEK_SET);
    9898}
    9999 
     
    111111  unsigned version, flags;
    112112
    113   pos = lseek(fd, 0, SEEK_END);
     113  pos = LSEEK(fd, 0, SEEK_END);
    114114  if (pos < 0) {
    115115    return false;
     
    117117  pos -= sizeof(trailer);
    118118
    119   if (lseek(fd, pos, SEEK_SET) < 0) {
     119  if (LSEEK(fd, pos, SEEK_SET) < 0) {
    120120    return false;
    121121  }
     
    133133    return false;
    134134  }
    135   if (lseek(fd, disp, SEEK_CUR) < 0) {
     135  if (LSEEK(fd, disp, SEEK_CUR) < 0) {
    136136    return false;
    137137  }
     
    227227   
    228228  }
    229   lseek(fd, pos+advance, SEEK_SET);
     229  LSEEK(fd, pos+advance, SEEK_SET);
    230230}
    231231
     
    249249    }
    250250#if WORD_SIZE == 64
    251     lseek(fd, section_data_delta, SEEK_CUR);
     251    LSEEK(fd, section_data_delta, SEEK_CUR);
    252252#endif
    253253    for (i = 0; i < nsections; i++, sect++) {
     
    380380  *header_pos = seek_to_next_page(fd);
    381381
    382   if (lseek (fd, *header_pos, SEEK_SET) < 0) {
     382  if (LSEEK (fd, *header_pos, SEEK_SET) < 0) {
    383383    return errno;
    384384  }
     
    497497#if WORD_SIZE == 64
    498498  seek_to_next_page(fd);
    499   section_data_delta = -((lseek(fd,0,SEEK_CUR)+sizeof(fh)+sizeof(sections)) -
     499  section_data_delta = -((LSEEK(fd,0,SEEK_CUR)+sizeof(fh)+sizeof(sections)) -
    500500                         image_data_pos);
    501501  fh.section_data_offset_high = (int)(section_data_delta>>32L);
     
    510510  trailer.sig1 = IMAGE_SIG1;
    511511  trailer.sig2 = IMAGE_SIG2;
    512   eof_pos = lseek(fd, 0, SEEK_CUR) + sizeof(trailer);
     512  eof_pos = LSEEK(fd, 0, SEEK_CUR) + sizeof(trailer);
    513513  trailer.delta = (int) (header_pos-eof_pos);
    514514  if (write(fd, &trailer, sizeof(trailer)) == sizeof(trailer)) {
  • trunk/source/lisp-kernel/macros.h

    r10093 r10718  
    9191  (((signed_natural *)((tcr)->tlb_pointer))[INTERRUPT_LEVEL_BINDING_INDEX])
    9292#endif
     93
     94#ifdef WINDOWS
     95#define LSEEK(fd,offset,how) _lseeki64(fd,offset,how)
     96#else
     97#define LSEEK(fd,offset,how) lseek(fd,offset,how)
     98#endif
  • trunk/source/lisp-kernel/memory.c

    r10565 r10718  
    391391  size_t opos;
    392392
    393   opos = lseek(fd, 0, SEEK_CUR);
     393  opos = LSEEK(fd, 0, SEEK_CUR);
    394394  CommitMemory(addr, nbytes);
    395   lseek(fd, pos, SEEK_SET);
     395  LSEEK(fd, pos, SEEK_SET);
    396396
    397397  while (total < nbytes) {
     
    403403  }
    404404
    405   lseek(fd, opos, SEEK_SET);
     405  LSEEK(fd, opos, SEEK_SET);
    406406
    407407  return true;
Note: See TracChangeset for help on using the changeset viewer.