From patchwork Thu Apr 14 21:20:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 35320 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:671c:b0:7c:62c8:b2d1 with SMTP id q28csp962021pzh; Thu, 14 Apr 2022 14:21:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBcE7rPVFXGPaC53skEWX0NukJUh1JsZS9zx67cDs94YhtdQD+UoMgZdM49WaDoDZyUMJB X-Received: by 2002:a05:6402:321b:b0:41d:888a:3ff0 with SMTP id g27-20020a056402321b00b0041d888a3ff0mr5064625eda.167.1649971268000; Thu, 14 Apr 2022 14:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649971267; cv=none; d=google.com; s=arc-20160816; b=0cQjoAjJz0Bv/WlPAsSG0dwQ5NFSNAlO03cjMy/+ontDfC+HVpv9wdBn+G0Lwjs/+4 mbIoUcn/CiTugvxGoQixseUsWbuhx7uNtTmSjm3csEMfwFcEgpmOAoy8ePhlnRYEj+3K HRS1vRciLfJm9PV8iayzq/ZXAzvDTP57b1BDmFOPSvHTHmFqpjwN/VgG8Gi6BHShf5r5 icRxUkNBKhdysGpauao4XjwpJVPHzVPr8dvy6WmUwDHAYjIX97QUsifS2+5Kp8WtIFct rdKfVrUQOfy/svl7UdZRc3z2hYjg/rSgOPqFCrNHzugt6s9FZOp8FzN5l41dxt6gMcor vEzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=vCZqFAvnmVW6Gi8m4ePwanMy2q9bMYuu9YJ4qUefGzY=; b=KfRwmxLe0mmB9TQ6mI8Cy+r0dpNb0VPaImi/mDG0zUmDCjsvp6BUhcOJN1PJEfQDx4 8aB5jm62MgmcHDdj+01V26QJGv4M1MMLTSWQAX0c4kqpJnTpeHBPmMuYkrbuOpqZS86M uEX+RcUg7mh4/Ic+WRcB/4iFDKvBt4dpZ2b+oQeb2c8JBpOTYa1sCPqcJdrFcpP+YmgS VMHzR4UdYJ8b0rZlhcSScO1tfbON4CNwtKraHvw6fwflmcBOh5DXzFdGtP7qTeXOU7c6 +0o1sVLyKzNiUPIM6JhcSY7V78f2nq3FfwfsjqquShewGpsA+AzxwxuzL8zniDq5QFU/ aJng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y18-20020a056402359200b0041933337939si5170037edc.97.2022.04.14.14.20.58; Thu, 14 Apr 2022 14:21:07 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4612E68B48A; Fri, 15 Apr 2022 00:20:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DE4EB68B3F2 for ; Fri, 15 Apr 2022 00:20:48 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 6CD14E6B04; Thu, 14 Apr 2022 23:20:49 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id J89zOaLkBcgH; Thu, 14 Apr 2022 23:20:48 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id AC1ABE676B; Thu, 14 Apr 2022 23:20:47 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Thu, 14 Apr 2022 23:20:43 +0200 Message-Id: <20220414212043.25953-1-cus@passwd.hu> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avutil/cpu: #define _GNU_SOURCE before including any standard headers X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: nQIxLGW85CqR 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 --- 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 +#endif + #include #include #include @@ -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 -#endif #if HAVE_GETPROCESSAFFINITYMASK || HAVE_WINRT #include #endif