From: Phil Budne <phil@ultimate.com>
To: cygwin@cygwin.com
Subject: stat st_birthtim(espec)
Date: Mon, 19 Oct 2020 02:06:06 -0400 (EDT) [thread overview]
Message-ID: <202010190606.09J666Jp007285@ultimate.com> (raw)
While checking if an OSS project of mine (www.snobol4.org/csnobol4)
compiled cleanly under Cygwin, I was happy to discover that struct
stat contains file birth time as on various BSD based systems.
BUT, I was unhappy to find out that MacOS 10.15 and Cygwin 3.1.7 have
non-overlapping definitions for birth time information.
FreeBSD 12, NetBSD 9, and OSX 10.15 all have a "timespec" available as
"st_birthtimespec", but Cygwin does not.
On FreeBSD, NetBSD, and Cygwin the actual member of struct stat is
st_birthtim, but on OSX, the member is st_birthtimespec, and there is
no define for st_birthtim.
A st_birthtimespec define in cygwin/stat.h would make it easier to
write portable code.
Snips from .../stat.h, possible patch below:
==== /* $NetBSD: stat.h,v 1.69 2019/09/15 23:55:22 christos Exp $ */
struct timespec st_birthtim; /* time of creation */
#define st_birthtime st_birthtim.tv_sec
#define st_birthtimespec st_birthtim
#define st_birthtimensec st_birthtimespec.tv_nsec
==== * $FreeBSD: releng/12.1/sys/sys/stat.h 326023 2017-11-20 19:43:44Z pfg $
struct timespec st_birthtim; /* time of file creation */
#define st_birthtime st_birthtim.tv_sec
#define st_birthtimespec st_birthtim
NO st_birthtimensec
==== CYGWIN_NT-10.0 WinDev2005Eval 3.1.7(0.340/5/3) 2020-08-22 17:48 x86_64 Cygwin
timestruc_t st_birthtim;
#define st_birthtime st_birthtim.tv_sec
NO st_birthtimespec
NO st_birthtimensec
==== OSX 10.15
NO st_birthtim
struct timespec st_birthtimespec; /* time of file creation(birth) */
#define st_birthtime st_birthtimespec.tv_sec
NO st_birthtimensec
================================================================
From f07900b9a8e9e56b04fac493f86196079bcf9001 Mon Sep 17 00:00:00 2001
From: phil <phil@ultimate.com>
Date: Mon, 19 Oct 2020 01:33:15 -0400
Subject: [PATCH] add st_birthtimespec define
---
winsup/cygwin/include/cygwin/stat.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/winsup/cygwin/include/cygwin/stat.h b/winsup/cygwin/include/cygwin/stat.h
index 0e489d7a9..a5adf29f3 100644
--- a/winsup/cygwin/include/cygwin/stat.h
+++ b/winsup/cygwin/include/cygwin/stat.h
@@ -65,6 +65,7 @@ extern int lstat64 (const char *__restrict file_name,
#define st_mtime st_mtim.tv_sec
#define st_ctime st_ctim.tv_sec
#define st_birthtime st_birthtim.tv_sec
+#define st_birthtimespec st_birthtim
/* POSIX IPC objects are not implemented as distinct file types, so the
below macros have to return 0. The expression is supposed to catch
--
2.25.1
next reply other threads:[~2020-10-19 6:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-19 6:06 Phil Budne [this message]
2020-10-19 12:01 ` 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=202010190606.09J666Jp007285@ultimate.com \
--to=phil@ultimate.com \
--cc=cygwin@cygwin.com \
/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).