-
-
Notifications
You must be signed in to change notification settings - Fork 411
Conversation
|
Thanks for your pull request and interest in making D better, @jercaianu! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + druntime#1937" |
src/core/sys/posix/sys/statvfs.d
Outdated
| else version (FreeBSD) | ||
| { | ||
| enum MFSNAMELEN = 16; | ||
| enum MNAMELEN = 1024; |
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.
MNAMELEN is defined as 88 here: https://www.freebsd.org/cgi/man.cgi?query=statfs&sektion=2. Why are you changing it to 1024?
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.
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'm not sure why man page doesn't respect that, though 🤔
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.
Ah, I think I know why. It might be the part of the inode64 changes for the FreeBSD. Here's the latest man page: https://github.com/freebsd/freebsd/blob/565b5a2e9ec6e684421a7e6eb7b37d19e3c0f47e/lib/libc/sys/statfs.2#L69
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.
Here's commit changing it: freebsd/freebsd-src@e75ba1d#diff-685f3d1e8b4f3709173b73973b379ac0
Extend the ino_t, dev_t, nlink_t types to 64-bit ints. Modify
struct dirent layout to add d_off, increase the size of d_fileno
to 64-bits, increase the size of d_namlen to 16-bits, and change
the required alignment. Increase struct statfs f_mntfromname[] and
f_mntonname[] array length MNAMELEN to 1024.
So, this is not still the value for the RELEASE, but it is for the CURRENT.
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'm not sure how we should proceed here. Use only the latest definition, or provide the two under version FreeBSDv1X.X (or something like that). I would go for the second option, but I don't know if we have a good interface for passing this version to druntime build.
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.
The problem will arise as soon as this functionality is used in Phobos as the Autotester uses the (AFAIK) the older version of FreeBSD.
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.
Here's what @CyberShadow proposed in the issue:
- We add getosreldate and INO64_FIRST to druntime
- We add both the old and new struct definitions
- We add a stat wrapper which,when getosreldate() < INO64_FIRST, translates the old struct to the new struct and returns it.
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.
There's an issue about this, as right now dmd will not work on the CURRENT at all: https://issues.dlang.org/show_bug.cgi?id=17596)
Thanks. @jercaianu can you add both definitions (with different names, but defined unconditionally together) and add a D translation of the C wrapper function mentioned here: https://issues.dlang.org/show_bug.cgi?id=17596#c8 ?
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.
Sure. I'll look into it :)
andralex
left a comment
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.
So what's the status of this?
src/core/sys/posix/sys/statvfs.d
Outdated
| MNT_AUTOMOUNTED = 131072 /* mounted by automountd(8) */ | ||
| } | ||
|
|
||
| int statfs (const char * file, statfs_t* buf); |
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.
we don't use space before open paren in function declarations and calls.
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.
and also we don't put a space before pointers -> char*
src/core/sys/posix/sys/statvfs.d
Outdated
| enum FFlag | ||
| { | ||
| MNT_RDONLY = 1, /* read only filesystem */ | ||
| MNT_SYNCHRONOUS = 2, /* fs written synchronously */ |
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.
no tabs please
@andralex FreeBSD changed their ABI and in order for us to be compatible with both versions we would need to add two versions of the same struct, along with a wrapper function that fills the right one depending on the OS version and returns the one defined by the newer ABI (superset of the older) to higher-level code. See the discussion in this bug report for more info: https://issues.dlang.org/show_bug.cgi?id=17596#c8 |
|
@ZombineDev @andralex @wilzbach Thanks |
Officially, we only support the latest version of FreeBSD, which is currently 11. We do need to sort out the 12 stuff, but that shouldn't be a blocker for adding missing druntime bindings. It just means that we're then going to need to do more work on the bindings to make them work for 12, and while how to fix that has been discussed, AFAIK, that hasn't actually been sorted out yet. So, I'd say that you should just add the bindings that match for 11 so that 11 works, and then if changes are necessary to make 12 work, then they can be made with the other changes that need to be made to make 12 work. |
|
@jmdavis @ZombineDev @andralex |
Although POSIX uses statvfs, statvfs does not give good results on FreeBSD.
However statfs works fine on FreeBSD as described here[1].
@edi33416 helped me test the functionality on FreeBSD. Statfs should be used for implementing "getAvailableDiskSpace" on FreeBSD as discussed here[2].
[1] - https://www.freebsd.org/cgi/man.cgi?query=statfs&sektion=2
[2] - dlang/phobos#5776