Drivers and servers are simply known as services.
/etc CHANGES: - /etc/drivers.conf has been renamed to /etc/system.conf. Every entry in the file is now marked as "service" rather than driver. - user "service" has been added to password file /etc/passwd. - docs/UPDATING updated accordingly, as well as every other mention to the old drivers.conf in the system. RS CHANGES: - No more distinction between servers and drivers. - RS_START has been renamed to RS_UP and the old legacy RS_UP and RS_UP_COPY dropped. - RS asks PCI to set / remove ACL entries only for services whose ACL properties have been set. This change eliminates unnecessary warnings. - Temporarily minimize the risk of potential races at boot time or when starting a new service. Upcoming changes will eliminate races completely. - General cleanup.
This commit is contained in:
parent
b4d6d9db26
commit
e090013056
21 changed files with 237 additions and 373 deletions
|
@ -2,4 +2,4 @@
|
||||||
if [ $# -gt 0 ]
|
if [ $# -gt 0 ]
|
||||||
then ARGS="-args $@"
|
then ARGS="-args $@"
|
||||||
fi
|
fi
|
||||||
/bin/service up /sbin/readclock.drv -config /etc/drivers.conf -script /etc/rs.single $ARGS
|
/bin/service up /sbin/readclock.drv -config /etc/system.conf -script /etc/rs.single $ARGS
|
||||||
|
|
|
@ -46,7 +46,7 @@ one_round()
|
||||||
# Start our own driver.
|
# Start our own driver.
|
||||||
service down $LABEL
|
service down $LABEL
|
||||||
sleep 10 # Allow driver to die
|
sleep 10 # Allow driver to die
|
||||||
service up $EXE -script `pwd`/rs.restart_imm -config /etc/drivers.conf -period 3HZ
|
service up $EXE -script `pwd`/rs.restart_imm -config /etc/system.conf -period 3HZ
|
||||||
|
|
||||||
i=0
|
i=0
|
||||||
i=4000
|
i=4000
|
||||||
|
|
|
@ -103,7 +103,7 @@ esac
|
||||||
# Start our own driver.
|
# Start our own driver.
|
||||||
service down $LABEL
|
service down $LABEL
|
||||||
sleep 2 # Allow driver to die
|
sleep 2 # Allow driver to die
|
||||||
service up $EXE -script `pwd`/rs.restart_imm -config /etc/drivers.conf -period 3HZ $DEV
|
service up $EXE -script `pwd`/rs.restart_imm -config /etc/system.conf -period 3HZ $DEV
|
||||||
|
|
||||||
i=0
|
i=0
|
||||||
while [ $i -lt "$count" ]
|
while [ $i -lt "$count" ]
|
||||||
|
|
|
@ -123,7 +123,7 @@ esac
|
||||||
# Start our own driver.
|
# Start our own driver.
|
||||||
service down $LABEL
|
service down $LABEL
|
||||||
sleep 10 # Allow driver to die
|
sleep 10 # Allow driver to die
|
||||||
service up $EXE -script `pwd`/rs.restart_imm -config /etc/drivers.conf -period 3HZ
|
service up $EXE -script `pwd`/rs.restart_imm -config /etc/system.conf -period 3HZ
|
||||||
|
|
||||||
i=0
|
i=0
|
||||||
while [ $i -lt "$count" ]
|
while [ $i -lt "$count" ]
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
20091212:
|
||||||
|
/etc/drivers.conf has been renamed to /etc/system.conf.
|
||||||
|
user "service" has been added to password file /etc/passwd.
|
||||||
20060818:
|
20060818:
|
||||||
You need flex in your $PATH, which has become part of the base
|
You need flex in your $PATH, which has become part of the base
|
||||||
system. This needs bigger binaries.
|
system. This needs bigger binaries.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
PROGRAMS=at_wini bios_wini cdprobe dev2name floppy loadramdisk newroot \
|
PROGRAMS=at_wini bios_wini cdprobe dev2name floppy loadramdisk newroot \
|
||||||
pci sh service sysenv mfs
|
pci sh service sysenv mfs
|
||||||
EXTRA=drivers.conf passwd
|
EXTRA=system.conf passwd
|
||||||
|
|
||||||
MAKEDEV=/usr/bin/MAKEDEV
|
MAKEDEV=/usr/bin/MAKEDEV
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ mfs: ../../../servers/mfs/mfs
|
||||||
../../../servers/mfs/mfs:
|
../../../servers/mfs/mfs:
|
||||||
cd ../../../servers/mfs && make
|
cd ../../../servers/mfs && make
|
||||||
|
|
||||||
drivers.conf: ../../../etc/drivers.conf
|
system.conf: ../../../etc/system.conf
|
||||||
install -s ../../../etc/$@ $@
|
install -s ../../../etc/$@ $@
|
||||||
|
|
||||||
passwd: ../../../etc/passwd
|
passwd: ../../../etc/passwd
|
||||||
|
|
|
@ -21,7 +21,7 @@ d--755 0 0
|
||||||
@DEV@
|
@DEV@
|
||||||
$
|
$
|
||||||
etc d--755 0 0
|
etc d--755 0 0
|
||||||
drivers.conf ---644 0 0 drivers.conf
|
system.conf ---644 0 0 system.conf
|
||||||
mtab ---644 0 0 mtab
|
mtab ---644 0 0 mtab
|
||||||
passwd ---644 0 0 passwd
|
passwd ---644 0 0 passwd
|
||||||
rc ---755 0 0 rc
|
rc ---755 0 0 rc
|
||||||
|
|
|
@ -5,15 +5,15 @@ exec >/dev/log
|
||||||
exec 2>/dev/log
|
exec 2>/dev/log
|
||||||
exec </dev/null
|
exec </dev/null
|
||||||
|
|
||||||
/bin/service up /bin/pci -config /etc/drivers.conf
|
/bin/service up /bin/pci -config /etc/system.conf
|
||||||
/bin/service -c up /bin/floppy -config /etc/drivers.conf -dev /dev/fd0
|
/bin/service -c up /bin/floppy -config /etc/system.conf -dev /dev/fd0
|
||||||
if [ X`/bin/sysenv bios_wini` = Xyes ]
|
if [ X`/bin/sysenv bios_wini` = Xyes ]
|
||||||
then
|
then
|
||||||
echo Using bios_wini.
|
echo Using bios_wini.
|
||||||
/bin/service -c up /bin/bios_wini -dev /dev/c0d0
|
/bin/service -c up /bin/bios_wini -dev /dev/c0d0
|
||||||
else
|
else
|
||||||
/bin/service -c up /bin/at_wini -dev /dev/c0d0 -config /etc/drivers.conf -label at_wini_0
|
/bin/service -c up /bin/at_wini -dev /dev/c0d0 -config /etc/system.conf -label at_wini_0
|
||||||
/bin/service -c up /bin/at_wini -dev /dev/c1d0 -config /etc/drivers.conf -label at_wini_1 -args ata_instance=1
|
/bin/service -c up /bin/at_wini -dev /dev/c1d0 -config /etc/system.conf -label at_wini_1 -args ata_instance=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rootdev=`sysenv rootdev` || echo 'No rootdev?'
|
rootdev=`sysenv rootdev` || echo 'No rootdev?'
|
||||||
|
|
|
@ -10,7 +10,7 @@ This script will patch, compile and install 2 code files in Minix:
|
||||||
/usr/src/commands/dhcpd/devices.c
|
/usr/src/commands/dhcpd/devices.c
|
||||||
(see the docs directory for more information)
|
(see the docs directory for more information)
|
||||||
Furthermore, the script will patch 1 configuration file:
|
Furthermore, the script will patch 1 configuration file:
|
||||||
/etc/drivers.conf
|
/etc/system.conf
|
||||||
(adding an entry for 'orinoco')
|
(adding an entry for 'orinoco')
|
||||||
and 1 script file:
|
and 1 script file:
|
||||||
/usr/etc/rc
|
/usr/etc/rc
|
||||||
|
|
|
@ -4,7 +4,7 @@ USRETC=/usr/etc/
|
||||||
FILES1=fstab group hostname.file inet.conf motd.install mtab passwd profile \
|
FILES1=fstab group hostname.file inet.conf motd.install mtab passwd profile \
|
||||||
protocols rc services termcap ttytab utmp rc.cd binary_sizes \
|
protocols rc services termcap ttytab utmp rc.cd binary_sizes \
|
||||||
binary_sizes.big binary_sizes.xxl rc.rescue syslog.conf \
|
binary_sizes.big binary_sizes.xxl rc.rescue syslog.conf \
|
||||||
rc.daemons.dist rs.inet rs.single make.conf drivers.conf
|
rc.daemons.dist rs.inet rs.single make.conf system.conf
|
||||||
FILES2=shadow
|
FILES2=shadow
|
||||||
FILES3=daily dhcptags.conf rc
|
FILES3=daily dhcptags.conf rc
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ ast:*:8:3:Andrew S. Tanenbaum:/home/ast:
|
||||||
www:*:9:9:World Wide Web:/usr/www:
|
www:*:9:9:World Wide Web:/usr/www:
|
||||||
driver:*:10:10:Device Drivers:/:
|
driver:*:10:10:Device Drivers:/:
|
||||||
server:*:11:11:OS Servers:/:
|
server:*:11:11:OS Servers:/:
|
||||||
|
service:*:12:12:System Services:/:
|
||||||
sshd:*:22:22:sshd:/:
|
sshd:*:22:22:sshd:/:
|
||||||
smtpd:*:25:25:smtpd:/:
|
smtpd:*:25:25:smtpd:/:
|
||||||
games:*:9998:98::/:
|
games:*:9998:98::/:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
driver floppy
|
service floppy
|
||||||
{
|
{
|
||||||
irq 6;
|
irq 6;
|
||||||
io 3f0:8
|
io 3f0:8
|
||||||
|
@ -16,46 +16,48 @@ driver floppy
|
||||||
SAFECOPYFROM # 31
|
SAFECOPYFROM # 31
|
||||||
SAFECOPYTO # 32
|
SAFECOPYTO # 32
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver dp8390
|
service dp8390
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
IRQCTL # 19
|
IRQCTL # 19
|
||||||
DEVIO # 21
|
DEVIO # 21
|
||||||
SDEVIO # 22
|
SDEVIO # 22
|
||||||
SETALARM # 24
|
SETALARM # 24
|
||||||
|
TIMES # 25
|
||||||
GETINFO # 26
|
GETINFO # 26
|
||||||
SAFECOPYFROM # 31
|
SAFECOPYFROM # 31
|
||||||
SAFECOPYTO # 32
|
SAFECOPYTO # 32
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
pci device 10ec/8029;
|
pci device 10ec/8029;
|
||||||
uid 0;
|
uid 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver dpeth
|
service dpeth
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
IRQCTL # 19
|
IRQCTL # 19
|
||||||
DEVIO # 21
|
DEVIO # 21
|
||||||
SDEVIO # 22
|
SDEVIO # 22
|
||||||
SETALARM # 24
|
SETALARM # 24
|
||||||
|
TIMES # 25
|
||||||
GETINFO # 26
|
GETINFO # 26
|
||||||
SAFECOPYFROM # 31
|
SAFECOPYFROM # 31
|
||||||
SAFECOPYTO # 32
|
SAFECOPYTO # 32
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
uid 0;
|
uid 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver lance
|
service lance
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
UMAP # 14
|
UMAP # 14
|
||||||
|
@ -68,13 +70,13 @@ driver lance
|
||||||
SAFECOPYTO # 32
|
SAFECOPYTO # 32
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
pci device 1022/2000;
|
pci device 1022/2000;
|
||||||
uid 0;
|
uid 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver rtl8139
|
service rtl8139
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
UMAP # 14
|
UMAP # 14
|
||||||
|
@ -87,9 +89,9 @@ driver rtl8139
|
||||||
SAFECOPYFROM # 31
|
SAFECOPYFROM # 31
|
||||||
SAFECOPYTO # 32
|
SAFECOPYTO # 32
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
MAPDMA # 41
|
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
MAPDMA # 41
|
||||||
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
pci device 10ec/8139;
|
pci device 10ec/8139;
|
||||||
pci device 02ac/1012;
|
pci device 02ac/1012;
|
||||||
|
@ -114,7 +116,7 @@ driver rtl8139
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver fxp
|
service fxp
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
UMAP # 14
|
UMAP # 14
|
||||||
|
@ -128,7 +130,7 @@ driver fxp
|
||||||
SAFECOPYTO # 32
|
SAFECOPYTO # 32
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
pci device 8086/103d;
|
pci device 8086/103d;
|
||||||
pci device 8086/1064;
|
pci device 8086/1064;
|
||||||
|
@ -140,19 +142,20 @@ driver fxp
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver dumpcore
|
service dumpcore
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
TRACE # 5
|
TRACE # 5
|
||||||
VIRCOPY # 15
|
VIRCOPY # 15
|
||||||
|
TIMES # 25
|
||||||
GETINFO # 26
|
GETINFO # 26
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver inet
|
service inet
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
SETALARM # 24
|
SETALARM # 24
|
||||||
|
@ -163,50 +166,51 @@ driver inet
|
||||||
VSAFECOPY # 33
|
VSAFECOPY # 33
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
uid 0;
|
uid 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver random
|
service random
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
UMAP # 14
|
UMAP # 14
|
||||||
SETALARM # 24
|
SETALARM # 24
|
||||||
|
TIMES # 25
|
||||||
GETINFO # 26
|
GETINFO # 26
|
||||||
SAFECOPYFROM # 31
|
SAFECOPYFROM # 31
|
||||||
SAFECOPYTO # 32
|
SAFECOPYTO # 32
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver readclock.drv
|
service readclock.drv
|
||||||
{
|
{
|
||||||
io 70:2;
|
io 70:2;
|
||||||
system
|
system
|
||||||
DEVIO # 21
|
DEVIO # 21
|
||||||
TIMES # 25
|
TIMES # 25
|
||||||
GETINFO # 26
|
GETINFO # 26
|
||||||
|
SAFECOPYFROM # 31
|
||||||
SAFECOPYTO # 32
|
SAFECOPYTO # 32
|
||||||
SAFECOPYFROM # 32
|
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
READBIOS # 35
|
READBIOS # 35
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
uid 0;
|
uid 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver is
|
service is
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
TIMES # 25
|
TIMES # 25
|
||||||
GETINFO # 26
|
GETINFO # 26
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
vm
|
vm
|
||||||
CTL
|
CTL
|
||||||
|
@ -214,7 +218,7 @@ driver is
|
||||||
uid 0;
|
uid 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver pci
|
service pci
|
||||||
{
|
{
|
||||||
io cf8:8 # PCI bus controller
|
io cf8:8 # PCI bus controller
|
||||||
4d0:2 # PIIX
|
4d0:2 # PIIX
|
||||||
|
@ -222,17 +226,18 @@ driver pci
|
||||||
system
|
system
|
||||||
PRIVCTL # 4
|
PRIVCTL # 4
|
||||||
DEVIO # 21
|
DEVIO # 21
|
||||||
|
TIMES # 25
|
||||||
GETINFO # 26
|
GETINFO # 26
|
||||||
SAFECOPYFROM # 31
|
SAFECOPYFROM # 31
|
||||||
SAFECOPYTO # 32
|
SAFECOPYTO # 32
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
uid 0;
|
uid 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver at_wini
|
service at_wini
|
||||||
{
|
{
|
||||||
io 1f0:8 # Controller 0
|
io 1f0:8 # Controller 0
|
||||||
3f6 # Also controller 0
|
3f6 # Also controller 0
|
||||||
|
@ -257,7 +262,7 @@ driver at_wini
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
READBIOS # 35
|
READBIOS # 35
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
pci class
|
pci class
|
||||||
1/1 # Mass storage / IDE
|
1/1 # Mass storage / IDE
|
||||||
|
@ -265,10 +270,11 @@ driver at_wini
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver bios_wini
|
service bios_wini
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
UMAP # 14
|
UMAP # 14
|
||||||
|
INT86 # 20
|
||||||
SETALARM # 24
|
SETALARM # 24
|
||||||
TIMES # 25
|
TIMES # 25
|
||||||
GETINFO # 26
|
GETINFO # 26
|
||||||
|
@ -277,41 +283,40 @@ driver bios_wini
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
READBIOS # 35
|
READBIOS # 35
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
INT86
|
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver mfs
|
service mfs
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
TIMES # 25
|
TIMES # 25
|
||||||
|
GETINFO # 26
|
||||||
SAFECOPYFROM # 31
|
SAFECOPYFROM # 31
|
||||||
SAFECOPYTO # 32
|
SAFECOPYTO # 32
|
||||||
GETINFO
|
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
uid 0;
|
uid 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver isofs
|
service isofs
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
TIMES # 25
|
|
||||||
SAFECOPYFROM # 31
|
|
||||||
SAFECOPYTO # 32
|
|
||||||
GETINFO
|
|
||||||
SETGRANT # 34
|
|
||||||
UMAP # 14
|
UMAP # 14
|
||||||
|
TIMES # 25
|
||||||
|
GETINFO # 26
|
||||||
|
SAFECOPYFROM # 31
|
||||||
|
SAFECOPYTO # 32
|
||||||
|
SETGRANT # 34
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
uid 0;
|
uid 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver printer
|
service printer
|
||||||
{
|
{
|
||||||
io 378:4 # LPT1
|
io 378:4 # LPT1
|
||||||
278:4 # LPT2
|
278:4 # LPT2
|
||||||
|
@ -320,27 +325,26 @@ driver printer
|
||||||
7 # PRINTER_IRQ
|
7 # PRINTER_IRQ
|
||||||
;
|
;
|
||||||
system
|
system
|
||||||
KILL # 6
|
KILL # 6
|
||||||
SETGRANT # 34
|
UMAP # 14
|
||||||
UMAP # 14
|
VIRCOPY # 15
|
||||||
VIRCOPY # 15
|
IRQCTL # 19
|
||||||
IRQCTL # 19
|
DEVIO # 21
|
||||||
DEVIO # 21
|
VDEVIO # 23
|
||||||
VDEVIO # 23
|
TIMES # 25
|
||||||
GETINFO # 26
|
GETINFO # 26
|
||||||
SAFECOPYFROM # 31
|
SAFECOPYFROM # 31
|
||||||
SAFECOPYTO # 32
|
SAFECOPYTO # 32
|
||||||
|
SETGRANT # 34
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver orinoco
|
service orinoco
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
PRIVCTL # 4
|
PRIVCTL # 4
|
||||||
DEVIO # 21
|
|
||||||
GETINFO # 26
|
|
||||||
UMAP # 14
|
UMAP # 14
|
||||||
IRQCTL # 19
|
IRQCTL # 19
|
||||||
DEVIO # 21
|
DEVIO # 21
|
||||||
|
@ -348,41 +352,43 @@ driver orinoco
|
||||||
SETALARM # 24
|
SETALARM # 24
|
||||||
TIMES # 25
|
TIMES # 25
|
||||||
GETINFO # 26
|
GETINFO # 26
|
||||||
|
VM_MAP # 30
|
||||||
SAFECOPYFROM # 31
|
SAFECOPYFROM # 31
|
||||||
SAFECOPYTO # 32
|
SAFECOPYTO # 32
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
VM_MAP # 30
|
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
pci device 1260/3873;
|
pci device 1260/3873;
|
||||||
pci device 1186/1300;
|
pci device 1186/1300;
|
||||||
uid 0;
|
uid 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver es1370
|
service es1370
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
SAFECOPYFROM
|
UMAP # 14
|
||||||
SAFECOPYTO
|
|
||||||
UMAP
|
|
||||||
GETINFO
|
|
||||||
SETGRANT
|
|
||||||
IRQCTL # 19
|
IRQCTL # 19
|
||||||
DEVIO # 21
|
DEVIO # 21
|
||||||
|
TIMES # 25
|
||||||
|
GETINFO # 26
|
||||||
|
SAFECOPYFROM # 31
|
||||||
|
SAFECOPYTO # 32
|
||||||
|
SETGRANT # 34
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
pci device 1274/5000;
|
pci device 1274/5000;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver es1371
|
service es1371
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
SAFECOPYFROM
|
SAFECOPYFROM
|
||||||
SAFECOPYTO
|
SAFECOPYTO
|
||||||
UMAP
|
UMAP
|
||||||
SETGRANT
|
SETGRANT
|
||||||
|
TIMES # 25
|
||||||
GETINFO
|
GETINFO
|
||||||
IRQCTL # 19
|
IRQCTL # 19
|
||||||
DEVIO # 21
|
DEVIO # 21
|
||||||
|
@ -392,30 +398,33 @@ driver es1371
|
||||||
pci device 1274/1371;
|
pci device 1274/1371;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver amddev
|
service amddev
|
||||||
{
|
{
|
||||||
pci device 1022/1103;
|
pci device 1022/1103;
|
||||||
system
|
system
|
||||||
UMAP # 14
|
UMAP # 14
|
||||||
|
TIMES # 25
|
||||||
|
GETINFO # 26
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
GETINFO
|
|
||||||
REGDEV # 40
|
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
REGDEV # 40
|
||||||
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
uid 0;
|
uid 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver ipc
|
service ipc
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
UMAP
|
UMAP # 14
|
||||||
PROFBUF
|
VIRCOPY # 15
|
||||||
SAFECOPYFROM
|
TIMES # 25
|
||||||
SAFECOPYTO
|
GETINFO # 26
|
||||||
VIRCOPY
|
SAFECOPYFROM # 31
|
||||||
SETGRANT
|
SAFECOPYTO # 32
|
||||||
SYSCTL
|
SETGRANT # 34
|
||||||
|
PROFBUF # 38
|
||||||
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
uid 0;
|
uid 0;
|
||||||
ipc
|
ipc
|
||||||
|
@ -437,11 +446,10 @@ driver ipc
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver osscore
|
service osscore
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
PRIVCTL # 4
|
PRIVCTL # 4
|
||||||
DEVIO # 21
|
|
||||||
UMAP # 14
|
UMAP # 14
|
||||||
IRQCTL # 19
|
IRQCTL # 19
|
||||||
DEVIO # 21
|
DEVIO # 21
|
||||||
|
@ -453,7 +461,7 @@ driver osscore
|
||||||
SAFECOPYTO # 32
|
SAFECOPYTO # 32
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
pci class
|
pci class
|
||||||
4/1 # Multimedia / Audio device
|
4/1 # Multimedia / Audio device
|
||||||
|
@ -465,7 +473,7 @@ driver osscore
|
||||||
uid 0;
|
uid 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver rtl8169
|
service rtl8169
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
UMAP # 14
|
UMAP # 14
|
||||||
|
@ -478,9 +486,9 @@ driver rtl8169
|
||||||
SAFECOPYFROM # 31
|
SAFECOPYFROM # 31
|
||||||
SAFECOPYTO # 32
|
SAFECOPYTO # 32
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
MAPDMA # 41
|
|
||||||
PROFBUF # 38
|
PROFBUF # 38
|
||||||
SYSCTL
|
MAPDMA # 41
|
||||||
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
pci device 10ec/8129;
|
pci device 10ec/8129;
|
||||||
pci device 10ec/8167;
|
pci device 10ec/8167;
|
||||||
|
@ -496,7 +504,7 @@ driver rtl8169
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver filter
|
service filter
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
SETALARM # 24
|
SETALARM # 24
|
||||||
|
@ -518,7 +526,7 @@ driver filter
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
driver e1000
|
service e1000
|
||||||
{
|
{
|
||||||
system
|
system
|
||||||
UMAP # 14
|
UMAP # 14
|
||||||
|
@ -530,7 +538,7 @@ driver e1000
|
||||||
SAFECOPYFROM # 31
|
SAFECOPYFROM # 31
|
||||||
SAFECOPYTO # 32
|
SAFECOPYTO # 32
|
||||||
SETGRANT # 34
|
SETGRANT # 34
|
||||||
SYSCTL
|
SYSCTL # 44
|
||||||
;
|
;
|
||||||
pci device 8086/100e;
|
pci device 8086/100e;
|
||||||
pci device 8086/107c;
|
pci device 8086/107c;
|
|
@ -64,7 +64,7 @@
|
||||||
#define PM_PROC_NR 0 /* process manager */
|
#define PM_PROC_NR 0 /* process manager */
|
||||||
#define FS_PROC_NR 1 /* file system */
|
#define FS_PROC_NR 1 /* file system */
|
||||||
#define VFS_PROC_NR FS_PROC_NR /* FS has been renamed to VFS. */
|
#define VFS_PROC_NR FS_PROC_NR /* FS has been renamed to VFS. */
|
||||||
#define RS_PROC_NR 2 /* memory driver (RAM disk, null, etc.) */
|
#define RS_PROC_NR 2 /* reincarnation server */
|
||||||
#define MEM_PROC_NR 3 /* memory driver (RAM disk, null, etc.) */
|
#define MEM_PROC_NR 3 /* memory driver (RAM disk, null, etc.) */
|
||||||
#define LOG_PROC_NR 4 /* log device driver */
|
#define LOG_PROC_NR 4 /* log device driver */
|
||||||
#define TTY_PROC_NR 5 /* terminal (TTY) driver */
|
#define TTY_PROC_NR 5 /* terminal (TTY) driver */
|
||||||
|
@ -675,14 +675,8 @@
|
||||||
#define RS_DOWN (RS_RQ_BASE + 1) /* stop system service */
|
#define RS_DOWN (RS_RQ_BASE + 1) /* stop system service */
|
||||||
#define RS_REFRESH (RS_RQ_BASE + 2) /* refresh system service */
|
#define RS_REFRESH (RS_RQ_BASE + 2) /* refresh system service */
|
||||||
#define RS_RESTART (RS_RQ_BASE + 3) /* restart system service */
|
#define RS_RESTART (RS_RQ_BASE + 3) /* restart system service */
|
||||||
#define RS_SHUTDOWN (RS_RQ_BASE + 5) /* alert about shutdown */
|
#define RS_SHUTDOWN (RS_RQ_BASE + 4) /* alert about shutdown */
|
||||||
#define RS_UP_COPY (RS_RQ_BASE + 6) /* start system service and
|
|
||||||
* keep the binary in memory
|
|
||||||
*/
|
|
||||||
#define RS_START (RS_RQ_BASE + 7) /* start a driver/service
|
|
||||||
* arguments are passed in
|
|
||||||
* a struct rs_start
|
|
||||||
*/
|
|
||||||
#define RS_LOOKUP (RS_RQ_BASE + 8) /* lookup server name */
|
#define RS_LOOKUP (RS_RQ_BASE + 8) /* lookup server name */
|
||||||
|
|
||||||
# define RS_CMD_ADDR m1_p1 /* command string */
|
# define RS_CMD_ADDR m1_p1 /* command string */
|
||||||
|
|
|
@ -18,6 +18,6 @@
|
||||||
|
|
||||||
#define _PATH_BSHELL "/bin/sh"
|
#define _PATH_BSHELL "/bin/sh"
|
||||||
#define _PATH_SERVICE "/bin/service"
|
#define _PATH_SERVICE "/bin/service"
|
||||||
#define _PATH_DRIVERS_CONF "/etc/drivers.conf"
|
#define _PATH_SYSTEM_CONF "/etc/system.conf"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -97,14 +97,14 @@ int mountflags;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strlen(_PATH_SERVICE)+strlen(path)+strlen(label)+
|
if(strlen(_PATH_SERVICE)+strlen(path)+strlen(label)+
|
||||||
strlen(_PATH_DRIVERS_CONF)+strlen(args)+50 >= sizeof(cmd)) {
|
strlen(_PATH_SYSTEM_CONF)+strlen(args)+50 >= sizeof(cmd)) {
|
||||||
errno = E2BIG;
|
errno = E2BIG;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sprintf(cmd, _PATH_SERVICE " %sup %s -label '%s' -config " _PATH_DRIVERS_CONF
|
sprintf(cmd, _PATH_SERVICE " %sup %s -label '%s' -config " _PATH_SYSTEM_CONF
|
||||||
" -args '%s%s' -printep yes",
|
" -args '%s%s' -printep yes",
|
||||||
reuse ? "-r ": "", path, label, args[0] ? "-o " : "", args);
|
reuse ? "-r ": "", path, label, args[0] ? "-o " : "", args);
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
/* Space reserved for program and arguments. */
|
/* Space reserved for program and arguments. */
|
||||||
#define MAX_COMMAND_LEN 512 /* maximum argument string length */
|
#define MAX_COMMAND_LEN 512 /* maximum argument string length */
|
||||||
#define MAX_LABEL_LEN 16 /* Unique name of (this instance of)
|
#define MAX_LABEL_LEN 16 /* Unique name of (this instance of)
|
||||||
* the driver
|
* the service
|
||||||
*/
|
*/
|
||||||
#define MAX_SCRIPT_LEN 256 /* maximum restart script name length */
|
#define MAX_SCRIPT_LEN 256 /* maximum restart script name length */
|
||||||
#define MAX_NR_ARGS 4 /* maximum number of arguments */
|
#define MAX_NR_ARGS 4 /* maximum number of arguments */
|
||||||
|
@ -21,11 +21,11 @@
|
||||||
#define RS_IN_USE 0x001 /* set when process slot is in use */
|
#define RS_IN_USE 0x001 /* set when process slot is in use */
|
||||||
#define RS_EXITING 0x004 /* set when exit is expected */
|
#define RS_EXITING 0x004 /* set when exit is expected */
|
||||||
#define RS_REFRESHING 0x008 /* set when refresh must be done */
|
#define RS_REFRESHING 0x008 /* set when refresh must be done */
|
||||||
#define RS_NOPINGREPLY 0x010 /* driver failed to reply to a ping request */
|
#define RS_NOPINGREPLY 0x010 /* service failed to reply to a ping request */
|
||||||
#define RS_KILLED 0x020 /* driver is killed */
|
#define RS_KILLED 0x020 /* service is killed */
|
||||||
#define RS_CRASHED 0x040 /* driver crashed */
|
#define RS_CRASHED 0x040 /* service crashed */
|
||||||
#define RS_LATEREPLY 0x080 /* no reply sent to RS_DOWN caller yet */
|
#define RS_LATEREPLY 0x080 /* no reply sent to RS_DOWN caller yet */
|
||||||
#define RS_SIGNALED 0x100 /* driver crashed */
|
#define RS_SIGNALED 0x100 /* service crashed */
|
||||||
|
|
||||||
/* Sys flag values. */
|
/* Sys flag values. */
|
||||||
#define SF_CORE_PROC 0x001 /* set for core system processes
|
#define SF_CORE_PROC 0x001 /* set for core system processes
|
||||||
|
|
|
@ -86,7 +86,7 @@ PUBLIC int main(void)
|
||||||
if (is_notify(m.m_type)) {
|
if (is_notify(m.m_type)) {
|
||||||
switch (who_p) {
|
switch (who_p) {
|
||||||
case CLOCK:
|
case CLOCK:
|
||||||
do_period(&m); /* check drivers status */
|
do_period(&m); /* check services status */
|
||||||
continue;
|
continue;
|
||||||
case PM_PROC_NR:
|
case PM_PROC_NR:
|
||||||
sig_handler();
|
sig_handler();
|
||||||
|
@ -116,9 +116,7 @@ PUBLIC int main(void)
|
||||||
|
|
||||||
/* Handler functions are responsible for permission checking. */
|
/* Handler functions are responsible for permission checking. */
|
||||||
switch(call_nr) {
|
switch(call_nr) {
|
||||||
case RS_UP: result = do_up(&m, FALSE, 0); break;
|
case RS_UP: result = do_up(&m); break;
|
||||||
case RS_UP_COPY: result = do_up(&m, TRUE, 0); break;
|
|
||||||
case RS_START: result = do_start(&m); break;
|
|
||||||
case RS_DOWN: result = do_down(&m); break;
|
case RS_DOWN: result = do_down(&m); break;
|
||||||
case RS_REFRESH: result = do_refresh(&m); break;
|
case RS_REFRESH: result = do_refresh(&m); break;
|
||||||
case RS_RESTART: result = do_restart(&m); break;
|
case RS_RESTART: result = do_restart(&m); break;
|
||||||
|
@ -455,6 +453,32 @@ PRIVATE void init_server(void)
|
||||||
rp->r_dev_nr = boot_image_dev->dev_nr; /* major device number */
|
rp->r_dev_nr = boot_image_dev->dev_nr; /* major device number */
|
||||||
rp->r_dev_style = boot_image_dev->dev_style; /* device style */
|
rp->r_dev_style = boot_image_dev->dev_style; /* device style */
|
||||||
rp->r_period = boot_image_dev->period; /* heartbeat period */
|
rp->r_period = boot_image_dev->period; /* heartbeat period */
|
||||||
|
|
||||||
|
/* Get label. */
|
||||||
|
strcpy(rp->r_label, ip->proc_name);
|
||||||
|
|
||||||
|
/* Get command settings. */
|
||||||
|
rp->r_cmd[0]= '\0';
|
||||||
|
rp->r_argv[0] = rp->r_cmd;
|
||||||
|
rp->r_argv[1] = NULL;
|
||||||
|
rp->r_argc = 1;
|
||||||
|
rp->r_script[0]= '\0';
|
||||||
|
|
||||||
|
/* Get some settings from the boot image table. */
|
||||||
|
rp->r_nice = ip->priority;
|
||||||
|
rp->r_proc_nr_e = ip->endpoint;
|
||||||
|
|
||||||
|
/* Set some defaults. */
|
||||||
|
rp->r_uid = 0; /* root */
|
||||||
|
rp->r_check_tm = 0; /* not checked yet */
|
||||||
|
getuptime(&rp->r_alive_tm); /* currently alive */
|
||||||
|
rp->r_stop_tm = 0; /* not exiting yet */
|
||||||
|
rp->r_restarts = 0; /* no restarts so far */
|
||||||
|
rp->r_set_resources = 0; /* don't set resources */
|
||||||
|
|
||||||
|
/* Mark as in use. */
|
||||||
|
rp->r_flags = RS_IN_USE;
|
||||||
|
rproc_ptr[_ENDPOINT_P(rp->r_proc_nr_e)]= rp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* - Step 2: allow every system service in the boot image to run.
|
/* - Step 2: allow every system service in the boot image to run.
|
||||||
|
@ -477,9 +501,9 @@ PRIVATE void init_server(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* - Step 3: all the system services in the boot image are now running. Use
|
/* - Step 3: all the system services in the boot image are now running.
|
||||||
* the boot image table from the kernel and PM process table to complete
|
* Complete the initialization of the system process table in collaboration
|
||||||
* the initialization of the system process table.
|
* with other system processes.
|
||||||
*/
|
*/
|
||||||
if ((s = getsysinfo(PM_PROC_NR, SI_PROC_TAB, mproc)) != OK) {
|
if ((s = getsysinfo(PM_PROC_NR, SI_PROC_TAB, mproc)) != OK) {
|
||||||
panic("RS", "unable to get copy of PM process table", s);
|
panic("RS", "unable to get copy of PM process table", s);
|
||||||
|
@ -492,25 +516,9 @@ PRIVATE void init_server(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup the corresponding entry in the boot image table. */
|
/* Lookup the corresponding slot in the system process table. */
|
||||||
boot_image_info_lookup(boot_image_priv->endpoint, image,
|
|
||||||
&ip, NULL, NULL, NULL);
|
|
||||||
rp = &rproc[boot_image_priv - boot_image_priv_table];
|
rp = &rproc[boot_image_priv - boot_image_priv_table];
|
||||||
|
|
||||||
/* Get label. */
|
|
||||||
strcpy(rp->r_label, ip->proc_name);
|
|
||||||
|
|
||||||
/* Get command settings. */
|
|
||||||
rp->r_cmd[0]= '\0';
|
|
||||||
rp->r_argv[0] = rp->r_cmd;
|
|
||||||
rp->r_argv[1] = NULL;
|
|
||||||
rp->r_argc = 1;
|
|
||||||
rp->r_script[0]= '\0';
|
|
||||||
|
|
||||||
/* Get settings from the boot image table. */
|
|
||||||
rp->r_nice = ip->priority;
|
|
||||||
rp->r_proc_nr_e = ip->endpoint;
|
|
||||||
|
|
||||||
/* Get pid from PM process table. */
|
/* Get pid from PM process table. */
|
||||||
rp->r_pid = NO_PID;
|
rp->r_pid = NO_PID;
|
||||||
for (j = 0; j < NR_PROCS; j++) {
|
for (j = 0; j < NR_PROCS; j++) {
|
||||||
|
@ -523,19 +531,10 @@ PRIVATE void init_server(void)
|
||||||
panic("RS", "unable to get pid", NO_NUM);
|
panic("RS", "unable to get pid", NO_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set some defaults. */
|
/* Publish the new system service.
|
||||||
rp->r_uid = 0; /* root */
|
* XXX FIXME. Possible race condition. We should publish labels before
|
||||||
rp->r_check_tm = 0; /* not checked yet */
|
* allowing other processes to run.
|
||||||
getuptime(&rp->r_alive_tm); /* currently alive */
|
*/
|
||||||
rp->r_stop_tm = 0; /* not exiting yet */
|
|
||||||
rp->r_restarts = 0; /* no restarts so far */
|
|
||||||
rp->r_set_resources = 0; /* no resources */
|
|
||||||
|
|
||||||
/* Mark as in use. */
|
|
||||||
rp->r_flags = RS_IN_USE;
|
|
||||||
rproc_ptr[_ENDPOINT_P(rp->r_proc_nr_e)]= rp;
|
|
||||||
|
|
||||||
/* Publish the new system service. */
|
|
||||||
s = publish_service(rp);
|
s = publish_service(rp);
|
||||||
if (s != OK) {
|
if (s != OK) {
|
||||||
panic("RS", "unable to publish boot system service", s);
|
panic("RS", "unable to publish boot system service", s);
|
||||||
|
|
|
@ -128,120 +128,14 @@ size_t dst_len;
|
||||||
dst_label[len] = 0;
|
dst_label[len] = 0;
|
||||||
|
|
||||||
if (rs_verbose)
|
if (rs_verbose)
|
||||||
printf("RS: do_start: using label (custom) '%s'\n", dst_label);
|
printf("RS: copy_label: using label (custom) '%s'\n", dst_label);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* do_up *
|
* do_up *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC int do_up(m_ptr, do_copy, flags)
|
PUBLIC int do_up(m_ptr)
|
||||||
message *m_ptr; /* request message pointer */
|
|
||||||
int do_copy; /* keep copy in memory */
|
|
||||||
int flags; /* extra flags, if any */
|
|
||||||
{
|
|
||||||
/* A request was made to start a new system service. Dismember the request
|
|
||||||
* message and gather all information needed to start the service. Starting
|
|
||||||
* is done by a helper routine.
|
|
||||||
*/
|
|
||||||
register struct rproc *rp; /* system process table */
|
|
||||||
int slot_nr; /* local table entry */
|
|
||||||
int arg_count; /* number of arguments */
|
|
||||||
char *cmd_ptr; /* parse command string */
|
|
||||||
char *label; /* unique name of command */
|
|
||||||
enum dev_style dev_style; /* device style */
|
|
||||||
int s; /* status variable */
|
|
||||||
int len; /* length of string */
|
|
||||||
int r;
|
|
||||||
endpoint_t ep; /* new endpoint no. */
|
|
||||||
|
|
||||||
/* This call requires special privileges. */
|
|
||||||
if (!caller_is_root(m_ptr->m_source)) return(EPERM);
|
|
||||||
|
|
||||||
/* See if there is a free entry in the table with system processes. */
|
|
||||||
for (slot_nr = 0; slot_nr < NR_SYS_PROCS; slot_nr++) {
|
|
||||||
rp = &rproc[slot_nr]; /* get pointer to slot */
|
|
||||||
if (! rp->r_flags & RS_IN_USE) /* check if available */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Obtain command name and parameters. This is a space-separated string
|
|
||||||
* that looks like "/sbin/service arg1 arg2 ...". Arguments are optional.
|
|
||||||
*/
|
|
||||||
if (m_ptr->RS_CMD_LEN > MAX_COMMAND_LEN) return(E2BIG);
|
|
||||||
if (OK!=(s=sys_datacopy(m_ptr->m_source, (vir_bytes) m_ptr->RS_CMD_ADDR,
|
|
||||||
SELF, (vir_bytes) rp->r_cmd, m_ptr->RS_CMD_LEN))) return(s);
|
|
||||||
rp->r_cmd[m_ptr->RS_CMD_LEN] = '\0'; /* ensure it is terminated */
|
|
||||||
if (rp->r_cmd[0] != '/') return(EINVAL); /* insist on absolute path */
|
|
||||||
|
|
||||||
rp->r_script[0]= '\0';
|
|
||||||
|
|
||||||
/* Build argument vector to be passed to execute call. The format of the
|
|
||||||
* arguments vector is: path, arguments, NULL.
|
|
||||||
*/
|
|
||||||
arg_count = 0; /* initialize arg count */
|
|
||||||
rp->r_argv[arg_count++] = rp->r_cmd; /* start with path */
|
|
||||||
cmd_ptr = rp->r_cmd; /* do some parsing */
|
|
||||||
while(*cmd_ptr != '\0') { /* stop at end of string */
|
|
||||||
if (*cmd_ptr == ' ') { /* next argument */
|
|
||||||
*cmd_ptr = '\0'; /* terminate previous */
|
|
||||||
while (*++cmd_ptr == ' ') ; /* skip spaces */
|
|
||||||
if (*cmd_ptr == '\0') break; /* no arg following */
|
|
||||||
if (arg_count>MAX_NR_ARGS+1) break; /* arg vector full */
|
|
||||||
rp->r_argv[arg_count++] = cmd_ptr; /* add to arg vector */
|
|
||||||
}
|
|
||||||
cmd_ptr ++; /* continue parsing */
|
|
||||||
}
|
|
||||||
rp->r_argv[arg_count] = NULL; /* end with NULL pointer */
|
|
||||||
rp->r_argc = arg_count;
|
|
||||||
|
|
||||||
/* Default label for the driver */
|
|
||||||
label= strrchr(rp->r_argv[0], '/');
|
|
||||||
if (label)
|
|
||||||
label++;
|
|
||||||
else
|
|
||||||
label= rp->r_argv[0];
|
|
||||||
len= strlen(label);
|
|
||||||
if (len > MAX_LABEL_LEN-1)
|
|
||||||
len= MAX_LABEL_LEN-1; /* truncate name */
|
|
||||||
memcpy(rp->r_label, label, len);
|
|
||||||
rp->r_label[len]= '\0';
|
|
||||||
if(rs_verbose) printf("RS: do_up: using label '%s'\n", rp->r_label);
|
|
||||||
|
|
||||||
rp->r_uid= 0;
|
|
||||||
rp->r_nice= 0;
|
|
||||||
|
|
||||||
rp->r_sys_flags = DSRV_SF;
|
|
||||||
rp->r_exec= NULL;
|
|
||||||
|
|
||||||
if (do_copy)
|
|
||||||
{
|
|
||||||
s= read_exec(rp);
|
|
||||||
if (s != OK)
|
|
||||||
return s;
|
|
||||||
|
|
||||||
rp->r_sys_flags |= SF_USE_COPY;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize some fields. */
|
|
||||||
rp->r_period = m_ptr->RS_PERIOD;
|
|
||||||
rp->r_dev_nr = m_ptr->RS_DEV_MAJOR;
|
|
||||||
rp->r_dev_style = STYLE_DEV;
|
|
||||||
rp->r_restarts = -1; /* will be incremented */
|
|
||||||
rp->r_set_resources= 0; /* old style */
|
|
||||||
|
|
||||||
/* All information was gathered. Now try to start the system service. */
|
|
||||||
|
|
||||||
r = start_service(rp, flags, &ep);
|
|
||||||
m_ptr->RS_ENDPOINT = ep;
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================*
|
|
||||||
* do_start *
|
|
||||||
*===========================================================================*/
|
|
||||||
PUBLIC int do_start(m_ptr)
|
|
||||||
message *m_ptr; /* request message pointer */
|
message *m_ptr; /* request message pointer */
|
||||||
{
|
{
|
||||||
/* A request was made to start a new system service.
|
/* A request was made to start a new system service.
|
||||||
|
@ -271,7 +165,7 @@ message *m_ptr; /* request message pointer */
|
||||||
}
|
}
|
||||||
if (slot_nr >= NR_SYS_PROCS)
|
if (slot_nr >= NR_SYS_PROCS)
|
||||||
{
|
{
|
||||||
printf("rs`do_start: driver table full\n");
|
printf("RS: do_up: system process table full\n");
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,15 +204,15 @@ message *m_ptr; /* request message pointer */
|
||||||
rp->r_argc = arg_count;
|
rp->r_argc = arg_count;
|
||||||
|
|
||||||
if(rs_start.rss_label.l_len > 0) {
|
if(rs_start.rss_label.l_len > 0) {
|
||||||
/* RS_START caller has supplied a custom label for this driver. */
|
/* RS_UP caller has supplied a custom label for this service. */
|
||||||
int s = copy_label(m_ptr->m_source, &rs_start.rss_label,
|
int s = copy_label(m_ptr->m_source, &rs_start.rss_label,
|
||||||
rp->r_label, sizeof(rp->r_label));
|
rp->r_label, sizeof(rp->r_label));
|
||||||
if(s != OK)
|
if(s != OK)
|
||||||
return s;
|
return s;
|
||||||
if(rs_verbose)
|
if(rs_verbose)
|
||||||
printf("RS: do_start: using label (custom) '%s'\n", rp->r_label);
|
printf("RS: do_up: using label (custom) '%s'\n", rp->r_label);
|
||||||
} else {
|
} else {
|
||||||
/* Default label for the driver. */
|
/* Default label for the service. */
|
||||||
label= strrchr(rp->r_argv[0], '/');
|
label= strrchr(rp->r_argv[0], '/');
|
||||||
if (label)
|
if (label)
|
||||||
label++;
|
label++;
|
||||||
|
@ -330,7 +224,7 @@ message *m_ptr; /* request message pointer */
|
||||||
memcpy(rp->r_label, label, len);
|
memcpy(rp->r_label, label, len);
|
||||||
rp->r_label[len]= '\0';
|
rp->r_label[len]= '\0';
|
||||||
if(rs_verbose)
|
if(rs_verbose)
|
||||||
printf("RS: do_start: using label (from binary %s) '%s'\n",
|
printf("RS: do_up: using label (from binary %s) '%s'\n",
|
||||||
rp->r_argv[0], rp->r_label);
|
rp->r_argv[0], rp->r_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,7 +232,7 @@ message *m_ptr; /* request message pointer */
|
||||||
int i, s;
|
int i, s;
|
||||||
if (rs_start.rss_nr_control > RSS_NR_CONTROL)
|
if (rs_start.rss_nr_control > RSS_NR_CONTROL)
|
||||||
{
|
{
|
||||||
printf("RS: do_start: too many control labels\n");
|
printf("RS: do_up: too many control labels\n");
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
for (i=0; i<rs_start.rss_nr_control; i++) {
|
for (i=0; i<rs_start.rss_nr_control; i++) {
|
||||||
|
@ -350,7 +244,7 @@ message *m_ptr; /* request message pointer */
|
||||||
rp->r_nr_control = rs_start.rss_nr_control;
|
rp->r_nr_control = rs_start.rss_nr_control;
|
||||||
|
|
||||||
if (rs_verbose) {
|
if (rs_verbose) {
|
||||||
printf("RS: do_start: control labels:");
|
printf("RS: do_up: control labels:");
|
||||||
for (i=0; i<rp->r_nr_control; i++)
|
for (i=0; i<rp->r_nr_control; i++)
|
||||||
printf(" %s", rp->r_control[i]);
|
printf(" %s", rp->r_control[i]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -443,7 +337,7 @@ message *m_ptr; /* request message pointer */
|
||||||
/* Copy granted resources */
|
/* Copy granted resources */
|
||||||
if (rs_start.rss_nr_irq > NR_IRQ)
|
if (rs_start.rss_nr_irq > NR_IRQ)
|
||||||
{
|
{
|
||||||
printf("RS: do_start: too many IRQs requested\n");
|
printf("RS: do_up: too many IRQs requested\n");
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
rp->r_priv.s_nr_irq= rs_start.rss_nr_irq;
|
rp->r_priv.s_nr_irq= rs_start.rss_nr_irq;
|
||||||
|
@ -451,12 +345,12 @@ message *m_ptr; /* request message pointer */
|
||||||
{
|
{
|
||||||
rp->r_priv.s_irq_tab[i]= rs_start.rss_irq[i];
|
rp->r_priv.s_irq_tab[i]= rs_start.rss_irq[i];
|
||||||
if(rs_verbose)
|
if(rs_verbose)
|
||||||
printf("RS: do_start: IRQ %d\n", rp->r_priv.s_irq_tab[i]);
|
printf("RS: do_up: IRQ %d\n", rp->r_priv.s_irq_tab[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rs_start.rss_nr_io > NR_IO_RANGE)
|
if (rs_start.rss_nr_io > NR_IO_RANGE)
|
||||||
{
|
{
|
||||||
printf("RS: do_start: too many I/O ranges requested\n");
|
printf("RS: do_up: too many I/O ranges requested\n");
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
rp->r_priv.s_nr_io_range= rs_start.rss_nr_io;
|
rp->r_priv.s_nr_io_range= rs_start.rss_nr_io;
|
||||||
|
@ -466,14 +360,14 @@ message *m_ptr; /* request message pointer */
|
||||||
rp->r_priv.s_io_tab[i].ior_limit=
|
rp->r_priv.s_io_tab[i].ior_limit=
|
||||||
rs_start.rss_io[i].base+rs_start.rss_io[i].len-1;
|
rs_start.rss_io[i].base+rs_start.rss_io[i].len-1;
|
||||||
if(rs_verbose)
|
if(rs_verbose)
|
||||||
printf("RS: do_start: I/O [%x..%x]\n",
|
printf("RS: do_up: I/O [%x..%x]\n",
|
||||||
rp->r_priv.s_io_tab[i].ior_base,
|
rp->r_priv.s_io_tab[i].ior_base,
|
||||||
rp->r_priv.s_io_tab[i].ior_limit);
|
rp->r_priv.s_io_tab[i].ior_limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rs_start.rss_nr_pci_id > RSS_NR_PCI_ID)
|
if (rs_start.rss_nr_pci_id > RSS_NR_PCI_ID)
|
||||||
{
|
{
|
||||||
printf("RS: do_start: too many PCI device IDs\n");
|
printf("RS: do_up: too many PCI device IDs\n");
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
rp->r_nr_pci_id= rs_start.rss_nr_pci_id;
|
rp->r_nr_pci_id= rs_start.rss_nr_pci_id;
|
||||||
|
@ -482,12 +376,12 @@ message *m_ptr; /* request message pointer */
|
||||||
rp->r_pci_id[i].vid= rs_start.rss_pci_id[i].vid;
|
rp->r_pci_id[i].vid= rs_start.rss_pci_id[i].vid;
|
||||||
rp->r_pci_id[i].did= rs_start.rss_pci_id[i].did;
|
rp->r_pci_id[i].did= rs_start.rss_pci_id[i].did;
|
||||||
if(rs_verbose)
|
if(rs_verbose)
|
||||||
printf("RS: do_start: PCI %04x/%04x\n",
|
printf("RS: do_up: PCI %04x/%04x\n",
|
||||||
rp->r_pci_id[i].vid, rp->r_pci_id[i].did);
|
rp->r_pci_id[i].vid, rp->r_pci_id[i].did);
|
||||||
}
|
}
|
||||||
if (rs_start.rss_nr_pci_class > RSS_NR_PCI_CLASS)
|
if (rs_start.rss_nr_pci_class > RSS_NR_PCI_CLASS)
|
||||||
{
|
{
|
||||||
printf("RS: do_start: too many PCI class IDs\n");
|
printf("RS: do_up: too many PCI class IDs\n");
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
rp->r_nr_pci_class= rs_start.rss_nr_pci_class;
|
rp->r_nr_pci_class= rs_start.rss_nr_pci_class;
|
||||||
|
@ -496,7 +390,7 @@ message *m_ptr; /* request message pointer */
|
||||||
rp->r_pci_class[i].class= rs_start.rss_pci_class[i].class;
|
rp->r_pci_class[i].class= rs_start.rss_pci_class[i].class;
|
||||||
rp->r_pci_class[i].mask= rs_start.rss_pci_class[i].mask;
|
rp->r_pci_class[i].mask= rs_start.rss_pci_class[i].mask;
|
||||||
if(rs_verbose)
|
if(rs_verbose)
|
||||||
printf("RS: do_start: PCI class %06x mask %06x\n",
|
printf("RS: do_up: PCI class %06x mask %06x\n",
|
||||||
rp->r_pci_class[i].class, rp->r_pci_class[i].mask);
|
rp->r_pci_class[i].class, rp->r_pci_class[i].mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,7 +404,7 @@ message *m_ptr; /* request message pointer */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
"RS: do_start: internal inconsistency: bad size of r_call_mask\n");
|
"RS: do_up: internal inconsistency: bad size of r_call_mask\n");
|
||||||
memset(rp->r_call_mask, '\0', sizeof(rp->r_call_mask));
|
memset(rp->r_call_mask, '\0', sizeof(rp->r_call_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,9 +413,8 @@ message *m_ptr; /* request message pointer */
|
||||||
rp->r_dev_nr = rs_start.rss_major;
|
rp->r_dev_nr = rs_start.rss_major;
|
||||||
rp->r_dev_style = STYLE_DEV;
|
rp->r_dev_style = STYLE_DEV;
|
||||||
rp->r_restarts = -1; /* will be incremented */
|
rp->r_restarts = -1; /* will be incremented */
|
||||||
rp->r_set_resources= 1; /* new style, enforce
|
rp->r_set_resources= 1; /* set resources */
|
||||||
* I/O resources
|
|
||||||
*/
|
|
||||||
if (sizeof(rp->r_vm) == sizeof(rs_start.rss_vm) &&
|
if (sizeof(rp->r_vm) == sizeof(rs_start.rss_vm) &&
|
||||||
sizeof(rp->r_vm[0]) == sizeof(rs_start.rss_vm[0]))
|
sizeof(rp->r_vm[0]) == sizeof(rs_start.rss_vm[0]))
|
||||||
{
|
{
|
||||||
|
@ -529,7 +422,7 @@ message *m_ptr; /* request message pointer */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("RS: do_start: internal inconsistency: bad size of r_vm\n");
|
printf("RS: do_up: internal inconsistency: bad size of r_vm\n");
|
||||||
memset(rp->r_vm, '\0', sizeof(rp->r_vm));
|
memset(rp->r_vm, '\0', sizeof(rp->r_vm));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -767,7 +660,10 @@ PUBLIC void do_exit(message *m_ptr)
|
||||||
rproc_ptr[proc] = NULL; /* invalidate */
|
rproc_ptr[proc] = NULL; /* invalidate */
|
||||||
rp->r_pid= -1;
|
rp->r_pid= -1;
|
||||||
|
|
||||||
pci_del_acl(rp->r_proc_nr_e); /* Ignore errors */
|
/* If PCI properties are set, inform the PCI driver. */
|
||||||
|
if(rp->r_nr_pci_id || rp->r_nr_pci_class) {
|
||||||
|
pci_del_acl(rp->r_proc_nr_e);
|
||||||
|
}
|
||||||
|
|
||||||
if ((rp->r_flags & RS_EXITING) || shutting_down) {
|
if ((rp->r_flags & RS_EXITING) || shutting_down) {
|
||||||
/* No reply sent to RS_DOWN yet. */
|
/* No reply sent to RS_DOWN yet. */
|
||||||
|
@ -883,7 +779,7 @@ message *m_ptr;
|
||||||
else if (rp->r_period > 0) {
|
else if (rp->r_period > 0) {
|
||||||
|
|
||||||
/* Check if an answer to a status request is still pending. If
|
/* Check if an answer to a status request is still pending. If
|
||||||
* the driver didn't respond within time, kill it to simulate
|
* the service didn't respond within time, kill it to simulate
|
||||||
* a crash. The failure will be detected and the service will
|
* a crash. The failure will be detected and the service will
|
||||||
* be restarted automatically.
|
* be restarted automatically.
|
||||||
*/
|
*/
|
||||||
|
@ -935,7 +831,6 @@ endpoint_t *endpoint;
|
||||||
pid_t child_pid; /* child's process id */
|
pid_t child_pid; /* child's process id */
|
||||||
char *file_only;
|
char *file_only;
|
||||||
int s, use_copy, slot_nr;
|
int s, use_copy, slot_nr;
|
||||||
struct priv *privp;
|
|
||||||
bitchunk_t *vm_mask;
|
bitchunk_t *vm_mask;
|
||||||
message m;
|
message m;
|
||||||
char * null_env = NULL;
|
char * null_env = NULL;
|
||||||
|
@ -1035,36 +930,25 @@ endpoint_t *endpoint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
privp= NULL;
|
/* Set resources when asked to. */
|
||||||
vm_mask = NULL;
|
|
||||||
if (rp->r_set_resources)
|
if (rp->r_set_resources)
|
||||||
{
|
{
|
||||||
|
/* Initialize privilege structure. */
|
||||||
init_privs(rp, &rp->r_priv);
|
init_privs(rp, &rp->r_priv);
|
||||||
privp= &rp->r_priv;
|
|
||||||
|
|
||||||
/* Inform the PCI server about the driver */
|
|
||||||
init_pci(rp, child_proc_nr_e);
|
|
||||||
|
|
||||||
|
/* Tell VM about allowed calls. */
|
||||||
vm_mask = &rp->r_vm[0];
|
vm_mask = &rp->r_vm[0];
|
||||||
|
if ((s = vm_set_priv(child_proc_nr_e, vm_mask)) < 0) {
|
||||||
|
report("RS", "vm_set_priv call failed", s);
|
||||||
|
kill(child_pid, SIGKILL);
|
||||||
|
rp->r_flags |= RS_EXITING;
|
||||||
|
return (s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tell VM about allowed calls, before actually letting the process run. */
|
/* If PCI properties are set, inform the PCI driver about the new service. */
|
||||||
if ((s = vm_set_priv(child_proc_nr_e, vm_mask)) < 0) {
|
if(rp->r_nr_pci_id || rp->r_nr_pci_class) {
|
||||||
report("RS", "vm_set_priv call failed", s);
|
init_pci(rp, child_proc_nr_e);
|
||||||
kill(child_pid, SIGKILL);
|
|
||||||
rp->r_flags |= RS_EXITING;
|
|
||||||
return (s);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set the privilege structure for the child process.
|
|
||||||
* That will also cause the child process to start running.
|
|
||||||
* This call should succeed: we tested number in use above.
|
|
||||||
*/
|
|
||||||
if ((s = set_privs(child_proc_nr_e, privp, SYS_PRIV_SET_SYS)) != OK) {
|
|
||||||
report("RS","set_privs failed", s);
|
|
||||||
kill(child_pid, SIGKILL); /* kill driver */
|
|
||||||
rp->r_flags |= RS_EXITING; /* expect exit */
|
|
||||||
return(s); /* return error */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The purpose of non-blocking forks is to avoid involving VFS in the forking
|
/* The purpose of non-blocking forks is to avoid involving VFS in the forking
|
||||||
|
@ -1089,14 +973,20 @@ endpoint_t *endpoint;
|
||||||
if ((s=mapdriver5(rp->r_label, strlen(rp->r_label),
|
if ((s=mapdriver5(rp->r_label, strlen(rp->r_label),
|
||||||
rp->r_dev_nr, rp->r_dev_style, !!use_copy /* force */)) < 0) {
|
rp->r_dev_nr, rp->r_dev_style, !!use_copy /* force */)) < 0) {
|
||||||
report("RS", "couldn't map driver (continuing)", errno);
|
report("RS", "couldn't map driver (continuing)", errno);
|
||||||
#if 0
|
|
||||||
kill(child_pid, SIGKILL); /* kill driver */
|
|
||||||
rp->r_flags |= RS_EXITING; /* expect exit */
|
|
||||||
return(s); /* return error */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set the privilege structure for the child process.
|
||||||
|
* That will also cause the child process to start running.
|
||||||
|
* This call should succeed: we tested number in use above.
|
||||||
|
*/
|
||||||
|
if ((s = set_privs(child_proc_nr_e, &rp->r_priv, SYS_PRIV_SET_SYS)) != OK) {
|
||||||
|
report("RS","set_privs failed", s);
|
||||||
|
kill(child_pid, SIGKILL); /* kill the service */
|
||||||
|
rp->r_flags |= RS_EXITING; /* expect exit */
|
||||||
|
return(s); /* return error */
|
||||||
|
}
|
||||||
|
|
||||||
if(rs_verbose)
|
if(rs_verbose)
|
||||||
printf("RS: started '%s', major %d, pid %d, endpoint %d, proc %d\n",
|
printf("RS: started '%s', major %d, pid %d, endpoint %d, proc %d\n",
|
||||||
rp->r_cmd, rp->r_dev_nr, child_pid,
|
rp->r_cmd, rp->r_dev_nr, child_pid,
|
||||||
|
@ -1555,7 +1445,7 @@ PRIVATE void init_pci(rp, endpoint)
|
||||||
struct rproc *rp;
|
struct rproc *rp;
|
||||||
int endpoint;
|
int endpoint;
|
||||||
{
|
{
|
||||||
/* Tell the PCI driver about the new driver */
|
/* Inform the PCI driver about the new service. */
|
||||||
size_t len;
|
size_t len;
|
||||||
int i, r;
|
int i, r;
|
||||||
struct rs_pci rs_pci;
|
struct rs_pci rs_pci;
|
||||||
|
|
|
@ -11,8 +11,7 @@ _PROTOTYPE( int dev_execve, (int proc_e,
|
||||||
_PROTOTYPE( int main, (void));
|
_PROTOTYPE( int main, (void));
|
||||||
|
|
||||||
/* manager.c */
|
/* manager.c */
|
||||||
_PROTOTYPE( int do_up, (message *m, int do_copy, int flags));
|
_PROTOTYPE( int do_up, (message *m));
|
||||||
_PROTOTYPE( int do_start, (message *m));
|
|
||||||
_PROTOTYPE( int do_down, (message *m));
|
_PROTOTYPE( int do_down, (message *m));
|
||||||
_PROTOTYPE( int do_refresh, (message *m));
|
_PROTOTYPE( int do_refresh, (message *m));
|
||||||
_PROTOTYPE( int do_restart, (message *m));
|
_PROTOTYPE( int do_restart, (message *m));
|
||||||
|
|
|
@ -35,9 +35,7 @@ PRIVATE char *known_requests[] = {
|
||||||
"down",
|
"down",
|
||||||
"refresh",
|
"refresh",
|
||||||
"restart",
|
"restart",
|
||||||
"-unused",
|
|
||||||
"shutdown",
|
"shutdown",
|
||||||
"upcopy", /* fill for RS_UP_COPY */
|
|
||||||
"catch for illegal requests"
|
"catch for illegal requests"
|
||||||
};
|
};
|
||||||
#define ILLEGAL_REQUEST sizeof(known_requests)/sizeof(char *)
|
#define ILLEGAL_REQUEST sizeof(known_requests)/sizeof(char *)
|
||||||
|
@ -47,7 +45,7 @@ PRIVATE char *known_requests[] = {
|
||||||
|
|
||||||
#define RUN_CMD "run"
|
#define RUN_CMD "run"
|
||||||
#define RUN_SCRIPT "/etc/rs.single" /* Default script for 'run' */
|
#define RUN_SCRIPT "/etc/rs.single" /* Default script for 'run' */
|
||||||
#define PATH_CONFIG _PATH_DRIVERS_CONF /* Default config file */
|
#define PATH_CONFIG _PATH_SYSTEM_CONF /* Default config file */
|
||||||
|
|
||||||
/* Define names for arguments provided to this utility. The first few
|
/* Define names for arguments provided to this utility. The first few
|
||||||
* arguments are required and have a known index. Thereafter, some optional
|
* arguments are required and have a known index. Thereafter, some optional
|
||||||
|
@ -66,7 +64,7 @@ PRIVATE char *known_requests[] = {
|
||||||
#define ARG_DEV "-dev" /* major device number for drivers */
|
#define ARG_DEV "-dev" /* major device number for drivers */
|
||||||
#define ARG_PERIOD "-period" /* heartbeat period in ticks */
|
#define ARG_PERIOD "-period" /* heartbeat period in ticks */
|
||||||
#define ARG_SCRIPT "-script" /* name of the script to restart a
|
#define ARG_SCRIPT "-script" /* name of the script to restart a
|
||||||
* driver
|
* system service
|
||||||
*/
|
*/
|
||||||
#define ARG_LABELNAME "-label" /* custom label name */
|
#define ARG_LABELNAME "-label" /* custom label name */
|
||||||
#define ARG_CONFIG "-config" /* name of the file with the resource
|
#define ARG_CONFIG "-config" /* name of the file with the resource
|
||||||
|
@ -74,7 +72,7 @@ PRIVATE char *known_requests[] = {
|
||||||
*/
|
*/
|
||||||
#define ARG_PRINTEP "-printep" /* print endpoint number after start */
|
#define ARG_PRINTEP "-printep" /* print endpoint number after start */
|
||||||
|
|
||||||
#define DRIVER_LOGIN "driver" /* Passwd file entry for drivers */
|
#define SERVICE_LOGIN "service" /* passwd file entry for services */
|
||||||
|
|
||||||
#define MAX_CLASS_RECURS 100 /* Max nesting level for classes */
|
#define MAX_CLASS_RECURS 100 /* Max nesting level for classes */
|
||||||
|
|
||||||
|
@ -192,8 +190,6 @@ PRIVATE int parse_arguments(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req_nr == RS_UP) {
|
if (req_nr == RS_UP) {
|
||||||
req_nr= RS_START;
|
|
||||||
|
|
||||||
rs_start.rss_flags= RF_IPC_VALID;
|
rs_start.rss_flags= RF_IPC_VALID;
|
||||||
if (c_flag)
|
if (c_flag)
|
||||||
rs_start.rss_flags |= RF_COPY;
|
rs_start.rss_flags |= RF_COPY;
|
||||||
|
@ -205,14 +201,8 @@ PRIVATE int parse_arguments(int argc, char **argv)
|
||||||
{
|
{
|
||||||
/* Set default recovery script for RUN */
|
/* Set default recovery script for RUN */
|
||||||
req_script = RUN_SCRIPT;
|
req_script = RUN_SCRIPT;
|
||||||
req_nr = RS_START;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (req_nr == RS_UP && c_flag)
|
|
||||||
req_nr= RS_UP_COPY;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Verify argument count. */
|
/* Verify argument count. */
|
||||||
if (argc - 1 < optind+ARG_PATH) {
|
if (argc - 1 < optind+ARG_PATH) {
|
||||||
print_usage(argv[ARG_NAME], "action requires a binary to start");
|
print_usage(argv[ARG_NAME], "action requires a binary to start");
|
||||||
|
@ -276,15 +266,12 @@ PRIVATE int parse_arguments(int argc, char **argv)
|
||||||
}
|
}
|
||||||
else if (strcmp(argv[i], ARG_SCRIPT)==0) {
|
else if (strcmp(argv[i], ARG_SCRIPT)==0) {
|
||||||
req_script = argv[i+1];
|
req_script = argv[i+1];
|
||||||
req_nr = RS_START;
|
|
||||||
}
|
}
|
||||||
else if (strcmp(argv[i], ARG_LABELNAME)==0) {
|
else if (strcmp(argv[i], ARG_LABELNAME)==0) {
|
||||||
req_label = argv[i+1];
|
req_label = argv[i+1];
|
||||||
req_nr = RS_START;
|
|
||||||
}
|
}
|
||||||
else if (strcmp(argv[i], ARG_CONFIG)==0) {
|
else if (strcmp(argv[i], ARG_CONFIG)==0) {
|
||||||
req_config = argv[i+1];
|
req_config = argv[i+1];
|
||||||
req_nr = RS_START;
|
|
||||||
}
|
}
|
||||||
else if (strcmp(argv[i], ARG_PRINTEP)==0) {
|
else if (strcmp(argv[i], ARG_PRINTEP)==0) {
|
||||||
req_printep = 1;
|
req_printep = 1;
|
||||||
|
@ -325,7 +312,7 @@ PRIVATE void fatal(char *fmt, ...)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define KW_DRIVER "driver"
|
#define KW_SERVICE "service"
|
||||||
#define KW_UID "uid"
|
#define KW_UID "uid"
|
||||||
#define KW_NICE "nice"
|
#define KW_NICE "nice"
|
||||||
#define KW_IRQ "irq"
|
#define KW_IRQ "irq"
|
||||||
|
@ -338,7 +325,7 @@ PRIVATE void fatal(char *fmt, ...)
|
||||||
#define KW_VM "vm"
|
#define KW_VM "vm"
|
||||||
#define KW_CONTROL "control"
|
#define KW_CONTROL "control"
|
||||||
|
|
||||||
FORWARD void do_driver(config_t *cpe, config_t *config);
|
FORWARD void do_service(config_t *cpe, config_t *config);
|
||||||
|
|
||||||
PRIVATE void do_class(config_t *cpe, config_t *config)
|
PRIVATE void do_class(config_t *cpe, config_t *config)
|
||||||
{
|
{
|
||||||
|
@ -382,10 +369,10 @@ PRIVATE void do_class(config_t *cpe, config_t *config)
|
||||||
cp1->file, cp1->line);
|
cp1->file, cp1->line);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* At this place we expect the word 'driver' */
|
/* At this place we expect the word KW_SERVICE */
|
||||||
if (strcmp(cp1->word, KW_DRIVER) != 0)
|
if (strcmp(cp1->word, KW_SERVICE) != 0)
|
||||||
fatal("do_class: exected word '%S' at %s:%d",
|
fatal("do_class: exected word '%S' at %s:%d",
|
||||||
KW_DRIVER, cp1->file, cp1->line);
|
KW_SERVICE, cp1->file, cp1->line);
|
||||||
|
|
||||||
cp1= cp1->next;
|
cp1= cp1->next;
|
||||||
if ((cp1->flags & CFG_STRING) ||
|
if ((cp1->flags & CFG_STRING) ||
|
||||||
|
@ -395,7 +382,7 @@ PRIVATE void do_class(config_t *cpe, config_t *config)
|
||||||
cp1->file, cp1->line);
|
cp1->file, cp1->line);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* At this place we expect the name of the driver */
|
/* At this place we expect the name of the service */
|
||||||
if (strcmp(cp1->word, cpe->word) == 0)
|
if (strcmp(cp1->word, cpe->word) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -405,7 +392,7 @@ PRIVATE void do_class(config_t *cpe, config_t *config)
|
||||||
"do_class: no entry found for class '%s' at %s:%d",
|
"do_class: no entry found for class '%s' at %s:%d",
|
||||||
cpe->word, cpe->file, cpe->line);
|
cpe->word, cpe->file, cpe->line);
|
||||||
}
|
}
|
||||||
do_driver(cp1->next, config);
|
do_service(cp1->next, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
class_recurs--;
|
class_recurs--;
|
||||||
|
@ -887,7 +874,7 @@ PRIVATE void do_control(config_t *cpe)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRIVATE void do_driver(config_t *cpe, config_t *config)
|
PRIVATE void do_service(config_t *cpe, config_t *config)
|
||||||
{
|
{
|
||||||
config_t *cp;
|
config_t *cp;
|
||||||
|
|
||||||
|
@ -896,13 +883,13 @@ PRIVATE void do_driver(config_t *cpe, config_t *config)
|
||||||
*/
|
*/
|
||||||
if (!(cpe->flags & CFG_SUBLIST))
|
if (!(cpe->flags & CFG_SUBLIST))
|
||||||
{
|
{
|
||||||
fatal("do_driver: expected list at %s:%d",
|
fatal("do_service: expected list at %s:%d",
|
||||||
cpe->file, cpe->line);
|
cpe->file, cpe->line);
|
||||||
}
|
}
|
||||||
if (cpe->next != NULL)
|
if (cpe->next != NULL)
|
||||||
{
|
{
|
||||||
cpe= cpe->next;
|
cpe= cpe->next;
|
||||||
fatal("do_driver: expected end of list at %s:%d",
|
fatal("do_service: expected end of list at %s:%d",
|
||||||
cpe->file, cpe->line);
|
cpe->file, cpe->line);
|
||||||
}
|
}
|
||||||
cpe= cpe->list;
|
cpe= cpe->list;
|
||||||
|
@ -912,13 +899,13 @@ PRIVATE void do_driver(config_t *cpe, config_t *config)
|
||||||
{
|
{
|
||||||
if (!(cp->flags & CFG_SUBLIST))
|
if (!(cp->flags & CFG_SUBLIST))
|
||||||
{
|
{
|
||||||
fatal("do_driver: expected list at %s:%d",
|
fatal("do_service: expected list at %s:%d",
|
||||||
cp->file, cp->line);
|
cp->file, cp->line);
|
||||||
}
|
}
|
||||||
cpe= cp->list;
|
cpe= cp->list;
|
||||||
if ((cpe->flags & CFG_STRING) || (cpe->flags & CFG_SUBLIST))
|
if ((cpe->flags & CFG_STRING) || (cpe->flags & CFG_SUBLIST))
|
||||||
{
|
{
|
||||||
fatal("do_driver: expected word at %s:%d",
|
fatal("do_service: expected word at %s:%d",
|
||||||
cpe->file, cpe->line);
|
cpe->file, cpe->line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -987,7 +974,7 @@ PRIVATE void do_config(char *label, char *filename)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find an entry for our driver */
|
/* Find an entry for our service */
|
||||||
for (cp= config; cp; cp= cp->next)
|
for (cp= config; cp; cp= cp->next)
|
||||||
{
|
{
|
||||||
if (!(cp->flags & CFG_SUBLIST))
|
if (!(cp->flags & CFG_SUBLIST))
|
||||||
|
@ -1002,10 +989,10 @@ PRIVATE void do_config(char *label, char *filename)
|
||||||
cpe->file, cpe->line);
|
cpe->file, cpe->line);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* At this place we expect the word 'driver' */
|
/* At this place we expect the word KW_SERVICE */
|
||||||
if (strcmp(cpe->word, KW_DRIVER) != 0)
|
if (strcmp(cpe->word, KW_SERVICE) != 0)
|
||||||
fatal("do_config: exected word '%S' at %s:%d",
|
fatal("do_config: exected word '%S' at %s:%d",
|
||||||
KW_DRIVER, cpe->file, cpe->line);
|
KW_SERVICE, cpe->file, cpe->line);
|
||||||
|
|
||||||
cpe= cpe->next;
|
cpe= cpe->next;
|
||||||
if ((cpe->flags & CFG_STRING) || (cpe->flags & CFG_SUBLIST))
|
if ((cpe->flags & CFG_STRING) || (cpe->flags & CFG_SUBLIST))
|
||||||
|
@ -1014,20 +1001,20 @@ PRIVATE void do_config(char *label, char *filename)
|
||||||
cpe->file, cpe->line);
|
cpe->file, cpe->line);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* At this place we expect the name of the driver */
|
/* At this place we expect the name of the service. */
|
||||||
if (strcmp(cpe->word, label) == 0)
|
if (strcmp(cpe->word, label) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (cp == NULL)
|
if (cp == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "service: driver '%s' not found in config\n",
|
fprintf(stderr, "service: service '%s' not found in config\n",
|
||||||
label);
|
label);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cpe= cpe->next;
|
cpe= cpe->next;
|
||||||
|
|
||||||
do_driver(cpe, config);
|
do_service(cpe, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Main program.
|
/* Main program.
|
||||||
|
@ -1060,22 +1047,6 @@ PUBLIC int main(int argc, char **argv)
|
||||||
*/
|
*/
|
||||||
switch(request) {
|
switch(request) {
|
||||||
case RS_UP:
|
case RS_UP:
|
||||||
case RS_UP_COPY:
|
|
||||||
/* Build space-separated command string to be passed to RS server. */
|
|
||||||
strcpy(command, req_path);
|
|
||||||
command[strlen(req_path)] = ' ';
|
|
||||||
strcpy(command+strlen(req_path)+1, req_args);
|
|
||||||
|
|
||||||
/* Build request message and send the request. */
|
|
||||||
m.RS_CMD_ADDR = command;
|
|
||||||
m.RS_CMD_LEN = strlen(command);
|
|
||||||
m.RS_DEV_MAJOR = req_major;
|
|
||||||
m.RS_PERIOD = req_period;
|
|
||||||
if (OK != (s=_taskcall(RS_PROC_NR, request, &m)))
|
|
||||||
failure(-s);
|
|
||||||
result = m.m_type;
|
|
||||||
break;
|
|
||||||
case RS_START:
|
|
||||||
/* Build space-separated command string to be passed to RS server. */
|
/* Build space-separated command string to be passed to RS server. */
|
||||||
strcpy(command, req_path);
|
strcpy(command, req_path);
|
||||||
command[strlen(req_path)] = ' ';
|
command[strlen(req_path)] = ' ';
|
||||||
|
@ -1098,12 +1069,12 @@ PUBLIC int main(int argc, char **argv)
|
||||||
else
|
else
|
||||||
rs_start.rss_scriptlen= 0;
|
rs_start.rss_scriptlen= 0;
|
||||||
|
|
||||||
pw= getpwnam(DRIVER_LOGIN);
|
pw= getpwnam(SERVICE_LOGIN);
|
||||||
if (pw == NULL)
|
if (pw == NULL)
|
||||||
fatal("no passwd file entry for '%s'", DRIVER_LOGIN);
|
fatal("no passwd file entry for '%s'", SERVICE_LOGIN);
|
||||||
rs_start.rss_uid= pw->pw_uid;
|
rs_start.rss_uid= pw->pw_uid;
|
||||||
|
|
||||||
/* The name of the driver */
|
/* The name of the system service. */
|
||||||
(label= strrchr(req_path, '/')) ? label++ : (label= req_path);
|
(label= strrchr(req_path, '/')) ? label++ : (label= req_path);
|
||||||
|
|
||||||
if (req_config) {
|
if (req_config) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ struct rproc {
|
||||||
char *r_exec; /* Executable image */
|
char *r_exec; /* Executable image */
|
||||||
size_t r_exec_len; /* Length of image */
|
size_t r_exec_len; /* Length of image */
|
||||||
|
|
||||||
char r_label[MAX_LABEL_LEN]; /* unique name of this driver */
|
char r_label[MAX_LABEL_LEN]; /* unique name of this service */
|
||||||
char r_cmd[MAX_COMMAND_LEN]; /* raw command plus arguments */
|
char r_cmd[MAX_COMMAND_LEN]; /* raw command plus arguments */
|
||||||
char r_script[MAX_SCRIPT_LEN]; /* name of the restart script executable */
|
char r_script[MAX_SCRIPT_LEN]; /* name of the restart script executable */
|
||||||
char *r_argv[MAX_NR_ARGS+2]; /* parsed arguments vector */
|
char *r_argv[MAX_NR_ARGS+2]; /* parsed arguments vector */
|
||||||
|
|
Loading…
Reference in a new issue