"Plan 9 from User Space (aka plan9port)
is a port of many Plan 9 programs from their native
Plan 9
environment to Unix-like operating systems.
Commands
Plan 9 from User Space expects its own directory tree, conventionally
/usr/local/plan9. When programs need to access files in the tree,
they expect the
$PLAN9 environment variable to contain the name
of the root of the tree. See
install(1) for details about installation.
Many of the familiar Unix commands, for example
cat(1),
ls(1),
and
wc(1), are present, but in their Plan 9 forms:
cat takes no
options,
ls does not columnate its output when printing to a terminal,
and
wc counts UTF characters. In some cases, the differences are
quite noticeable:
grep(1) and
sed(1) expect Plan 9 regular expressions
(see
regexp(7)),
which are closest to what Unix calls extended regular expressions.
Because of these differences, it is not recommended to put
$PLAN9/bin
before the usual system
bin directories in your search path. Instead,
put it at the end of your path and use the
9(1) script when you
want to invoke the Plan 9 version of a traditional Unix command.
Occasionally the Plan 9 programs have been changed to adapt to
Unix.
Mk(1) now allows mkfiles to choose their own shell, and
rc(1) has a
ulimit builtin and manages
$PATH.
Many of the graphical programs from Plan 9 are present, including
sam(1) and
acme(1). An X11 window manager
rio(1) mimics Plan 9’s
window system, with command windows implemented by the external
program
9term(1). Following the style of X Windows, these programs
run in new windows rather than the one in which they are invoked.
They all
take a
−W option to specify the size and placement of the new
window. The argument is one of
widthxheight,
widthxheight@xmin,xmax,
or
xmin,ymin,xmax,ymax.
The
plumber(4) helps to connect the various Plan 9 programs together,
and fittings like
web(1) connect it to external programs such
as web browsers; one can click on a URL in
acme and see the page
load in
Firefox.
User-level file servers
In Plan 9, user-level file servers present file trees via the
Plan 9 file protocol, 9P. Processes can mount arbitrary file servers
and customize their own name spaces. These facilities are used
to connect programs. Clients interact with file servers by reading
and writing files.
This cannot be done directly on Unix. Instead the servers listen
for 9P connections on Unix domain sockets; clients connect to
these sockets and speak 9P directly using the
9pclient(3) library.
Intro(4) tells more of the story. The effect is not as clean as
on Plan 9, but it gets the job done and still provides a uniform
and easy-to-understand mechanism.
The
9p(1) client can be used in shell scripts or by hand to carry
out simple interactions with servers.
Netfiles(1) is an experimental
client for acme.
External databases
Some programs rely on large databases that would be cumbersome
to include in every release. Scripts are provided that download
these databases separately. These databases can be downloaded
separately. See
$PLAN9/dict/README and
$PLAN9/sky/README.
Programming
The shell scripts
9c and
9l (see
9c(1)) provide a simple interface
to the underlying system compiler and linker, similar to the
2c
and
2l families on Plan 9.
9c compiles source files, and
9l links
object files into executables. When using Plan 9 libraries,
9l
infers the correct set of libraries from the object files, so
that no
−l options are needed.
The only way to write multithreaded programs is to use the
thread(3)
library.
Rfork(3) exists but is not as capable as on Plan 9. There
are many unfortunate by necessary preprocessor diversions to make
Plan 9 and Unix libraries coexist. See
intro(3) for details.
The debuggers
acid(1) and
db(1) and the debugging library
mach(3)
are works in progress. They are platform-independent, so that
x86 Linux core dumps can be inspected on PowerPC Mac OS X machines,
but they are also fairly incomplete. The x86 target is the most
mature; initial PowerPC support exists; and other targets are
unimplemented. The
debuggers can only inspect, not manipulate, target processes.
Support for operating system threads and for 64-bit architectures
needs to be rethought. On x86 Linux systems,
acid and
db can be
relied upon to produce reasonable stack traces (often in cases
when GNU
gdb cannot) and dump data structures, but that it is
the extent to which they have
been developed and exercised.
Porting programs
The vast majority of the familiar Plan 9 programs have been ported,
including the Unicode-aware
troff(1).
Of the more recent additions to Plan 9,
factotum(4),
secstore(1),
and
secstored(1),
vac(1),
vacfs(4), and
venti(8) are all ported.
A backup system providing a dump file system built atop Venti
is in progress; see
vbackup(8).
https://swtch.com/plan9port/
Commands -
https://swtch.com/plan9port/man/man1/
No comments:
Post a Comment