Author eryksun
Recipients Arfrever, amaury.forgeotdarc, benjamin.peterson, eric.araujo, eryksun, nadeem.vawda, ned.deily, neologix, pitrou, python-dev, rosslagerwall, socketpair, terry.reedy, vstinner
Date 2015-12-22.21:37:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1450820223.76.0.140974583234.issue12797@psf.upfronthosting.co.za>
In-reply-to
Content
Марк, os.open added dir_fd support in 3.3, which is implemented on POSIX systems by calling openat. The dir_fd parameter is available for many os functions. This is discussed in section 1.5, Files and Directories [1].

It would be nice if we could support dir_fd on Windows as well, but we'd have to bypass the CRT and Windows API to use the native NT API instead, such as NtCreateFile [2]. The kernel has supported opening a file relative to a directory handle since it was release in 1993 (NT 3.1). All named kernel objects are referenced using an OBJECT_ATTRIBUTES [3] data structure. ObjectName -- a path with up to 32768 UTF-16 characters -- is relative to the RootDirectory handle if non-NULL. This is how paths relative to the process working directory are implemented, but changing the working directory isn't thread safe. 

[1]: https://docs.python.org/3/library/os.html#files-and-directories
[2]: https://msdn.microsoft.com/en-us/library/ff566424
[3]: https://msdn.microsoft.com/en-us/library/ff557749
History
Date User Action Args
2015-12-22 21:37:03eryksunsetrecipients: + eryksun, terry.reedy, amaury.forgeotdarc, pitrou, vstinner, nadeem.vawda, benjamin.peterson, ned.deily, eric.araujo, Arfrever, neologix, rosslagerwall, socketpair, python-dev
2015-12-22 21:37:03eryksunsetmessageid: <1450820223.76.0.140974583234.issue12797@psf.upfronthosting.co.za>
2015-12-22 21:37:03eryksunlinkissue12797 messages
2015-12-22 21:37:03eryksuncreate