TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Why did 16-bit _lopen and _lcreat functions return -1 on failure instead of 0?

6 pointsby nikbackmover 1 year ago

1 comment

NikkiAover 1 year ago
That, surprisingly for raymond, doesn&#x27;t actually answer the question, since you cannot request opening stdin&#x2F;stdout&#x2F;stderr via this API, the values 0..2 are also invalid return values.<p>(&#x2F;dev&#x2F;stdin, &#x2F;dev&#x2F;stdout, &#x2F;dev&#x2F;stderr exist today, but did not then, and even today I don&#x27;t think you can open&#x2F;create them since they are symlinks to &#x2F;proc&#x2F;self&#x2F;fd&#x2F;0..2 and thus open(&quot;&#x2F;dev&#x2F;stdin&quot;, ...) returns -1)<p>AFAIK if you close(0) you lose your stdin and never see it again.
评论 #37581002 未加载