[pg-cvs] issue: mmap returns a pointer

madnificent at gmail.com madnificent at gmail.com
Wed Nov 11 11:56:49 UTC 2009


Hello osicat-devel


Whilst getting help from John Fremlin for manardb, an issue with osicat arose.  Apparently osicat-posix assumes that the return value from mmap is an int when it is a pointer.  He noted that mremap is broken too.

a backtrace containing the result:

CL-USER> (manardb:use-mmap-dir "/tmp/manardb/" :if-does-not-exist :create)

The value -134270976 is not of type (UNSIGNED-BYTE 64).
   [Condition of type TYPE-ERROR]

Restarts:
 0: [ABORT] Return to SLIME's top level.
 1: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" RUNNING {1003249DB1}>)

Backtrace:
  0: (OSICAT-POSIX:MMAP #.(SB-SYS:INT-SAP #X00000000) 4096 3 1 4 0)
  1: (MANARDB::MTAGMAP-OPEN #<MANARDB::MTAGMAP >)[:EXTERNAL]
  2: (MANARDB:OPEN-ALL-MMAPS)

John Fremlin made me fix the bug by evaluating the following code in osicat-posix:

(DEFCFUN ("mmap_cffi_wrap" MMAP :CONVENTION :CDECL :LIBRARY :DEFAULT)
                 (ERRNO-WRAPPER :UNSIGNED-LONG :ERROR-PREDICATE (LAMBDA (P) (= P MAP-FAILED)) :RETURN-FILTER MAKE-POINTER)
                 (START :POINTER)
                 (LENGTH SIZE)
                 (PROT :INT)
                 (FLAGS :INT)
                 (FD FILE-DESCRIPTOR-DESIGNATOR)
                 (OFFSET OFF))


cheers,

the madnificent
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <https://mailman.common-lisp.net/pipermail/osicat-devel/attachments/20091111/2663be67/attachment.sig>


More information about the osicat-devel mailing list