JuliaLang/julia

wanted: `open(create=true, exclusive=true)` dead or alive

Open

#33,947 创建于 2019年11月26日

在 GitHub 查看
 (2 评论) (1 反应) (0 负责人)Julia (5,773 fork)batch import
featuregood first issue

仓库指标

Star
 (48,709 star)
PR 合并指标
 (平均合并 20天 6小时) (30 天内合并 157 个 PR)

描述

Sometimes useful, for creating atomic lockfiles (https://github.com/vtjnash/Pidfile.jl) or secure tempfiles: https://github.com/JuliaLang/julia/blob/31bf76f8a1719e07612b9af4196bfc924cf73e21/base/file.jl#L586

The exclusive=true flag (only valid in combination with create=true) should simply map the the underlying O_EXCL option to open (this exists everywhere that Julia runs).

(could also try to add O_NOFOLLOW, though FILE_FLAG_OPEN_REPARSE_POINT is more like O_SYMLINK, and so is hard to implement everywhere. And there's a couple others like RANDOM, SEQUENTIAL, SYNC, DSYNC, NOATIME, DIRECT, and SHORT_LIVED that could even be filtered out when not supported.)

贡献者指南