Author giampaolo.rodola
Recipients brett.cannon, davin, eric.snow, giampaolo.rodola, lukasz.langa, nascheme, osvenskan, pitrou, pmpp, rhettinger, ronaldoussoren, skrah, terry.reedy, yselivanov
Date 2019-02-16.20:20:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1550348453.1.0.118232458789.issue35813@roundup.psfhosted.org>
In-reply-to
Content
As for *flags* argument "man shm_open" mentions 5 possible flags:

- O_RDONLY, OR_RDWR: these can be served by existing *read_only* arg
- O_CREAT, O_EXCL: dictates whether to raise error if file exists; could be served via *attach_if_exists* arg, if added, or internally if not added
- O_TRUNC: related to *size* argument (it seems it should be set when size=0)

As such I think "flags" should not be exposed. As for Windows, *read_only* is currently exposed but ignored, and no other flags are contemplated. It seems you can implement *read_only* by passing FILE_MAP_READ or FILE_MAP_WRITE to OpenFileMappingW() here:
https://github.com/python/cpython/blob/1e5341eb171d7d2b988880020cfcc0a64021326d/Lib/multiprocessing/shared_memory.py#L98
Not sure how to reliably check if a file mapping already exists, but possibly POSIX and Windows should behave the same in this regard (and some test cases to exercise all the possible combinations would be good to have).
History
Date User Action Args
2019-02-16 20:20:53giampaolo.rodolasetrecipients: + giampaolo.rodola, brett.cannon, nascheme, rhettinger, terry.reedy, ronaldoussoren, pitrou, osvenskan, skrah, pmpp, lukasz.langa, eric.snow, yselivanov, davin
2019-02-16 20:20:53giampaolo.rodolasetmessageid: <1550348453.1.0.118232458789.issue35813@roundup.psfhosted.org>
2019-02-16 20:20:53giampaolo.rodolalinkissue35813 messages
2019-02-16 20:20:53giampaolo.rodolacreate