Message ID | 20220414212043.25953-1-cus@passwd.hu |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel] avutil/cpu: #define _GNU_SOURCE before including any standard headers | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_armv7_RPi4 | success | Make finished |
andriy/make_fate_armv7_RPi4 | success | Make fate finished |
On Thu, 14 Apr 2022, Marton Balint wrote: > Otherwise its effect might not work causing CPU_COUNT to not get defined. > > Fixes cpu count detection to actually use sched_getaffinity if available. Will apply tomorrow. Regards, Marton > > Signed-off-by: Marton Balint <cus@passwd.hu> > --- > libavutil/cpu.c | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > > diff --git a/libavutil/cpu.c b/libavutil/cpu.c > index 833c220192..24b99d2554 100644 > --- a/libavutil/cpu.c > +++ b/libavutil/cpu.c > @@ -16,6 +16,15 @@ > * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA > */ > > +#include "config.h" > + > +#if HAVE_SCHED_GETAFFINITY > +#ifndef _GNU_SOURCE > +# define _GNU_SOURCE > +#endif > +#include <sched.h> > +#endif > + > #include <stddef.h> > #include <stdint.h> > #include <stdatomic.h> > @@ -23,16 +32,9 @@ > #include "attributes.h" > #include "cpu.h" > #include "cpu_internal.h" > -#include "config.h" > #include "opt.h" > #include "common.h" > > -#if HAVE_SCHED_GETAFFINITY > -#ifndef _GNU_SOURCE > -# define _GNU_SOURCE > -#endif > -#include <sched.h> > -#endif > #if HAVE_GETPROCESSAFFINITYMASK || HAVE_WINRT > #include <windows.h> > #endif > -- > 2.31.1 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". >
diff --git a/libavutil/cpu.c b/libavutil/cpu.c index 833c220192..24b99d2554 100644 --- a/libavutil/cpu.c +++ b/libavutil/cpu.c @@ -16,6 +16,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "config.h" + +#if HAVE_SCHED_GETAFFINITY +#ifndef _GNU_SOURCE +# define _GNU_SOURCE +#endif +#include <sched.h> +#endif + #include <stddef.h> #include <stdint.h> #include <stdatomic.h> @@ -23,16 +32,9 @@ #include "attributes.h" #include "cpu.h" #include "cpu_internal.h" -#include "config.h" #include "opt.h" #include "common.h" -#if HAVE_SCHED_GETAFFINITY -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif -#include <sched.h> -#endif #if HAVE_GETPROCESSAFFINITYMASK || HAVE_WINRT #include <windows.h> #endif
Otherwise its effect might not work causing CPU_COUNT to not get defined. Fixes cpu count detection to actually use sched_getaffinity if available. Signed-off-by: Marton Balint <cus@passwd.hu> --- libavutil/cpu.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)