From: Jorrit Herder Date: Fri, 24 Jun 2005 16:21:54 +0000 (+0000) Subject: New Makefiles for mkdep script. X-Git-Tag: v3.1.0~706 X-Git-Url: http://zhaoyanbai.com/repos/Bv9ARM.ch10.html?a=commitdiff_plain;h=5654996c070e30ff7a42c6478ac65c90c9bc6e97;p=minix.git New Makefiles for mkdep script. --- diff --git a/drivers/Makefile b/drivers/Makefile index b9eb9d784..610af2bc2 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -13,7 +13,7 @@ usage: @echo "" >&2 build: all -all install clean: +all install depend clean: cd ./libdriver && $(MAKE) $@ cd ./libpci && $(MAKE) $@ cd ./tty && $(MAKE) $@ diff --git a/drivers/at_wini/Makefile b/drivers/at_wini/Makefile index 8f155d69a..943445fe8 100644 --- a/drivers/at_wini/Makefile +++ b/drivers/at_wini/Makefile @@ -38,18 +38,9 @@ install: /usr/sbin/drivers/$(DRIVER) clean: rm -f $(DRIVER) *.o *.bak +depend: + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c ../libdriver/*.c > .depend -# dependencies -a = $d/drivers.h $b/interrupt.h $b/bios.h \ - $i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \ - $m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \ - $m/syslib.h $s/types.h \ - $m/utils.h $m/devio.h -l = $d/libdriver/driver.h $d/libdriver/driver.c $m/partition.h $m/u64.h - - -at_wini.o: $a $l - -$(LIBDRIVER): $a $l -$(LIBDRIVER): $s/ioc_disk.h +# Include generated dependencies. +include .depend diff --git a/drivers/drivers.h b/drivers/drivers.h index 8d45e97b4..69eb79b95 100644 --- a/drivers/drivers.h +++ b/drivers/drivers.h @@ -23,6 +23,8 @@ #include /* Well-known ports */ #include +#include +#include #include #include #include diff --git a/drivers/floppy/Makefile b/drivers/floppy/Makefile index c61d70272..e0144d4c9 100644 --- a/drivers/floppy/Makefile +++ b/drivers/floppy/Makefile @@ -37,18 +37,9 @@ install: /usr/sbin/drivers/$(DRIVER) clean: rm -f $(DRIVER) *.o *.bak +depend: + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c ../libdriver/*.c > .depend -# dependencies -a = $d/drivers.h $b/interrupt.h $b/bios.h \ - $i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \ - $m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \ - $m/syslib.h $s/types.h \ - $m/utils.h $m/devio.h -l = $d/libdriver/driver.h $d/libdriver/driver.c $m/partition.h $m/u64.h - - -floppy.o: $a $l - -$(LIBDRIVER): $a $l -$(LIBDRIVER): $s/ioc_disk.h +# Include generated dependencies. +include .depend diff --git a/drivers/fxp/Makefile b/drivers/fxp/Makefile index 8c20132f5..afafd0508 100644 --- a/drivers/fxp/Makefile +++ b/drivers/fxp/Makefile @@ -36,12 +36,9 @@ install: /usr/sbin/drivers/$(DRIVER) clean: rm -f *.o *.bak $(DRIVER) -# Dependencies -a = $d/drivers.h $b/interrupt.h $b/bios.h \ - $i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \ - $m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \ - $m/syslib.h $s/types.h \ - $m/utils.h $m/devio.h - -fxp.o: $a +depend: + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c ../libpci/*.c > .depend + +# Include generated dependencies. +include .depend diff --git a/drivers/libdriver/Makefile b/drivers/libdriver/Makefile index 021710fe6..eda7c7434 100644 --- a/drivers/libdriver/Makefile +++ b/drivers/libdriver/Makefile @@ -8,7 +8,7 @@ b = $i/ibm m = $i/minix # Programs, flags, etc. -CC = exec cc +CC = exec cc CFLAGS = -I$i LDFLAGS = -i LIBS = -lsys -lutils @@ -22,16 +22,9 @@ all build install: $(OBJECTS) clean: rm -f *.o *.bak +depend: + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend -# Dependencies -a = $m/config.h $i/ansi.h $m/type.h $m/com.h $m/callnr.h $s/types.h \ - $m/const.h $m/syslib.h $m/utils.h \ - $i/string.h $i/limits.h $i/stddef.h $i/errno.h \ - $m/partition.h $m/u64.h - -driver.o: driver.h $a -driver.o: $s/ioc_disk.h - -drvlib.o: driver.h $a -drvlib.o: drvlib.h $b/partition.h +# Include generated dependencies. +include .depend diff --git a/drivers/libpci/Makefile b/drivers/libpci/Makefile index b0712a746..d8f262830 100644 --- a/drivers/libpci/Makefile +++ b/drivers/libpci/Makefile @@ -22,14 +22,9 @@ all build install: $(OBJECTS) clean: rm -f *.o *.bak +depend: + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend -# Dependencies -a = $m/config.h $i/ansi.h $m/type.h $m/com.h $m/callnr.h $s/types.h \ - $m/const.h $m/syslib.h $m/utils.h \ - $i/string.h $i/limits.h $i/stddef.h $i/errno.h \ - $m/partition.h $m/u64.h - -pci.o: $a -pci.o: pci.h -pci.o: pci_amd.h pci_intel.h pci_via.h pci_sis.h +# Include generated dependencies. +include .depend diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile index 239648493..a109fea25 100644 --- a/drivers/memory/Makefile +++ b/drivers/memory/Makefile @@ -39,17 +39,9 @@ clean: rm -f $(DRIVER) *.o *.bak -# dependencies -a = $d/drivers.h $b/interrupt.h $b/bios.h \ - $i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \ - $m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \ - $m/syslib.h $s/types.h \ - $m/utils.h $m/devio.h -l = $d/libdriver/driver.h $d/libdriver/driver.c $m/partition.h $m/u64.h +depend: + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c ../libdriver/*.c > .depend - -memory.o: $a $l - -$(LIBDRIVER): $a $l -$(LIBDRIVER): $s/ioc_disk.h +# Include generated dependencies. +include .depend diff --git a/drivers/printer/Makefile b/drivers/printer/Makefile index 4ab6e0807..0e8e06cd5 100644 --- a/drivers/printer/Makefile +++ b/drivers/printer/Makefile @@ -21,23 +21,21 @@ OBJ = printer.o all build: $(DRIVER) $(DRIVER): $(OBJ) $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LIBS) - install -S 64w $(DRIVER) +# install -S 64w $(DRIVER) # install with other drivers install: /usr/sbin/drivers/$(DRIVER) /usr/sbin/drivers/$(DRIVER): $(DRIVER) - install -o root -cs $? $@ + install -o root -c $? $@ +# install -o root -cs $? $@ # clean up local files clean: rm -f *.o *.bak $(DRIVER) -# Dependencies -a = $d/drivers.h $b/interrupt.h $b/bios.h \ - $i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \ - $m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \ - $m/syslib.h $s/types.h \ - $m/utils.h $m/devio.h +depend: + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend -printer.o: $a +# Include generated dependencies. +include .depend diff --git a/drivers/printer/printer.c b/drivers/printer/printer.c index d9a44a848..699f0c72e 100644 --- a/drivers/printer/printer.c +++ b/drivers/printer/printer.c @@ -12,7 +12,7 @@ * DEV_CLOSE: does nothing * HARD_INT: interrupt handler has finished current chunk of output * DEV_WRITE: a process wants to write on a terminal - * CANCEL: terminate a previous incomplete system call immediately + * CANCEL: terminate a previous incomplete system call immediately * * m_type TTY_LINE PROC_NR COUNT ADDRESS * |-------------+---------+---------+---------+---------| @@ -99,6 +99,8 @@ PRIVATE vir_bytes user_vir; /* address of remainder of user buf */ PRIVATE int writing; /* nonzero while write is in progress */ PRIVATE int irq_hook_id; /* id of irq hook at kernel */ +extern int errno; /* error number */ + FORWARD _PROTOTYPE( void do_cancel, (message *m_ptr) ); FORWARD _PROTOTYPE( void output_done, (void) ); FORWARD _PROTOTYPE( void do_write, (message *m_ptr) ); @@ -106,6 +108,25 @@ FORWARD _PROTOTYPE( void prepare_output, (void) ); FORWARD _PROTOTYPE( void do_initialize, (void) ); FORWARD _PROTOTYPE( void reply, (int code,int replyee,int proc,int status)); FORWARD _PROTOTYPE( void do_printer_output, (void) ); +FORWARD _PROTOTYPE( void signal_handler, (int sig) ); + + + +/*===========================================================================* + * 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 PRINTER driver\n"); + exit(0); + } else { + printf("PRINTER got unknown signal\n"); + } +} + /*===========================================================================* * printer_task * @@ -115,9 +136,18 @@ PUBLIC void main(void) /* Main routine of the printer task. */ message pr_mess; /* buffer for all incoming messages */ +#if DEAD_CODE + struct sigaction sigact; + + /* Install signal handler.*/ + sigact.sa_handler = signal_handler; + sigact.sa_mask = ~0; /* block all other signals */ + sigact.sa_flags = 0; /* default behaviour */ + printf("PRINTER calls sigaction()\n"); + if (sigaction(SIGTERM, &sigact, NULL) != OK) + report("PRINTER","warning, sigaction() failed", errno); +#endif - printf("PRN: user-level printer driver is up and running\n"); - while (TRUE) { receive(ANY, &pr_mess); switch(pr_mess.m_type) { diff --git a/drivers/rtl8139/Makefile b/drivers/rtl8139/Makefile index 99bde673a..adcba51bc 100644 --- a/drivers/rtl8139/Makefile +++ b/drivers/rtl8139/Makefile @@ -38,17 +38,9 @@ install: /usr/sbin/drivers/$(DRIVER) clean: rm -f $(DRIVER) *.o *.bak +depend: + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c ../libpci/*.c > .depend -# dependencies -a = $d/drivers.h $b/interrupt.h $b/bios.h \ - $i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \ - $m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \ - $m/syslib.h $s/types.h \ - $m/utils.h $m/devio.h -l = $d/libpci/pci.h $d/libpci/pci.c $d/libpci/pci_table.c - - -rtl8139.o: $a $l - -$(LIBPCI): $a $l +# Include generated dependencies. +include .depend diff --git a/drivers/tty/Makefile b/drivers/tty/Makefile index 76685f0c1..3a8ca61a2 100644 --- a/drivers/tty/Makefile +++ b/drivers/tty/Makefile @@ -36,20 +36,10 @@ clean: cd keymaps && $(MAKE) -$(MAKEFLAGS) $@ rm -f $(DRIVER) *.o *.bak +depend: + /usr/bin/mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend - -# dependencies -a = $d/drivers.h $b/interrupt.h $b/bios.h \ - $i/ansi.h $i/string.h $i/limits.h $i/stddef.h $i/errno.h \ - $m/config.h $m/type.h $m/com.h $m/callnr.h $m/const.h $s/types.h \ - $m/syslib.h $s/types.h \ - $m/utils.h $m/devio.h - -tty.o: tty.h $a -console.o: tty.h $a -vidcopy.o: # nothing -keyboard.o: tty.h $a -rs232.o: tty.h $a $i/termios.h $i/signal.h - +# Include generated dependencies. +include .depend diff --git a/drivers/tty/tty.c b/drivers/tty/tty.c index f20c8ded9..dd2b7348e 100644 --- a/drivers/tty/tty.c +++ b/drivers/tty/tty.c @@ -120,7 +120,7 @@ FORWARD _PROTOTYPE( void reprint, (tty_t *tp) ); FORWARD _PROTOTYPE( void dev_ioctl, (tty_t *tp) ); FORWARD _PROTOTYPE( void setattr, (tty_t *tp) ); FORWARD _PROTOTYPE( void tty_icancel, (tty_t *tp) ); -FORWARD _PROTOTYPE( void tty_init, (tty_t *tp) ); +FORWARD _PROTOTYPE( void tty_init, (void) ); #if ENABLE_SRCCOMPAT || ENABLE_BINCOMPAT FORWARD _PROTOTYPE( int compat_getp, (tty_t *tp, struct sgttyb *sg) ); FORWARD _PROTOTYPE( int compat_getc, (tty_t *tp, struct tchars *sg) ); @@ -160,17 +160,14 @@ PUBLIC void main(void) /* Main routine of the terminal task. */ message tty_mess; /* buffer for all incoming messages */ - register tty_t *tp; unsigned line; int s; char *types[] = {"task","driver","server", "user"}; register struct proc *rp; + register tty_t *tp; - /* Initialize the terminal lines. */ - for (tp = FIRST_TTY,s=0; tp < END_TTY; tp++,s++) { - tp->tty_index = s; - tty_init(tp); - } + /* Initialize the TTY driver. */ + tty_init(); /* Get kernel environment (protected_mode, pc_at and ega are needed). */ if (OK != (s=sys_getmachine(&machine))) { @@ -1432,26 +1429,45 @@ register tty_t *tp; /*==========================================================================* * tty_init * *==========================================================================*/ -PRIVATE void tty_init(tp) -tty_t *tp; /* TTY line to initialize. */ +PRIVATE void tty_init() { /* Initialize tty structure and call device initialization routines. */ - tmr_inittimer(&tp->tty_tmr); + register tty_t *tp; + int s; - tp->tty_intail = tp->tty_inhead = tp->tty_inbuf; - tp->tty_min = 1; - tp->tty_termios = termios_defaults; - tp->tty_icancel = tp->tty_ocancel = tp->tty_ioctl = tp->tty_close = + struct sigaction sigact; + + /* Initialize the terminal lines. */ + for (tp = FIRST_TTY,s=0; tp < END_TTY; tp++,s++) { + + tp->tty_index = s; + + tmr_inittimer(&tp->tty_tmr); + + tp->tty_intail = tp->tty_inhead = tp->tty_inbuf; + tp->tty_min = 1; + tp->tty_termios = termios_defaults; + tp->tty_icancel = tp->tty_ocancel = tp->tty_ioctl = tp->tty_close = tty_devnop; - if (tp < tty_addr(NR_CONS)) { - scr_init(tp); - } else - if (tp < tty_addr(NR_CONS+NR_RS_LINES)) { - rs_init(tp); - } else { - pty_init(tp); + if (tp < tty_addr(NR_CONS)) { + scr_init(tp); + } else + if (tp < tty_addr(NR_CONS+NR_RS_LINES)) { + rs_init(tp); + } else { + pty_init(tp); + } } + +#if DEAD_CODE + /* Install signal handler to ignore SIGTERM. */ + sigact.sa_handler = SIG_IGN; + sigact.sa_mask = ~0; /* block all other signals */ + sigact.sa_flags = 0; /* default behaviour */ + if (sigaction(SIGTERM, &sigact, NULL) != OK) + report("TTY","warning, sigaction() failed", errno); +#endif } /*==========================================================================*