Updated debugging dumps at IS server, and function key control.
NOTE: pm modified with DEBUG() output, to be removed later.
@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) $@
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
*/
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. */
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
+
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()
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
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
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; i<IMAGE_SIZE; i++) {
ip = &image[i];
for (j=-NR_TASKS; j<INIT_PROC_NR+2; j++)
maskstr[j+NR_TASKS] = (isallowed(ip->sendmask, 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");
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); j<INIT_PROC_NR+2; j++) {
if (isallowed(rp->p_sendmask, j)) printf(" 1 ");
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;
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,
printf("-process- -nr-prnt- -pid/grp- --uid---gid-- -flags- --ignore--catch--block--\n");
for (i=prev_i; i<NR_PROCS; i++) {
mp = &mproc[i];
- if (mp->mp_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);
/* Global variables. */
-extern is_proc_nr; /* process number of IS server */
/* Parameters needed to keep diagnostics at IS. */
#define DIAG_BUF_SIZE 1024
#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;
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 *
}
+/*===========================================================================*
+ * 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);
}
/*===========================================================================*
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
#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); }
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;
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;
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 */
}
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;
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];
/* 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++) {
/* 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);
}
}
+ /* 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;
/*=====================================================================*
* 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);
/* 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 */
}
#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
{
/* 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);
}
*===========================================================================*/
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,
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. */
}
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);
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;
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 */
}
&& 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;
}
* 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 */
/* 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;