From: Joel Sherrill <joel@rtems.org>
To: Dionna Amalie Glaze <dionnaglaze@google.com>
Cc: Newlib <newlib@sourceware.org>
Subject: Re: [PATCH] Make st_*tim visible in stat for POSIX.1-2008
Date: Tue, 13 Aug 2019 18:46:00 -0000 [thread overview]
Message-ID: <CAF9ehCUKqiVHVf=rmud=yxF69-1zfa3-jNaR1f-3MGhx0vE=xg@mail.gmail.com> (raw)
In-Reply-To: <CAAH4kHZdBrhCYW3R-MLX0nkp=NTcvT2PD-6AmeTm1t-D-asesw@mail.gmail.com>
On Tue, Aug 13, 2019 at 1:30 PM Dionna Amalie Glaze via newlib <
newlib@sourceware.org> wrote:
> The st_{a,c,m}tim fields are needed for POSIX.1-2008, not just RTEMS.
>
> Signed-off-by: Dionna Glaze <dionnaglaze@google.com>
> ---
> 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
> struct timespec st_atim;
> struct timespec st_mtim;
> struct timespec st_ctim;
> +#endif
>
If I am reading this change correctly, this is breakage for RTEMS. Both of
those
terms are defined as a consequence of user provided defines. If the user
application
and RTEMS are not compiled with the same options, the fields in the
structure will
not agree and these below will be overlaid on the time fields.
Most of the newlib targets are single address space so changing the fields
in
the structure based on user provided conditionals is going to introduce
breakage.
Perhaps adding a new define to sys/config.h so the fields are always there
for
the targets that support them. I couldn't find any example that wasn't
based on
a hard-coded always on value in either sys/config.h or sys/features.h. Maybe
someone else has another idea.
Preprocessing this test program confirms that __POSIX_VISIBLE isn't defined
by default for RTEMS.
=========================
#include <sys/stat.h>
int X = __POSIX_VISIBLE;
=========================
> +#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
>
> --
> -Dionna Glaze, PhD (she/her)
>
next prev parent reply other threads:[~2019-08-13 18:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-13 18:30 Dionna Amalie Glaze via newlib
2019-08-13 18:46 ` Joel Sherrill [this message]
2019-08-14 8:41 ` Corinna Vinschen
2019-08-14 18:45 ` Dionna Amalie Glaze via newlib
2019-08-14 18:52 ` Yaakov Selkowitz
2019-08-14 19:06 ` Dionna Amalie Glaze via newlib
2019-08-14 19:25 ` Yaakov Selkowitz
2019-08-14 19:50 ` Dionna Amalie Glaze via newlib
2019-08-15 10:03 ` Corinna Vinschen
2019-08-15 15:59 ` Dionna Amalie Glaze via newlib
2019-08-15 18:29 ` Joel Sherrill
2019-08-16 8:59 ` Corinna Vinschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAF9ehCUKqiVHVf=rmud=yxF69-1zfa3-jNaR1f-3MGhx0vE=xg@mail.gmail.com' \
--to=joel@rtems.org \
--cc=dionnaglaze@google.com \
--cc=newlib@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).