From patchwork Fri Apr 17 13:22:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 38829 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by sourceware.org (Postfix) with ESMTPS id 3CE67384A040 for ; Fri, 17 Apr 2020 13:22:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3CE67384A040 Received: by mail-qk1-x742.google.com with SMTP id j4so2255035qkc.11 for ; Fri, 17 Apr 2020 06:22:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=9QEcMFZzHkQd57gAOKmxBGPpo2ohwB1UCXxWhjrDmOA=; b=nQAXuGD5y9uQ/sDxAH3rsMaJC1yu1yrMR9+I0al492Wo6Xd8qTwoJPYNfXAjWgN4CT BZhdQ6FP0N+BQMkb8dyPFzq6Nc00BfMmVHiCOkoGy4nnVOobu5Zl79xVtOFXnG2EkcOV 46egAvkr1mvfvF0Cnoy2TzHF5RQXMstZq9UiWd7rIkJUw6n8CvBt0os674KgQ7dFKyU7 SxTdBEV8TmFMamp5ZU7OYTWOJBzmhyl7663AWPOoalfJVbcYzUu+bap3CrVkICQicAQO Y1bKTFJkwwtNP51PtMQMgozrSA+n2ri+ffPKo5phuBKrqKL9EYzzdrFxIZ/eRv+NQiq1 rKZw== X-Gm-Message-State: AGi0PuZ9/5UzO/6XT1PKezgW3GDosksQxBPs1fKJMc31bBdodYo6bp+o oJY+vDmIEPWwBwqj1Fo8iChmFk+6DaoC0w== X-Google-Smtp-Source: APiQypIJLmr8vhuu3pj1jG62vGy4fnGjnF+Jt/AUW3ZSmfoReDw3fJGybKCEjMgsobnWxWbnlIW/jw== X-Received: by 2002:a37:a486:: with SMTP id n128mr3235785qke.140.1587129747594; Fri, 17 Apr 2020 06:22:27 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id s14sm14737571qts.70.2020.04.17.06.22.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Apr 2020 06:22:27 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 10/10] dirent: Deprecate getdirentries Date: Fri, 17 Apr 2020 10:22:09 -0300 Message-Id: <20200417132209.22065-10-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200417132209.22065-1-adhemerval.zanella@linaro.org> References: <20200417132209.22065-1-adhemerval.zanella@linaro.org> X-Spam-Status: No, score=-25.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, 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: Fri, 17 Apr 2020 13:22:29 -0000 The interface has some issues: 1. It is build on top getdents on Linux and requires handling non-LFS call using LFS getdents. 2. It is not wildly used and the non-LFS support is as problematic as non-LFS readdir. glibc only exports the LFS getdents. 3. It is not a direct replacement over BSD since on some plataform its signature has changed (FreeBSD 11, for instance, used to set the offset as a 'long' and changed to 'off_t' on version 12). The idea is to eventually move the symbols to compat ones. --- NEWS | 3 +++ dirent/dirent.h | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 2424fecdc0..58d9db6d00 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,9 @@ Deprecated and removed features, and other changes affecting compatibility: but always fails with ENOSYS. This reflects the removal of the system call from all architectures, starting with Linux 5.5. +* The function getdirentries is now deprecated, applications should use + either getdents or POSIX readdir instead. + Changes to build and runtime requirements: [Add changes to build and runtime requirements here] diff --git a/dirent/dirent.h b/dirent/dirent.h index 92d0925047..4ee60471f7 100644 --- a/dirent/dirent.h +++ b/dirent/dirent.h @@ -353,14 +353,15 @@ extern int alphasort64 (const struct dirent64 **__e1, extern __ssize_t getdirentries (int __fd, char *__restrict __buf, size_t __nbytes, __off_t *__restrict __basep) - __THROW __nonnull ((2, 4)); + __THROW __nonnull ((2, 4)) __attribute_deprecated__; # else # ifdef __REDIRECT extern __ssize_t __REDIRECT_NTH (getdirentries, (int __fd, char *__restrict __buf, size_t __nbytes, __off64_t *__restrict __basep), - getdirentries64) __nonnull ((2, 4)); + getdirentries64) + __THROW __nonnull ((2, 4)) __attribute_deprecated__; # else # define getdirentries getdirentries64 # endif @@ -370,7 +371,7 @@ extern __ssize_t __REDIRECT_NTH (getdirentries, extern __ssize_t getdirentries64 (int __fd, char *__restrict __buf, size_t __nbytes, __off64_t *__restrict __basep) - __THROW __nonnull ((2, 4)); + __THROW __nonnull ((2, 4)) __attribute_deprecated__; # endif #endif /* Use misc. */