@echo "" >&2
build: all
-all install clean:
+all install depend clean:
cd ./libdriver && $(MAKE) $@
cd ./libpci && $(MAKE) $@
cd ./tty && $(MAKE) $@
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
#include <ibm/ports.h> /* Well-known ports */
#include <string.h>
+#include <signal.h>
+#include <stdlib.h>
#include <limits.h>
#include <stddef.h>
#include <errno.h>
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
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
m = $i/minix
# Programs, flags, etc.
-CC = exec cc
+CC = exec cc
CFLAGS = -I$i
LDFLAGS = -i
LIBS = -lsys -lutils
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
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
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
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
* 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
* |-------------+---------+---------+---------+---------|
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) );
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 *
/* 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) {
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
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
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) );
/* 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))) {
/*==========================================================================*
* 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
}
/*==========================================================================*