-
Notifications
You must be signed in to change notification settings - Fork 48
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
Update temp file handling for windows support #1036
Conversation
I think we might be better off here to use a |
That was my first thought, but |
Ah yes, I remember why I did it this way now! |
The best solution is probably to add a createUniquePath function to llvm that returns a file_t instead. I can look in to that. |
Race condition? |
Used |
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.
Perhaps we can call createUniquePath ourselves and use that path to call createNativeFile?
Race condition?
LLVM does exactly this internally in createUniqueFile, so if it would be a race condition here it would be there also. However, your convertFDToNativeFile also works fine.
I'm going to investigate adding a createUniqueNativeFile to LLVM, at which point we should be able to switch over to exclusively using file_t, but in the mean time this fix works fine and we should merge it.
Thanks!
@isuruf Please update the commit message to explain why this change is required. (This explanation is in #1036 (comment) and in your reply.) Also, please squash into a single commit. |
The struct Temp is used in the function call createUniqueFile which only takes in a file descriptor instead of a file handler. In Unix these are the same thing, but in Windows they are different. Therefore, the type of the member of struct Temp is changed from file handler to file descriptor and when closing the file the file descriptor is converted to a file handler.
Done |
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.
@DavidTruby Looking forward to your upstream changes
The struct Temp is used in the function call createUniqueFile which only takes in a file descriptor instead of a file handler. In Unix these are the same thing, but in Windows they are different. Therefore, the type of the member of struct Temp is changed from file handler to file descriptor and when closing the file the file descriptor is converted to a file handler.
The struct Temp is used in the function call createUniqueFile which only takes in a file descriptor instead of a file handler. In Unix these are the same thing, but in Windows they are different. Therefore, the type of the member of struct Temp is changed from file handler to file descriptor and when closing the file the file descriptor is converted to a file handler. Original-commit: flang-compiler/f18@a8edb32 Reviewed-on: flang-compiler/f18#1036
The struct Temp is used in the function call createUniqueFile which only takes in a file descriptor instead of a file handler. In Unix these are the same thing, but in Windows they are different. Therefore, the type of the member of struct Temp is changed from file handler to file descriptor and when closing the file the file descriptor is converted to a file handler. Original-commit: flang-compiler/f18@a8edb32 Reviewed-on: flang-compiler/f18#1036
No description provided.