first usable version of kernel and commands

After an year of hard work, this is a first "usable" version of Jehanne.
This commit is contained in:
Giacomo Tesio 2016-11-25 16:18:40 +00:00
parent 391252a059
commit 38aca7a581
4032 changed files with 412179 additions and 7391 deletions

7
.gitignore vendored
View File

@ -1,8 +1,9 @@
arch/amd64/bin
arch/amd64/cmd
arch/amd64/aux
arch/amd64/kern
arch/amd64/lib
sys/log
arch/amd64/qa
arch/amd64/include/syscalls.h
sys/src/9/port/error.h
sys/src/9/root/nvram

View File

@ -3,30 +3,36 @@
# Jehanne
Jehanne is a [simple][simplicity] operating system.
Jehanne is a [simple][simplicity] operating system.
It is a fork of [Harvey][harvey] (which in turn is a fork of
[Plan 9 from Bell Labs][plan9] merged with [Nix][nix] sources) but
diverges from the design and conventions of its ancestors whenever
they are at odds with its goals.
Jehanne has noble ancestors:
For this reason project is named after the famous French heretic [Joan of Arc][arc].
- most of userland tools, a lot of wisdom and some kernel modules,
come from [9front][9front]
- the kernel is a fork of Charles Forsyth's [Plan9-9k][plan9-9k]
- most of the build system and some valuable piece of code come from [Harvey OS][harvey]
Still the project is named after a humble peasant,
the famous French heretic [Joan of Arc][arc], because it diverges deeply
from the design and conventions of its predecessors.
## Overview
This is the main repository, used to build the system as a whole:
- [arch](./arch/) contains one folder for each
supported architecture, with specific C headers and binaries
supported architecture, with specific C headers, libraries and executables
(note that by architecture we intend any kind of physical or virtual
machine that is able to run code, thus rc is actually an architecture)
- [sys](./sys) is the system folder
* [include](./sys/include) contains portable C headers
* [lib](./sys/lib) contains data and scripts used by the
* [lib](./sys/lib) contains data and scripts used by the
running system
* [man](./sys/man) contains manual pages
* [src](./sys/src) contains the sources of the system
- [doc](./doc/) contains useful documentation for Jehanne
development
* [license](./doc/license/) contains detailed info
* [license](./doc/license/) contains detailed info
about Jehanne [licenses][lic]
* [hacking](./doc/hacking/) contains details about how
to build and modify Jehanne
@ -38,12 +44,12 @@ This is the main repository, used to build the system as a whole:
- [pkgs](./pkgs) will contains the installed packages
The running system also includes supplemental folders like `/lib`,
`/bin` and `/dev` that are bound during the boot as required.
`/cmd` and `/dev` that are bound during the boot as required.
## Build
To build Jehanne and play with it, you need to have git, golang, qemu,
gcc, binutils and bison installed.
To build Jehanne and play with it, you need to have git, golang, qemu,
gcc, binutils and bison installed.
For example on Debian GNU/Linux you should be able to get going with
sudo aptitude install git golang build-essential bison qemu-system
@ -53,16 +59,16 @@ After the repository clone, you can give a look with
git submodule init # we have a lot of submodules
git submodule update --init --recursive --remote
./hacking/devshell.sh # start a shell with appropriate environment
./hacking/continuous-build.sh # to build everything
./hacking/continuous-build.sh # to build everything (will take a while)
./hacking/runOver9P.sh # to start the system in QEMU
./hacking/drawterm.sh # to connect Jehanne with drawterm
## Hacking
Jehanne is a work in progress.
Jehanne is a work in progress.
Forks and pull requests are welcome.
In [doc/hacking](./doc/hacking/) you will find all you
In [doc/hacking](./doc/hacking/) you will find all you
need to know about its principles, design and weirdness.
There's a lot of work to do, in every area of the system.
@ -74,8 +80,10 @@ yourself and your attitudes.
[simplicity]: http://plato.stanford.edu/entries/simplicity/ "What is simplicity?"
[harvey]: http://harvey-os.org "Harvey OS"
[plan9]: https://github.com/brho/plan9 "UC Berkeley release of Plan 9 under the GPLv2"
[9front]: http://9front.org/ "THE PLAN FELL OFF"
[plan9-9k]: https://bitbucket.org/forsyth/plan9-9k "Experimental 64-bit Plan 9 kernel"
[nix]: https://github.com/rminnich/nix-os
[arc]: https://en.wikipedia.org/wiki/Joan_of_Arc "Jeanne d'Arc"
[lic]: ./LICENSE.md "A summary of Jehanne licensing"
[mailinglist]: https://groups.google.com/forum/#!forum/jehanneos

View File

@ -1,5 +0,0 @@
#!/bin/rc
if(test -e /mnt/keys/$1)
echo -n disabled > /mnt/keys/$1/status
if(test -e /mnt/netkeys/$1)
echo -n disabled > /mnt/netkeys/$1/status

View File

@ -1,5 +0,0 @@
#!/bin/rc
if(test -e /mnt/keys/$1)
echo -n ok > /mnt/keys/$1/status
if(test -e /mnt/netkeys/$1)
echo -n ok > /mnt/netkeys/$1/status

View File

@ -1,36 +0,0 @@
#!/bin/rc
cd /mnt/keys/$1 > /dev/null >[2=1] && {
stat=`{cat status}
exp=`{cat expire}
switch($exp){
case never 0
exp='never expires'
case *
exp=(expires on `{date $exp})
}
switch($stat){
case expired
echo user $1: plan 9 key has expired
case *
echo user $1: plan 9 key status is $stat and $exp
}
grep '^'$1'[ ]' /adm/keys.who | tail -1
}
cd /mnt/netkeys/$1 > /dev/null >[2=1] && {
stat=`{cat status}
exp=`{cat expire}
switch($exp){
case never 0
exp='never expires'
case *
exp=(expires on `{date $exp})
}
switch($stat){
case expired
echo user $1: network key has expired
case *
echo user $1: network key status is $stat and $exp
auth/printnetkey $1
}
grep '^'$1'[ ]' /adm/netkeys.who | tail -1
}

View File

@ -1,12 +1,6 @@
{
"buildflags": {
"Cflags": [
"-std=c11",
"-c",
"-I/$JEHANNE/arch/$ARCH/include",
"-I/$JEHANNE/sys/include",
"-I.",
"-ffreestanding",
"-fno-builtin",
"-fno-omit-frame-pointer",
"-fplan9-extensions",
@ -16,10 +10,10 @@
"-gdwarf-2",
"-ggdb",
"-mcmodel=small",
"-mno-red-zone",
"-O0",
"-static",
"-Wall",
"-Wno-main",
"-Wno-missing-braces",
"-Wno-parentheses",
"-Wno-unknown-pragmas"

View File

@ -7,87 +7,68 @@
* in the LICENSE file.
*/
#define nil ((void*)0)
typedef unsigned char uint8_t;
typedef signed char int8_t;
typedef unsigned short uint16_t;
typedef signed short int16_t;
typedef unsigned int uint32_t;
typedef unsigned int uint;
typedef signed int int32_t;
typedef unsigned long long uint64_t;
typedef long long int64_t;
typedef uint64_t uintptr;
typedef uint64_t uintptr_t;
typedef uint32_t usize;
typedef int64_t size_t;
typedef uint32_t Rune;
typedef union FPdbleword FPdbleword;
typedef uintptr jmp_buf[10]; // for registers.
#define nil ((void*)0)
typedef unsigned char uint8_t;
typedef signed char int8_t;
typedef unsigned short uint16_t;
typedef signed short int16_t;
typedef unsigned int uint32_t;
typedef unsigned int uint;
typedef signed int int32_t;
typedef unsigned long long uint64_t;
typedef long long int64_t;
typedef uint64_t uintptr;
typedef uint64_t uintptr_t;
typedef uint32_t usize;
typedef __SIZE_TYPE__ size_t;
typedef int32_t pid_t;
typedef uint32_t Rune;
typedef union FPdbleword FPdbleword;
typedef uintptr jmp_buf[10]; // for registers.
#define JMPBUFSP 6
#define JMPBUFPC 7
#define JMPBUFARG1 8
#define JMPBUFARG2 9
#define JMPBUFSP 6
#define JMPBUFPC 7
#define JMPBUFARG1 8
#define JMPBUFARG2 9
#define JMPBUFDPC 0
typedef unsigned int mpdigit; /* for /sys/include/mp.h */
#define JMPBUFDPC 0
typedef unsigned int mpdigit; /* for /sys/include/mp.h */
/* MXCSR */
/* fcr */
#define FPFTZ (1<<15) /* amd64 */
#define FPINEX (1<<12)
#define FPUNFL (1<<11)
#define FPOVFL (1<<10)
#define FPZDIV (1<<9)
#define FPDNRM (1<<8) /* amd64 */
#define FPINVAL (1<<7)
#define FPDAZ (1<<6) /* amd64 */
#define FPRNR (0<<13)
#define FPRZ (3<<13)
#define FPRPINF (2<<13)
#define FPRNINF (1<<13)
#define FPRMASK (3<<13)
#define FPPEXT 0
#define FPPSGL 0
#define FPPDBL 0
#define FPPMASK 0
#define FPFTZ (1<<15) /* amd64 */
#define FPINEX (1<<12)
#define FPUNFL (1<<11)
#define FPOVFL (1<<10)
#define FPZDIV (1<<9)
#define FPDNRM (1<<8) /* amd64 */
#define FPINVAL (1<<7)
#define FPDAZ (1<<6) /* amd64 */
#define FPRNR (0<<13)
#define FPRZ (3<<13)
#define FPRPINF (2<<13)
#define FPRNINF (1<<13)
#define FPRMASK (3<<13)
#define FPPEXT 0
#define FPPSGL 0
#define FPPDBL 0
#define FPPMASK 0
/* fsr */
#define FPAINEX (1<<5)
#define FPAUNFL (1<<4)
#define FPAOVFL (1<<3)
#define FPAZDIV (1<<2)
#define FPADNRM (1<<1) /* not in plan 9 */
#define FPAINVAL (1<<0)
#define FPAINEX (1<<5)
#define FPAUNFL (1<<4)
#define FPAOVFL (1<<3)
#define FPAZDIV (1<<2)
#define FPADNRM (1<<1) /* not in plan 9 */
#define FPAINVAL (1<<0)
union FPdbleword
{
double x;
struct { /* little endian */
uint lo;
uint hi;
};
double x;
struct { /* little endian */
uint lo;
uint hi;
};
};
/*
#if 0
typedef char* va_list;
#define va_start(list, start) list =\
(sizeof(start) < 8?\
(char*)((int64_t*)&(start)+1):\
(char*)(&(start)+1))
#define va_end(list)\
USED(list)
#define va_arg(list, mode)\
((sizeof(mode) == 1)?\
((list += 8), (mode*)list)[-8]:\
(sizeof(mode) == 2)?\
((list += 8), (mode*)list)[-4]:\
(sizeof(mode) == 4)?\
((list += 8), (mode*)list)[-2]:\
((list += sizeof(mode)), (mode*)list)[-1])
#endif
*/
typedef __builtin_va_list va_list;
#define va_start(v,l) __builtin_va_start(v,l)
@ -95,3 +76,17 @@ typedef __builtin_va_list va_list;
#define va_arg(v,l) __builtin_va_arg(v,l)
#define va_copy(v,l) __builtin_va_copy(v,l)
typedef union NativeTypes
{
char c;
unsigned char uc;
short s;
unsigned short us;
int i;
unsigned int ui;
long l;
unsigned long ul;
void* p;
} NativeTypes;
extern volatile NativeTypes* _sysargs;
# include "syscalls.h"

3
arch/rc/aux/acme/agrep Executable file
View File

@ -0,0 +1,3 @@
#!/cmd/rc
exec grep -n $* /dev/null

3
arch/rc/aux/acme/ind Executable file
View File

@ -0,0 +1,3 @@
#!/cmd/rc
sed 's/^/ /' $*

10
arch/rc/aux/acme/new Executable file
View File

@ -0,0 +1,10 @@
#!/cmd/rc
id=`{cat /mnt/acme/new/ctl}
id=$id(1)
cmd = $*
if(~ $#cmd 0) cmd = cat
echo 'name '^`{pwd}^/-^`{basename $cmd(1)} > /mnt/acme/$id/ctl
$cmd > /mnt/acme/$id/body
echo clean > /mnt/acme/$id/ctl

3
arch/rc/aux/acme/quote Executable file
View File

@ -0,0 +1,3 @@
#!/cmd/rc
sed 's/^/> /' $*

3
arch/rc/aux/acme/unind Executable file
View File

@ -0,0 +1,3 @@
#!/cmd/rc
sed 's/^ //' $*

5
arch/rc/aux/acme/wnew Executable file
View File

@ -0,0 +1,5 @@
#!/cmd/rc -e
id=`{mkwnew $*}
cat >/mnt/acme/$id/body
echo clean >/mnt/acme/$id/ctl

9
arch/rc/aux/inst/dircp Executable file
View File

@ -0,0 +1,9 @@
#!/cmd/rc
# dircp src dest - copy a tree with tar, not respecting permissions
switch($#*){
case 2
@ {builtin cd $1 && tar cif /fd/1 .} | @ {builtin cd $2 && tar xf /fd/0}
case *
echo usage: dircp from to >[1=2]
exit usage
}

6
arch/rc/aux/rio/label Executable file
View File

@ -0,0 +1,6 @@
#!/cmd/rc
# label word ... - write words into our label, if any
if (test -w /dev/label)
echo -n $* > /dev/label
if not if (test -w /mnt/term/dev/label)
echo -n $* > /mnt/term/dev/label

100
arch/rc/aux/rio/window Executable file
View File

@ -0,0 +1,100 @@
#!/cmd/rc
# window [many options] cmd [arg...] - create new window and run cmd in it
rfork e
fn checkwsys{
if(~ $wsys ''){
echo 'window: $wsys not defined'
exit bad
}
}
# original version used mount to do the work
fn oldway{
switch($#*){
case 0 1
echo usage: window '''minx miny maxx maxy''' cmd args ...
exit usage
}
checkwsys
dir = /mnt/wsys
srv = $wsys
rfork ne
{
if(x=`{cat /dev/ppid}; mount $srv $dir N`{{echo $x $1 }| sed 's/^ //g;s/ +/,/g'}){
shift
bind -b $dir /dev
echo -n `{basename $1} > /dev/label >[2] /dev/null
exec $* < /dev/cons > /dev/cons >[2] /dev/cons
}
}&
}
# if argument is of form '100 100 200 200' or '100,100,200,200' use old way
if(~ $1 *[0-9][' ,'][0-9]*){
oldway $*
exit
}
# geometry parameters are:
# -r 0 0 100 100
# -dx n
# -dy n
# -minx n
# -miny n
# -maxx n
# -maxy n
# where n can be a number, to set the value, or +number or -number to change it
# find wctl file
fn getwctl{
if(~ $wctl ''){
if(test -f /dev/wctl) echo /dev/wctl
if not if(test -f /mnt/term/dev/wctl) echo /mnt/term/dev/wctl
if not if(~ $service cpu) echo /mnt/term/srv/riowctl.*.*
if not {
echo window: '$wctl' not defined >[1=2]
exit usage
}
}
if not echo $wctl
}
# use mount to make local window
if(~ $1 -m){
shift
checkwsys
dir = /mnt/wsys
srv = $wsys
rfork ne
{
unmount /mnt/acme /dev >[2]/dev/null
if(mount $srv $dir 'new -pid '^`{cat /dev/ppid}^' '$"*){
bind -b $dir /dev
# toss geometry parameters to find command
while(~ $1 -*)
switch($1){
case -dx -dy -minx -miny -maxx -maxy
shift 2
case -r
shift 5
case -scroll
shift
case -noscroll
shift
case -hide
shift
}
if(~ $#* 0) cmd = rc
if not cmd = $*
echo -n `{basename $cmd(1)} > /dev/label >[2] /dev/null
exec $cmd < /dev/cons > /dev/cons >[2] /dev/cons
}
}&
}
if not echo new -cd `{pwd} $* >> `{getwctl}

10
arch/rc/aux/rio/wloc Executable file
View File

@ -0,0 +1,10 @@
#!/cmd/rc
rfork e
ifs='
'
for(i in `{ls /dev/wsys}) {
echo window -r `{syscall -o read 0 buf 59 < $i/window >[2] /dev/null |
sed 's/............//; s/^ *//; s/ */ /g'} `{cat $i/label}
}

45
arch/rc/aux/usb/usbrc Executable file
View File

@ -0,0 +1,45 @@
#!/cmd/rc
if(! test -e '#σ/usb/usbevent')
exit
if(! bind -a '#u' /dev)
exit
@{
rfork ne
fn attach {
id=$1
if(~ $#* 5 && ! test -e /env/nousbhname)
id=$1:$5
switch($4){
case *01
usb/audio $id
case *02
# serial and ethernet
usb/serial $id
# handled /sys/src/kern/boot/nusbrc
# usb/ether $id
case *03
# handled /sys/src/kern/boot/nusbrc
# usb/kb $id
case *08
# handled /sys/src/kern/boot/nusbrc
# usb/disk $id
case 010106
usb/ptp $id
case *
# HUAWEI E220 modem
if(~ $2$3 12d11003)
usb/serial $id
# FTDI
if(~ $2 0403)
usb/serial $id
}
}
fn detach {
# handled /sys/src/kern/boot/nusbrc
}
rc < '#σ/usb/usbevent' &
}
bind -qa '#σ/usb' /dev
bind -qa '#σ/usbnet' /net

9
arch/rc/cmd/dircp Executable file
View File

@ -0,0 +1,9 @@
#!/cmd/rc
# dircp src dest - copy a tree with tar
switch($#*){
case 2
@ {builtin cd $1 && tar cif /fd/1 .} | @ {builtin cd $2 && tar xTf /fd/0}
case *
echo usage: dircp from to >[1=2]
exit usage
}

42
arch/rc/cmd/diskparts Executable file
View File

@ -0,0 +1,42 @@
#!/cmd/rc
rfork e
# note that really big disks (e.g., aoe devices) may have no mbr
# partition table because the mbr partition table can't cope with large
# block numbers, so we may have to examine the data file with prep if
# there's no plan9 file. beware that `disk/prep -p data' on a disk with
# no plan 9 partition table will delete all extant partitions.
fn setup {
if(test -f $1/data && test -f $1/ctl)
{@{disk/fdisk -p $1/data} |
grep -v '^delpart ' >$1/ctl } >[2]/dev/null
if(test -f $1/plan9)
parts=($1/plan9*)
if not
parts=($1/data)
for(part in $parts)
if(test -f $part)
{ disk/prep -p $part |
grep -v '^delpart ' >$1/ctl } >[2]/dev/null
}
if(~ $#* 0){
# set up any disk partitions
if (! test -e /dev/sdctl)
bind -b '#S' /dev
for(disk in /dev/sd*) {
setup $disk
}
sysname=`{cat /dev/sysname}
# set up any fs(3) partitions
if (! test -e /dev/fs/ctl && test -e '#k/fs')
bind -b '#k' /dev
if (~ $#sysname 1 && ! ~ $sysname '' &&
test -r /cfg/$sysname/fsconfig && test -w /dev/fs/ctl)
awk '{print $0; fflush}' /cfg/$sysname/fsconfig >/dev/fs/ctl
}
if not {
for(disk) {
setup $disk
}
}

10
arch/rc/cmd/dontkill Executable file
View File

@ -0,0 +1,10 @@
#!/cmd/rc
# dontkill regexp - mark invoker's processes with names matching regexp
# as not killable when the kernel runs out of memory
if (! ~ $#* 1) {
echo $0 regexp >[1=2]
exit usage
}
# see /sys/src/kern/port/proc.c:/^killbig
pids=`{psu | awk '$NF ~ /'$1'/ {print $2}'}
~ $#pids 0 || chmod -w $pids^/ctl >[2]/dev/null

79
arch/rc/cmd/fstype Executable file
View File

@ -0,0 +1,79 @@
#!/cmd/rc
rfork e
m=`{dd -if $1 -bs 2048 -skip 16 >[2]/dev/null | xd -c | sed 1q | \
sed 's/.........(....................).*/\1/; s/ //g'}
if(~ $"m 01CD00101){
echo 9660
exit
}
fn fat {
m=`{dd -if $1 -bs 1 -count 3 -skip $2 >[2]/dev/null}
~ $"m FAT
}
if(fat $1 54 || fat $1 82){
echo dos
exit
}
m=`{dd -if $1 -bs 4 -count 1 >[2]/dev/null | xd | sed 's,0000000 ,,;q'}
if(~ $"m 529ab12b){
echo paqfs
exit
}
if(~ $"m 011ce50d){
echo hjfs
exit
}
m=`{dd -if $1 -bs 16 -count 1 -skip 16 >[2]/dev/null}
if(~ $"m 'kfs wren device'){
echo kfs
exit
}
dd -if $1 -count 1 >[2]/dev/null | \
awk '
/^(blocksize|daddrbits|daddrbits|indirblks|dirblks|namelen)/{p[$1]=$2}
END{
ca["fs", "blocksize"] = 4*1024
ca["fs", "namelen"] = 28
ca["fs", "dirblks"] = 6
ca["fs", "indirblks"] = 2
ca["fs", "daddrbits"] = 32
ca["fs64", "blocksize"] = 8*1024
ca["fs64", "namelen"] = 56
ca["fs64", "dirblks"] = 6
ca["fs64", "indirblks"] = 4
ca["fs64", "daddrbits"] = 64
ca["cwfs", "blocksize"] = 16*1024
ca["cwfs", "namelen"] = 28
ca["cwfs", "dirblks"] = 6
ca["cwfs", "indirblks"] = 2
ca["cwfs", "daddrbits"] = 32
ca["cwfs64", "blocksize"] = 16*1024
ca["cwfs64", "namelen"] = 56
ca["cwfs64", "dirblks"] = 6
ca["cwfs64", "indirblks"] = 4
ca["cwfs64", "daddrbits"] = 64
ca["cwfs64x", "blocksize"] = 16*1024
ca["cwfs64x", "namelen"] = 144
ca["cwfs64x", "dirblks"] = 6
ca["cwfs64x", "indirblks"] = 4
ca["cwfs64x", "daddrbits"] = 64
for(e in ca){
split(e, k, SUBSEP)
if(ca[k[1],k[2]] == p[k[2]])
fs[k[1]]++
}
for(i in fs)
if(fs[i] > fs[j])
j=i
if(fs[j]){
print j
exit
}
exit 1
}
'

2
arch/rc/cmd/lc Executable file
View File

@ -0,0 +1,2 @@
#!/cmd/rc
ls -pF $* | mc

20
arch/rc/cmd/psu Executable file
View File

@ -0,0 +1,20 @@
#!/cmd/rc
# psu - ps for just one user
rfork e
flags=()
while (! ~ $#* 0 && ~ $1 -*) {
flags = ($flags $1)
shift
}
# sed -n p rather than grep so that we get buffered writes.
# this is a huge difference in drawterm.
switch($#*){
case 0
ps $flags | sed -n '/^'$user' /p'
case 1
ps $flags | sed -n '/^'$1' /p'
case *
echo Usage: psu '[ps-flags] [ user ]' >[1=2]
exit usage
}

34
arch/rc/lib/rcmain Normal file
View File

@ -0,0 +1,34 @@
# rcmain: Plan 9 version
if(~ $#home 0) home=/
if(~ $#ifs 0) ifs='
'
switch($#prompt){
case 0
prompt=('% ' ' ')
case 1
prompt=($prompt ' ')
}
if(~ $rcname ?.out) prompt=('broken! ' ' ')
if(flag p) path=/cmd
if not{
finit
if(~ $#path 0) path=(. /cmd)
}
fn sigexit
if(! ~ $#cflag 0){
if(flag l && /cmd/test -r $home/lib/profile) . $home/lib/profile
status=''
eval $cflag
}
if not if(flag i){
if(flag l && /cmd/test -r $home/lib/profile) . $home/lib/profile
status=''
if(! ~ $#* 0) . $*
. -i '#d/0'
}
if not if(~ $#* 0) . '#d/0'
if not{
status=''
. $*
}
exit $status

87
arch/rc/lib/startup/cpu Executable file
View File

@ -0,0 +1,87 @@
#!/cmd/rc
# cpu server start up
date > /env/boottime
# mount points
mntgen -s slashn && chmod 666 /srv/slashn
# name translation, cs sets /dev/sysname
ndb/cs
sysname=`{cat /dev/sysname}
# parallelism for mk
NPROC = `{wc -l </dev/sysstat}
# site-specific startup
if(test -e /arch/rc/cmd/cpurc.local)
. /arch/rc/cmd/cpurc.local
if (~ $#sysname 0 || ~ $sysname '') {
sysname = jehanne # default
echo -n $sysname >/dev/sysname
}
prompt=($sysname^'# ' ' ')
# cpu-specific startup
if(test -e /cfg/$sysname/cpurc)
. /cfg/$sysname/cpurc
# start up internet if we don't already have an address
if(! grep u /net/ipselftab | grep -sv 127.0.0.1)
ip/ipconfig
if(! grep -s 127.0.0.1 /net/ipselftab)
ip/ipconfig loopback /dev/null 127.1
# if we're not a server, start a dns resolver
if(! test -e /srv/dns)
ndb/dns -r
# If you are on an auth server, start these before listening:
#
# auth/keyfs -wp -m /mnt/keys /adm/keys >/dev/null >[2=1]
# auth/cron >>/sys/log/cron >[2=1] &
# keep other bootes processes from creating capabilities
rm -f '#¤/caphash'
# also rename some files on an auth server:
#
# if(! test -e /arch/rc/cmd/service.auth/tcp567){
# mv /arch/rc/cmd/service.auth/authsrv.il566 /arch/rc/cmd/service.auth/il566
# mv /arch/rc/cmd/service.auth/authsrv.tcp567 /arch/rc/cmd/service.auth/tcp567
# mv /arch/rc/cmd/service/il566 /arch/rc/cmd/service/_il566
# mv /arch/rc/cmd/service/tcp567 /arch/rc/cmd/service/_tcp567
# }
# netssh
# start listeners if it hasn't already been done (dicey check)
if(! netstat -n | grep -s 'tcp.*Listen.* (7|9|21|22|23|25|110|113|565|993|17007|17009|17010) .*')
ip/listen -q tcp
# TODO: Removed until awk works
#if(! ps|grep -s timesync) {
# aux/timesync -n pool.ntp.org
# if (test -e '#r/rtc') @ {
# sleep 10 # let timesync correct the time
# awk '{print $1}' /dev/time >'#r/rtc' # fix hw clock
# } &
#}
# cpu-specific late startup
if(test -e /cfg/$sysname/cpustart)
. /cfg/$sysname/cpustart
# mode of /proc/*/ctl is inherited across rfork, and sets modes on
# other /proc files, such as note, so let listen be killed.
#dontkill '^(ipconfig|factotum|mntgen|venti|fossil|cs|dns|reboot)$'
ip/listen1 -t -v tcp!*!1522 /cmd/hmi/pipeconsole /cmd/rc -m /arch/rc/lib/rcmain -i &
if(test ! -e '#s/comconsole')
hmi/comconsole '#t/eia0' /cmd/rc -m/arch/rc/lib/rcmain -i &
echo 'key proto=p9sk1 dom=jehanne user=glenda !password=demodemo' >/mnt/factotum/ctl
ip/listen1 -t tcp!*!17010 /cmd/cpu -R &
# echo `{date} $sysname >>/sys/log/boot
exit ''

110
arch/rc/lib/startup/terminal Executable file
View File

@ -0,0 +1,110 @@
#!/cmd/rc
# terminal startup
TIMESYNCARGS=(-rLa1000000)
NDBFILE=/lib/ndb/local
mntgen -s slashn && chmod 666 /srv/slashn
# bind all likely devices (#S was bound in boot)
for(i in f t m v L P u U '$' Σ κ)
/cmd/bind -a '#'^$i /dev >/dev/null >[2=1]
rm -f /env/i
# set up any partitions
diskparts
# start up local swapping
disk=`{ls /dev/sd*/swap >[2]/dev/null}
if (! ~ $#disk 0)
swap $disk(1) >/dev/null >[2=1]
rm /env/disk
# we do this before we have a name. we may need to do network
# setup so that we can get a name.
if(test -e /arch/rc/cmd/termrc.local)
. /arch/rc/cmd/termrc.local
# cs sets sysname (termrc.local may already have started it so check)
if(! test -e /srv/cs && ! test -e /net/cs)
ndb/cs -f $NDBFILE
sysname=`{cat /dev/sysname}
if (~ $#sysname 0 || ~ $sysname '') {
sysname = jehanne # default
echo -n $sysname >/dev/sysname
}
# machine specific startup (e.g., for devices not probed)
if(test -e /cfg/$sysname/termrc)
. /cfg/$sysname/termrc
# start IP on the LAN, if not already configured. diskless terminals
# are already configured by now. It's commented out to avoid a long timeout
# on startup waiting for DHCP.
#
# If your site provides DHCP service,
#
#if(! test -e /net/ipifc/0/ctl)
# ip/ipconfig
#
# Otherwise, see /cfg/$sysname/termrc (/cfg/example/termrc is an example).
# start dns if we have an internet
if(test -e /net/ipifc/0/ctl && ! test -e /srv/dns)
ndb/dns -r
if(! ~ $terminal *vx32*){
# start timesync if it isn't running and we weren't told not to
if(! ps|grep -s timesync)
if(! ~ $TIMESYNCARGS '')
ip/timesync $TIMESYNCARGS
# add the loop-back medium
if(! grep -s 127.0.0.1 /net/ipselftab)
ip/ipconfig loopback /dev/null 127.1
# set things up for vmware
if(! ~ `{cat /dev/user} none)
if(test -e /cmd/aux/vmware)
aux/vmware
}
# query user if terminal isn't adequately configured yet
if(~ $mouseport ask){
echo -n 'mouseport is (ps2, ps2intellimouse, 0, 1, 2)[ps2]: '
mouseport=`{read}
if(~ $#mouseport 0)
mouseport=ps2
}
if(~ $vgasize ask){
echo -n 'vgasize [640x480x8]: '
vgasize=`{read}
if(~ $#vgasize 0)
vgasize=640x480x8
}
if(~ $monitor ask){
echo -n 'monitor is [xga]: '
monitor=`{read}
if(~ $#monitor 0)
monitor=xga
}
if(test -f /dev/mousectl){
switch($mouseport){
case ps2 ps2intellimouse 0 1 2
hmi/mouse $mouseport
ms &
# parse vgasize into fields
vgasize=`{echo $vgasize}
if(! ~ $"monitor '' && ! ~ `{cat /dev/user} none)
`{ hmi/realemu && hmi/vga -m $monitor -l $vgasize }
if(~ $accupoint 1)
pipefile -dr /cmd/aux/accupoint /dev/mouse
}
}
# usb listener
/arch/rc/aux/usb/usbrc
if (test -f /dev/apm)
aux/apm
dontkill '^(ipconfig|factotum|mntgen|fossil|cs|dns|listen|reboot)$'

View File

@ -1,8 +1,12 @@
{
"all": {
"Projects": [
"/sys/src/klibs.json",
"/sys/src/libs.json"
"/sys/src/lib/klibs.json",
"/sys/src/lib/libs.json",
"/sys/src/cmd/cmds.json",
"/sys/src/kern/amd64/workhorse.json",
"/sys/src/kern/amd64/",
"qa/"
]
}
}

7
cfg/ndb/local Normal file
View File

@ -0,0 +1,7 @@
#
# files comprising the database, use as many as you like, see ndb(6)
#
database=
file=/net/ndb
file=/lib/ndb/local
file=/lib/ndb/common

87
cfg/startup Executable file
View File

@ -0,0 +1,87 @@
#!/cmd/rc
# cpu server start up
date > /env/boottime
# mount points
mntgen -s slashn && chmod 666 /srv/slashn
# name translation, cs sets /dev/sysname
ndb/cs
sysname=`{cat /dev/sysname}
# parallelism for mk
NPROC = `{wc -l </dev/sysstat}
# site-specific startup
if(test -e /arch/rc/cmd/cpurc.local)
. /arch/rc/cmd/cpurc.local
if (~ $#sysname 0 || ~ $sysname '') {
sysname = jehanne # default
echo -n $sysname >/dev/sysname
}
prompt=($sysname^'# ' ' ')
# cpu-specific startup
if(test -e /cfg/$sysname/cpurc)
. /cfg/$sysname/cpurc
# start up internet if we don't already have an address
if(! grep u /net/ipselftab | grep -sv 127.0.0.1)
ip/ipconfig
if(! grep -s 127.0.0.1 /net/ipselftab)
ip/ipconfig loopback /dev/null 127.1
# if we're not a server, start a dns resolver
if(! test -e /srv/dns)
ndb/dns -r
# If you are on an auth server, start these before listening:
#
# auth/keyfs -wp -m /mnt/keys /adm/keys >/dev/null >[2=1]
# auth/cron >>/sys/log/cron >[2=1] &
# keep other bootes processes from creating capabilities
rm -f '#¤/caphash'
# also rename some files on an auth server:
#
# if(! test -e /arch/rc/cmd/service.auth/tcp567){
# mv /arch/rc/cmd/service.auth/authsrv.il566 /arch/rc/cmd/service.auth/il566
# mv /arch/rc/cmd/service.auth/authsrv.tcp567 /arch/rc/cmd/service.auth/tcp567
# mv /arch/rc/cmd/service/il566 /arch/rc/cmd/service/_il566
# mv /arch/rc/cmd/service/tcp567 /arch/rc/cmd/service/_tcp567
# }
# netssh
# start listeners if it hasn't already been done (dicey check)
if(! netstat -n | grep -s 'tcp.*Listen.* (7|9|21|22|23|25|110|113|565|993|17007|17009|17010) .*')
ip/listen -q tcp
# TODO: Removed until awk works
#if(! ps|grep -s timesync) {
# aux/timesync -n pool.ntp.org
# if (test -e '#r/rtc') @ {
# sleep 10 # let timesync correct the time
# awk '{print $1}' /dev/time >'#r/rtc' # fix hw clock
# } &
#}
# cpu-specific late startup
if(test -e /cfg/$sysname/cpustart)
. /cfg/$sysname/cpustart
# mode of /proc/*/ctl is inherited across rfork, and sets modes on
# other /proc files, such as note, so let listen be killed.
#dontkill '^(ipconfig|factotum|mntgen|venti|fossil|cs|dns|reboot)$'
ip/listen1 -t -v tcp!*!1522 /cmd/hmi/pipeconsole /cmd/rc -m /arch/rc/lib/rcmain -i &
if(test ! -e '#s/comconsole')
hmi/comconsole '#t/eia0' /cmd/rc -m/arch/rc/lib/rcmain -i &
echo 'key proto=p9sk1 dom=jehanne user=glenda !password=demodemo' >/mnt/factotum/ctl
ip/listen1 -t tcp!*!17010 /cmd/cpu -R &
# echo `{date} $sysname >>/sys/log/boot
exit ''

19
cfg/timezone Normal file
View File

@ -0,0 +1,19 @@
CET 3600 CES 7200
512532000 528256800 543981600 559706400 575431200 591156000
606880800 622605600 638330400 654660000 670384800 686109600
701834400 717559200 733284000 749008800 764733600 780458400
796183200 811908000 828237600 846381600 859687200 877831200
891136800 909280800 922586400 941335200 954036000 972784800
985485600 1004234400 1017540000 1035684000 1048989600 1067133600
1080439200 1099188000 1111888800 1130637600 1143338400 1162087200
1174788000 1193536800 1206842400 1224986400 1238292000 1256436000
1269741600 1288490400 1301191200 1319940000 1332640800 1351389600
1364695200 1382839200 1396144800 1414288800 1427594400 1445738400
1459044000 1477792800 1490493600 1509242400 1521943200 1540692000
1553997600 1572141600 1585447200 1603591200 1616896800 1635645600
1648346400 1667095200 1679796000 1698544800 1711850400 1729994400
1743300000 1761444000 1774749600 1792893600 1806199200 1824948000
1837648800 1856397600 1869098400 1887847200 1901152800 1919296800
1932602400 1950746400 1964052000 1982800800 1995501600 2014250400
2026951200 2045700000 2058400800 2077149600 2090455200 2108599200
2121904800 2140048800

@ -1 +1 @@
Subproject commit 6cc262b43b1d5630c73f079872a260c8d0cd5e0e
Subproject commit 79eb26540ea9e3217211c429908e38ebe15c37bb

3
lib/acme/guide Normal file
View File

@ -0,0 +1,3 @@
win
aspell file
adict -d oed

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/font/bit/fixed/4x6.0000 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/4x6.0100 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/4x6.0200 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/4x6.0300 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/4x6.0400 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/4x6.0500 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/4x6.1E00 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/4x6.2000 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/4x6.2100 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/4x6.2200 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/4x6.2300 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/4x6.2400 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/4x6.2500 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/4x6.2600 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/4x6.FF00 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.0000 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.0100 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.0200 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.0300 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.0400 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.0500 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.1600 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.1E00 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.1F00 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.2000 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.2100 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.2200 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.2300 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.2400 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.2500 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.2600 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.2800 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.FB00 Normal file

Binary file not shown.

BIN
lib/font/bit/fixed/5x7.FF00 Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More