Is Haiku a Unix-like OS?

I recall some devs telling me some time ago that Haiku is a *nix-like system underneath, including (unexposed) multi-user suppoort, Unix permissions system, etc. However, aren’t all these just for POSIX compatibility just like BeOS did? Is Haiku really using a Unix-style system design internally or are the *nix bits purely just for POSIX?

I’d really like for this to be explained, especially in-depth.

yes… it is…
BeOs!!!

Not unix, only POSIX and Beos here, no x11, no systemd etc.

2 Likes

POSIX = UNIX; as, after all, POSIX is the “single UNIX specification.” As we are (largely) POSIX compliant, we are thus a UNIX. There is no requirement for X11, systemd, or any other application for something to be a UNIX; otherwise, the first UNIX machines would not have been UNIX either!

The multiuser support is exposed; there is already chown, chmod, su, etc. and you can SSH into other users. The GUI does not make use of it, but making those changes will not be as hard as some seem to think.

BeOS was not really POSIX compliant:

  • No pthreads
  • No mmap
  • Berkeley sockets with BONE only (IIRC?)
  • etc.

Haiku, on the other hand, has native (i.e. in-kernel) support for mmap, BSD sockets, and so on. Some of these (the pthreads, for instance) are entirely in userland on top of the “native” thread APIs (but you could also say the same of Linux here, their thread syscalls don’t have “pthread” in the name.)

For me, by far the biggest indicator of an OS being POSIX/UNIX-like or not is (1) the fork-based process model, and (2) POSIX file management [modes, permissions, etc.]. Haiku uses both, and “natively”, i.e. there is no other process model or file management system behind these, i.e. the POSIX functions are not wrappers around some other API. So Haiku is thus indisputably a UNIX-like OS.

13 Likes

Unix was around before X11 Systemd or what have you, My AT&T Unix PC doesn’t have X11 it has it’s own windowing system and/or MGR which was a predecessor to X11… Haiku’s init system is to some degree inspired by Mac OS which… is a certified Unix.

2 Likes

I might add, the file descriptor, which is a characteristic UNIX concept - common system level I/O operations like write() and close(2) operate universally, whether it’s a disk file, pipe, socket, whatever, given just that file descriptor number. Plus the 0, 1, 2 convention for input, output and error units.

That’s one of the great advances from BeOS to Haiku - BeOS 5’s sockets were still implemented outside that file descriptor space, a major barrier to implementing network services written for UNIX. But aside from that exception, BeOS followed UNIX on file descriptors, it just lost the plot with sockets. (Until BONE, which was never really released.)

The roots of this topic was that someone told me Haiku is not a UNIX-like (at least internally) based on the code supposedly not following the Unix system design for the most part and documentation. They explained a bunch of other things, but I can’t find the chat where it happened. They also said that Haiku is as much of a *nix-like as z/OS (with its UNIX-certified POSIX compatibility layer), OpenVMS, and Windows NT are; POSIX compatible but still not *nix-like beyond that (such as the internal structures).

EDIT: If I can find the chat again, I’ll let you know.

1 Like

It depends on what you put under the word “UNIX”. If you mean to say we inherited some code from the original UNIX implementation, then indeed, that is not really the case except for a few bits we borrowed from the *BSD. But according to that definition, GNU/Linux wouldn’t be UNIX either (and that’s the reason GNU means “GNU is Not Unix”).

If we talk about POSIX or “UNIX like”, then it’s a different matter. POSIX only gives a set of interfaces to implement. It does not say anything about how to do it. The traditional UNIX had most of these as system calls, but for performance or simplicity reasons they may also be implemented in the C library instead. Or in some sideways “libunix” or whatever seems convenient. To claim POSIX compliance there is also a set of command line tools we have to provide, following the POSIX documentation on it.

You can dig into the specification here: https://pubs.opengroup.org/onlinepubs/9699919799/
There are a few surprises in there, for example providing an implementation of “vi” as an editor is required, but nothing is said about how to add and remove user accounts, leaving each POSIX implementation free to use whatever they think is convenient: a command like useradd, a graphical settings panel, or… nothing at all, for example in an embedded system where you decide to not allow at all editing of the user list.

As you can see in the POSIX specification, it is rather high level and does not say anything special about how to do things. So, saying an operating system is not UNIX-like because the UNIX parts are not tied tightly with other parts of the system is nonsense. It seems to be people making excuses for how intertangled everything is in their implementation, when it could be nicely modular instead :wink:

5 Likes

Another argument that I’ve heard is that since Haiku strives for full binary compatibility with BeOS 5, it needs to also have BeOS-esque system designs and internal structures; therefore, it is more BeOS-like and not so much *nix-like. Is this a falsehood/misconception or is there some truth to this??

It provide both APIs. That is still completely unrelated to how it achieves it internally. And the APIs aren’t all that distinct anyway: there is the same C standard library, the standard sockets (we are compatible with BONE which does them UNIX-like even on BeOS), etc.

Just like on BeOS, there is a libroot implementing the standard C library, and a libbe that builds upon that. And projects like Cosmoe and BlueEyedOS, or even our own buildsystem when building on Linux, have already shown that it’s possible to bring libbe to other UNIX operating systems without too much restrictions (there are some, still). So if anything, the Be API implementation is a wrapper over an UNIX core, more than the opposite. There are some places where the kernel has grown support for something not usually possible on a plain POSIX system, as it is the case on Linux, BSD, or pretty much any POSIX compliant system. Because POSIX tends to describe a bare minimal set of things, and if you want to implement a real OS, you are always going to extend on it in some way or another.

So, the Be API and POSIX complement each other, they are not conflicting. A typical Haiku application may for example use BSocket which is an object wrapper around an UNIX socket. They may use both UNIX sockets and Be ports to communicate with other local applications. They may easily convert a pthread identifier to a Be thread_id in order to set the thread priority in a more fine-grained way than the pthread API provides, or even just to set the thread name, which is something POSIX doesn’t provide a way of doing. They may receive their arguments through BApplication::ArgsReceived() and still parse them with the POSIX standard getopt() function.

This is not similar to, for example, some POSIX implementations for Windows, where you had to choose between using the POSIX APIs, or the Win32 ones, but it was very difficult to mix both in a single application (different and often conflicting runtime library sets would be used). But I think even Windows made some progress on this lately?

6 Likes

“More BeOS-like” makes it UNIX-like, anyway. BeOS was also a POSIX compliant OS where UNIX software felt at home, that isn’t a new feature introduced by Haiku, it’s just improved on.

The socket implementation was an important exception, but BeOS wasn’t the only UNIX with that issue. There was a time when “BSD” referred to stuff that not everyone had, including sockets believe it or not. Of course it quickly became important to correct that particular deficiency, and some early socket implementations on AT&T UNIX platforms weren’t as fully integrated as they’re expected to be today.

Beos and Haiku are not Unix, they are stand alone systems. What Unix programs are available in the past and today? Useing bsd drivers or porting Linux stuff does not make a Unix out of haiku

1 Like

Well, you’re seizing on one use of “UNIX”, introducing a point that was about operating systems based on AT&T UNIX. Where just before, I’d said “UNIX-like.” So I’ll take this in the spirit of “let’s dispute trivial matters.” (If we’re going for something useful, we’d have insisted on knowing why the question - what depends on it? Lacking that, various different answers could be valid on their own basis.)

UNIX programs? apropos, ar, as, awk, basename, bash, bc, bison, … yacc, yes. Lots more. An operating system that not only provides a full UNIX environment, but makes that environment integral to its operation (plenty of shell scripts etc. in the works, for example), is “UNIX” in the loose sense of the word.

In the narrower sense of the word, we might argue that Mac OS is truly UNIX, by direct linear descent through Berkeley UNIX, but Gentoo is not (if anyone still uses that.) If we know why we care, this could be a more interesting question.

2 Likes

No, but following the UNIX specification “natively” does; so we most definitely are a UNIX.

2 Likes

Try this:

  • Is BeOS officially considered a UNIX variant?
  • Was BeOS SuSv1 compliant?
  • Was BeOS SuSv2 compliant?
  • Is Haiku officially considered a UNIX variant?
  • Is Haiku POSIX.1-2001/SuSv3 compliant?
  • Is Haiku mostly POSIX.1-2008 compatible?

UNIX != POSIX. Well, kinda like using a Porsche=car means car=Porsche theorem. Careful…

Also, it is stated (from Wikipedia) that: "POSIX-certified means some versions of operating systems have been certified to conform to one or more of the various POSIX standards. This means that they passed the automated conformance tests.

NOTE: An OS may qualify as POSIX-certified if it passes the automated POSIX conformance tests (PCTS). Consider if all of those certified OSes received 100% passability on all tests.

According to the POSIX article on Wikipedia:

  • BeOS (and subsequently Haiku) are mostly POSIX-compliant and UNIX variants.

So, is Haiku a Unix-like OS. The answer is YES. Now, get into compatibility and compliance… :fire:

1 Like

Gentoo is kernel independent for the most part… has ran on FreeBSD and even has had a Solaris port at one point :stuck_out_tongue: so… Gentoo on Solaris is obviously a Unix lol, and FreeBSD is about as Unix as it gets without being certified.

But carry on… just thought I’d add some fuel for thought lol.

1 Like

These questions are largely irrelevant. Any given Linux version is almost certainly not “officially considered” a UNIX variant, but nobody would say Linux is not UNIX-like, which is what we are discussing here.

Multiple Haiku developers in this thread have already given detailed explanations of why Haiku is POSIX, so I don’t know why a single detail-less sentence from Wikipedia has any relevance in this thread…

3 Likes

Incorrect. Possible misconceptions exists outside the walls of this forum…

The Wikipedia article stated BeOS and Haiku as mostly POSIX compliant.

The BeOS Bible - statement about BeOS POSIX compliance and earlier kernel conception.

Also this: https://forums.macrumors.com/threads/applying-beos-lessons-to-macos-x.3484/
“BeOS, a POSIX compliant Unix variant”

You stated differently.

You said, “Multiple Haiku developers in this thread have already given detailed explanations of why Haiku is POSIX, so I don’t know why a single detail-less sentence from Wikipedia has any relevance in this thread…”

My question, if Haiku=POSIX, which POSIX=Haiku ?? That was all I said, really.

Haiku conforms to the POSIX.1-2001 spec makes a nicer statement… but I’ll digress…

What did I say that was incorrect?

Well, that is certainly true.

Okay … how is that relevant here? We are presently discussing whether or not Haiku is a UNIX, and I think we developers are a better authority on that than Wikipedia…

Yes, BeOS was not really POSIX compliant. Citing a Wikipedia article that thinks it “partially” was says nothing. Why do they think it “partially” was? I don’t know, but just pointing to that does not get us anywhere.

Okay, which POSIX standard is the Linux kernel compliant to?

The answer is “none,” because you need a C library and userland utilities to be POSIX compliant, which the Linux kernel does not provide. Only a given distribution can be POSIX compliant, and most are not tested against the “official” test suite. So, can you tell me what POSIX standard a recent Ubuntu release conforms to? Probably there is no one answer, they vary just like Haiku does.

With that being said: Most of the major POSIX features have version declarations, and Haiku provides these. By this metric we are at a a mix of 2001 and 2008 POSIX specifications, with some more recent features included where it made sense (e.g. posix_spawn.) When more applications need or want more POSIX features, we’ll add them.

2 Likes

That hit the nail perfectly - as well as stating Haiku is Unix-like.

What is Haiku?

  • a single user graphical desktop-oriented computer operating system
  • BeOS R5 and BeOS Networking Environment (BONE) API compatible
  • Unix-like OS, using a hybrid kernel based on the NewOS kernel.
  • POSIX.1-2001 compatible
  • provides standard UNIX multi-user tools (privilege separation mostly implemented.)

.

1 Like