Changed Makefiles for mkdep script.

Updated debugging dumps at IS server, and function key control.

NOTE: pm modified with DEBUG() output, to be removed later.
This commit is contained in:
Jorrit Herder 2005-06-24 16:21:21 +00:00
parent e3bb0e40ee
commit 042c4ac395
19 changed files with 165 additions and 756 deletions

View File

@ -13,9 +13,10 @@ usage:
@echo "" >&2 @echo "" >&2
build: all build: all
all install clean: all install depend clean:
cd ./pm && $(MAKE) $@ cd ./pm && $(MAKE) $@
cd ./fs && $(MAKE) $@ cd ./fs && $(MAKE) $@
cd ./sm && $(MAKE) $@
cd ./is && $(MAKE) $@ cd ./is && $(MAKE) $@
cd ./init && $(MAKE) $@ cd ./init && $(MAKE) $@
cd ./inet && $(MAKE) $@ cd ./inet && $(MAKE) $@

View File

@ -33,224 +33,9 @@ install: /usr/sbin/servers/$(SERVER)
clean: clean:
rm -f $(SERVER) *.o *.bak rm -f $(SERVER) *.o *.bak
# dependencies depend:
a= fs.h $h/config.h $s/types.h $h/const.h $h/type.h \ /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend
$i/limits.h $i/errno.h $i/ansi.h $h/syslib.h \
const.h type.h proto.h glo.h $s/dir.h
cache.o: $a # Include generated dependencies.
cache.o: $h/com.h include .depend
cache.o: buf.h
cache.o: file.h
cache.o: fproc.h
cache.o: super.h
cache2.o: $a
cache2.o: $h/com.h
cache2.o: buf.h
device.o: $a
device.o: $i/fcntl.h
device.o: $h/callnr.h
device.o: $h/com.h
device.o: dmap.h
device.o: file.h
device.o: fproc.h
device.o: inode.h
device.o: param.h
dmap.o: $a
dmap.o: $i/string.h
dmap.o: $h/com.h
dmap.o: $h/utils.h
dmap.o: dmap.h
filedes.o: $a
filedes.o: file.h
filedes.o: fproc.h
filedes.o: inode.h
inode.o: $a
inode.o: buf.h
inode.o: file.h
inode.o: fproc.h
inode.o: inode.h
inode.o: super.h
link.o: $a
link.o: $s/stat.h
link.o: $i/string.h
link.o: $h/com.h
link.o: $h/callnr.h
link.o: buf.h
link.o: file.h
link.o: fproc.h
link.o: inode.h
link.o: param.h
link.o: super.h
lock.o: $a
lock.o: $h/com.h
lock.o: $i/fcntl.h
lock.o: $i/unistd.h
lock.o: file.h
lock.o: fproc.h
lock.o: inode.h
lock.o: lock.h
lock.o: param.h
main.o: $a
main.o: $i/fcntl.h
main.o: $i/string.h
main.o: $i/stdlib.h
main.o: $h/ioctl.h
main.o: $h/utils.h
main.o: $s/ioc_memory.h
main.o: $s/svrctl.h
main.o: $h/callnr.h
main.o: $h/com.h
main.o: $h/keymap.h
main.o: buf.h
main.o: dmap.h
main.o: file.h
main.o: fproc.h
main.o: inode.h
main.o: param.h
main.o: super.h
misc.o: $a
misc.o: $i/fcntl.h
misc.o: $i/unistd.h
misc.o: $h/callnr.h
misc.o: $h/com.h
misc.o: $s/svrctl.h
misc.o: buf.h
misc.o: file.h
misc.o: fproc.h
misc.o: inode.h
misc.o: dmap.h
misc.o: param.h
misc.o: super.h
mount.o: $a
mount.o: $i/fcntl.h
mount.o: $h/com.h
mount.o: $s/stat.h
mount.o: buf.h
mount.o: dmap.h
mount.o: file.h
mount.o: fproc.h
mount.o: inode.h
mount.o: param.h
mount.o: super.h
open.o: $a
open.o: $s/stat.h
open.o: $i/fcntl.h
open.o: $h/callnr.h
open.o: $h/com.h
open.o: buf.h
open.o: dmap.h
open.o: file.h
open.o: fproc.h
open.o: inode.h
open.o: lock.h
open.o: param.h
open.o: super.h
path.o: $a
path.o: $i/string.h
path.o: $h/callnr.h
path.o: buf.h
path.o: file.h
path.o: fproc.h
path.o: inode.h
path.o: super.h
pipe.o: $a
pipe.o: $i/fcntl.h
pipe.o: $i/signal.h
pipe.o: $h/callnr.h
pipe.o: $h/com.h
pipe.o: dmap.h
pipe.o: file.h
pipe.o: fproc.h
pipe.o: inode.h
pipe.o: param.h
protect.o: $a
protect.o: $i/unistd.h
protect.o: $h/callnr.h
protect.o: buf.h
protect.o: file.h
protect.o: fproc.h
protect.o: inode.h
protect.o: param.h
protect.o: super.h
read.o: $a
read.o: $i/fcntl.h
read.o: $h/com.h
read.o: buf.h
read.o: file.h
read.o: fproc.h
read.o: inode.h
read.o: param.h
read.o: super.h
stadir.o: $a
stadir.o: $s/stat.h
stadir.o: $h/com.h
stadir.o: file.h
stadir.o: fproc.h
stadir.o: inode.h
stadir.o: param.h
super.o: $a
super.o: $i/string.h
super.o: buf.h
super.o: inode.h
super.o: super.h
table.o: $a
table.o: $h/callnr.h
table.o: $h/com.h
table.o: buf.h
table.o: file.h
table.o: fproc.h
table.o: inode.h
table.o: lock.h
table.o: super.h
time.o: $a
time.o: $h/callnr.h
time.o: $h/com.h
time.o: file.h
time.o: fproc.h
time.o: inode.h
time.o: param.h
cmostime.o: $a
cmostime.o: $i/time.h
cmostime.o: $i/ibm/cmos.h
cmostime.o: $h/callnr.h
cmostime.o: $h/com.h
utility.o: $a
utility.o: $h/com.h
utility.o: $i/unistd.h
utility.o: buf.h
utility.o: file.h
utility.o: fproc.h
utility.o: inode.h
utility.o: param.h
write.o: $a
write.o: $i/string.h
write.o: buf.h
write.o: file.h
write.o: fproc.h
write.o: inode.h
write.o: super.h

View File

@ -70,7 +70,7 @@ PUBLIC void main()
*/ */
fs_expire_timers(m_in.NOTIFY_ARG); fs_expire_timers(m_in.NOTIFY_ARG);
} else if(call_nr == DEV_SELECTED) { } else if(call_nr == DEV_SELECTED) {
/* device notify()s us of fd that has become usable */ /* Device notify()s us of fd that has become usable. */
select_notified(&m_in); select_notified(&m_in);
} else { } else {
/* Call the internal function that does the work. */ /* Call the internal function that does the work. */

View File

@ -41,370 +41,50 @@ install: /usr/sbin/servers/$(SERVER)
install -o root -cs $? $@ install -o root -cs $? $@
clean: clean:
rm -f $(SERVER) *.a *.o */*.o */*.a *.bak .all rm -f $(SERVER) *.a *.o */*.o */*.a *.bak
# depencencies depend:
.all: $h/com.h /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c generic/*.c > .depend
.all: $h/config.h
.all: $h/const.h
.all: $h/syslib.h
.all: $h/type.h
.all: $i/ansi.h
.all: $i/errno.h
.all: $i/stddef.h
.all: $i/stdlib.h
.all: $i/string.h
.all: $n/gen/eth_hdr.h
.all: $n/gen/eth_io.h
.all: $n/gen/ether.h
.all: $n/gen/icmp.h
.all: $n/gen/icmp_hdr.h
.all: $n/gen/in.h
.all: $n/gen/ip_hdr.h
.all: $n/gen/ip_io.h
.all: $n/gen/oneCsum.h
.all: $n/gen/psip_hdr.h
.all: $n/gen/psip_io.h
.all: $n/gen/route.h
.all: $n/gen/tcp.h
.all: $n/gen/tcp_hdr.h
.all: $n/gen/tcp_io.h
.all: $n/gen/udp.h
.all: $n/gen/udp_hdr.h
.all: $n/gen/udp_io.h
.all: $n/hton.h
.all: $h/ioctl.h
.all: $n/ioctl.h
.all: $s/types.h
.all: const.h
.all: inet_config.h
.all: inet.h
touch .all
a = .all # Trick to avoid many dependencies (that overload make)
buf.o: $g/assert.h # Include generated dependencies.
buf.o: $g/buf.h include .depend
buf.o: $g/type.h
buf.o: $i/stdlib.h
buf.o: $i/string.h
buf.o: inet.h
buf.o: $a
clock.o: $g/assert.h
clock.o: $g/buf.h
clock.o: $g/clock.h
clock.o: $g/type.h
clock.o: inet.h
clock.o: proto.h
clock.o: $a
inet.o: $g/arp.h
inet.o: $g/assert.h
inet.o: $g/buf.h
inet.o: $g/clock.h
inet.o: $g/eth.h
inet.o: $g/event.h
inet.o: $g/ip.h
inet.o: $g/psip.h
inet.o: $g/sr.h
inet.o: $g/tcp.h
inet.o: $g/type.h
inet.o: $g/udp.h
inet.o: $i/unistd.h
inet.o: $h/utils.h
inet.o: $s/svrctl.h
inet.o: inet.h
inet.o: mq.h
inet.o: proto.h
inet.o: $a
inet_config.o: $i/unistd.h
inet_config.o: $i/fcntl.h
inet_config.o: $s/stat.h
inet_config.o: $a
mnx_eth.o: $g/assert.h
mnx_eth.o: $g/buf.h
mnx_eth.o: $g/clock.h
mnx_eth.o: $g/eth.h
mnx_eth.o: $g/eth_int.h
mnx_eth.o: $g/sr.h
mnx_eth.o: $g/type.h
mnx_eth.o: inet.h
mnx_eth.o: osdep_eth.h
mnx_eth.o: $g/event.h
mnx_eth.o: proto.h
mnx_eth.o: $a
mq.o: $g/assert.h
mq.o: inet.h
mq.o: mq.h
mq.o: $a
sr.o: $g/assert.h
sr.o: $g/buf.h
sr.o: $g/sr.h
sr.o: $g/type.h
sr.o: $h/callnr.h
sr.o: inet.h
sr.o: mq.h
sr.o: proto.h
sr.o: $a
stacktrace.o: inet.h
stacktrace.o: $a
$g/arp.o: $g/arp.h
$g/arp.o: $g/assert.h
$g/arp.o: $g/buf.h
$g/arp.o: $g/clock.h
$g/arp.o: $g/eth.h
$g/arp.o: inet.h
$g/arp.o: $g/io.h
$g/arp.o: $g/sr.h
$g/arp.o: $g/type.h
$g/arp.o: $a
$g/arp.o: $g/arp.c $g/arp.o: $g/arp.c
cd generic && $(CC) -c $(CFLAGS) arp.c cd generic && $(CC) -c $(CFLAGS) arp.c
$g/eth.o: $g/assert.h
$g/eth.o: $g/buf.h
$g/eth.o: $g/buf.h
$g/eth.o: $g/clock.h
$g/eth.o: $g/eth.h
$g/eth.o: $g/eth_int.h
$g/eth.o: $g/event.h
$g/eth.o: inet.h
$g/eth.o: $g/io.h
$g/eth.o: osdep_eth.h
$g/eth.o: $g/event.h
$g/eth.o: $g/sr.h
$g/eth.o: $g/type.h
$g/eth.o: $a
$g/eth.o: $g/eth.c $g/eth.o: $g/eth.c
cd generic && $(CC) -c $(CFLAGS) eth.c cd generic && $(CC) -c $(CFLAGS) eth.c
$g/event.o: $g/assert.h
$g/event.o: $g/event.h
$g/event.o: inet.h
$g/event.o: $a
$g/event.o: $g/event.c $g/event.o: $g/event.c
cd generic && $(CC) -c $(CFLAGS) event.c cd generic && $(CC) -c $(CFLAGS) event.c
$g/icmp.o: $g/assert.h
$g/icmp.o: $g/buf.h
$g/icmp.o: $g/event.h
$g/icmp.o: $g/icmp.h
$g/icmp.o: $g/icmp_lib.h
$g/icmp.o: inet.h
$g/icmp.o: $g/io.h
$g/icmp.o: $g/ip.h
$g/icmp.o: $g/ip_int.h
$g/icmp.o: $g/ipr.h
$g/icmp.o: $g/type.h
$g/icmp.o: $a
$g/icmp.o: $g/icmp.c $g/icmp.o: $g/icmp.c
cd generic && $(CC) -c $(CFLAGS) icmp.c cd generic && $(CC) -c $(CFLAGS) icmp.c
$g/io.o: $i/stdlib.h
$g/io.o: inet.h
$g/io.o: $g/io.h
$g/io.o: $a
$g/io.o: $g/io.c $g/io.o: $g/io.c
cd generic && $(CC) -c $(CFLAGS) io.c cd generic && $(CC) -c $(CFLAGS) io.c
$g/ip.o: $g/arp.h
$g/ip.o: $g/assert.h
$g/ip.o: $g/buf.h
$g/ip.o: $g/clock.h
$g/ip.o: $g/eth.h
$g/ip.o: $g/event.h
$g/ip.o: $g/icmp.h
$g/ip.o: $g/icmp_lib.h
$g/ip.o: inet.h
$g/ip.o: $g/io.h
$g/ip.o: $g/ip.h
$g/ip.o: $g/ip_int.h
$g/ip.o: $g/ipr.h
$g/ip.o: $g/sr.h
$g/ip.o: $g/type.h
$g/ip.o: $a
$g/ip.o: $g/ip.c $g/ip.o: $g/ip.c
cd generic && $(CC) -c $(CFLAGS) ip.c cd generic && $(CC) -c $(CFLAGS) ip.c
$g/ip_eth.o: $g/arp.h
$g/ip_eth.o: $g/assert.h
$g/ip_eth.o: $g/buf.h
$g/ip_eth.o: $g/clock.h
$g/ip_eth.o: $g/eth.h
$g/ip_eth.o: $g/event.h
$g/ip_eth.o: inet.h
$g/ip_eth.o: $g/ip.h
$g/ip_eth.o: $g/ip_int.h
$g/ip_eth.o: $g/type.h
$g/ip_eth.o: $a
$g/ip_eth.o: $g/ip_eth.c $g/ip_eth.o: $g/ip_eth.c
cd generic && $(CC) -c $(CFLAGS) ip_eth.c cd generic && $(CC) -c $(CFLAGS) ip_eth.c
$g/ip_ioctl.o: $g/arp.h
$g/ip_ioctl.o: $g/assert.h
$g/ip_ioctl.o: $g/buf.h
$g/ip_ioctl.o: $g/clock.h
$g/ip_ioctl.o: $g/event.h
$g/ip_ioctl.o: $g/icmp_lib.h
$g/ip_ioctl.o: inet.h
$g/ip_ioctl.o: $g/ip.h
$g/ip_ioctl.o: $g/ip_int.h
$g/ip_ioctl.o: $g/ipr.h
$g/ip_ioctl.o: $g/type.h
$g/ip_ioctl.o: $a
$g/ip_ioctl.o: $g/ip_ioctl.c $g/ip_ioctl.o: $g/ip_ioctl.c
cd generic && $(CC) -c $(CFLAGS) ip_ioctl.c cd generic && $(CC) -c $(CFLAGS) ip_ioctl.c
$g/ip_lib.o: $g/assert.h
$g/ip_lib.o: $g/buf.h
$g/ip_lib.o: $g/event.h
$g/ip_lib.o: inet.h
$g/ip_lib.o: $g/io.h
$g/ip_lib.o: $g/ip_int.h
$g/ip_lib.o: $g/type.h
$g/ip_lib.o: $a
$g/ip_lib.o: $g/ip_lib.c $g/ip_lib.o: $g/ip_lib.c
cd generic && $(CC) -c $(CFLAGS) ip_lib.c cd generic && $(CC) -c $(CFLAGS) ip_lib.c
$g/ip_ps.o: $g/assert.h
$g/ip_ps.o: $g/buf.h
$g/ip_ps.o: $g/event.h
$g/ip_ps.o: inet.h
$g/ip_ps.o: $g/ip.h
$g/ip_ps.o: $g/ip_int.h
$g/ip_ps.o: $g/psip.h
$g/ip_ps.o: $g/type.h
$g/ip_ps.o: $a
$g/ip_ps.o: $g/ip_ps.c $g/ip_ps.o: $g/ip_ps.c
cd generic && $(CC) -c $(CFLAGS) ip_ps.c cd generic && $(CC) -c $(CFLAGS) ip_ps.c
$g/ip_read.o: $g/assert.h
$g/ip_read.o: $g/buf.h
$g/ip_read.o: $g/clock.h
$g/ip_read.o: $g/event.h
$g/ip_read.o: $g/icmp_lib.h
$g/ip_read.o: inet.h
$g/ip_read.o: $g/io.h
$g/ip_read.o: $g/ip.h
$g/ip_read.o: $g/ip_int.h
$g/ip_read.o: $g/ipr.h
$g/ip_read.o: $g/type.h
$g/ip_read.o: $a
$g/ip_read.o: $g/ip_read.c $g/ip_read.o: $g/ip_read.c
cd generic && $(CC) -c $(CFLAGS) ip_read.c cd generic && $(CC) -c $(CFLAGS) ip_read.c
$g/ip_write.o: $g/arp.h
$g/ip_write.o: $g/assert.h
$g/ip_write.o: $g/buf.h
$g/ip_write.o: $g/clock.h
$g/ip_write.o: $g/eth.h
$g/ip_write.o: $g/event.h
$g/ip_write.o: $g/icmp_lib.h
$g/ip_write.o: inet.h
$g/ip_write.o: $g/io.h
$g/ip_write.o: $g/ip.h
$g/ip_write.o: $g/ip_int.h
$g/ip_write.o: $g/ipr.h
$g/ip_write.o: $g/type.h
$g/ip_write.o: $a
$g/ip_write.o: $g/ip_write.c $g/ip_write.o: $g/ip_write.c
cd generic && $(CC) -c $(CFLAGS) ip_write.c cd generic && $(CC) -c $(CFLAGS) ip_write.c
$g/ipr.o: $g/assert.h
$g/ipr.o: $g/buf.h
$g/ipr.o: $g/clock.h
$g/ipr.o: $g/event.h
$g/ipr.o: inet.h
$g/ipr.o: $g/io.h
$g/ipr.o: $g/ip_int.h
$g/ipr.o: $g/ipr.h
$g/ipr.o: $g/type.h
$g/ipr.o: $a
$g/ipr.o: $g/ipr.c $g/ipr.o: $g/ipr.c
cd generic && $(CC) -c $(CFLAGS) ipr.c cd generic && $(CC) -c $(CFLAGS) ipr.c
$g/psip.o: $g/assert.h
$g/psip.o: $g/buf.h
$g/psip.o: $g/event.h
$g/psip.o: inet.h
$g/psip.o: $g/ip_int.h
$g/psip.o: $g/psip.h
$g/psip.o: $g/sr.h
$g/psip.o: $g/type.h
$g/psip.o: $a
$g/psip.o: $g/psip.c $g/psip.o: $g/psip.c
cd generic && $(CC) -c $(CFLAGS) psip.c cd generic && $(CC) -c $(CFLAGS) psip.c
$g/tcp.o: $g/assert.h
$g/tcp.o: $g/buf.h
$g/tcp.o: $g/clock.h
$g/tcp.o: $g/event.h
$g/tcp.o: inet.h
$g/tcp.o: $g/io.h
$g/tcp.o: $g/ip.h
$g/tcp.o: $g/sr.h
$g/tcp.o: $g/tcp.h
$g/tcp.o: $g/tcp_int.h
$g/tcp.o: $g/type.h
$g/tcp.o: $a
$g/tcp.o: $g/tcp.c $g/tcp.o: $g/tcp.c
cd generic && $(CC) -c $(CFLAGS) tcp.c cd generic && $(CC) -c $(CFLAGS) tcp.c
$g/tcp_lib.o: $g/assert.h
$g/tcp_lib.o: $g/buf.h
$g/tcp_lib.o: $g/clock.h
$g/tcp_lib.o: $g/event.h
$g/tcp_lib.o: inet.h
$g/tcp_lib.o: $g/io.h
$g/tcp_lib.o: $g/tcp_int.h
$g/tcp_lib.o: $g/type.h
$g/tcp_lib.o: $a
$g/tcp_lib.o: $g/tcp_lib.c $g/tcp_lib.o: $g/tcp_lib.c
cd generic && $(CC) -c $(CFLAGS) tcp_lib.c cd generic && $(CC) -c $(CFLAGS) tcp_lib.c
$g/tcp_recv.o: $g/assert.h
$g/tcp_recv.o: $g/buf.h
$g/tcp_recv.o: $g/clock.h
$g/tcp_recv.o: $g/event.h
$g/tcp_recv.o: inet.h
$g/tcp_recv.o: $g/io.h
$g/tcp_recv.o: $g/tcp.h
$g/tcp_recv.o: $g/tcp_int.h
$g/tcp_recv.o: $g/type.h
$g/tcp_recv.o: $a
$g/tcp_recv.o: $g/tcp_recv.c $g/tcp_recv.o: $g/tcp_recv.c
cd generic && $(CC) -c $(CFLAGS) tcp_recv.c cd generic && $(CC) -c $(CFLAGS) tcp_recv.c
$g/tcp_send.o: $g/assert.h
$g/tcp_send.o: $g/buf.h
$g/tcp_send.o: $g/clock.h
$g/tcp_send.o: $g/event.h
$g/tcp_send.o: inet.h
$g/tcp_send.o: $g/io.h
$g/tcp_send.o: $g/ip.h
$g/tcp_send.o: $g/tcp.h
$g/tcp_send.o: $g/tcp_int.h
$g/tcp_send.o: $g/type.h
$g/tcp_send.o: $a
$g/tcp_send.o: $g/tcp_send.c $g/tcp_send.o: $g/tcp_send.c
cd generic && $(CC) -c $(CFLAGS) tcp_send.c cd generic && $(CC) -c $(CFLAGS) tcp_send.c
$g/udp.o: $g/assert.h
$g/udp.o: $g/buf.h
$g/udp.o: $g/clock.h
$g/udp.o: $g/icmp_lib.h
$g/udp.o: inet.h
$g/udp.o: $g/io.h
$g/udp.o: $g/ip.h
$g/udp.o: $g/sr.h
$g/udp.o: $g/type.h
$g/udp.o: $g/udp.h
$g/udp.o: $a
$g/udp.o: $g/udp.c $g/udp.o: $g/udp.c
cd generic && $(CC) -c $(CFLAGS) udp.c cd generic && $(CC) -c $(CFLAGS) udp.c

View File

@ -106,7 +106,6 @@ FORWARD _PROTOTYPE ( int cp_b2u, (acc_t *acc_ptr, int proc, char *dest) );
PRIVATE sr_fd_t sr_fd_table[FD_NR]; PRIVATE sr_fd_t sr_fd_table[FD_NR];
PRIVATE mq_t *repl_queue, *repl_queue_tail; PRIVATE mq_t *repl_queue, *repl_queue_tail;
PRIVATE cpvec_t cpvec[CPVEC_NR];
PRIVATE struct vir_cp_req vir_cp_req[CPVEC_NR]; PRIVATE struct vir_cp_req vir_cp_req[CPVEC_NR];
PUBLIC void sr_init() PUBLIC void sr_init()

View File

@ -30,9 +30,9 @@ install: /usr/sbin/servers/$(SERVER)
clean: clean:
rm -f $(SERVER) *.o *.bak rm -f $(SERVER) *.o *.bak
# dependencies depend:
a = $s/types.h $s/wait.h $s/stat.h $s/svrctl.h \ /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend
$i/ttyent.h $i/fcntl.h $i/unistd.h $i/time.h $i/stdlib.h \
$i/limits.h $i/errno.h $i/signal.h $i/string.h $i/utmp.h # Include generated dependencies.
include .depend
init.o: $a

View File

@ -23,41 +23,21 @@ OBJ = main.o dmp.o dmp_kernel.o dmp_pm.o dmp_fs.o diag.o kputc.o
all build: $(SERVER) all build: $(SERVER)
$(SERVER): $(OBJ) $(SERVER): $(OBJ)
$(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS) $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS)
install -S 256w $@ # install -S 256w $@
# install with other servers # install with other servers
install: /usr/sbin/servers/$(SERVER) install: /usr/sbin/servers/$(SERVER)
/usr/sbin/servers/$(SERVER): $(SERVER) /usr/sbin/servers/$(SERVER): $(SERVER)
install -o root -cs $? $@ install -o root -c $? $@
# install -o root -cs $? $@
# clean up local files # clean up local files
clean: clean:
rm -f $(SERVER) *.o *.bak rm -f $(SERVER) *.o *.bak
# dependencies depend:
a = is.h proto.h glo.h \ /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend
$i/unistd.h $i/stdlib.h $i/stdio.h $i/ansi.h $i/limits.h $i/errno.h \
$s/types.h $m/config.h $m/type.h $m/const.h $m/com.h $m/keymap.h \
$m/syslib.h $s/types.h \
$m/utils.h $m/devio.h
main.o: $a # Include generated dependencies.
include .depend
dmp.o: $a
diag.o: $a
diag.o: $k/type.h
dmp_kernel.o: $a
dmp_kernel.o: $i/timers.h $i/string.h $b/interrupt.h
dmp_kernel.o: $k/proc.h $k/sendmask.h $k/type.h $k/const.h
dmp_pm.o: $a
dmp_pm.o: $p/mproc.h
dmp_fs.o: $a
dmp_fs.o: $f/fproc.h
dmp_fs.o: $f/dmap.h
kputc.o: $a

View File

@ -183,22 +183,20 @@ PUBLIC void image_dmp()
int i,j,r; int i,j,r;
struct system_image *ip; struct system_image *ip;
char maskstr[NR_TASKS + NR_PROCS] = "mask"; char maskstr[NR_TASKS + NR_PROCS] = "mask";
char* types[] = {"task", "system","driver", "server", "user", "idle"};
char* priorities[] = {"task", "higher","high", "normal", "low", "lower", "user","idle"};
if ((r = sys_getimage(image)) != OK) { if ((r = sys_getimage(image)) != OK) {
report("IS","warning: couldn't get copy of image table", r); report("IS","warning: couldn't get copy of image table", r);
return; return;
} }
printf("Image table dump showing all processes included in system image.\n"); printf("Image table dump showing all processes included in system image.\n");
printf("---name-- -nr- --type- -priority- ----pc- -stack- ------sendmask-------\n"); printf("---name-- -nr- -q- ----pc- -stack- ------sendmask-------\n");
for (i=0; i<IMAGE_SIZE; i++) { for (i=0; i<IMAGE_SIZE; i++) {
ip = &image[i]; ip = &image[i];
for (j=-NR_TASKS; j<INIT_PROC_NR+2; j++) for (j=-NR_TASKS; j<INIT_PROC_NR+2; j++)
maskstr[j+NR_TASKS] = (isallowed(ip->sendmask, j)) ? '1' : '0'; maskstr[j+NR_TASKS] = (isallowed(ip->sendmask, j)) ? '1' : '0';
maskstr[j+NR_TASKS] = '\0'; maskstr[j+NR_TASKS] = '\0';
printf("%8s %4d %7s %10s %7lu %7lu %s\n", printf("%8s %4d %3d %7lu %7lu %s\n",
ip->proc_name, ip->proc_nr, types[ip->type], priorities[ip->priority], ip->proc_name, ip->proc_nr, ip->priority,
(long)ip->initial_pc, ip->stksize, maskstr); (long)ip->initial_pc, ip->stksize, maskstr);
} }
printf("\n"); printf("\n");
@ -335,15 +333,9 @@ PUBLIC void sendmask_dmp()
if (++n > 20) break; if (++n > 20) break;
printf("%8s ", rp->p_name); printf("%8s ", rp->p_name);
j = proc_nr(rp); if (proc_nr(rp) == IDLE) printf("(%2d) ", proc_nr(rp));
switch(rp->p_type) { else if (proc_nr(rp) < 0) printf("[%2d] ", proc_nr(rp));
case P_IDLE: printf("/%2d/ ", proc_nr(rp)); break; else printf(" %2d ", proc_nr(rp));
case P_TASK: printf("[%2d] ", proc_nr(rp)); break;
case P_SYSTEM: printf("<%2d> ", proc_nr(rp)); break;
case P_DRIVER: printf("{%2d} ", proc_nr(rp)); break;
case P_SERVER: printf("(%2d) ", proc_nr(rp)); break;
default: printf(" %2d ", proc_nr(rp));
}
for (j=proc_nr(BEG_PROC_ADDR); j<INIT_PROC_NR+2; j++) { for (j=proc_nr(BEG_PROC_ADDR); j<INIT_PROC_NR+2; j++) {
if (isallowed(rp->p_sendmask, j)) printf(" 1 "); if (isallowed(rp->p_sendmask, j)) printf(" 1 ");
@ -377,7 +369,7 @@ PUBLIC void proctab_dmp()
return; return;
} }
printf("\n--nr/name--- -q- -sc- -user- -sys- -text- -data- -size- -flags- -command-\n"); printf("\n--nr/name--- -q- -sc- -user- -sys- -text- -data- -size- -flags-\n");
for (rp = oldrp; rp < END_PROC_ADDR; rp++) { for (rp = oldrp; rp < END_PROC_ADDR; rp++) {
if (isemptyp(rp)) continue; if (isemptyp(rp)) continue;
@ -386,14 +378,9 @@ PUBLIC void proctab_dmp()
data = rp->p_memmap[D].mem_phys; data = rp->p_memmap[D].mem_phys;
size = rp->p_memmap[T].mem_len size = rp->p_memmap[T].mem_len
+ ((rp->p_memmap[S].mem_phys + rp->p_memmap[S].mem_len) - data); + ((rp->p_memmap[S].mem_phys + rp->p_memmap[S].mem_len) - data);
switch(rp->p_type) { if (proc_nr(rp) == IDLE) printf("(%2d) ", proc_nr(rp));
case P_IDLE: printf("/%2d/ ", proc_nr(rp)); break; else if (proc_nr(rp) < 0) printf("[%2d] ", proc_nr(rp));
case P_TASK: printf("[%2d] ", proc_nr(rp)); break; else printf(" %2d ", proc_nr(rp));
case P_SYSTEM: printf("<%2d> ", proc_nr(rp)); break;
case P_DRIVER: printf("{%2d} ", proc_nr(rp)); break;
case P_SERVER: printf("(%2d) ", proc_nr(rp)); break;
default: printf(" %2d ", proc_nr(rp));
}
printf("%-7.7s %2u %02.2x %6lu%6lu%6uK%6uK%6uK %3x", printf("%-7.7s %2u %02.2x %6lu%6lu%6uK%6uK%6uK %3x",
rp->p_name, rp->p_name,
rp->p_priority, rp->p_priority,

View File

@ -29,7 +29,7 @@ PUBLIC void mproc_dmp()
printf("-process- -nr-prnt- -pid/grp- --uid---gid-- -flags- --ignore--catch--block--\n"); printf("-process- -nr-prnt- -pid/grp- --uid---gid-- -flags- --ignore--catch--block--\n");
for (i=prev_i; i<NR_PROCS; i++) { for (i=prev_i; i<NR_PROCS; i++) {
mp = &mproc[i]; mp = &mproc[i];
if (mp->mp_pid <= 0) continue; if (mp->mp_pid == 0 && i != PM_PROC_NR) continue;
if (++n > 22) break; if (++n > 22) break;
printf("%8.8s %4d%4d %4d%4d ", printf("%8.8s %4d%4d %4d%4d ",
mp->mp_name, i, mp->mp_parent, mp->mp_pid, mp->mp_procgrp); mp->mp_name, i, mp->mp_parent, mp->mp_pid, mp->mp_procgrp);

View File

@ -1,5 +1,4 @@
/* Global variables. */ /* Global variables. */
extern is_proc_nr; /* process number of IS server */
/* Parameters needed to keep diagnostics at IS. */ /* Parameters needed to keep diagnostics at IS. */
#define DIAG_BUF_SIZE 1024 #define DIAG_BUF_SIZE 1024

View File

@ -14,12 +14,13 @@
#define DPRINTF if (DEBUG_LEVEL > 0) printf #define DPRINTF if (DEBUG_LEVEL > 0) printf
/* Allocate space for the global variables. */ /* Allocate space for the global variables. */
int is_proc_nr; /* own process number */
message m_in; /* the input message itself */ message m_in; /* the input message itself */
message m_out; /* the output message used for reply */ message m_out; /* the output message used for reply */
int who; /* caller's proc number */ int who; /* caller's proc number */
int callnr; /* system call number */ int callnr; /* system call number */
extern int errno; /* error number set by system library */
/* Diagnostic messages buffer. */ /* Diagnostic messages buffer. */
char diag_buf[DIAG_BUF_SIZE]; char diag_buf[DIAG_BUF_SIZE];
int diag_size = 0; int diag_size = 0;
@ -29,7 +30,7 @@ int diag_next = 0;
FORWARD _PROTOTYPE(void init_server, (void) ); FORWARD _PROTOTYPE(void init_server, (void) );
FORWARD _PROTOTYPE(void get_work, (void) ); FORWARD _PROTOTYPE(void get_work, (void) );
FORWARD _PROTOTYPE(void reply, (int whom, int result) ); FORWARD _PROTOTYPE(void reply, (int whom, int result) );
FORWARD _PROTOTYPE(void signal_handler, (int sig) );
/*===========================================================================* /*===========================================================================*
* main * * main *
@ -79,26 +80,48 @@ PUBLIC void main(void)
} }
/*===========================================================================*
* signal_handler *
*===========================================================================*/
PRIVATE void signal_handler(sig)
int sig; /* signal number */
{
/* Expect a SIGTERM signal when this server must shutdown. */
if (sig == SIGTERM) {
printf("Shutting down IS server.\n");
exit(0);
} else {
printf("IS got unknown signal\n");
}
}
/*===========================================================================* /*===========================================================================*
* init_server * * init_server *
*===========================================================================*/ *===========================================================================*/
PRIVATE void init_server() PRIVATE void init_server()
{ {
/* Initialize the information service. */ /* Initialize the information service. */
message m; int fkeys, sfkeys;
int i; int i, s;
struct sigaction sigact;
/* Set own process number. */ #if DEAD_CODE
is_proc_nr = IS_PROC_NR; /* Install signal handler.*/
sigact.sa_handler = signal_handler;
sigact.sa_mask = ~0; /* block all other signals */
sigact.sa_flags = 0; /* default behaviour */
printf("IS calls sigaction()\n");
if (sigaction(SIGTERM, &sigact, NULL) != OK)
report("IS","warning, sigaction() failed", errno);
#endif
/* Set key mappings. IS takes all of F1-F12 and Shift+F1-F6 . */ /* Set key mappings. IS takes all of F1-F12 and Shift+F1-F6 . */
m.FKEY_FKEYS = m.FKEY_SFKEYS = 0; fkeys = sfkeys = 0;
for (i=1; i<=12; i++) bit_set(m.FKEY_FKEYS, i); for (i=1; i<=12; i++) bit_set(fkeys, i);
for (i=1; i<= 6; i++) bit_set(m.FKEY_SFKEYS, i); for (i=1; i<= 6; i++) bit_set(sfkeys, i);
m.m_type = FKEY_CONTROL; if ((s=fkey_map(&fkeys, &sfkeys)) != OK)
m.FKEY_REQUEST = FKEY_MAP; report("IS", "warning, sendrec failed:", s);
if (OK != (i=sendrec(TTY, &m)))
report("IS", "warning, sendrec failed:", i);
/* Display status message ... */ /* Display status message ... */
report("IS", "information service is alive and kicking", NO_NUM); report("IS", "information service is alive and kicking", NO_NUM);

View File

@ -31,103 +31,9 @@ install: /usr/sbin/servers/$(SERVER)
clean: clean:
rm -f $(SERVER) *.o *.bak rm -f $(SERVER) *.o *.bak
# dependencies depend:
a = pm.h $h/config.h $s/types.h $h/const.h $h/type.h \ /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend
$i/ansi.h $i/fcntl.h $i/unistd.h $h/syslib.h $h/utils.h \
$i/limits.h $i/errno.h const.h type.h proto.h glo.h
alloc.o: $a # Include generated dependencies.
alloc.o: $i/signal.h include .depend
alloc.o: $h/com.h
alloc.o: $h/callnr.h
alloc.o: mproc.h
alloc.o: $k/type.h
alloc.o: $k/const.h
break.o: $a
break.o: $i/signal.h
break.o: mproc.h
break.o: param.h
exec.o: $a
exec.o: $s/stat.h
exec.o: $h/callnr.h
exec.o: $h/com.h
exec.o: $i/a.out.h
exec.o: $i/signal.h
exec.o: $i/string.h
exec.o: mproc.h
exec.o: param.h
forkexit.o: $a
forkexit.o: $s/wait.h
forkexit.o: $h/callnr.h
forkexit.o: $h/com.h
forkexit.o: $h/utils.h
forkexit.o: $i/signal.h
forkexit.o: mproc.h
forkexit.o: param.h
getset.o: $a
getset.o: $h/callnr.h
getset.o: $i/signal.h
getset.o: mproc.h
getset.o: param.h
main.o: $a
main.o: $h/callnr.h
main.o: $h/com.h
main.o: $i/signal.h
main.o: $i/fcntl.h
main.o: $h/ioctl.h
main.o: $s/ioc_memory.h
main.o: $h/utils.h
main.o: mproc.h
main.o: param.h
misc.o: $a
misc.o: $h/callnr.h
misc.o: $h/utils.h
misc.o: $i/signal.h
misc.o: $h/ioctl.h
misc.o: $s/svrctl.h
misc.o: mproc.h
misc.o: param.h
signal.o: $a
signal.o: $s/stat.h
signal.o: $h/callnr.h
signal.o: $h/utils.h
signal.o: $h/com.h
signal.o: $i/signal.h
signal.o: $s/sigcontext.h
signal.o: $i/string.h
signal.o: mproc.h
signal.o: param.h
table.o: $a
table.o: $h/callnr.h
table.o: $i/signal.h
table.o: mproc.h
table.o: param.h
trace.o: $a
trace.o: $h/com.h
trace.o: $s/ptrace.h
trace.o: $i/signal.h
trace.o: mproc.h
trace.o: param.h
utility.o: $a
utility.o: $s/stat.h
utility.o: $h/callnr.h
utility.o: $h/com.h
utility.o: $i/fcntl.h
utility.o: $i/signal.h
utility.o: mproc.h
utility.o: $i/timers.h
utility.o: $i/string.h
utility.o: $k/const.h
utility.o: $k/type.h
utility.o: $k/proc.h

View File

@ -11,4 +11,12 @@
#define MAX_PAGES 4096 /* how many pages in the virtual addr space */ #define MAX_PAGES 4096 /* how many pages in the virtual addr space */
#endif #endif
#define INIT_PID 1 /* init's process id number */ #define NR_PIDS 65536 /* process ids range from 0 to NR_PIDS-1 */
#define PM_PID 0 /* PM's process id number */
#define PM_PARENT -1 /* PM's parent process slot */
#define INIT_PID 1 /* INIT's process id number */
#define DEBUG(x,y) if ((x)) { (y); }

View File

@ -138,6 +138,7 @@ int exit_status; /* the process' exit status (for parent) */
clock_t t[5]; clock_t t[5];
proc_nr = (int) (rmp - mproc); /* get process slot number */ proc_nr = (int) (rmp - mproc); /* get process slot number */
DEBUG(proc_nr == PRINTER, printf("PM: printer about to die ...\n"));
/* Remember a session leader's process group. */ /* Remember a session leader's process group. */
procgrp = (rmp->mp_pid == mp->mp_procgrp) ? mp->mp_procgrp : 0; procgrp = (rmp->mp_pid == mp->mp_procgrp) ? mp->mp_procgrp : 0;
@ -152,8 +153,9 @@ int exit_status; /* the process' exit status (for parent) */
p_mp->mp_child_stime += t[1] + rmp->mp_child_stime; /* add system time */ p_mp->mp_child_stime += t[1] + rmp->mp_child_stime; /* add system time */
/* Tell the kernel and FS that the process is no longer runnable. */ /* Tell the kernel and FS that the process is no longer runnable. */
DEBUG(proc_nr == PRINTER, printf("PM: telling FS and kernel about xit...\n"));
tell_fs(EXIT, proc_nr, 0, 0); /* file system can free the proc slot */ tell_fs(EXIT, proc_nr, 0, 0); /* file system can free the proc slot */
sys_xit(rmp->mp_parent, proc_nr); sys_xit(proc_nr);
/* Pending reply messages for the dead process cannot be delivered. */ /* Pending reply messages for the dead process cannot be delivered. */
rmp->mp_flags &= ~REPLY; rmp->mp_flags &= ~REPLY;
@ -172,13 +174,16 @@ int exit_status; /* the process' exit status (for parent) */
pidarg = p_mp->mp_wpid; /* who's being waited for? */ pidarg = p_mp->mp_wpid; /* who's being waited for? */
parent_waiting = p_mp->mp_flags & WAITING; parent_waiting = p_mp->mp_flags & WAITING;
DEBUG(proc_nr == PRINTER, printf("PM: parent waiting %d, for %d...\n", parent_waiting, pidarg));
right_child = /* child meets one of the 3 tests? */ right_child = /* child meets one of the 3 tests? */
(pidarg == -1 || pidarg == rmp->mp_pid || -pidarg == rmp->mp_procgrp); (pidarg == -1 || pidarg == rmp->mp_pid || -pidarg == rmp->mp_procgrp);
if (parent_waiting && right_child) { if (parent_waiting && right_child) {
DEBUG(proc_nr == PRINTER, printf("PM: parent waiting, release slot...\n"));
cleanup(rmp); /* tell parent and release child slot */ cleanup(rmp); /* tell parent and release child slot */
} else { } else {
DEBUG(proc_nr == PRINTER, printf("PM: parent not waiting, zombify ...\n"));
rmp->mp_flags = IN_USE|ZOMBIE; /* parent not waiting, zombify child */ rmp->mp_flags = IN_USE|ZOMBIE; /* parent not waiting, zombify child */
sig_proc(p_mp, SIGCHLD); /* send parent a "child died" signal */ sig_proc(p_mp, SIGCHLD); /* send parent a "child died" signal */
} }
@ -280,6 +285,7 @@ register struct mproc *child; /* tells which process is exiting */
parent->mp_flags &= ~WAITING; /* parent no longer waiting */ parent->mp_flags &= ~WAITING; /* parent no longer waiting */
/* Release the process table entry and reinitialize some field. */ /* Release the process table entry and reinitialize some field. */
child->mp_pid = 0;
child->mp_flags = 0; child->mp_flags = 0;
child->mp_child_utime = 0; child->mp_child_utime = 0;
child->mp_child_stime = 0; child->mp_child_stime = 0;

View File

@ -139,7 +139,7 @@ PRIVATE void pm_init()
register int proc_nr; register int proc_nr;
register struct mproc *rmp; register struct mproc *rmp;
register char *sig_ptr; register char *sig_ptr;
phys_clicks ram_clicks, total_clicks, minix_clicks, free_clicks; phys_clicks total_clicks, minix_clicks, free_clicks;
message mess; message mess;
struct mem_map mem_map[NR_LOCAL_SEGS]; struct mem_map mem_map[NR_LOCAL_SEGS];
struct memory mem_chunks[NR_MEMS]; struct memory mem_chunks[NR_MEMS];
@ -173,7 +173,7 @@ PRIVATE void pm_init()
/* Initialize PM's process table. Request a copy of the system image table /* Initialize PM's process table. Request a copy of the system image table
* that is defined at the kernel level to see which slots to fill in. * that is defined at the kernel level to see which slots to fill in.
*/ */
if (OK != (s=sys_getimage(&image))) if (OK != (s=sys_getimage(image)))
panic(__FILE__,"PM: warning, couldn't get image table: %d\n", s); panic(__FILE__,"PM: warning, couldn't get image table: %d\n", s);
procs_in_use = 0; /* start populating table */ procs_in_use = 0; /* start populating table */
for (ip = &image[0]; ip < &image[IMAGE_SIZE]; ip++) { for (ip = &image[0]; ip < &image[IMAGE_SIZE]; ip++) {
@ -183,11 +183,9 @@ PRIVATE void pm_init()
/* Set process details found in the image table. */ /* Set process details found in the image table. */
rmp = &mproc[ip->proc_nr]; rmp = &mproc[ip->proc_nr];
rmp->mp_flags |= IN_USE | DONT_SWAP; rmp->mp_flags |= IN_USE | DONT_SWAP;
rmp->mp_pid = (ip->proc_nr == INIT_PROC_NR) ? rmp->mp_pid = get_free_pid();
INIT_PID : get_free_pid(); rmp->mp_parent = INIT_PROC_NR;
strncpy(rmp->mp_name, ip->proc_name, PROC_NAME_LEN); strncpy(rmp->mp_name, ip->proc_name, PROC_NAME_LEN);
/* Change local signal handling behaviour. */
sigfillset(&rmp->mp_ignore); sigfillset(&rmp->mp_ignore);
sigfillset(&rmp->mp_sigmask); sigfillset(&rmp->mp_sigmask);
sigemptyset(&rmp->mp_catch); sigemptyset(&rmp->mp_catch);
@ -208,16 +206,30 @@ PRIVATE void pm_init()
} }
} }
/* PM and INIT are somewhat special. Override some details. Set signal
* handling behaviour for PM, since PM cannot call sigaction() as others.
*/
mproc[INIT_PROC_NR].mp_pid = INIT_PID;
mproc[INIT_PROC_NR].mp_parent = PM_PROC_NR;
sigemptyset(&mproc[INIT_PROC_NR].mp_ignore);
sigemptyset(&mproc[INIT_PROC_NR].mp_sigmask);
sigemptyset(&mproc[INIT_PROC_NR].mp_catch);
mproc[PM_PROC_NR].mp_pid = PM_PID;
mproc[PM_PROC_NR].mp_parent = PM_PARENT;
sigfillset(&mproc[PM_PROC_NR].mp_ignore);
sigfillset(&mproc[PM_PROC_NR].mp_sigmask);
sigemptyset(&mproc[PM_PROC_NR].mp_catch);
sigfillset(&mproc[FS_PROC_NR].mp_ignore);
sigfillset(&mproc[FS_PROC_NR].mp_sigmask);
sigemptyset(&mproc[FS_PROC_NR].mp_catch);
/* Tell FS that no more system processes follow and synchronize. */ /* Tell FS that no more system processes follow and synchronize. */
mess.PR_PROC_NR = NONE; mess.PR_PROC_NR = NONE;
if (sendrec(FS_PROC_NR, &mess) != OK || mess.m_type != OK) if (sendrec(FS_PROC_NR, &mess) != OK || mess.m_type != OK)
panic(__FILE__,"PM can't sync up with FS", NO_NUM); panic(__FILE__,"PM can't sync up with FS", NO_NUM);
/* INIT process is somewhat special. */
sigemptyset(&mproc[INIT_PROC_NR].mp_ignore);
sigemptyset(&mproc[INIT_PROC_NR].mp_sigmask);
sigemptyset(&mproc[INIT_PROC_NR].mp_catch);
/* Possibly we must correct the memory chunks for the boot device. */ /* Possibly we must correct the memory chunks for the boot device. */
if (kinfo.bootdev_size > 0) { if (kinfo.bootdev_size > 0) {
mem_map[T].mem_phys = kinfo.bootdev_base >> CLICK_SHIFT; mem_map[T].mem_phys = kinfo.bootdev_base >> CLICK_SHIFT;

View File

@ -121,25 +121,34 @@ PUBLIC int do_getprocnr()
/*=====================================================================* /*=====================================================================*
* do_reboot * * do_reboot *
*=====================================================================*/ *=====================================================================*/
#define REBOOT_CODE "delay; boot"
PUBLIC int do_reboot() PUBLIC int do_reboot()
{ {
register struct mproc *rmp = mp;
char monitor_code[32*sizeof(char *)]; char monitor_code[32*sizeof(char *)];
int code_len;
int abort_flag;
if (rmp->mp_effuid != SUPER_USER) return(EPERM); if (mp->mp_effuid != SUPER_USER) return(EPERM);
switch (m_in.reboot_flag) { switch (m_in.reboot_flag) {
case RBT_HALT: case RBT_HALT:
case RBT_REBOOT:
case RBT_PANIC: case RBT_PANIC:
case RBT_RESET: case RBT_RESET:
abort_flag = m_in.reboot_flag;
break;
case RBT_REBOOT:
code_len = strlen(REBOOT_CODE) + 1;
strncpy(monitor_code, REBOOT_CODE, code_len);
abort_flag = RBT_MONITOR;
break; break;
case RBT_MONITOR: case RBT_MONITOR:
if (m_in.reboot_size >= sizeof(monitor_code)) return(EINVAL); code_len = m_in.reboot_strlen + 1;
if (code_len > sizeof(monitor_code)) return(EINVAL);
if (sys_datacopy(who, (vir_bytes) m_in.reboot_code, if (sys_datacopy(who, (vir_bytes) m_in.reboot_code,
PM_PROC_NR, (vir_bytes) monitor_code, PM_PROC_NR, (vir_bytes) monitor_code,
(phys_bytes) (m_in.reboot_size+1)) != OK) return(EFAULT); (phys_bytes) (code_len)) != OK) return(EFAULT);
if (monitor_code[m_in.reboot_size] != 0) return(EINVAL); if (monitor_code[code_len-1] != 0) return(EINVAL);
abort_flag = RBT_MONITOR;
break; break;
default: default:
return(EINVAL); return(EINVAL);
@ -151,7 +160,7 @@ PUBLIC int do_reboot()
/* Ask the kernel to abort. All system services, including the PM, will /* Ask the kernel to abort. All system services, including the PM, will
* get a HARD_STOP notification. Await the notification in the main loop. * get a HARD_STOP notification. Await the notification in the main loop.
*/ */
sys_abort(m_in.reboot_flag, PM_PROC_NR, monitor_code, m_in.reboot_size); sys_abort(abort_flag, PM_PROC_NR, monitor_code, code_len);
return(SUSPEND); /* don't reply to killed process */ return(SUSPEND); /* don't reply to killed process */
} }

View File

@ -31,7 +31,7 @@
#define info_where m1_p1 #define info_where m1_p1
#define reboot_flag m1_i1 #define reboot_flag m1_i1
#define reboot_code m1_p1 #define reboot_code m1_p1
#define reboot_size m1_i2 #define reboot_strlen m1_i2
#define svrctl_req m2_i1 #define svrctl_req m2_i1
#define svrctl_argp m2_p1 #define svrctl_argp m2_p1
#define stime m2_l1 #define stime m2_l1

View File

@ -184,6 +184,8 @@ PUBLIC int do_kill()
{ {
/* Perform the kill(pid, signo) system call. */ /* Perform the kill(pid, signo) system call. */
DEBUG(m_in.pid == 11, printf("PM: detected do_kill PRINTER\n"));
return check_sig(m_in.pid, m_in.sig_nr); return check_sig(m_in.pid, m_in.sig_nr);
} }
@ -192,11 +194,11 @@ PUBLIC int do_kill()
*===========================================================================*/ *===========================================================================*/
PUBLIC int ksig_pending() PUBLIC int ksig_pending()
{ {
/* Certain signals, such as segmentation violations and DEL, originate in the /* Certain signals, such as segmentation violations originate in the kernel.
* kernel. When the kernel detects such signals, it sets bits in a bit map. * When the kernel detects such signals, it notifies the PM to take further
* As soon as PM is awaiting new work, the kernel sends PM a message containing * action. The PM requests the kernel to send messages with the process
* the process slot and bit map. That message comes here. The File System * slot and bit map for all signaled processes. The File System, for example,
* also uses this mechanism to signal writing on broken pipes (SIGPIPE). * uses this mechanism to signal writing on broken pipes (SIGPIPE).
* *
* The kernel has notified the PM about pending signals. Request pending * The kernel has notified the PM about pending signals. Request pending
* signals until all signals are handled. If there are no more signals, * signals until all signals are handled. If there are no more signals,
@ -373,7 +375,10 @@ int signo; /* signal to send to process (1 to _NSIG) */
return; return;
} }
/* Some signals are ignored by default. */ /* Some signals are ignored by default. */
if (sigismember(&rmp->mp_ignore, signo)) return; if (sigismember(&rmp->mp_ignore, signo)) {
DEBUG(m_in.pid == 11, printf("PM: sig_proc ignored sig\n"));
return;
}
if (sigismember(&rmp->mp_sigmask, signo)) { if (sigismember(&rmp->mp_sigmask, signo)) {
/* Signal should be blocked. */ /* Signal should be blocked. */
@ -382,6 +387,7 @@ int signo; /* signal to send to process (1 to _NSIG) */
} }
sigflags = rmp->mp_sigact[signo].sa_flags; sigflags = rmp->mp_sigact[signo].sa_flags;
if (sigismember(&rmp->mp_catch, signo)) { if (sigismember(&rmp->mp_catch, signo)) {
DEBUG(m_in.pid == 11, printf("PM: sig_proc catch sig!\n"));
if (rmp->mp_flags & ONSWAP) { if (rmp->mp_flags & ONSWAP) {
/* Process is swapped out, leave signal pending. */ /* Process is swapped out, leave signal pending. */
sigaddset(&rmp->mp_sigpending, signo); sigaddset(&rmp->mp_sigpending, signo);
@ -417,15 +423,20 @@ int signo; /* signal to send to process (1 to _NSIG) */
rmp->mp_sigact[signo].sa_handler = SIG_DFL; rmp->mp_sigact[signo].sa_handler = SIG_DFL;
} }
sys_sigsend(slot, &sm); DEBUG(m_in.pid == 11, printf("PM: sig_proc about to call sys_sigsend for %d \n",slot));
if (OK == (s=sys_sigsend(slot, &sm))) {
sigdelset(&rmp->mp_sigpending, signo); sigdelset(&rmp->mp_sigpending, signo);
/* If process is hanging on PAUSE, WAIT, SIGSUSPEND, tty, pipe, etc., /* If process is hanging on PAUSE, WAIT, SIGSUSPEND, tty,
* release it. * pipe, etc., release it.
*/ */
unpause(slot); unpause(slot);
return; return;
} }
panic(__FILE__, "warning, sys_sigsend failed", s);
}
doterminate: doterminate:
DEBUG(m_in.pid == 11, printf("PM: sig_proc doterminate\n"));
/* Signal should not or cannot be caught. Take default action. */ /* Signal should not or cannot be caught. Take default action. */
if (sigismember(&ign_sset, signo)) return; if (sigismember(&ign_sset, signo)) return;
@ -441,6 +452,7 @@ doterminate:
tell_fs(CHDIR, slot, FALSE, 0); tell_fs(CHDIR, slot, FALSE, 0);
dump_core(rmp); dump_core(rmp);
} }
DEBUG(m_in.pid == 11, printf("PM: about to exit proc\n"));
mm_exit(rmp, 0); /* terminate process */ mm_exit(rmp, 0); /* terminate process */
} }
@ -487,6 +499,7 @@ int signo; /* signal to send to process (0 to _NSIG) */
&& mp->mp_effuid != rmp->mp_realuid && mp->mp_effuid != rmp->mp_realuid
&& mp->mp_realuid != rmp->mp_effuid && mp->mp_realuid != rmp->mp_effuid
&& mp->mp_effuid != rmp->mp_effuid) { && mp->mp_effuid != rmp->mp_effuid) {
DEBUG(m_in.pid == 11, printf("PM: check_sig, EPERM\n"));
error_code = EPERM; error_code = EPERM;
continue; continue;
} }
@ -498,6 +511,7 @@ int signo; /* signal to send to process (0 to _NSIG) */
* signal may be caught, blocked, ignored, or cause process * signal may be caught, blocked, ignored, or cause process
* termination, possibly with core dump. * termination, possibly with core dump.
*/ */
DEBUG(m_in.pid == 11, printf("PM: calling sig_proc with signo %d\n", signo));
sig_proc(rmp, signo); sig_proc(rmp, signo);
if (proc_id > 0) break; /* only one process being signaled */ if (proc_id > 0) break; /* only one process being signaled */

View File

@ -39,7 +39,7 @@ PUBLIC pid_t get_free_pid()
/* Find a free pid for the child and put it in the table. */ /* Find a free pid for the child and put it in the table. */
do { do {
t = 0; t = 0;
next_pid = (next_pid < 30000 ? next_pid + 1 : INIT_PID + 1); next_pid = (next_pid < NR_PIDS ? next_pid + 1 : INIT_PID + 1);
for (rmp = &mproc[0]; rmp < &mproc[NR_PROCS]; rmp++) for (rmp = &mproc[0]; rmp < &mproc[NR_PROCS]; rmp++)
if (rmp->mp_pid == next_pid || rmp->mp_procgrp == next_pid) { if (rmp->mp_pid == next_pid || rmp->mp_procgrp == next_pid) {
t = 1; t = 1;