From patchwork Mon Oct 17 19:02:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lv Zheng X-Patchwork-Id: 9380227 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 97650600CA for ; Mon, 17 Oct 2016 19:03:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FC0828D53 for ; Mon, 17 Oct 2016 19:03:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7473828D5E; Mon, 17 Oct 2016 19:03:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4F5428D53 for ; Mon, 17 Oct 2016 19:02:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932782AbcJQTC7 (ORCPT ); Mon, 17 Oct 2016 15:02:59 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:35979 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932518AbcJQTC6 (ORCPT ); Mon, 17 Oct 2016 15:02:58 -0400 Received: by mail-qk0-f195.google.com with SMTP id z190so14960647qkc.3 for ; Mon, 17 Oct 2016 12:02:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kvJzGhyQWpoQvLwoNa36odaHjLVB38yo9gHWYkJFp98=; b=DjMUT4WuhXbs3nIIqo6Krz4WplP+LYQX7dcGFMLi91Qw8yYd02x0X0kw56LguST5uN /950YxVuciNHrqEacsnUAqwviTBvIxOiTxIG/qc8yolxWdZFsZ8fydKIMvSGKfpbC9PY /H+zE1/pBAgtDJKlX06PikLkynv9578QYjLJ98GrYbjzt1Hl7cyI9nEn/xYbe0S3QRVe fBasWvTpgGFgzLCQTadNlWIw8hfP0fGw7FqO0iN1oujAyQo7RwPMPFPqH/151wHg5zgO Ra7BRsJMJig/SV0GfZTlR9FgsmM9bY8YMPAlJVzOxj0Bi8Sf5gseEXMRUgYIH3h0SmB6 uoiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kvJzGhyQWpoQvLwoNa36odaHjLVB38yo9gHWYkJFp98=; b=Nw9lsNVE52j7heD3tfISK9tb+pEcgivKHv+tXjkPLf3VGmVmY8tNbLGB5g+mXRSpci pC1NV5BpvZT8t767i9V1y2qkShzeXeBLV1xXTIXoCnwQtO1EGNnNsnKiF59ZHtg2WK65 P4OQAS/uxcgG2ca5yq4BvnBzgqdckiZNh9+/8DDNhfMXtPBPmd5oeouHM6198q/0o96z PyLBIbyrfxVz1UXOMDncPyUuTR8Q5csXuDHr2xMXdNO5fE1BwLU55IB878RgGDF9kAX2 u2n/e47+d8DPxwmufx9G/xc4Gv02w2inIt5jvVXGXRK/BGaNS/gK44Ni2q3tgQPAPKLD RI/Q== X-Gm-Message-State: AA6/9Rkm93n1bQOK3eUPEie9ZlpRUMZBQSdGZGnIusGTW2nszBvjXnMdFciARzlOYJgkGQ== X-Received: by 10.55.148.131 with SMTP id w125mr13414081qkd.57.1476730978018; Mon, 17 Oct 2016 12:02:58 -0700 (PDT) Received: from localhost.localdomain (h3.246.129.40.static.ip.windstream.net. [40.129.246.3]) by smtp.gmail.com with ESMTPSA id y126sm15825323qkb.37.2016.10.17.12.02.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Oct 2016 12:02:57 -0700 (PDT) From: Lv Zheng X-Google-Original-From: Lv Zheng To: "Rafael J . Wysocki" , "Rafael J . Wysocki" , Robert Moore , Len Brown , Lv Zheng , "David E . Box" Cc: linux-acpi@vger.kernel.org Subject: [PATCH 2/7] ACPICA: MacOSX: Fix anonymous semaphore implementation Date: Tue, 18 Oct 2016 03:02:40 +0800 Message-Id: <5e5749f96dac6d16f5b7f5225a9a83e5a167c1ba.1476725675.git.lv.zheng@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ACPICA commit 01eb9a58f4cf6300a0feb838a02bc4b1895c76e8 ACPICA commit de5b9c0ef1ccb264cbe57c88f6dd3fbf8229f907 The following build errors can be seen for MacOSX builds: .../osunixxf.c:829:42: error: 'tmpnam' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tmpnam(3), it is highly recommended that you use mkstemp(3) instead. [-Werror,-Wdeprecated-declarations] Using of temporal file name functions can easily result in bus errors on MacOSX. This patch implements anonymous semaphore using an automatic increasing number. Lv Zheng. Linux is not affected by this change. Link: https://github.com/acpica/acpica/commit/01eb9a58 Link: https://github.com/acpica/acpica/commit/de5b9c0e Signed-off-by: Lv Zheng Signed-off-by: Bob Moore --- tools/power/acpi/os_specific/service_layers/osunixxf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/power/acpi/os_specific/service_layers/osunixxf.c b/tools/power/acpi/os_specific/service_layers/osunixxf.c index 8d8003c..8f5ded8 100644 --- a/tools/power/acpi/os_specific/service_layers/osunixxf.c +++ b/tools/power/acpi/os_specific/service_layers/osunixxf.c @@ -646,8 +646,12 @@ acpi_os_create_semaphore(u32 max_units, } #ifdef __APPLE__ { - char *semaphore_name = tmpnam(NULL); + static int semaphore_count = 0; + char semaphore_name[32]; + snprintf(semaphore_name, sizeof(semaphore_name), "acpi_sem_%d", + semaphore_count++); + printf("%s\n", semaphore_name); sem = sem_open(semaphore_name, O_EXCL | O_CREAT, 0755, initial_units);