“POSIX”是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1780599/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the meaning of "POSIX"?
提问by claws
What is POSIX? I have read the Wikipedia articleand I read it every time I encounter the term. The fact is that I never really understood what it is.
什么是POSIX?我读过维基百科的文章,每次遇到这个词我都会读一读。事实是我从来没有真正理解它是什么。
Can anyone please explain it to me by explaining "the need for POSIX" too?
任何人都可以通过解释“对POSIX的需求”来向我解释吗?
采纳答案by Alex Martelli
POSIXis a family of standards, specified by the IEEE, to clarify and make uniform the application programming interfaces (and ancillary issues, such as commandline shell utilities) provided by Unix-y operating systems. When you write your programs to rely on POSIX standards, you can be pretty sure to be able to port them easily among a large family of Unix derivatives (including Linux, but not limited to it!); if and when you use some Linux API that's not standardized as part of Posix, you will have a harder time if and when you want to port that program or library to other Unix-y systems (e.g., MacOSX) in the future.
POSIX是由IEEE指定的一系列标准,用于阐明和统一 Unix-y 操作系统提供的应用程序编程接口(以及辅助问题,例如命令行 shell 实用程序)。当您编写程序以依赖 POSIX 标准时,您可以肯定能够轻松地将它们移植到一大类 Unix 衍生产品(包括 Linux,但不限于它!);如果并且当您使用一些未作为 Posix 一部分标准化的 Linux API 时,如果您想在将来将该程序或库移植到其他 Unix-y 系统(例如 MacOSX),您将遇到困难。
回答by Hank Gay
POSIX is a standard for operating systems that was supposed to make it easier to write cross-platform software. It's an especially big deal in the world of Unix.
POSIX 是操作系统的标准,旨在简化跨平台软件的编写。这在 Unix 世界中尤其重要。
回答by cletus
POSIXis:
POSIX是:
POSIX (pronounced /?p?z?ks/) or "Portable Operating System Interface [for Unix]"1is the name of a family of related standards specified by the IEEE to define the application programming interface (API), along with shell and utilities interfaces for software compatible with variants of the Unix operating system, although the standard can apply to any operating system.
POSIX(读作 /?p?z?ks/)或“Portable Operating System Interface [for Unix]” 1是 IEEE 指定的一系列相关标准的名称,用于定义应用程序编程接口 (API),以及 shell和实用程序接口,用于与 Unix 操作系统的变体兼容的软件,尽管该标准适用于任何操作系统。
Basically it was a set of measures to ease the pain of development and usage of different flavours of UNIX by having a (mostly) common API and utilities. Limited POSIX compliance also extended to various versions of Windows.
基本上,它是一套通过(大部分)通用 API 和实用程序来减轻开发和使用不同风格 UNIX 的痛苦的措施。有限的 POSIX 合规性也扩展到各种版本的 Windows。
回答by Jed Smith
POSIX is a set of standards put forth by IEEE and The Open Group that describes how an ideal Unix would operate. Programmers, users, and administrators can all become familiar with the POSIX document, and expect a POSIX-complaint Unix to provide all of the standard facilities mentioned.
POSIX 是 IEEE 和 The Open Group 提出的一组标准,用于描述理想的 Unix 将如何运行。程序员、用户和管理员都可以熟悉 POSIX 文档,并期望兼容 POSIX 的 Unix 提供所有提到的标准设施。
Since every Unix does things a little differently -- Solaris, Mac OS X, IRIX, BSD, and Linux all have their quirks -- POSIX is especially useful to those in the industry as it defines a standard environment to operate in. For example, most of the functions in the C library are based in POSIX; a programmer can, therefore, use one in his application and expect it to behave the same across most Unices.
由于每个 Unix 的工作方式都略有不同——Solaris、Mac OS X、IRIX、BSD 和 Linux 都有自己的怪癖——POSIX 对业内人士特别有用,因为它定义了一个标准的运行环境。例如, C 库中的大部分函数都基于 POSIX;因此,程序员可以在他的应用程序中使用一个,并期望它在大多数 Unices 中表现相同。
However, the divergent areas of Unix are typically the focus, rather than the standard ones.
然而,Unix 的不同领域通常是焦点,而不是标准领域。
The great thing about POSIX is that you're welcome to read it yourself:
POSIX 的伟大之处在于,欢迎您自己阅读:
Issue 7 is known as POSIX.1-2008, and there are new things in there -- however, Google-fu for POSIX.1 and such will allow you to see the entire history behind what Unix is.
第 7 期被称为 POSIX.1-2008,其中有一些新东西——但是,POSIX.1 的 Google-fu 等将让您了解 Unix 背后的整个历史。
回答by t0mm13b
Posix governs interoperability, portability, and in other areas such as the usage and mechanism of fork, permissions and filesystem standards such as /etc, /var, /usr and so on . Hence, when developers write a program under a Posix compliant system such as for example Linux, it is generally, not always, guaranteed to run on another posix compliant system such as IBM's AIX system or other commercial variants of Unix. Posix is a good thing to have as such it eases the software development for maximum portability which it strives for. Hope this answer makes sense.
Posix 管理互操作性、可移植性以及其他领域,例如 fork 的使用和机制、权限和文件系统标准,例如 /etc、/var、/usr 等。因此,当开发人员在 Posix 兼容系统(例如 Linux)下编写程序时,通常并不总是保证在另一个 posix 兼容系统(例如 IBM 的 AIX 系统或 Unix 的其他商业变体)上运行。Posix 是一件好事,因为它简化了软件开发,以实现它所追求的最大可移植性。希望这个回答有意义。
Thanks to Jed Smith & Tinkertim for pointing out my error - my bad!!! :(
感谢 Jed Smith 和 Tinkertim 指出我的错误——我的错!!!:(
回答by Jim Dennis
Let me give the churlish "unofficial" explanation.
让我给出粗俗的“非官方”解释。
POSIX is a set of standards which attempts to distinguish "UNIX" and UNIX-like systems from those which are incompatible with them. It was created by the U.S. government for procurement purposes. The idea was that the U.S. federal procurements needed a way to legally specify the requirements for various sorts of bids and contracts in a way that could be used to exclude systems to which a given existing code base or programming staff would NOT be portable.
POSIX 是一组标准,试图将“UNIX”和类 UNIX 系统与那些不兼容的系统区分开来。它是由美国政府出于采购目的而创建的。这个想法是美国联邦采购需要一种方法来合法地指定各种投标和合同的要求,以一种可用于排除给定现有代码库或编程人员无法移植的系统。
Since POSIX was written post facto ... to describe a loosely similar set of competing systems ... it was NOT written in a way that could be implemented.
由于 POSIX 是事后编写的……用来描述一组松散相似的竞争系统……它不是以可以实现的方式编写的。
So, for example, Microsoft's NT was written with enough POSIX conformance to qualify for some bids ... even though the POSIX subsystem was essentially useless in terms of practical portability and compatibility with UNIX systems.
因此,例如,Microsoft 的 NT 编写时具有足够的 POSIX 一致性以符合某些投标的资格……即使 POSIX 子系统在实际可移植性和与 UNIX 系统的兼容性方面基本上没有用处。
Various other standards for UNIX have been written over the decades. Things like the SPEC1170 (specified eleven hundred and seventy function calls which had to be implemented compatibly) and various incarnations of the SUS (Single UNIX Specification).
几十年来,已经为 UNIX 编写了各种其他标准。诸如 SPEC1170(指定必须兼容实现的 1170 个函数调用)和 SUS(单一 UNIX 规范)的各种化身。
For the most part these "standards" have been inadequate to any practical technical application. They most exist for argumentation, legal wrangling and other dysfunctional reasons.
在大多数情况下,这些“标准”对于任何实际的技术应用都是不够的。它们的存在大多是出于争论、法律纠纷和其他功能失调的原因。
回答by Koray Tugay
This standard provides a common basis for Unix-like operating systems. It specifies how the shell should work, what to expect from commands like ls and grep, and a number of C libraries that C authors can expect to have available.
该标准为类 Unix 操作系统提供了通用基础。它指定了 shell 应该如何工作,对 ls 和 grep 等命令的期望,以及 C 语言作者可以期望使用的许多 C 库。
For example, the pipes that command-line users use to string together commands are specified in detail here, which means C's popen (pipe open) function is POSIX-standard, not ISO C-standard.
例如,这里详细指定了命令行用户用来串接命令的管道,这意味着 C 的 popen(管道打开)函数是 POSIX 标准的,而不是 ISO C 标准的。
回答by Koray Tugay
In 1985, individuals from companies throughout the computer industry joined together to develop the POSIX (Portable Operating System Interface for Computer Environments) standard, which is based largely on the UNIX System V Interface Definition (SVID) and other earlier standardization efforts. These efforts were spurred by the U.S. government, which needed a standard computing environment to minimize its training and procurement costs. Released in 1988, POSIX is a group of IEEE standards that define the API, shell, and utility interfaces for an operating system. Although aimed at UNIX-like systems, the standards can apply to any compatible operating system. Now that these stan- dards have gained acceptance, software developers are able to develop applications that run on all conforming versions of UNIX, Linux, and other operating systems.
1985 年,来自整个计算机行业公司的个人联合开发了 POSIX(计算机环境的便携式操作系统接口)标准,该标准主要基于 UNIX System V 接口定义 (SVID) 和其他早期的标准化工作。这些努力是由美国政府推动的,它需要一个标准的计算环境来最大限度地减少培训和采购成本。POSIX 于 1988 年发布,是一组 IEEE 标准,用于定义操作系统的 API、外壳和实用程序接口。虽然针对类 UNIX 系统,但这些标准可以适用于任何兼容的操作系统。现在这些标准已经被接受,软件开发人员能够开发在所有符合标准的 UNIX、Linux、
From the book: A Practical Guide To Linux
来自这本书:Linux 实用指南
回答by sras
POSIX defines set of standards for an operating system or a program. The goal is to write new software that is compatible with UNIX-like systems.
POSIX 为操作系统或程序定义了一组标准。目标是编写与类 UNIX 系统兼容的新软件。
For example a program runs on Linux is also can be compile and run on other UNIX-like systems like Solaris, HP-UX, and AIX etc..
例如,在 Linux 上运行的程序也可以在其他类 UNIX 系统(如 Solaris、HP-UX 和 AIX 等)上编译和运行。
The most popular examples are GNU Bash
which is 100% POSIX compliance and gawk
utility.
最流行的例子GNU Bash
是 100% POSIX 合规性和gawk
实用性。
回答by peterh - Reinstate Monica
Posix is more as an OS, it is an "OS standard". You can imagine it as an imaginary OS, which actually doesn't exist, but it has a documentation. These papers are the "posix standard", defined by the IEEE, which is the big standard organization of the USA. The OSes implementing this specification are "Posix-compliant".
Posix 更像是一个操作系统,它是一个“操作系统标准”。你可以把它想象成一个虚构的操作系统,它实际上并不存在,但它有一个文档。这些论文是“posix 标准”,由美国最大的标准组织 IEEE 定义。实现此规范的操作系统是“符合 Posix 的”。
Government regulations prefer Posix-compliant solutions in their investments, thus being Posix-compliant has a significant financial advantage, particularly for the big IT companies of the USA.
政府法规在其投资中更喜欢符合 Posix 的解决方案,因此符合 Posix 的解决方案具有显着的财务优势,特别是对于美国的大型 IT 公司。
The reward for an OS being fully posix compliant, that it is a guarantee that it will compile and run all Posix-compliant applications seamlessly.
操作系统完全符合 posix 的奖励,即保证它将无缝编译和运行所有符合 Posix 的应用程序。
Linux is the most well-known one. OSX, Solaris, NetBSD and Windows NT play here as well. Free- and OpenBSD are only "nearly" Posix-compliant. The posix-compliance of the WinNT is only a pseudo-solution to avoid this government regulation above.
Linux 是最著名的一种。OSX、Solaris、NetBSD 和 Windows NT 也可以在这里播放。Free- 和 OpenBSD 只是“几乎”符合 Posix 标准。WinNT 的 posix 合规性只是一种避免上述政府规定的伪解决方案。