From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21744 invoked by alias); 14 Aug 2019 19:06:49 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 21736 invoked by uid 89); 14 Aug 2019 19:06:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-34.5 required=5.0 tests=AWL,BAYES_00,ENV_AND_HDR_SPF_MATCH,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,HTML_MESSAGE,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_PASS,USER_IN_DEF_SPF_WL autolearn=ham version=3.3.1 spammy=sco, H*c:alternative X-HELO: mail-oi1-f195.google.com Received: from mail-oi1-f195.google.com (HELO mail-oi1-f195.google.com) (209.85.167.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 14 Aug 2019 19:06:47 +0000 Received: by mail-oi1-f195.google.com with SMTP id o6so5293146oic.9 for ; Wed, 14 Aug 2019 12:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VdNJ0PKqPM9l6V0ez2awCOX9qGp/3HhDF0Mm7I/jdag=; b=cAQxpiFNsfhOkpnvRaKU3iAqg5Dm8kg8wEJMEhbw+FRgmrb9Xea9Nk1LMyYoau0mSD 3GWVGE0TZ9F0PdWIzkMpZ+gmdzr8AwtYKsb4Om1jEQcaY82Q7InYOa8AVnYbF6s4p3kW MyB3IfBPYnN4ju/T/yYLuBKJWEORwKMmZbjDR69QP9HQl6Is6oI4QJGI6472y138p8LK wbVddzq1WwLzVw5JeD5amJ2YsOGtJBGbg8zsQVaN0yEGLHVYtpQ47R4JHmKqLjmHTPVa YUx914TQGfTDe3aq+Qx2cux9x5cBP3OOGq+oafBj+cvGewYdhh9oAuF84X9olQqOoZcf v/QQ== MIME-Version: 1.0 References: <822320514b423ceb851f0f60a5692b49841232d5.camel@redhat.com> In-Reply-To: <822320514b423ceb851f0f60a5692b49841232d5.camel@redhat.com> From: "Dionna Amalie Glaze via newlib" Reply-To: Dionna Amalie Glaze Date: Wed, 14 Aug 2019 19:06:00 -0000 Message-ID: Subject: Re: [PATCH] Make st_*tim visible in stat for POSIX.1-2008 To: Yaakov Selkowitz Cc: newlib@sourceware.org Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019/txt/msg00487.txt.bz2 Ah you're right, I didn't properly handle the block size definitions. Here's another go at it that splits the timestamp declarations from the blocksize declarations. --- newlib/libc/include/sys/stat.h | 64 ++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/newlib/libc/include/sys/stat.h b/newlib/libc/include/sys/stat.h index eee98db64..4a05081e4 100644 --- a/newlib/libc/include/sys/stat.h +++ b/newlib/libc/include/sys/stat.h @@ -24,7 +24,7 @@ extern "C" { #define stat64 stat #endif #else -struct stat +struct stat { dev_t st_dev; ino_t st_ino; @@ -34,15 +34,11 @@ struct stat gid_t st_gid; dev_t st_rdev; off_t st_size; -#if defined(__rtems__) +#if defined(__MISC_VISIBLE) || __POSIX_VISIBLE >= 200809 || defined(__rtems__) struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; - blksize_t st_blksize; - blkcnt_t st_blocks; -#else - /* SysV/sco doesn't have the rest... But Solaris, eabi does. */ -#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__) +#elif defined(__svr4__) && !defined(__PPC__) && !defined(__sun__) time_t st_atime; time_t st_mtime; time_t st_ctime; @@ -53,14 +49,19 @@ struct stat long st_spare2; time_t st_ctime; long st_spare3; +#endif +#if defined(__rtems__) + blksize_t st_blksize; + blkcnt_t st_blocks; +/* SysV/sco doesn't have the rest... But Solaris, eabi does. */ +#elif !defined(__svr4__) || defined(__PPC__) || defined(__sun__) blksize_t st_blksize; blkcnt_t st_blocks; long st_spare4[2]; #endif -#endif }; -#if defined(__rtems__) +#if __POSIX_VISIBLE >= 200809 || defined(__rtems__) On Wed, Aug 14, 2019 at 11:53 AM Yaakov Selkowitz wrote: > On Tue, 2019-08-13 at 11:29 -0700, Dionna Amalie Glaze via newlib > wrote: > > The st_{a,c,m}tim fields are needed for POSIX.1-2008, not just RTEMS. > > > > Signed-off-by: Dionna Glaze > > --- > > newlib/libc/include/sys/stat.h | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/newlib/libc/include/sys/stat.h > b/newlib/libc/include/sys/stat.h > > index eee98db64..052ef5a66 100644 > > --- a/newlib/libc/include/sys/stat.h > > +++ b/newlib/libc/include/sys/stat.h > > @@ -34,10 +34,12 @@ struct stat > > gid_t st_gid; > > dev_t st_rdev; > > off_t st_size; > > -#if defined(__rtems__) > > +#if defined(__USE_MISC) || __POSIX_VISIBLE >= 200809 > > Nak. > > 1) __USE_MISC is a glibc internal and has no meaning within Newlib. > The proper guards must be used. > > 2) This would cause the struct size to vary based on FTMs. This is a > big no-no. There needs to be size equivalent no-ops in an #else chunk > to match this. > > > struct timespec st_atim; > > struct timespec st_mtim; > > struct timespec st_ctim; > > +#endif > > +#if defined(__rtems__) > > blksize_t st_blksize; > > blkcnt_t st_blocks; > > #else > > @@ -60,7 +62,7 @@ struct stat > > #endif > > }; > > > > -#if defined(__rtems__) > > +#if __POSIX_VISIBLE >= 200809 > > #define st_atime st_atim.tv_sec > > #define st_ctime st_ctim.tv_sec > > #define st_mtime st_mtim.tv_sec > > > > -- > Yaakov Selkowitz > Senior Software Engineer - Platform Enablement > Red Hat, Inc. > > > -- -Dionna Glaze, PhD (she/her)