Manuel Giraud <[EMAIL PROTECTED]> writes:

>    In a program I'm writing, I want to be able to set FILE-POSITION
>    over 536870911 (most-positive-fixnum on my machine) but it is too
>    much for FILE-POSITION. So : 
>         - Is there something else to try (maybe unix syscall)? 
>         - Why such a limitation?

It seems that the underlying FD-STREAM has no such limitations, so
and compiling+loading the following patch-file (which just adjusts a
bogus(?) type declaration) should remove that limit.  Note that since
the underlying mechanism uses the standard lseek syscall, you are
still limited to the usual 2GB file size that 32bit API's (and
filesystems) suffer from.

That said, has anyone researched this issue in more depth?  Is it just
the stray declaration on file-position?  The fndb entry seems to also
allow the full unsigned-byte range, as does the fd-stream
implementation...  So if it's only that buglet, I'd suggest fixing it
also in the RELENG_18 branch.  Opinions?

Regs, Pierre.

(in-package :lisp)

(defun file-position (stream &optional position)
  "With one argument returns the current position within the file
   File-Stream is open to.  If the second argument is supplied, then
   this becomes the new file position.  The second argument may also
   be :start or :end for the start and end of the file, respectively."
  (declare (stream stream)
           (type (or (integer 0) (member nil :start :end)) position))
  (cond
   (position
    (setf (lisp-stream-in-index stream) in-buffer-length)
    (funcall (lisp-stream-misc stream) stream :file-position position))
   (t
    (let ((res (funcall (lisp-stream-misc stream) stream :file-position nil)))
      (when res (- res (- in-buffer-length (lisp-stream-in-index stream))))))))

-- 
Pierre R. Mai <[EMAIL PROTECTED]>                    http://www.pmsf.de/pmai/
 The most likely way for the world to be destroyed, most experts agree,
 is by accident. That's where we come in; we're computer professionals.
 We cause accidents.                           -- Nathaniel Borenstein

Reply via email to