From patchwork Wed Oct 21 14:15:42 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: 40805 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2A3323959CB7; Wed, 21 Oct 2020 14:16:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A3323959CB7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1603289773; bh=KE1CoT3rnYOZe59ux/O/6ANspSJGMetPj7G/N6EnyFs=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ElAmQzwTPVUvrztVHr8PaG734EQY6AfBYz2KWpq4ER0Om8usDimzLjtSR9FXOW4qe VWqo4cclCZemySdWFZVhsjkkr3Ul0EHj4SdJ1TdkvjtiSg4/qTLvqQ0kxHGHhfkW0c 47SjfkpCyaJ3IEyx8asW1ZaJTL9diFh30mTA+usw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by sourceware.org (Postfix) with ESMTPS id E54773959E47 for ; Wed, 21 Oct 2020 14:16:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E54773959E47 Received: by mail-qk1-x72e.google.com with SMTP id s14so2538915qkg.11 for ; Wed, 21 Oct 2020 07:16:05 -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:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KE1CoT3rnYOZe59ux/O/6ANspSJGMetPj7G/N6EnyFs=; b=SHnu8Xy2dn60Q9Pl4UyJIVqfo5ykLXeed1OG4xQ9AX7YNiXXx2Kd/aoRGMPDSH8cdA ZJ3WdEVj5XgJuG9FnTy6z5ga6/BptThJ2whw3Iz05mKsXhSmCVTFWxViS83Ul2NqMinN /mUCGbOYaVslmKnPXOSBCoauahWe2zsL6bpaF2IA2UrKRvns6WX1MIO6L3tf8pUQk5wp cZOBYkY02KubzIBPyxrxHhhSURgxeYwcTUpj9wnte0yBzVpVGywhD3hnL1Sq0znRgNwa 8U3/gM9FKXckB2IW2OWs6Jv5/FuAj5pACrQMq+kA8POzG0MOkVnZbw4EZUIIyn7n9S/T cwYw== X-Gm-Message-State: AOAM531tFY7QaLuy+INr2XuAZ/hfQaq0Vp8ZXXqpmnSkvlT6y3Nww5VM fHcVuJeJo4TNi6nWZNzUYeSQdMEfZyLkdQ== X-Google-Smtp-Source: ABdhPJxoOAhh5LY3uCRaKdPMHjCGijtN7kLqklfNGftyKQY+bcUJDplSngxxnR5JpokJE68DExcUyg== X-Received: by 2002:a37:6790:: with SMTP id b138mr3427281qkc.355.1603289765218; Wed, 21 Oct 2020 07:16:05 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id e17sm1187952qts.54.2020.10.21.07.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Oct 2020 07:16:04 -0700 (PDT) To: libc-alpha@sourceware.org, Florian Weimer Subject: [PATCH v3 7/7] dirent: Deprecate getdirentries Date: Wed, 21 Oct 2020 11:15:42 -0300 Message-Id: <20201021141542.2003377-8-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021141542.2003377-1-adhemerval.zanella@linaro.org> References: <20201021141542.2003377-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Cc: James Clarke , John Paul Adrian Glaubitz Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" 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 | 14 ++++++++++---- sysdeps/unix/sysv/linux/Makefile | 3 +++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 3c1e509744..63623dcee2 100644 --- a/NEWS +++ b/NEWS @@ -47,6 +47,9 @@ Deprecated and removed features, and other changes affecting compatibility: as a compatibility symbol. Applications should use the getrlimit or prlimit. +* The function getdirentries is now deprecated, applications should use + either getdents64, readdir64 or readdir. + Changes to build and runtime requirements: * On Linux, the system administrator needs to configure /dev/pts with diff --git a/dirent/dirent.h b/dirent/dirent.h index 92d0925047..62bb77b4e1 100644 --- a/dirent/dirent.h +++ b/dirent/dirent.h @@ -348,29 +348,35 @@ extern int alphasort64 (const struct dirent64 **__e1, /* Read directory entries from FD into BUF, reading at most NBYTES. Reading starts at offset *BASEP, and *BASEP is updated with the new position after reading. Returns the number of bytes read; zero when at - end of directory; or -1 for errors. */ + end of directory; or -1 for errors. + This is deprecated and getdents64 or readdir should be used instead. */ # ifndef __USE_FILE_OFFSET64 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_msg__ ("Use getdents64 instead"); # 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_msg__ ("Use getdents64 instead"); # else # define getdirentries getdirentries64 # endif # endif # ifdef __USE_LARGEFILE64 +/* This is deprecated and getdents64 or readdir64 should be used instead. */ 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_msg__ ("Use getdents64 instead"); # endif #endif /* Use misc. */ diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 09604e128b..242b07734f 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -262,6 +262,9 @@ ifeq ($(subdir),dirent) sysdep_routines += getdirentries getdirentries64 tests += tst-getdents64 tests-internal += tst-readdir64-compat + +# Avoid the warning for the weak_alias for _DIRENT_MATCHES_DIRENT64 +CFLAGS-getdirentries64.c = -Wno-deprecated-declarations endif ifeq ($(subdir),nis)