Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004895OCaml~DO NOT USE (was: OCaml general)public2009-10-16 02:262013-08-31 12:48
Assigned To 
PlatformOSOS Version
Product Version3.11.1 
Target VersionFixed in Version3.13.0+dev 
Summary0004895: Windows (mingw): Unix.set/clear_close_on_exec modifies the descriptor
DescriptionThe implementation of Unix.set/clear_close_on_exec creates a duplicate of the file handler, and changes the inheritance flag while doing so. The duplication changes the value of the descriptor, and is unnecessary, as Windows now supports changing the inheritance flag directly.

let h = Hashtbl.create 10;;
Hashtbl.add h fd "Something";;
Unix.set_close_on_exec fd;;
Hashtbl.find h fd

raises Not_found
Additional Informationuse the win32 call SetHandleInformation
TagsNo tags attached.
Attached Files

- Relationships
related to 0005416closed Unix.(set|clear)_close_on_exec changes sockets to blocking mode 

-  Notes
xleroy (administrator)
2009-10-18 10:46

SetHandleInformation is a relatively recent addition to Win32
(since Windows 2000 Professional / Server), so at the time this code was written there was probably no other option than duplicating the handle. I guess we can assume everyone has SetHandleInformation nowadays.

A (tested) patch would be most welcome.
ripoche (reporter)
2012-02-27 14:55
edited on: 2012-02-27 14:57

Gerd's proposal matches what was implemented for bug 0005416.
And indeed, I was unable to reproduce the issue with the patch applied.

(OCaml 3.12.1, Msvc7.1, Windows XP SP3 32bits)

xleroy (administrator)
2012-02-27 18:15

Very good. I'll mark this PR as resolved, then. Thanks for the notice.

- Issue History
Date Modified Username Field Change
2009-10-16 02:26 gerd New Issue
2009-10-18 10:46 xleroy Note Added: 0005137
2009-10-18 10:46 xleroy Status new => feedback
2012-02-27 14:55 ripoche Note Added: 0006971
2012-02-27 14:57 ripoche Note Edited: 0006971 View Revisions
2012-02-27 18:14 xleroy Relationship added related to 0005416
2012-02-27 18:15 xleroy Note Added: 0006973
2012-02-27 18:15 xleroy Status feedback => resolved
2012-02-27 18:15 xleroy Resolution open => fixed
2012-02-27 18:15 xleroy Fixed in Version => 3.13.0+dev
2013-08-31 12:48 xleroy Status resolved => closed
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker