From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by sourceware.org (Postfix) with ESMTPS id 401733892452 for ; Thu, 17 Jun 2021 11:08:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 401733892452 Received: by mail-qk1-x731.google.com with SMTP id c138so2663624qkg.5 for ; Thu, 17 Jun 2021 04:08:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=zUOdmJdne0UrvTEcZ/kL5nZDkzXN83CPAXTyWhF7K5E=; b=X9PunxQ2V4d9GdSEGxK8AwEoEI2bGbRw/RMVOtQS/kg6fbXBeVk4xOAXKulHJ0Wks9 UKZh/SxEQw8xr9cZW6Zo0v+AiIDerjddRKdoWfv4h2paDDNEvaF2WBs4Lmrtan1IEf9j FWwnzxo8oDosh3qEqZMrjCjUfoNxA4SYsBfOit+kE8LYd1GUkA5OCx+XwQEZtINWY74l PA//1lTrqhjBwdt9PoB0KrUN5gdMhbPc0GyoJGYq2+CZ3mjYEJrfh5Px7HE9y8EpiaVT E2n7N3J7UonoEiZgdbaNTHaVKaGnQfvbnh5+nMxMyBsExaf5GooiL9bo8t3uVawzvBAd G2sA== X-Gm-Message-State: AOAM532ycGzYywLO/JzBonq34/54LL2u9CIyehDhb1VnwQMAq4v4ZPyG oUEpq3QffmoRri6eO0O/kRjmUl3KH7Zdvw== X-Google-Smtp-Source: ABdhPJzlRbjpVjZ0GJ++JPYKnL11BtBRIASe1Xc057VzLmu7GlbisLuvIOwu/peLlKf/w0Uy18GSjQ== X-Received: by 2002:a05:620a:22d3:: with SMTP id o19mr3197152qki.471.1623928126658; Thu, 17 Jun 2021 04:08:46 -0700 (PDT) Received: from [192.168.1.4] ([177.194.59.218]) by smtp.gmail.com with ESMTPSA id e24sm2919077qtp.97.2021.06.17.04.08.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Jun 2021 04:08:46 -0700 (PDT) Subject: Re: [PATCH 04/35] rt: Replace generic stub of shm_unlink with the posix version To: Florian Weimer , libc-alpha@sourceware.org References: <4b3ec6e7e7ecfb243625e2ab1038f8666567d220.1622761828.git.fweimer@redhat.com> From: Adhemerval Zanella Message-ID: <61813ccd-bf0f-3cb9-4ad8-904c8dd8450c@linaro.org> Date: Thu, 17 Jun 2021 08:08:44 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <4b3ec6e7e7ecfb243625e2ab1038f8666567d220.1622761828.git.fweimer@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jun 2021 11:08:48 -0000 On 03/06/2021 20:15, Florian Weimer via Libc-alpha wrote: > Result of: git mv -f sysdeps/posix/shm_unlink.c rt > and manual removal of the _POSIX_MAPPED_FILES preprocessor condition. LGTM, thanks. Reviewed-by: Adhemerval Zanella > --- > rt/shm_unlink.c | 21 +++++++++++++---- > sysdeps/posix/shm_unlink.c | 48 -------------------------------------- > 2 files changed, 16 insertions(+), 53 deletions(-) > delete mode 100644 sysdeps/posix/shm_unlink.c > > diff --git a/rt/shm_unlink.c b/rt/shm_unlink.c > index 27c10d9dee..a5af5ac147 100644 > --- a/rt/shm_unlink.c > +++ b/rt/shm_unlink.c > @@ -1,4 +1,5 @@ > -/* Copyright (C) 2000-2021 Free Software Foundation, Inc. > +/* shm_unlink -- remove a POSIX shared memory object. Generic POSIX version. > + Copyright (C) 2001-2021 Free Software Foundation, Inc. > This file is part of the GNU C Library. > > The GNU C Library is free software; you can redistribute it and/or > @@ -16,13 +17,23 @@ > . */ > > #include > -#include > +#include > +#include > +#include > > /* Remove shared memory object. */ > int > shm_unlink (const char *name) > { > - __set_errno (ENOSYS); > - return -1; > + struct shmdir_name dirname; > + if (__shm_get_name (&dirname, name, false) != 0) > + { > + __set_errno (ENOENT); > + return -1; > + } > + > + int result = unlink (dirname.name); > + if (result < 0 && errno == EPERM) > + __set_errno (EACCES); > + return result; > } > -stub_warning (shm_unlink) > diff --git a/sysdeps/posix/shm_unlink.c b/sysdeps/posix/shm_unlink.c > deleted file mode 100644 > index c90b854c78..0000000000 > --- a/sysdeps/posix/shm_unlink.c > +++ /dev/null > @@ -1,48 +0,0 @@ > -/* shm_unlink -- remove a POSIX shared memory object. Generic POSIX version. > - Copyright (C) 2001-2021 Free Software Foundation, Inc. > - This file is part of the GNU C Library. > - > - The GNU C Library is free software; you can redistribute it and/or > - modify it under the terms of the GNU Lesser General Public > - License as published by the Free Software Foundation; either > - version 2.1 of the License, or (at your option) any later version. > - > - The GNU C Library is distributed in the hope that it will be useful, > - but WITHOUT ANY WARRANTY; without even the implied warranty of > - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > - Lesser General Public License for more details. > - > - You should have received a copy of the GNU Lesser General Public > - License along with the GNU C Library; if not, see > - . */ > - > -#include > - > -#if ! _POSIX_MAPPED_FILES > -#include > - > -#else > - > -#include > -#include > -#include > - > - > -/* Remove shared memory object. */ > -int > -shm_unlink (const char *name) > -{ > - struct shmdir_name dirname; > - if (__shm_get_name (&dirname, name, false) != 0) > - { > - __set_errno (ENOENT); > - return -1; > - } > - > - int result = unlink (dirname.name); > - if (result < 0 && errno == EPERM) > - __set_errno (EACCES); > - return result; > -} > - > -#endif >