From patchwork Fri Oct 2 17:06:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 40653 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 4BB56398E478; Fri, 2 Oct 2020 17:06:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4BB56398E478 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1601658409; bh=+ah46WTCXqxdiJQqFvLewS8EU7dq4ZW+Eufwr66uj2E=; 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=Ict3f+GNXCFE8fJFaiXlRAR9KfGE1viL15n8Cp+PcgyHqfPdGAP26kfGyoYPMgSfL 5eC7EGiGOc1FN4DtbnEk21kQGnIQc9APqGtiAwl9RgmY7E5d3iWT32IXsSvLN0g7kq Eyr9j5oX5uSlpNIuAsWkJ+nSE1ZQUxOoubcsw45g= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by sourceware.org (Postfix) with ESMTPS id 4E8BF398E469 for ; Fri, 2 Oct 2020 17:06:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4E8BF398E469 Received: by mail-qk1-x741.google.com with SMTP id c2so2074919qkf.10 for ; Fri, 02 Oct 2020 10:06:46 -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=+ah46WTCXqxdiJQqFvLewS8EU7dq4ZW+Eufwr66uj2E=; b=ujB4p68YHgz4C6QtnyF6Sb1yk0/mjRVns4g9BxQnQM0j5OH9edHbCXueXGjVPAao+Z I6gnVreHR5EQ0dwJKcHC15uYsbYd5LtZRNjvh+N5ohMLJOP8erz3hgn0ye0xD0PZL+kj U7+9OKNAtVh3EcZq/AssmSqpMVkji1fySIAm7FKYkCY12IFFg23k7QUxwu49I6i9GptP 7Y7tFU4jBZtjH8F56k0gPPGzl9Wd0XIw0xyLnMngpKXu0RQnI07Un2LXrYTdg+gbd3Wx oRYPyOKzyYVtGP6kGdCuqU+bvh6MElcvyEBpNLhQUrXMSGxZ/B2yxBVgWZyfYkJPyW9c 0Bcw== X-Gm-Message-State: AOAM532dGoAKB+lZApyy4p+e5WWeKIhg49JNPExd4Dv3tYpMhhOyNj69 O8WizIpiQbghJ07OsXe31k0VHlBGqC/F8w== X-Google-Smtp-Source: ABdhPJxvRZcRAOaJhYS9u4Hved03gOympUQgzjcNVHBDxN7i4C1ycP2D6wACb1x5lLtZH1Cx41oxzw== X-Received: by 2002:a37:745:: with SMTP id 66mr2977846qkh.344.1601658405664; Fri, 02 Oct 2020 10:06:45 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id d10sm1436891qkk.1.2020.10.02.10.06.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Oct 2020 10:06:45 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v2 9/9] dirent: Deprecate getdirentries Date: Fri, 2 Oct 2020 14:06:20 -0300 Message-Id: <20201002170620.1611673-10-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201002170620.1611673-1-adhemerval.zanella@linaro.org> References: <20201002170620.1611673-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.3 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 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 | 11 +++++++---- sysdeps/unix/sysv/linux/Makefile | 3 +++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index ce05d05b16..43dab4d519 100644 --- a/NEWS +++ b/NEWS @@ -33,6 +33,9 @@ Deprecated and removed features, and other changes affecting compatibility: * The mallinfo function is marked deprecated. Callers should call mallinfo2 instead. +* The function getdirentries is now deprecated, applications should use + either getdents64, readdir64 or readdir. + 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..1e93f2fbcf 100644 --- a/dirent/dirent.h +++ b/dirent/dirent.h @@ -348,29 +348,32 @@ 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__; # 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 # 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__; # endif #endif /* Use misc. */ diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 3bd3106ef9..55b8df59c5 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -260,6 +260,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)