emu
or emu-g
command (without support for graphics mode). By default, sh
starts and displays the command line prompt " ;
": $ emu ;
exit
sh using the exit
or by marking the end of the input with the Ctrl-D
combination (under Windows, after Ctrl-D
you must also press Enter
). You can exit inferno with the command shutdown -h
or (only under Linux / Win) interrupting the work on Ctrl-C
.sh
. If you run additional processes, for example ndb/cs
(a service resolver needed for working with the network), then after exiting sh
inferno will continue to work, but you will not be able to influence it. Under Linux / Win, you will also be able to turn off the inferno via Ctrl-C
, and under FreeBSD / MacOSX you will only have to kill the emu process using the main OS. Of course, if you first start the rstyx service (analogous to ssh for remote access), then you can connect to this emu from another and remotely execute shutdown -h
. powerman@Ubuntu:~$ emu-g echo ok ok powerman@Ubuntu:~$ [powerman@freebsd ~]$ emu-g echo ok ok Killed: 9 [powerman@freebsd ~]$
No harm from him, and there is a way to solve this problem. To do this, you will need to run emu and emu-g through the wrapper scripts ~ / bin / emu and ~ / bin / emu-g: powerman@Ubuntu:~$ cat ~/bin/emu-g #!/bin/bash $INFERNO_ROOT/Linux/386/bin/emu-g "$@" </dev/stdin & wait 2>/dev/null [powerman@freebsd ~]$ cat bin/emu-g #!/usr/local/bin/bash $INFERNO_ROOT/FreeBSD/386/bin/emu-g "$@" </dev/stdin & wait 2>/dev/null
Under Linux, it is enough to create these scripts and make them executable, and under FreeBSD, you must additionally install bash and modify the PATH
value in ~/.bash_profile
so that the directory /home/_/bin
in front of the directory with inferno.EMU
environment variable. There is only one mandatory parameter among these parameters: -r////
and we have already registered it in the EMU
variable during the installation process. Of the useful optional parameters, the following are worth mentioning:-g X x Y
sets the resolution of the graphical environment inferno, for example: -g1024x768
-1
includes JIT (makes sense in production and performance testing)-p pool = maxsize
allows -p pool = maxsize
to control available inferno memory, the pool value can be main
, heap
or image
, for example, if you need to process large amounts of data, you can increase the heap to 128MB: -p heap=134217728
; echo $emuroot /home/powerman/inferno ; echo $emuargs emu -g1024x768 -c1 ; cat /dev/memory 277568 33554432 328032 3303 1490 1 33276852 main 52544 33554432 78496 1650 1271 1 33501876 heap 0 33554688 0 0 0 0 33554676 image
As you can see (the last but one column), the default inferno uses no more than 32MB for each memory pool. ; cat /dev/jit 0; echo 1 >/dev/jit ; cat /dev/jit 1; echo 0 >/dev/jit ; cat /dev/jit 0;
Although JIT can be dynamically enabled / disabled, the modified JIT value will only affect the modules (in inferno there is no difference between programs and libraries, they are all simply loadable modules) that will be loaded after this change. Therefore, it is better to specify the JIT value with the emu
parameter.emuinit
launched by emuinit
, which in turn starts sh
-l
. The -l
tells sh to execute commands from /lib/sh/profile
. This file is analogous to the * NIX boot scripts, and that’s where we’ll add commands to configure and initialize inferno (there are no commands in this file now)./lib/sh/profile
will not be executed (unless you explicitly load them). Example: $ emu-g ; cat /lib/sh/profile # emu sh initialisation here ; echo 'echo executing /lib/sh/profile' >> /lib/sh/profile ; shutdown -h $ emu-g executing /lib/sh/profile ; shutdown -h $ emu-g sh ; shutdown -h $ emu-g sh -l executing /lib/sh/profile ; shutdown -h $ emu-g sh -c 'run /lib/sh/profile; echo ok; shutdown -h' executing /lib/sh/profile ok
/locale/timezone
, available options can be seen by viewing the names of other files in the directory /locale/
. In traditional OSs, we would simply copy the file /locale/_
over /locale/timezone
. In inferno, you can also do this, but a more natural way for an inferno to change the timezone is to modify the namespace with bind (1) : ; date Sun Jun 17 19:00:28 BST 2012 ; bind /locale/EET /locale/timezone ; date Sun Jun 17 21:00:39 EEST 2012
So we find our zone and add it to /lib/sh/profile
: bind /locale/_ /locale/timezone
/lib/sh/profile
is: bind -b '#s' /chan
It connects the srv (3) driver to the / chan directory. According to the agreement adopted in the inferno, virtual files are created in this directory, the read / write of which is converted by the srv driver into messages sent via the channel to the process serving these files. Using such files (created via file2chan (2) from Limbo or file2chan (1) from sh) is the easiest way to implement a file server in inferno./usr/
directory. By default, there is only one subdirectory inferno/
, which is essentially a template for creating home directories of other users. Therefore, if only your account in the main OS is not called inferno, :) then you do not yet have your home directory in inferno: $ emu ; pwd / ; cd cd: /usr/powerman: '/usr/powerman' does not exist ;
The easiest way to create one is to simply copy /usr/inferno/
to /usr/__/
(in fact, this is the way to add a new user account to the inferno). But we will go the other way, in a more flexible and efficient way - as a home directory of the user, we’ll connect the user's real home directory to the main OS (and files and subdirectories from / usr / inferno / can be copied to the real home directory to the main OS). $ pwd /home/powerman $ emu ; mount {mntgen&} /usr ; bind -c '#U*/home/powerman' /usr/powerman ; cd ; pwd /usr/powerman
The mntgen (4) file server is needed in order not to create directories (mount points), they will appear automatically in the directory where mntgen is connected at the moment when someone contacts them. In our case (when the Inferno OS is installed in our home directory), instead of using mntgen, it would be easy to create the directory ~/inferno/usr/powerman/
, but if the inferno was set by the root system-wide in /usr/local/inferno/
, then we would not have enough permissions to create the /usr/local/inferno/usr/powerman/
and would need root privileges to add a new user to the inferno. And mntgen allowed this problem to be solved without root and creating physical directories where you can get by with virtual ones./lib/sh/profile
: ( home unused ) := `{os sh -c 'echo $INFERNO_HOME $HOME' </dev/null} home = '#U*'^$home user := `{cat /dev/user} mount {mntgen&} /usr bind -c $home /usr/$user cd
home := `{os cmd /C 'IF DEFINED INFERNO_HOME ( echo %INFERNO_HOME:\=/% ) ELSE ( echo %USERPROFILE:\=/% )'} home = '#U'^$home user := `{cat /dev/user} mount {mntgen&} /usr bind -c $home /usr/$user cd
/lib/sh/profile
is the support for advanced user settings: load std and {ftest -d tmp} {bind -c tmp /tmp} and {ftest -e namespace} {nsbuild} and {ftest -e profile} {run profile}
The std module must be loaded in order to be able to use the and command (an analogue of if-a and &&). If the user's home directory has a subdirectory tmp/
- it will be connected to the system /tmp/
(in this case, there is no special need, but if we installed the inferno in /usr/local/inferno/
system-wide, we would not have write permissions to /usr/local/inferno/tmp/
and this command would be necessary). If there are namespace
and profile
files in the user's home directory, they will be executed./lib/sh/profile
: * NIX , Win (do not forget to change the zone in it from GMT to yours)./lib/wmsetup
and, if there is, ./lib/wmsetup
in the user's home directory. The plumber settings are in ./lib/plumbing
in the user's home directory (don't forget to copy them into your home directory from /usr/inferno/
). Right now, there is no need to set up these files, I just mentioned them just so that you know where they are and see what is in them)../keyring/
subdirectory in the home directory. In the old article I have already told how authentication is arranged in the inferno , and I don’t see the point of copying all this here. $ emu ; webgrab -rv -o /dev/null 87.250.251.3 connecting to 87.250.251.3 writing request: GET / HTTP/1.0 Host: 87.250.251.3 User-agent: Inferno/webgrab Cache-Control: no-cache Pragma: no-cache response: HTTP/1.1 200 Ok created /dev/null, 7383 bytes
ndb/cs
: ; ndb/cs ; webgrab -rv -o /dev/null ya.ru connecting to ya.ru writing request: GET / HTTP/1.0 Host: ya.ru User-agent: Inferno/webgrab Cache-Control: no-cache Pragma: no-cache response: HTTP/1.1 200 Ok created /dev/null, 7689 bytes
/lib/ndb/common
(equivalent to /etc/services
in * NIX), /lib/ndb/inferno
(complements /lib/ndb/common
with inferno-specific ports) and /lib/ndb/local
./lib/ndb/local
file is the main one - not only local settings are described in it, but the rest of the above mentioned files are also included. In the infernosite=
section, you can configure infernosite=
between short server names and their real names or IP addresses. The most commonly used short names are SIGNER and registry to indicate servers with CA (certificate authority) and registry (4) services. To connect by a short name in front of him you need to add the symbol " $
". For example, let's add a name for Yandex: $ emu ; cat /lib/ndb/local ... infernosite= ... Yandex=www.yandex.ru ; ndb/cs ; webgrab -rv -o /dev/null '$Yandex' connecting to $Yandex writing request: GET / HTTP/1.0 Host: $Yandex User-agent: Inferno/webgrab Cache-Control: no-cache Pragma: no-cache response: HTTP/1.1 200 Ok created /dev/null, 7378 bytes
/lib/ndb/services
contains the description of inferno-specific ports in the * NIX /etc/services
format. It makes sense to add it to /etc/services
in the main OS so that it is more convenient to connect from the main OS to the Infernovian services: cat ~/inferno/lib/ndb/services | sudo bash -c 'cat >>/etc/services'
cd ~/inferno hg pull -uv mk nuke mk install # X- GUI mk CONF=emu-g install
cd \inferno hg pull -uv mk nuke mk install
Source: https://habr.com/ru/post/145986/
All Articles