[FFmpeg-devel] [PATCH] libswscale: Fix the anonymous memory mapping in sws_GetContext for NetBSD when MMX2 optimisations are enabled.
Fri Aug 20 01:49:31 CEST 2010
On Thu, Aug 19, 2010 at 7:37 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Thu, Aug 19, 2010 at 12:47:22PM +0200, Grant Carver wrote:
>> > On Thu, Aug 19, 2010 at 08:19:24AM +0200, Grant Carver wrote:
>> > > Hi there
>> > >
>> > > Creation of a swscale context was failing on NetBSD due to the
>> > > anonymous mmap call failing. It seems that if the MAP_ANONYMOUS flag
>> > > is specified some BSD flavours require the file descriptor to be -1,
>> > > whilst on linux this parameter is just ignored.
>> > where is this documented or is it a bug?
>> The man page for NetBSD
>> (http://netbsd.gw.com/cgi-bin/man-cgi?mmap++NetBSD-current) and FreeBSD
>> (http://nixdoc.net/man-pages/FreeBSD/mmap.2.html) contain the following:
>> mmap() will fail if:
>> [EINVAL] ?MAP_FIXED was specified and the addr parameter was not
>> ? ? ? ? ? page aligned or was outside of the valid address range
>> ? ? ? ? ? for a process. ?MAP_ANON was specified and fd was not
>> ? ? ? ? ? -1.
> ok, then chaning them to -1 is probably ok.
> you might want to mail the linux mmap manpage maintainers they could add a
> note about portability (or start a flamewar about which way is right :)))
man mmap on ubuntu already says:
The mapping is not backed by any file; its contents are initial?
ized to zero. The fd and offset arguments are ignored; however,
some implementations require fd to be -1 if MAP_ANONYMOUS (or
MAP_ANON) is specified, and portable applications should ensure
this. The use of MAP_ANONYMOUS in conjunction with MAP_SHARED
is only supported on Linux since kernel 2.4.
It is likely a flamewar has already occurred =)
More information about the ffmpeg-devel