From 042c4ac395b0d175dd494ffef8491266d53b6857 Mon Sep 17 00:00:00 2001 From: Jorrit Herder Date: Fri, 24 Jun 2005 16:21:21 +0000 Subject: [PATCH] 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. --- servers/Makefile | 3 +- servers/fs/Makefile | 223 +-------------------------- servers/fs/main.c | 2 +- servers/inet/Makefile | 332 +--------------------------------------- servers/inet/sr.c | 1 - servers/init/Makefile | 10 +- servers/is/Makefile | 34 +--- servers/is/dmp_kernel.c | 33 ++-- servers/is/dmp_pm.c | 2 +- servers/is/glo.h | 1 - servers/is/main.c | 61 +++++--- servers/pm/Makefile | 102 +----------- servers/pm/const.h | 10 +- servers/pm/forkexit.c | 8 +- servers/pm/main.c | 36 +++-- servers/pm/misc.c | 25 ++- servers/pm/param.h | 2 +- servers/pm/signal.c | 40 +++-- servers/pm/utility.c | 2 +- 19 files changed, 168 insertions(+), 759 deletions(-) diff --git a/servers/Makefile b/servers/Makefile index d21521037..fadeba6a8 100644 --- a/servers/Makefile +++ b/servers/Makefile @@ -13,9 +13,10 @@ usage: @echo "" >&2 build: all -all install clean: +all install depend clean: cd ./pm && $(MAKE) $@ cd ./fs && $(MAKE) $@ + cd ./sm && $(MAKE) $@ cd ./is && $(MAKE) $@ cd ./init && $(MAKE) $@ cd ./inet && $(MAKE) $@ diff --git a/servers/fs/Makefile b/servers/fs/Makefile index 23e3b076e..bd761c618 100644 --- a/servers/fs/Makefile +++ b/servers/fs/Makefile @@ -33,224 +33,9 @@ install: /usr/sbin/servers/$(SERVER) clean: rm -f $(SERVER) *.o *.bak -# dependencies -a= fs.h $h/config.h $s/types.h $h/const.h $h/type.h \ - $i/limits.h $i/errno.h $i/ansi.h $h/syslib.h \ - const.h type.h proto.h glo.h $s/dir.h +depend: + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend -cache.o: $a -cache.o: $h/com.h -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 +# Include generated dependencies. +include .depend diff --git a/servers/fs/main.c b/servers/fs/main.c index 12eb70baa..cf1f86f66 100644 --- a/servers/fs/main.c +++ b/servers/fs/main.c @@ -70,7 +70,7 @@ PUBLIC void main() */ fs_expire_timers(m_in.NOTIFY_ARG); } 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); } else { /* Call the internal function that does the work. */ diff --git a/servers/inet/Makefile b/servers/inet/Makefile index 96c46de8e..c7a1ecbe4 100644 --- a/servers/inet/Makefile +++ b/servers/inet/Makefile @@ -41,370 +41,50 @@ install: /usr/sbin/servers/$(SERVER) install -o root -cs $? $@ clean: - rm -f $(SERVER) *.a *.o */*.o */*.a *.bak .all + rm -f $(SERVER) *.a *.o */*.o */*.a *.bak -# depencencies -.all: $h/com.h -.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) +depend: + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c generic/*.c > .depend -buf.o: $g/assert.h -buf.o: $g/buf.h -buf.o: $g/type.h -buf.o: $i/stdlib.h -buf.o: $i/string.h -buf.o: inet.h -buf.o: $a +# Include generated dependencies. +include .depend -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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 cd generic && $(CC) -c $(CFLAGS) udp.c + diff --git a/servers/inet/sr.c b/servers/inet/sr.c index f8eb38f0b..8f9e3da20 100644 --- a/servers/inet/sr.c +++ b/servers/inet/sr.c @@ -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 mq_t *repl_queue, *repl_queue_tail; -PRIVATE cpvec_t cpvec[CPVEC_NR]; PRIVATE struct vir_cp_req vir_cp_req[CPVEC_NR]; PUBLIC void sr_init() diff --git a/servers/init/Makefile b/servers/init/Makefile index f3901b2d4..5b19f4e5e 100644 --- a/servers/init/Makefile +++ b/servers/init/Makefile @@ -30,9 +30,9 @@ install: /usr/sbin/servers/$(SERVER) clean: rm -f $(SERVER) *.o *.bak -# dependencies -a = $s/types.h $s/wait.h $s/stat.h $s/svrctl.h \ - $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 +depend: + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend + +# Include generated dependencies. +include .depend -init.o: $a diff --git a/servers/is/Makefile b/servers/is/Makefile index c33bee82c..4e09ef9ba 100644 --- a/servers/is/Makefile +++ b/servers/is/Makefile @@ -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) $(SERVER): $(OBJ) $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS) - install -S 256w $@ +# install -S 256w $@ # install with other servers install: /usr/sbin/servers/$(SERVER) /usr/sbin/servers/$(SERVER): $(SERVER) - install -o root -cs $? $@ + install -o root -c $? $@ +# install -o root -cs $? $@ # clean up local files clean: rm -f $(SERVER) *.o *.bak -# dependencies -a = is.h proto.h glo.h \ - $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 +depend: + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend -main.o: $a - -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 +# Include generated dependencies. +include .depend diff --git a/servers/is/dmp_kernel.c b/servers/is/dmp_kernel.c index fd5e60fd6..aeb85b61b 100644 --- a/servers/is/dmp_kernel.c +++ b/servers/is/dmp_kernel.c @@ -183,22 +183,20 @@ PUBLIC void image_dmp() int i,j,r; struct system_image *ip; 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) { report("IS","warning: couldn't get copy of image table", r); return; } 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; isendmask, j)) ? '1' : '0'; maskstr[j+NR_TASKS] = '\0'; - printf("%8s %4d %7s %10s %7lu %7lu %s\n", - ip->proc_name, ip->proc_nr, types[ip->type], priorities[ip->priority], + printf("%8s %4d %3d %7lu %7lu %s\n", + ip->proc_name, ip->proc_nr, ip->priority, (long)ip->initial_pc, ip->stksize, maskstr); } printf("\n"); @@ -335,15 +333,9 @@ PUBLIC void sendmask_dmp() if (++n > 20) break; printf("%8s ", rp->p_name); - j = proc_nr(rp); - switch(rp->p_type) { - case P_IDLE: printf("/%2d/ ", proc_nr(rp)); break; - 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)); - } + if (proc_nr(rp) == IDLE) printf("(%2d) ", proc_nr(rp)); + else if (proc_nr(rp) < 0) printf("[%2d] ", proc_nr(rp)); + else printf(" %2d ", proc_nr(rp)); for (j=proc_nr(BEG_PROC_ADDR); jp_sendmask, j)) printf(" 1 "); @@ -377,7 +369,7 @@ PUBLIC void proctab_dmp() 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++) { if (isemptyp(rp)) continue; @@ -386,14 +378,9 @@ PUBLIC void proctab_dmp() data = rp->p_memmap[D].mem_phys; size = rp->p_memmap[T].mem_len + ((rp->p_memmap[S].mem_phys + rp->p_memmap[S].mem_len) - data); - switch(rp->p_type) { - case P_IDLE: printf("/%2d/ ", proc_nr(rp)); break; - 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)); - } + if (proc_nr(rp) == IDLE) printf("(%2d) ", proc_nr(rp)); + else if (proc_nr(rp) < 0) printf("[%2d] ", proc_nr(rp)); + else printf(" %2d ", proc_nr(rp)); printf("%-7.7s %2u %02.2x %6lu%6lu%6uK%6uK%6uK %3x", rp->p_name, rp->p_priority, diff --git a/servers/is/dmp_pm.c b/servers/is/dmp_pm.c index 82c7d2999..5b395a057 100644 --- a/servers/is/dmp_pm.c +++ b/servers/is/dmp_pm.c @@ -29,7 +29,7 @@ PUBLIC void mproc_dmp() printf("-process- -nr-prnt- -pid/grp- --uid---gid-- -flags- --ignore--catch--block--\n"); for (i=prev_i; imp_pid <= 0) continue; + if (mp->mp_pid == 0 && i != PM_PROC_NR) continue; if (++n > 22) break; printf("%8.8s %4d%4d %4d%4d ", mp->mp_name, i, mp->mp_parent, mp->mp_pid, mp->mp_procgrp); diff --git a/servers/is/glo.h b/servers/is/glo.h index 092dd72be..d38d14dc2 100644 --- a/servers/is/glo.h +++ b/servers/is/glo.h @@ -1,5 +1,4 @@ /* Global variables. */ -extern is_proc_nr; /* process number of IS server */ /* Parameters needed to keep diagnostics at IS. */ #define DIAG_BUF_SIZE 1024 diff --git a/servers/is/main.c b/servers/is/main.c index ef125ea83..1c56176dc 100644 --- a/servers/is/main.c +++ b/servers/is/main.c @@ -14,12 +14,13 @@ #define DPRINTF if (DEBUG_LEVEL > 0) printf /* Allocate space for the global variables. */ -int is_proc_nr; /* own process number */ message m_in; /* the input message itself */ message m_out; /* the output message used for reply */ int who; /* caller's proc number */ int callnr; /* system call number */ +extern int errno; /* error number set by system library */ + /* Diagnostic messages buffer. */ char diag_buf[DIAG_BUF_SIZE]; int diag_size = 0; @@ -29,7 +30,7 @@ int diag_next = 0; FORWARD _PROTOTYPE(void init_server, (void) ); FORWARD _PROTOTYPE(void get_work, (void) ); FORWARD _PROTOTYPE(void reply, (int whom, int result) ); - +FORWARD _PROTOTYPE(void signal_handler, (int sig) ); /*===========================================================================* * main * @@ -79,29 +80,51 @@ 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 * *===========================================================================*/ PRIVATE void init_server() { /* Initialize the information service. */ - message m; - int i; - - /* Set own process number. */ - is_proc_nr = IS_PROC_NR; - - /* Set key mappings. IS takes all of F1-F12 and Shift+F1-F6 . */ - m.FKEY_FKEYS = m.FKEY_SFKEYS = 0; - for (i=1; i<=12; i++) bit_set(m.FKEY_FKEYS, i); - for (i=1; i<= 6; i++) bit_set(m.FKEY_SFKEYS, i); - m.m_type = FKEY_CONTROL; - m.FKEY_REQUEST = FKEY_MAP; - if (OK != (i=sendrec(TTY, &m))) - report("IS", "warning, sendrec failed:", i); - - /* Display status message ... */ - report("IS", "information service is alive and kicking", NO_NUM); + int fkeys, sfkeys; + int i, s; + struct sigaction sigact; + +#if DEAD_CODE + /* 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 . */ + fkeys = sfkeys = 0; + for (i=1; i<=12; i++) bit_set(fkeys, i); + for (i=1; i<= 6; i++) bit_set(sfkeys, i); + if ((s=fkey_map(&fkeys, &sfkeys)) != OK) + report("IS", "warning, sendrec failed:", s); + + /* Display status message ... */ + report("IS", "information service is alive and kicking", NO_NUM); } /*===========================================================================* diff --git a/servers/pm/Makefile b/servers/pm/Makefile index 4f7134a82..de2b51126 100644 --- a/servers/pm/Makefile +++ b/servers/pm/Makefile @@ -31,103 +31,9 @@ install: /usr/sbin/servers/$(SERVER) clean: rm -f $(SERVER) *.o *.bak -# dependencies -a = pm.h $h/config.h $s/types.h $h/const.h $h/type.h \ - $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 +depend: + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend -alloc.o: $a -alloc.o: $i/signal.h -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 +# Include generated dependencies. +include .depend diff --git a/servers/pm/const.h b/servers/pm/const.h index cc2cba8cd..5325a5132 100644 --- a/servers/pm/const.h +++ b/servers/pm/const.h @@ -11,4 +11,12 @@ #define MAX_PAGES 4096 /* how many pages in the virtual addr space */ #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); } diff --git a/servers/pm/forkexit.c b/servers/pm/forkexit.c index 44832c39c..8a97f0608 100644 --- a/servers/pm/forkexit.c +++ b/servers/pm/forkexit.c @@ -138,6 +138,7 @@ int exit_status; /* the process' exit status (for parent) */ clock_t t[5]; 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. */ 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 */ /* 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 */ - sys_xit(rmp->mp_parent, proc_nr); + sys_xit(proc_nr); /* Pending reply messages for the dead process cannot be delivered. */ 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? */ 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? */ (pidarg == -1 || pidarg == rmp->mp_pid || -pidarg == rmp->mp_procgrp); if (parent_waiting && right_child) { + DEBUG(proc_nr == PRINTER, printf("PM: parent waiting, release slot...\n")); cleanup(rmp); /* tell parent and release child slot */ } else { + DEBUG(proc_nr == PRINTER, printf("PM: parent not waiting, zombify ...\n")); rmp->mp_flags = IN_USE|ZOMBIE; /* parent not waiting, zombify child */ 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 */ /* Release the process table entry and reinitialize some field. */ + child->mp_pid = 0; child->mp_flags = 0; child->mp_child_utime = 0; child->mp_child_stime = 0; diff --git a/servers/pm/main.c b/servers/pm/main.c index 5eb0fc2e3..90bf4aa6a 100644 --- a/servers/pm/main.c +++ b/servers/pm/main.c @@ -139,7 +139,7 @@ PRIVATE void pm_init() register int proc_nr; register struct mproc *rmp; register char *sig_ptr; - phys_clicks ram_clicks, total_clicks, minix_clicks, free_clicks; + phys_clicks total_clicks, minix_clicks, free_clicks; message mess; struct mem_map mem_map[NR_LOCAL_SEGS]; 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 * 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); procs_in_use = 0; /* start populating table */ for (ip = &image[0]; ip < &image[IMAGE_SIZE]; ip++) { @@ -183,12 +183,10 @@ PRIVATE void pm_init() /* Set process details found in the image table. */ rmp = &mproc[ip->proc_nr]; rmp->mp_flags |= IN_USE | DONT_SWAP; - rmp->mp_pid = (ip->proc_nr == INIT_PROC_NR) ? - INIT_PID : get_free_pid(); + rmp->mp_pid = get_free_pid(); + rmp->mp_parent = INIT_PROC_NR; 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); 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. */ mess.PR_PROC_NR = NONE; if (sendrec(FS_PROC_NR, &mess) != OK || mess.m_type != OK) 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. */ if (kinfo.bootdev_size > 0) { mem_map[T].mem_phys = kinfo.bootdev_base >> CLICK_SHIFT; diff --git a/servers/pm/misc.c b/servers/pm/misc.c index e2e3677b0..bf22f52c4 100644 --- a/servers/pm/misc.c +++ b/servers/pm/misc.c @@ -121,25 +121,34 @@ PUBLIC int do_getprocnr() /*=====================================================================* * do_reboot * *=====================================================================*/ +#define REBOOT_CODE "delay; boot" 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) { case RBT_HALT: - case RBT_REBOOT: case RBT_PANIC: 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; 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, PM_PROC_NR, (vir_bytes) monitor_code, - (phys_bytes) (m_in.reboot_size+1)) != OK) return(EFAULT); - if (monitor_code[m_in.reboot_size] != 0) return(EINVAL); + (phys_bytes) (code_len)) != OK) return(EFAULT); + if (monitor_code[code_len-1] != 0) return(EINVAL); + abort_flag = RBT_MONITOR; break; default: return(EINVAL); @@ -151,7 +160,7 @@ PUBLIC int do_reboot() /* Ask the kernel to abort. All system services, including the PM, will * 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 */ } diff --git a/servers/pm/param.h b/servers/pm/param.h index 0822b445f..38eba4444 100644 --- a/servers/pm/param.h +++ b/servers/pm/param.h @@ -31,7 +31,7 @@ #define info_where m1_p1 #define reboot_flag m1_i1 #define reboot_code m1_p1 -#define reboot_size m1_i2 +#define reboot_strlen m1_i2 #define svrctl_req m2_i1 #define svrctl_argp m2_p1 #define stime m2_l1 diff --git a/servers/pm/signal.c b/servers/pm/signal.c index 4dc9a6326..58dfd0858 100644 --- a/servers/pm/signal.c +++ b/servers/pm/signal.c @@ -184,6 +184,8 @@ PUBLIC int do_kill() { /* 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); } @@ -192,11 +194,11 @@ PUBLIC int do_kill() *===========================================================================*/ PUBLIC int ksig_pending() { -/* Certain signals, such as segmentation violations and DEL, originate in the - * kernel. When the kernel detects such signals, it sets bits in a bit map. - * As soon as PM is awaiting new work, the kernel sends PM a message containing - * the process slot and bit map. That message comes here. The File System - * also uses this mechanism to signal writing on broken pipes (SIGPIPE). +/* Certain signals, such as segmentation violations originate in the kernel. + * When the kernel detects such signals, it notifies the PM to take further + * action. The PM requests the kernel to send messages with the process + * slot and bit map for all signaled processes. The File System, for example, + * uses this mechanism to signal writing on broken pipes (SIGPIPE). * * The kernel has notified the PM about pending signals. Request pending * 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; } /* 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)) { /* 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; if (sigismember(&rmp->mp_catch, signo)) { + DEBUG(m_in.pid == 11, printf("PM: sig_proc catch sig!\n")); if (rmp->mp_flags & ONSWAP) { /* Process is swapped out, leave signal pending. */ 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; } - sys_sigsend(slot, &sm); - sigdelset(&rmp->mp_sigpending, signo); - /* If process is hanging on PAUSE, WAIT, SIGSUSPEND, tty, pipe, etc., - * release it. - */ - unpause(slot); - return; + 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); + /* If process is hanging on PAUSE, WAIT, SIGSUSPEND, tty, + * pipe, etc., release it. + */ + unpause(slot); + return; + } + panic(__FILE__, "warning, sys_sigsend failed", s); } doterminate: + DEBUG(m_in.pid == 11, printf("PM: sig_proc doterminate\n")); /* Signal should not or cannot be caught. Take default action. */ if (sigismember(&ign_sset, signo)) return; @@ -441,6 +452,7 @@ doterminate: tell_fs(CHDIR, slot, FALSE, 0); dump_core(rmp); } + DEBUG(m_in.pid == 11, printf("PM: about to exit proc\n")); 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_realuid != rmp->mp_effuid && mp->mp_effuid != rmp->mp_effuid) { + DEBUG(m_in.pid == 11, printf("PM: check_sig, EPERM\n")); error_code = EPERM; continue; } @@ -498,6 +511,7 @@ int signo; /* signal to send to process (0 to _NSIG) */ * signal may be caught, blocked, ignored, or cause process * termination, possibly with core dump. */ + DEBUG(m_in.pid == 11, printf("PM: calling sig_proc with signo %d\n", signo)); sig_proc(rmp, signo); if (proc_id > 0) break; /* only one process being signaled */ diff --git a/servers/pm/utility.c b/servers/pm/utility.c index 2a6a3aba2..0e8c577c9 100644 --- a/servers/pm/utility.c +++ b/servers/pm/utility.c @@ -39,7 +39,7 @@ PUBLIC pid_t get_free_pid() /* Find a free pid for the child and put it in the table. */ do { 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++) if (rmp->mp_pid == next_pid || rmp->mp_procgrp == next_pid) { t = 1; -- 2.44.0