From patchwork Wed Dec 18 15:15:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1212529 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-108199-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="Y7Q5Dm+0"; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="SAaQ/O+4"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47dJVS2BDMz9sRv for ; Thu, 19 Dec 2019 02:15:44 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=Tsk m+MUsm9iP7ItsLE+jTI3Jqe34HkwHktQa8dtUyk5+9Sni70O+UsYL8UMkZSeUZaf r07DG3LR7wmltUE228XV3FrLzMcM7TKhF5k+2QJUtXvVrSiw1D9qJO+0GYL9bp2V f0TIUZw6Ov7kREsoU0gtkTiasTzHDvdp6v2kUnn4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type:content-transfer-encoding; s=default; bh=Ovb13qGug 9h2V8UrjSF+6xoU3Ok=; b=Y7Q5Dm+0WEfavNGljlr/DkWiin3EWLmBF485t6zJ0 Scu3OUv8AMscwYKOthRJJe7FgnxyoLi8gFpdGjzzWoAlAfTgxOT5pZi8XQOp//ml 6/4RTzOjKiiIdpeM5PUiC0DA4fj+zqo3rfG8dFguUvCq8FoJEDvGcbRoHG2nd1K9 qY= Received: (qmail 67807 invoked by alias); 18 Dec 2019 15:15:37 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 67749 invoked by uid 89); 18 Dec 2019 15:15:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576682123; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0jPOBdKYiaj/FAj+SxMD9sARNUhCyAy1k9uS3lJneR8=; b=SAaQ/O+4b2eZV6/HBQhOFiorNrEwsILK5yZJyuIxIuMl9ieYxNddHoutOhYYFt+Z/9uAkO 42y36Fh9jd58Z6R4tvpRsv71wuhv18ipQjlW3v3YX6LpVQwQnzuYpg6xldcpCeqnFSot1p sknZ5X3qPEgbDarQ4zUfqmsU6TyNjFc= From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH] Use Linux-like in struct statx, struct statx_timestamp [BZ #25292] Date: Wed, 18 Dec 2019 16:15:19 +0100 Message-ID: <87zhfpzmuw.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 uint64_t is defined as unsigned long int on 64-bit architectures, while the kernel defines it as unsigned long long int. It is desirable to align with Linux types, to match printf format specifiers and the types of pointers to struct members. In retrospect, it was a mistake to add struct statx to the existing header because the header now requires long long support for _GNU_SOURCE even in cases where struct stat does not inherently require it. It would have been better to create a separate header file, to isolate from any compatibility concerns with legacy compilers. Tested with build-many-glibcs.py, on x86_64-linux-gnu and i686-linux-gnu with Linux 5.3 kernel headers, and with historic kernel headers on powerpc64-linux-gnu and s390x-linux-gnu (from kernel-headers-3.10.0-327.el7; these headers do not contain a statx backport). ----- io/bits/types/struct_statx.h | 34 +++++++++++++++++----------------- io/bits/types/struct_statx_timestamp.h | 6 +++--- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/io/bits/types/struct_statx.h b/io/bits/types/struct_statx.h index d042372a1b..5d1b7d07f9 100644 --- a/io/bits/types/struct_statx.h +++ b/io/bits/types/struct_statx.h @@ -29,27 +29,27 @@ argument of the statx function.) */ struct statx { - __uint32_t stx_mask; - __uint32_t stx_blksize; - __uint64_t stx_attributes; - __uint32_t stx_nlink; - __uint32_t stx_uid; - __uint32_t stx_gid; - __uint16_t stx_mode; - __uint16_t __statx_pad1[1]; - __uint64_t stx_ino; - __uint64_t stx_size; - __uint64_t stx_blocks; - __uint64_t stx_attributes_mask; + unsigned int stx_mask; + unsigned int stx_blksize; + __extension__ unsigned long long int stx_attributes; + unsigned int stx_nlink; + unsigned int stx_uid; + unsigned int stx_gid; + unsigned short int stx_mode; + unsigned short int __statx_pad1[1]; + __extension__ unsigned long long int stx_ino; + __extension__ unsigned long long int stx_size; + __extension__ unsigned long long int stx_blocks; + __extension__ unsigned long long int stx_attributes_mask; struct statx_timestamp stx_atime; struct statx_timestamp stx_btime; struct statx_timestamp stx_ctime; struct statx_timestamp stx_mtime; - __uint32_t stx_rdev_major; - __uint32_t stx_rdev_minor; - __uint32_t stx_dev_major; - __uint32_t stx_dev_minor; - __uint64_t __statx_pad2[14]; + unsigned int stx_rdev_major; + unsigned int stx_rdev_minor; + unsigned int stx_dev_major; + unsigned int stx_dev_minor; + __extension__ unsigned long long int __statx_pad2[14]; }; #endif /* __statx_defined */ diff --git a/io/bits/types/struct_statx_timestamp.h b/io/bits/types/struct_statx_timestamp.h index c1691065e8..98c9fb9fd5 100644 --- a/io/bits/types/struct_statx_timestamp.h +++ b/io/bits/types/struct_statx_timestamp.h @@ -25,9 +25,9 @@ struct statx_timestamp { - __int64_t tv_sec; - __uint32_t tv_nsec; - __int32_t __statx_timestamp_pad1[1]; + __extension__ long long int tv_sec; + unsigned int tv_nsec; + int __statx_timestamp_pad1[1]; }; #endif /* __statx_timestamp_defined */