-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
ftruncate is missing from core::libc #4199
Comments
@graydon knows best. Personally I think if the function doesn't exist on windows we should not try to emulate it in |
It seems that actually ftruncate is available on windows, using mingw. So I think just adding a ftruncate binding should work, but that will break when rust abandons mingw in favour of msvc (#1768). Is that desirable (i guess not)? |
I think that ideally the cross-platform ftruncate would use ftruncate64 on linux, ftruncate on OS X (which doesn't have ftruncate64, but instead always has a 64-bit off_t so ftruncate always takes a 64 bit length) and _chsize_s on windows (which also takes a 64bit length). Unfortunately mingw does not have either ftruncate64 or _chsize_s. |
@Dretch: There's no need to use |
There is no need for this, we have a trunc method implemented on floats that uses trunc[f] from libm. There is also a push to remove dependency on cmath/libm so I'm closing this. |
@Aatch: ftruncate is for truncating files :) |
Still isn't implemented. Are we decided this is something we want? Does windows support it? Should this actually be milestoned? |
Still not implemented. |
It looks like this is now implemented in |
rust does not seem to have the ftruncate function (http://pubs.opengroup.org/onlinepubs/7908799/xsh/ftruncate.html).
Might it be possible to add such a function? Some trickery would be needed on windows, like using _chsize instead (http://msdn.microsoft.com/en-us/library/dk925tyb%28v=vs.80%29.aspx).
Is there any reason this function shouldn't exist? If not then I will try and submit a pull request.
The text was updated successfully, but these errors were encountered: