Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.5.x: use higher resolution file stat fields #3049
0.5.x: use higher resolution file stat fields #3049
Changes from 4 commits
55c0b58
b38df8b
1c22d84
99aad5d
7ec4eac
174e9df
4e2096f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, how can we introduce public api changes in a less breaking way?
Is there way better than deprecation warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SN 0.5.0 is advertised/envisioned as requiring a re-build from sources and possibly requiring source changes.
That gives us some degrees of freedom to do things
a 'right' way.
So;
briefly describing the required source change and
pointing to an entry in javalib.rst
giving a fuller description and examples of the
required source change (i.e. change foo._8 to
foo.a_time to use seconds, foo.a_tim to use timespec).
Once the dust settles on this PR, I can either help you
set up the Sphinx environment on your system to build .rst (use "Makefile html" not 'scripts/makedoc") and .md files or do a followup PR for you to review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stat.c
scalanative_stat_init()
is exactly the kind ofglue code I have been trying to expunge from Scala Native.
After a bunch of network code, I had hoped to get to this one before it changed.
I think this section of code is correct/OK and will try
to queue up a follow on PR to optimize (probably to
optimize for Linux passthru with appropriate _Static guards.)
stat
is supposed to be fast (but must always be correct).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though I changed java File internal, it doesn't leak posixlib implementation for users.
In terms of source change, I think you mean
docs/lib/posixlib
, don't you?Of course, we should mention that java File metadata will support nanosecond resolution in the future(probably in 0.5.x?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added docs here
174e9df
4e2096f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this line is improper. POSIX 2018 (and many before, I believe) specify
timespec
as being definedin
time.h
, nottypes.h
( probablytime
was well established beforetypes.h
was specified.)Some else in this PR there is probably an
import
whichneeds to change or happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for feedback! I will address this later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, could you tell me why
scalanative_timespec
introduced here?(link below) If we use timespec from time.h, I don't think scalanative_timespec is needed. Do you mean I should create another time.h file and putscalanative_timespec
in it?https://github.com/scala-native/scala-native/pull/2713/files#diff-9db9f7da0930f16af30649420a8fd8857d1b9f1e07366491539a6d5ef0c0eeccR36
By the way, reading the comment in sys/stat.c, I guess src/main/resources/scala-native/types.h intentionally violates spec for portability.
These types above were introduced by Martin Duhem at 2017. Is this statement "these have different sizes on eg. Linux and OSX" not the case for recent versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: I'm not in a hurry😉 Have a nice holiday!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i10416 You ask good questions. Let me finish my
highest level concern, so the PR can progress, and return to the trickery at play here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick answer to 1st question. I'll get back to second later (tomorrow?)
Lines 92-102 check that Scala Natives scala timespec can be passed thru
to C with no "copy-in/copy-out" code.
From software engineering view, it is unfortunate that the C declaration of scalanative_timespec
is hand edited and hand synchronized with the corresponding Scala struct. The test would
be stronger if the former where generated from the latter. For now, the costly safeguards
are education & review. In someplaces there are "If you change .scala, also change .c" comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
So,
scalanative_timespec
and otherscalanative_*
structs so that we can verify Scala struct is the same format as c struct.typedef struct timespec scalanative_timespec;
intime.h
for future maintenance, though the original PR Fix #1610: add nanosecond resolution in javalib FileTime & posixlib sys/stat; requires previous PRs #1635 puts it intypes.h
.Am I right?