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.

The Unix API is more than just system calls or Posix (2018)

77 pointsby pcr910303almost 3 years ago

5 comments

Karellenalmost 3 years ago
&gt; As people have found out in the past, the real Unix API is the whole collection of behaviors and environments that Unix programs assume. It isn&#x27;t just POSIX library calls; it&#x27;s also the shell and standard utilities and files that are in known locations and standard capabilities and various other things.<p>But... &quot;the shell and standard utilities and files that are in known locations and standard capabilities and various other things&quot; are also specified by POSIX.<p>(Historically, they were the &quot;POSIX.2&quot; standard, and the libc&#x2F;syscall library functions were in the &quot;POSIX.1&quot; standard, but since 1998 when POSIX became the ratification of Single Unix Specification version 2-and-later, they&#x27;re all just in &quot;POSIX&quot;.)<p>So... yes?<p>&gt; Unless you intend for your program to be narrowly and specifically portable to POSIX or an even more minimal standard, it is not a bug for it to rely on portions of the broader, de facto Unix API. It&#x27;s not even necessarily a bug to rely on APIs that are only there on some Unixes (for example Linux and FreeBSD),<p>Why would any of those things be considered a &quot;bug&quot;?<p>&gt; for example, can you implement a compatible and fully capable Bourne shell using only public Unix kernel APIs, or at most public C library APIs?<p>What other APIs does the author think that Bourne shell writers used?<p>I feel like I&#x27;m missing some broader context for this post.
评论 #32053270 未加载
评论 #32052886 未加载
评论 #32054696 未加载
评论 #32055844 未加载
评论 #32052950 未加载
kazinatoralmost 3 years ago
&gt; <i>It isn&#x27;t just POSIX library calls; it&#x27;s also the shell and standard utilities and files that are in known locations and standard capabilities and various other things.</i><p>POSIX has standardized the shell and utilities since before 1990. Of course, not all of them. As far as locations go, you have to rely on PATH; systems do not agree on what exactly is in &#x2F;bin, &#x2F;usr&#x2F;bin and &#x2F;sbin.<p>&gt; A &#x27;Unix&#x27; without a useful $HOME environment variable and &#x2F;tmp may be specification compliant (I haven&#x27;t checked POSIX) but it&#x27;s not useful, in that many programs that people want generally won&#x27;t run on it.<p>Hits for the HOME variable in POSIX:<p><a href="https:&#x2F;&#x2F;pubs.opengroup.org&#x2F;cgi&#x2F;susv4search.cgi?KEYWORDS=HOME&amp;SUBSTRING=substring&amp;CONTEXT=" rel="nofollow">https:&#x2F;&#x2F;pubs.opengroup.org&#x2F;cgi&#x2F;susv4search.cgi?KEYWORDS=HOME...</a><p>Under the Shell Command Language it is documented that <i>HOME</i> is &quot;[t]he pathname of the user&#x27;s home directory. The contents of HOME are used in tilde expansion (see Tilde Expansion).&quot;<p>&#x2F;tmp is a <i>de facto</i> standard. POSIX encourages applications to check for the existence of a variable called TMPDIR, but doesn&#x27;t require implementations to provide that.<p>There are functions which abstract creating a temporary file or directory. Some of them need a template, some don&#x27;t. It is possible to write a program which uses &#x2F;tmp for temporary files, yet doesn&#x27;t refer to &quot;&#x2F;tmp&quot;.
评论 #32053443 未加载
zikalmost 3 years ago
I can see his point but it seems to rely on redefining what the term &quot;API&quot; means. You could as well say &quot;The Windows API isn&#x27;t just .NET - it&#x27;s Win32 and a whole lot of other things&quot;. Which is kind of true, but we don&#x27;t usually call all of those things an API. We call some of those individual parts APIs, just like we do with UNIX. And other parts we&#x27;d call filesystem conventions and so on.<p>I think he&#x27;s arguing that you need to know all of those things to program with the OS and he&#x27;s right, but that&#x27;s still not how we conventionally use the word &quot;API&quot;. It&#x27;s more of a &quot;standard&quot; and the POSIX standard actually does define a lot of this.
评论 #32053015 未加载
kodahalmost 3 years ago
This is kind of an odd take because POSIX is purposed to make application development across Linux and Unix easier by providing reliable behavior. Saying, &quot;my OS is better than the high level standard because it does more&quot; makes me go, &quot;Okay&quot;.<p>Also, I&#x27;m not sure the author has ever actually read POSIX?
sylwarealmost 3 years ago
If we could finally semantically split the signals as those which can be asynchronoulsy delivered and those which sort of cannot (segfault)... that without extra and bonus kludge.