TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Towards userspaceification of POSIX – part I: signal handling and IO

128 点作者 akyuu10 个月前

5 条评论

mananaysiempre10 个月前
&gt; POSIX allows file descriptors to be shared by an arbitrary number of processes, after e.g. forks or SCM_RIGHTS transfers (even though this use case is most likely very rare, so it’s not entirely impossible for this state to be moved to userspace).<p>Normally it’s rare, except shell functionality crucially depends on it[1].<p>The way to think about this, IMO, is that while a disk file is more or less random-access, when you open it unavoidably turns into strange hybrid of a random-access byte array and a (seekable) byte stream (classically, the “file description”), and <i>that</i> is what the resulting fd and any of its copies point at. Seekable streams made some sense in the age of tape drives, but nowadays it seems to me that random-access files and non-seekable streams have enough of a gulf between them that forcing both to appear like the same kind of object is more confusing than helpful.<p>(I don’t know what my ideal world would look like, given I still like to direct streams from&#x2F;to files. I still dislike the “file description” business rather strongly.)<p>[1] <a href="https:&#x2F;&#x2F;utcc.utoronto.ca&#x2F;~cks&#x2F;space&#x2F;blog&#x2F;unix&#x2F;DupSharedOffsetNecessary" rel="nofollow">https:&#x2F;&#x2F;utcc.utoronto.ca&#x2F;~cks&#x2F;space&#x2F;blog&#x2F;unix&#x2F;DupSharedOffse...</a>
评论 #41143741 未加载
评论 #41145616 未加载
评论 #41144404 未加载
评论 #41143541 未加载
评论 #41144537 未加载
评论 #41146974 未加载
评论 #41143625 未加载
评论 #41143733 未加载
tom_10 个月前
Those who understand Unix are condemned to reproduce it exactly.
评论 #41145601 未加载
Animats10 个月前
Why emulate POSIX signal semantics? Those are a holdover from the single-thread UNIX era. Events should be delivered by threads or async calls. Signals should be reserved for exceptions, things you don&#x27;t return to, like segfaults.
评论 #41145658 未加载
tbrownaw10 个月前
Would shared pipes not have approximately the same issue wrt file positions being shared state? A process group (cron job, systemd service) sharing a pipe for error output is probably a bit more common than directly having an on-disk file.
评论 #41145424 未加载
up2isomorphism10 个月前
This is very typical rust project. Trying to change the old world while tightly following the old world in a very unimaginative way.<p>Maybe too much memory safety is bad for creativity?
评论 #41148694 未加载
评论 #41147185 未加载
评论 #41146276 未加载