bug in mmap() and mremap() return value - and a fix

Massimiliano Ghilardi massimiliano.ghilardi at gmail.com
Sat Jan 11 02:58:23 UTC 2014


On 01/09/14 02:08, Luís Oliveira wrote:
> On Thu, Jan 9, 2014 at 12:15 AM, Massimiliano Ghilardi
> <massimiliano.ghilardi at gmail.com> wrote:
>> 2) Thinking that (or actually defining) MAP_FAILED = -1 is misleading.
>>     MAP_FAILED is (void *)-1.
>
> Your patch looks good.

Thanks :)

> Perhaps we could teach cffi-grovel how to grovel pointers,
 > then we'd be able to ditch the *map-failed-pointer*
> bits. I've attached an untested patch that does that. Does using
> (constant ... :type pointer) for the MAP_* constants solve the problem
> you found?
>
> Cheers,
>

Yes, after applying your patch to cffi_0.11.2 I could drop 
*map-failed-pointer* and directly use map-failed, provided that 
osicat/posix/unixint.lisp is updated to contain

(constant (map-failed  "MAP_FAILED")  :documentation "mmap: failure" 
:type cffi-grovel::pointer)


On the other hand, (... :type cffi-grovel::pointer) looks a bit ugly to 
me, as such symbol is not used anywhere else and is not exported by the 
package cffi-grovel. What about using the existing symbol 
cffi-sys:foreign-pointer ? It is the actual Lisp type of the 
constant/parameter being defined, and it's already exported...

Regards,

Massimiliano





More information about the osicat-devel mailing list