This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: O_ASYNC and FASYNC should be defined if available
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, donmez, georg.brandl, mishok13
Priority: normal Keywords: patch

Created on 2008-05-16 07:25 by donmez, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
async.patch donmez, 2008-05-16 11:36 Add O_ASYNC and FASYNC as GNU extensions
async-doc.patch donmez, 2008-05-16 13:30 Add documentation for O_ASYNC
Messages (12)
msg66921 - (view) Author: Ismail Donmez (donmez) * Date: 2008-05-16 07:25
os module have varios O_ declerations but it doesn't define O_ASYNC.
Same for fcntl module which doesn't define FASYNC.

Simply defining 

O_ASYNC = 020000

works fine but its not as elegant as saying os.O_ASYNC.
msg66922 - (view) Author: Andrii V. Mishkovskyi (mishok13) Date: 2008-05-16 08:16
These flags are non-posix, linux-specific constants. Python 'os' module
uses 'posix' module for all *nix systems, including those, that do not
support O_ASYNC and FASYNC flags. I think your feature request should be
rejected.
msg66923 - (view) Author: Ismail Donmez (donmez) * Date: 2008-05-16 08:31
I think they at least should be supported on Linux then. It does work if
you use the value itself anyway.
msg66924 - (view) Author: Andrii V. Mishkovskyi (mishok13) Date: 2008-05-16 08:55
>I think they at least should be supported on Linux then. 

And what happens if some Unix flavor (i.e. Solaris) adds new flag, say
O_NONLINUXSYNC and it has the same value as linux's O_ASYNC? And then
FreeBSD adds O_BSDSYNC flag with the same number and so on. Then Python
will have to have separate system-specific module for each *nix system
that uses Python. Why do you think Python maintainers would want that?

>It does work if you use the value itself anyway.

It's the way fcntl works -- it's just a thin layer on top of fcntl() and
ioctl() calls. But that's not a good reason for including non-posix
flags to 'posix' module
msg66925 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-05-16 09:25
Platform-specific values are not a problem.
On win32 os.O_NOINHERIT == 128, and on linux os.O_EXCL has the same value.

Python just exposes the available #defines at the module level.
(btw, the posix module is also available on windows. It is named 'nt',
but it is really the same module)

And in posixmodule.c, There are already some "GNU extensions":
os.O_DIRECT, os.O_NOFOLLOW...
msg66931 - (view) Author: Ismail Donmez (donmez) * Date: 2008-05-16 11:33
Add O_ASYNC and FASYNC as GNU extensions.
msg66932 - (view) Author: Ismail Donmez (donmez) * Date: 2008-05-16 11:35
Python code already has GNU/Windows only exceptions. Attached patch adds
O_ASYNC and FASYNC as GNU extensions. If accepted I can send a
complimentary documentation patch.
msg66937 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-05-16 13:10
OK, committed patch in r63368. Thanks!
msg66938 - (view) Author: Ismail Donmez (donmez) * Date: 2008-05-16 13:12
Thanks, can you also apply to py3k branch? :)
msg66939 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-05-16 13:15
That will happen automatically.
msg66942 - (view) Author: Ismail Donmez (donmez) * Date: 2008-05-16 13:30
Documentation patch is added too.
msg66945 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-05-16 13:42
Thanks, applied in r63373.
History
Date User Action Args
2022-04-11 14:56:34adminsetgithub: 47139
2008-05-16 13:42:02georg.brandlsetmessages: + msg66945
2008-05-16 13:30:18donmezsetfiles: + async-doc.patch
messages: + msg66942
2008-05-16 13:15:07georg.brandlsetmessages: + msg66939
2008-05-16 13:12:54donmezsetmessages: + msg66938
2008-05-16 13:10:34georg.brandlsetstatus: open -> closed
resolution: accepted
messages: + msg66937
nosy: + georg.brandl
2008-05-16 11:40:28donmezsettitle: O_ASYNC and FASYNC should be defined for *nix systems -> O_ASYNC and FASYNC should be defined if available
2008-05-16 11:36:49donmezsetfiles: - async.patch
2008-05-16 11:36:23donmezsetfiles: + async.patch
messages: + msg66932
2008-05-16 11:34:37donmezsetfiles: + async.patch
keywords: + patch
messages: + msg66931
2008-05-16 09:25:30amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg66925
2008-05-16 08:55:28mishok13setmessages: + msg66924
2008-05-16 08:31:32donmezsetmessages: + msg66923
2008-05-16 08:16:22mishok13setnosy: + mishok13
messages: + msg66922
2008-05-16 07:25:23donmezsettype: enhancement
2008-05-16 07:25:03donmezcreate