[FFmpeg-devel] [PATCH] libswscale: Fix the anonymous memory mapping in sws_GetContext for NetBSD when MMX2 optimisations are enabled.

Grant Carver grantc
Sun Aug 22 09:34:23 CEST 2010


> -----Original Message-----
> From: ffmpeg-devel-bounces at mplayerhq.hu [mailto:ffmpeg-devel-
> bounces at mplayerhq.hu] On Behalf Of Ramiro Polla
> Sent: 20 August 2010 01:50 AM
> To: FFmpeg development discussions and patches
> Subject: Re: [FFmpeg-devel] [PATCH] libswscale: Fix the anonymous memory
> mapping in sws_GetContext for NetBSD when MMX2 optimisations are
> enabled.
> 
> 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.
> 
> Applied.
> 
> > 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:
> MAP_ANONYMOUS
>        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 =)


Damn, the flamewar bit sounded very tempting...

Thanks guys





> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel






More information about the ffmpeg-devel mailing list