[x264-devel] bug in common/cpu.c
Loïc Le Loarer
lll+vlc at m4x.org
Wed Jul 18 16:37:00 CEST 2007
Hi,
Anders Brownworth wrote:
> Guillaume Poirier wrote:
> > Anders Brownworth wrote:
> >
> >> I ran into a compile error in common/cpu.c in the
> >> x264-snapshot-20070717-2245 source. Patch to fix is:
> >>
> >> 214c214
> >> < sched_getaffinity( 0, sizeof(p_aff), &p_aff );
> >> ---
> >> > sched_getaffinity( sizeof(p_aff), &p_aff );
> >>
> >>
> >>
> >
> > On which Operating System did you experience this problem?
> > No problem here on OSX and Linux.
> >
> > Guillaume
>
> This is Linux 2.6.18 - Gentoo flavor. Error was:
>
> gcc -O4 -ffast-math -Wall -I. -DHAVE_MALLOC_H -DHAVE_MMX -DARCH_X86
> -DSYS_LINUX -DHAVE_PTHREAD -s -fomit-frame-pointer -c -o common/cpu.o
> common/cpu.c
> common/cpu.c: In function `x264_cpu_num_processors':
> common/cpu.c:214: warning: passing arg 2 of `sched_getaffinity' makes
> pointer from integer without a cast
> common/cpu.c:214: error: too many arguments to function `sched_getaffinity'
> make: *** [common/cpu.o] Error 1
>
> On a hunch I eliminated the first param, recompiled and it worked. Where
> is sched_getaffinity defined?
It is a system called (so handled by the kernel) but defined by the
glibc. According to the man page, the prototype depends on the glibc
version:
HISTORY
The CPU affinity system calls were introduced in Linux kernel 2.5.8.
The library interfaces were introduced in glibc 2.3. Initially,
the glibc interfaces included a cpusetsize argument. In glibc
2.3.2, the cpusetsize argument was removed, but this argument was
restored in glibc 2.3.4.
Can you check that you use glibc version 2.3.2 or 2.3.3 ?
On this glibc versions, the correct patch is not to remove the first but
the second argument:
214c214
< sched_getaffinity( 0, sizeof(p_aff), &p_aff );
---
> sched_getaffinity( 0, &p_aff );
Best regards.
--
Loïc
"heaven is not a place, it's a feeling"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.videolan.org/pipermail/x264-devel/attachments/20070718/5a0984c8/attachment-0001.pgp
-------------- next part --------------
_______________________________________________
x264-devel mailing list
x264-devel at videolan.org
http://mailman.videolan.org/listinfo/x264-devel
More information about the x264-devel
mailing list