]> git.neil.brown.name Git - history.git/commitdiff
Import 2.1.57 2.1.57
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:13:55 +0000 (15:13 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:13:55 +0000 (15:13 -0500)
116 files changed:
CREDITS
Documentation/magic-number.txt
Makefile
arch/alpha/kernel/entry.S
arch/i386/boot/compressed/misc.c
arch/i386/kernel/entry.S
arch/m68k/kernel/entry.S
arch/mips/kernel/irixsig.c
arch/mips/kernel/syscalls.h
arch/ppc/kernel/misc.S
arch/sparc/ap1000/aplib.c
arch/sparc/ap1000/util.c
arch/sparc/kernel/systbls.S
arch/sparc64/kernel/systbls.S
drivers/block/acsi_slm.c
drivers/block/ataflop.c
drivers/block/floppy.c
drivers/block/swim3.c
drivers/cdrom/cdu31a.c
drivers/cdrom/mcdx.c
drivers/char/apm_bios.c
drivers/char/cyclades.c
drivers/char/epca.c
drivers/char/esp.c
drivers/char/ftape/fdc-io.c
drivers/char/ftape/ftape-io.c
drivers/char/istallion.c
drivers/char/lp.c
drivers/char/lp_m68k.c
drivers/char/n_tty.c
drivers/char/pcxx.c
drivers/char/psaux.c
drivers/char/random.c
drivers/char/riscom8.c
drivers/char/rocket.c
drivers/char/rtc.c
drivers/char/serial.c
drivers/char/stallion.c
drivers/char/tty_io.c
drivers/char/tty_ioctl.c
drivers/char/vt.c
drivers/isdn/avmb1/b1capi.c
drivers/isdn/avmb1/capi.c
drivers/isdn/isdn_tty.c
drivers/macintosh/adb.c
drivers/macintosh/macserial.c
drivers/misc/TODO-parport
drivers/net/ppp.c
drivers/sbus/audio/audio.c
drivers/sbus/char/pcikbd.c
drivers/sbus/char/sab82532.c
drivers/sbus/char/sunkbd.c
drivers/sbus/char/sunmouse.c
drivers/sbus/char/zs.c
drivers/scsi/ChangeLog.ncr53c8xx
drivers/scsi/ncr53c8xx.c
drivers/scsi/ncr53c8xx.h
drivers/scsi/scsi_module.c
drivers/scsi/sg.c
drivers/sound/dmabuf.c
drivers/sound/dmasound.c
drivers/sound/maui.c
drivers/sound/midi_synth.c
drivers/sound/midibuf.c
drivers/sound/sequencer.c
fs/autofs/root.c
fs/fcntl.c
fs/fifo.c
fs/locks.c
fs/ncpfs/sock.c
fs/nfs/dir.c
fs/nfs/file.c
fs/nfsd/export.c
fs/pipe.c
fs/proc/array.c
fs/proc/mem.c
fs/readdir.c
fs/select.c
fs/super.c
include/asm-alpha/elf.h
include/asm-alpha/unistd.h
include/asm-i386/elf.h
include/asm-i386/unistd.h
include/asm-m68k/elf.h
include/asm-m68k/unistd.h
include/asm-mips/elf.h
include/asm-mips/unistd.h
include/asm-ppc/elf.h
include/asm-ppc/unistd.h
include/asm-sparc/elf.h
include/asm-sparc/unistd.h
include/asm-sparc64/elf.h
include/asm-sparc64/unistd.h
include/linux/prctl.h [new file with mode: 0644]
include/linux/sched.h
include/linux/sunrpc/types.h
include/linux/wrapper.h
ipc/msg.c
kernel/exit.c
kernel/fork.c
kernel/printk.c
kernel/sched.c
kernel/sys.c
mm/vmscan.c
net/ax25/af_ax25.c
net/core/datagram.c
net/core/sock.c
net/ipv4/af_inet.c
net/ipv4/tcp.c
net/netlink.c
net/netrom/af_netrom.c
net/rose/af_rose.c
net/sunrpc/clnt.c
net/unix/af_unix.c
net/x25/af_x25.c
scripts/ksymoops.cc

diff --git a/CREDITS b/CREDITS
index 7a380d5ac69620bd401e750916734f1a6d60dee5..fc418ef083b7a6ab4b8050e866ffb2e5d3285970 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -483,6 +483,15 @@ S: USA
 N: Philip Gladstone
 E: philip@raptor.com
 D: Kernel / timekeeping stuff
+  
+N: Richard E. Gooch
+E: rgooch@atnf.csiro.au
+D: parent process death signal to children
+D: prctl() syscall
+S: CSIRO Australia Telescope National Facility
+S: P.O. Box 76, Epping
+S: N.S.W., 2121
+S: Australia
 
 N: Dmitry S. Gorodchanin
 E: begemot@bgm.rosprint.net
index c8ea597f4ae976803608be1ab2ca1b6693711481..ca5c3e20c62ede38b494bc6b7d15c1b6d0b2b033 100644 (file)
@@ -28,37 +28,50 @@ discipline, these cases get detected quickly and safely.
                                        Theodore Ts'o
                                        31-Mar-94
 
-The magic table is current to Linux 1.3.98.
+The magic table is current to Linux 2.1.55.
 
                                        Michael Chastain
-                                       <mec@duracef.shout.net>
-                                       6 May 1996
+                                       <mailto:mec@shout.net>
+                                       22 Sep 1997
 
 
 
 Magic Name          Number      Structure            File
 ===========================================================================
-RISCOM8_MAGIC       0x0907      struct riscom_port   drivers/char/riscom8.h
-APM_BIOS_MAGIC      0x4101      struct apm_struct    include/linux/apm_bios.h
-CYCLADES_MAGIC      0x4359      struct cyclades_port include/linux/cyclades.h
-FASYNC_MAGIC        0x4601      struct fasync_struct include/linux/fs.h
-PTY_MAGIC           0x5001      struct pty_struct    drivers/char/pty.c
-PPP_MAGIC           0x5002      struct ppp_struct    include/linux/if_ppp.h
-SERIAL_MAGIC        0x5301      struct async_struct  include/linux/serial.h
-SLIP_MAGIC          0x5302      struct slip          drivers/net/slip.h
-STRIP_MAGIC         0x5303      struct strip         drivers/net/strip.c
-TTY_MAGIC           0x5401      struct tty_struct    include/linux/tty.h
-TTY_DRIVER_MAGIC    0x5402      struct tty_driver    include/linux/tty_driver.h
-TTY_LDISC_MAGIC     0x5403      struct tty_ldisc     include/linux/tty_ldisc.h
-SCC_MAGIC           0x8530      struct scc_channel   include/linux/scc.h
-ISDN_ASYNC_MAGIC    0x49344C01  modem_info           include/linux/isdn.h
-ISDN_NET_MAGIC      0x49344C02  isdn_net_ndev        include/linux/isdn.h
-STLI_BOARDMAGIC     0x4bc6c825  stlibrd_t            include/linux/istallion.h
-ROUTER_MAGIC        0x524d4157  wanlink_t            include/linux/router.h
-STLI_PORTMAGIC      0xe671c7a1  stliport_t           include/linux/istallion.h
-STL_PANELMAGIC      0x7ef621a1  stlpanel_t           include/linux/stallion.h
-STL_BOARDMAGIC      0xa2267f52  stlbrd_t             include/linux/stallion.h
-STL_PORTMAGIC       0x5a7182c9  stlport_t            include/linux/stallion.h
-PCXX_MAGIC          0x5c6df104  struct channel       drivers/char/pcxx.h
-BAYCOM_MAGIC        0x3105bac0  struct baycom_state  drivers/char/baycom.c
 
+MKISS_DRIVER_MAGIC    0x04bf      mkiss_channel     drivers/net/mkiss.h
+RISCOM8_MAGIC         0x0907      riscom_port       drivers/char/riscom8.h
+APM_BIOS_MAGIC        0x4101      apm_bios_struct   include/linux/apm_bios.h
+CYCLADES_MAGIC        0x4359      cyclades_port     include/linux/cyclades.h
+FASYNC_MAGIC          0x4601      fasync_struct     include/linux/fs.h
+PPP_MAGIC             0x5002      ppp               include/linux/if_ppp.h
+SERIAL_MAGIC          0x5301      async_struct      include/linux/serial.h
+SSTATE_MAGIC          0x5302      serial_state      include/linux/serial.h
+SLIP_MAGIC            0x5302      slip              drivers/net/slip.h
+STRIP_MAGIC           0x5303      strip             drivers/net/strip.c
+X25_ASY_MAGIC         0x5303      x25_asy           drivers/net/x25_asy.h
+AX25_MAGIC            0x5316      ax_disp           drivers/net/mkiss.h
+ESP_MAGIC             0x53ee      esp_struct        drivers/char/esp.h
+TTY_MAGIC             0x5401      tty_struct        include/linux/tty.h
+TTY_DRIVER_MAGIC      0x5402      tty_driver        include/linux/tty_driver.h
+TTY_LDISC_MAGIC       0x5403      tty_ldisc         include/linux/tty_ldisc.h
+SCC_MAGIC             0x8530      scc_channel       include/linux/scc.h
+RPORT_MAGIC           0x525001    r_port            drivers/char/rocket_int.h
+SLAB_C_MAGIC          0x4f17a36d  kmem_cache_s      mm/slab.c
+SLAB_RED_MAGIC2       0x170fc2a5  (any)             mm/slab.c
+ECP_MAGIC             0x21504345  cdkecpsig         include/linux/cdk.h
+ISDN_ASYNC_MAGIC      0x49344C01  modem_info        include/linux/isdn.h
+ISDN_NET_MAGIC        0x49344C02  isdn_net_local_s  include/linux/isdn.h
+STLI_BOARDMAGIC       0x4bc6c825  stlibrd           include/linux/istallion.h
+ROUTER_MAGIC          0x524d4157  wan_device        include/linux/wanrouter.h
+SLAB_RED_MAGIC1       0x5a2cf071  (any)             mm/slab.c
+STL_PORTMAGIC         0x5a7182c9  stlport           include/linux/stallion.h
+HDLCDRV_MAGIC         0x5ac6e778  hdlcdrv_state     include/linux/hdlcdrv.h
+EPCA_MAGIC            0x5c6df104  channel           include/linux/epca.h
+PCXX_MAGIC            0x5c6df104  channel           drivers/char/pcxx.h
+STL_PANELMAGIC        0x7ef621a1  stlpanel          include/linux/stallion.h
+STL_BOARDMAGIC        0xa2267f52  stlbrd            include/linux/stallion.h
+SLAB_MAGIC_ALLOC      0xa5c32f2b  kmem_slab_s       mm/slab.c
+SLAB_MAGIC_DESTROYED  0xb2f23c5a  kmem_slab_s       mm/slab.c
+STLI_PORTMAGIC        0xe671c7a1  stliport          include/linux/istallion.h
+CCB_MAGIC             0xf2691ad2  ccb               drivers/scsi/ncr53c8xx.c
index f381407a4f578820e62295ef61c3063df79abb17..d4eb3e0423acfff794a1301e0039c5480ba36309 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 2
 PATCHLEVEL = 1
-SUBLEVEL = 56
+SUBLEVEL = 57
 
 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/)
 
index e2231303657662f1dd319cfe20b351093baf5859..5ba5506dde259cc76f512a5f850ae6c3c1baaa24 100644 (file)
@@ -771,4 +771,5 @@ sys_call_table:
        .quad sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, do_entSys /* sys_afs_syscall */, sys_newuname
        .quad sys_nanosleep, sys_mremap, sys_nfsservctl, sys_setresuid, sys_getresuid
        .quad sys_pciconfig_read, sys_pciconfig_write, sys_query_module
+       .quad sys_prctl
        .quad do_entSys, do_entSys
index fd835f5c0dffb43fefc92f35c865a745ceca4b1f..9a556baf4b2f8a39be3d0bbbb4a94fa46605ff2c 100644 (file)
@@ -75,6 +75,9 @@ static void gzip_release(void **);
  * This is set up by the setup-routine at boot-time
  */
 #define EXT_MEM_K (*(unsigned short *)0x90002)
+#ifndef STANDARD_MEMORY_BIOS_CALL
+#define ALT_MEM_K (*(unsigned long *) 0x901e0)
+#endif
 #define SCREEN_INFO (*(struct screen_info *)0x90000)
 
 extern char input_data[];
@@ -287,9 +290,9 @@ struct {
 void setup_normal_output_buffer()
 {
 #ifdef STANDARD_MEMORY_BIOS_CALL
-       if (EXT_MEM_K < 1024) error("<2M of mem\n");
+       if (EXT_MEM_K < 1024) error("Less than 2MB of memory.\n");
 #else
-       if (EXT_MEM_K*64 < 1024) error("<2M of mem\n");
+       if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < 1024) error("Less than 2MB of memory.\n");
 #endif
        output_data = (char *)0x100000; /* Points to 1M */
 }
@@ -305,7 +308,7 @@ void setup_output_buffer_if_we_run_high(struct moveparams *mv)
 #ifdef STANDARD_MEMORY_BIOS_CALL
        if (EXT_MEM_K < (3*1024)) error("Less than 4MB of memory.\n");
 #else
-       if (EXT_MEM_K*64 < (3*1024)) error("Less than 4MB of memory.\n");
+       if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory.\n");
 #endif 
        mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START;
        high_loaded = 1;
index 21bf047099e635da262db741b304968adbd762d2..dffc1379576945070cbe3901e4e3ca8260c2329a 100644 (file)
@@ -528,6 +528,7 @@ ENTRY(sys_call_table)
        .long SYMBOL_NAME(sys_nfsservctl)
        .long SYMBOL_NAME(sys_setresgid)        /* 170 */
        .long SYMBOL_NAME(sys_getresgid)
-       .rept NR_syscalls-171
+       .long SYMBOL_NAME(sys_prctl)
+       .rept NR_syscalls-172
                .long SYMBOL_NAME(sys_ni_syscall)
        .endr
index 459e9e93a73a51eaeae718918eae3046abe76562..10b1581ea1a281c251e91668232dc71486ee122b 100644 (file)
@@ -568,6 +568,7 @@ SYMBOL_NAME_LABEL(sys_call_table)
        .long SYMBOL_NAME(sys_query_module)
        .long SYMBOL_NAME(sys_poll)
        .long SYMBOL_NAME(sys_nfsservctl)
+       .long SYMBOL_NAME(sys_prctl)
        .rept NR_syscalls-(.-SYMBOL_NAME(sys_call_table))/4
                .long SYMBOL_NAME(sys_ni_syscall)
        .endr
index 396d6646643ad7939b5f75a34ba67cf4557c0ada..b3c0f73ca57aae5a2a494d212633cc61c2b03dfc 100644 (file)
@@ -565,7 +565,7 @@ asmlinkage int irix_sigpoll_sys(unsigned long *set, struct irix5_siginfo *info,
                        timeo = 1;
                        break;
                }
-               if(current->signal & ~(current->blocked)) return -EINTR;
+               if(signal_pending(current)) return -EINTR;
        }
 
        if(timeo) return -EAGAIN;
@@ -692,7 +692,7 @@ repeat:
                if(options & W_NOHANG)
                        goto end_waitsys;
                retval = -ERESTARTSYS;
-               if(current->signal & ~current->blocked)
+               if(signal_pending(current))
                        goto end_waitsys;
                current->state = TASK_INTERRUPTIBLE;
                schedule();
index 065f166fab63c8f289c595267f07584e73d1f3fb..a72133a5e73bbb4dc9897f5b914b92d86d9ca978 100644 (file)
@@ -212,3 +212,4 @@ SYS(sys_setresgid, 3)                               /* 4190 */
 SYS(sys_getresgid, 3)
 SYS(sys_setresgid, 3)                          /* 4190 */
 SYS(sys_getresgid, 3)
+SYS(sys_prctl, 5)
index 9c6d013b61ffe80c5bd892574faa31b533c012ab..f4174df3866b9f93130ef8a31fd5c7493e8869f5 100644 (file)
@@ -539,6 +539,7 @@ sys_call_table:
        .long sys_query_module
        .long sys_poll
        .long sys_nfsservctl
+       .long sys_prctl
        .long sys_debug
-       .space (NR_syscalls-170)*4
+       .space (NR_syscalls-171)*4
 
index 8bd67e530ead6ed424774467d3bfa0d37afe5b0f..4534271621c3abfdc0f87f9d422f5af4b0ec5653 100644 (file)
@@ -457,7 +457,7 @@ static inline int aplib_poll(unsigned counter)
                tnet_check_completion();
                if (resched_needed())
                        break;
-               if (current->signal & ~current->blocked) break;
+               if (signal_pending(current)) break;
        }
        return 0;
 }
index 18a65c53874d5fb4b6fbfc312e8f3e80fdcbb019..5185fdea9bbf572407e0bd2756fd49f4b55a5cad 100644 (file)
@@ -376,7 +376,7 @@ int wait_on_int(volatile int *p,int x,int interval)
                add_timer(timer);
                interruptible_sleep_on(&timer_wait);
                del_timer(timer);
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        return -EINTR;
        }
        kfree_s(timer,sizeof(*timer));
index a166e3490f04b46cfc9cd83b9c83f5f740c93d7a..055b85b21a0ece7adf593ba1e4c0519628ae7a85 100644 (file)
@@ -125,6 +125,7 @@ C_LABEL(sys_call_table):
        .long C_LABEL(sys_fdatasync)
        .long C_LABEL(sys_nfsservctl)
 /*255*/        .long C_LABEL(sys_aplib)
+       .long C_LABEL(sys_prctl)
        .long C_LABEL(sys_nis_syscall)
 
        /* Now the SunOS syscall table. */
@@ -219,3 +220,4 @@ C_LABEL(sunos_sys_table):
        .long C_LABEL(sunos_nosys), C_LABEL(sunos_nosys)
 /*250*/        .long C_LABEL(sunos_nosys), C_LABEL(sunos_nosys), C_LABEL(sunos_nosys)
        .long C_LABEL(sunos_nosys), C_LABEL(sunos_nosys), C_LABEL(sys_aplib)
+       .long C_LABEL(sunos_nosys)
index 9b00175a39161027f790f942649249f0d45bd562..ec2c3c9b6657a01b1988a71aa9bdacb9d1f57987 100644 (file)
@@ -68,7 +68,7 @@ sys_call_table32:
 /*240*/        .word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys_nis_syscall, sys_nis_syscall
        .word sys_nis_syscall, sys_sched_get_priority_max, sys_sched_get_priority_min, sys32_sched_rr_get_interval, sys32_nanosleep
 /*250*/        .word sys32_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys32_nfsservctl
-       .word sys_aplib
+       .word sys_aplib, sys_prctl
 
        /* Now the 64-bit native Linux syscall table. */
 
@@ -127,7 +127,7 @@ sys_call_table:
 /*240*/        .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_nis_syscall, sys_nis_syscall
        .word sys_nis_syscall, sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep
 /*250*/        .word sys_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
-       .word sys_aplib
+       .word sys_aplib, sys_prctl
 
        /* Now the 32-bit SunOS syscall table. */
 
@@ -221,3 +221,4 @@ sunos_sys_table:
        .word sunos_nosys, sunos_nosys
 /*250*/        .word sunos_nosys, sunos_nosys, sunos_nosys
        .word sunos_nosys, sunos_nosys, sys_aplib
+       .word sunos_nosys
index 97957c0eae9532c3a82c397d9b644a577334ad46..64a4011400d8292eb145530ba23c0567271ba762 100644 (file)
@@ -634,7 +634,7 @@ static long slm_write( struct inode *node, struct file *file,
        while( SLMState == PRINTING ||
                   (SLMState == FILLING && SLMBufOwner != device) ) {
                interruptible_sleep_on( &slm_wait );
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        return( -ERESTARTSYS );
        }
        if (SLMState == IDLE) {
index 77add0b3a8a208a56c9333429f0f906f4ab5c493..3e0c28379f06a6a02fd3639e9c6b18e92fa1b849 100644 (file)
@@ -1978,10 +1978,14 @@ static int floppy_release( struct inode * inode, struct file * filp )
 
   drive = inode->i_rdev & 3;
 
-  if (!filp || (filp->f_mode & (2 | OPEN_WRITE_BIT)))
-    /* if the file is mounted OR (writable now AND writable at open
-       time) Linus: Does this cover all cases? */
-    block_fsync (filp, filp->f_dentry);
+       /*
+        * If filp is NULL, we're being called from blkdev_release
+        * or after a failed mount attempt.  In the former case the
+        * device has already been sync'ed, and in the latter no
+        * sync is required.  Otherwise, sync if filp is writable.
+        */
+       if (filp && (filp->f_mode & (2 | OPEN_WRITE_BIT)))
+               block_fsync (filp, filp->f_dentry);
 
   if (fd_ref[drive] < 0)
     fd_ref[drive] = 0;
index 2d30343df8d1d5cba9a16c088216ca54d0030d04..fcecad84dba0bc771a59c4f5281820066f2b90d8 100644 (file)
@@ -415,7 +415,7 @@ static int probing = 0;
 
 static volatile int command_status = FD_COMMAND_NONE, fdc_busy = 0;
 static struct wait_queue *fdc_wait = NULL, *command_done = NULL;
-#define NO_SIGNAL (!(current->signal & ~current->blocked) || !interruptible)
+#define NO_SIGNAL (!interruptible || !signal_pending(current))
 #define CALL(x) if ((x) == -EINTR) return -EINTR
 #define ECALL(x) if ((ret = (x))) return ret;
 #define _WAIT(x,i) CALL(ret=wait_til_done((x),i))
@@ -3500,9 +3500,13 @@ static int floppy_release(struct inode * inode, struct file * filp)
 
        drive = DRIVE(inode->i_rdev);
 
-       if (!filp || (filp->f_mode & (2 | OPEN_WRITE_BIT)))
-               /* if the file is mounted OR (writable now AND writable at
-                * open time) Linus: Does this cover all cases? */
+       /*
+        * If filp is NULL, we're being called from blkdev_release
+        * or after a failed mount attempt.  In the former case the
+        * device has already been sync'ed, and in the latter no
+        * sync is required.  Otherwise, sync if filp is writable.
+        */
+       if (filp && (filp->f_mode & (2 | OPEN_WRITE_BIT)))
                block_fsync(filp, filp->f_dentry);
 
        if (UDRS->fd_ref < 0)
index 12be2e362dd02036d66ca5239f1e024caec69531..6ce5c037d19e2fd1c3f8b00c96cd31537b45acaa 100644 (file)
@@ -683,8 +683,7 @@ static int grab_drive(struct floppy_state *fs, enum swim_state state,
        if (fs->state != idle) {
                ++fs->wanted;
                while (fs->state != available) {
-                       if (interruptible
-                           && (current->signal & ~current->blocked)) {
+                       if (interruptible && signal_pending(current)) {
                                --fs->wanted;
                                restore_flags(flags);
                                return -EINTR;
@@ -720,7 +719,7 @@ static int fd_eject(struct floppy_state *fs)
        for (n = 2*HZ; n > 0; --n) {
                if (swim3_readbit(fs, RELAX))
                        break;
-               if ((current->signal & ~current->blocked) != 0) {
+               if (signal_pending(current)) {
                        err = -EINTR;
                        break;
                }
@@ -781,7 +780,7 @@ static int floppy_open(struct inode *inode, struct file *filp)
                for (n = HZ; n > 0; --n) {
                        if (swim3_readbit(fs, SEEK_COMPLETE))
                                break;
-                       if ((current->signal & ~current->blocked) != 0) {
+                       if (signal_pending(current)) {
                                err = -EINTR;
                                break;
                        }
@@ -840,9 +839,16 @@ static int floppy_release(struct inode *inode, struct file *filp)
 
        if (MINOR(inode->i_rdev) != 0)
                return -ENXIO;
+       /*
+        * If filp is NULL, we're being called from blkdev_release
+        * or after a failed mount attempt.  In the former case the
+        * device has already been sync'ed, and in the latter no
+        * sync is required.  Otherwise, sync if filp is writable.
+        */
+       if (filp && (filp->f_mode & (2 | OPEN_WRITE_BIT)))
+               block_fsync (filp, filp->f_dentry);
+
        fs = &floppy_states[0];
-       if (filp == 0 || (filp->f_mode & (2 | OPEN_WRITE_BIT)))
-               block_fsync(filp, filp->f_dentry);
        sw = fs->swim3;
        if (fs->ref_count > 0 && --fs->ref_count == 0) {
                swim3_action(fs, MOTOR_OFF);
@@ -880,7 +886,7 @@ static int floppy_revalidate(kdev_t dev)
        for (n = HZ; n > 0; --n) {
                if (swim3_readbit(fs, SEEK_COMPLETE))
                        break;
-               if ((current->signal & ~current->blocked) != 0)
+               if (signal_pending(current))
                        break;
                current->state = TASK_INTERRUPTIBLE;
                current->timeout = jiffies + 1;
index e2c269bcf763218b8de95d5dcc06a19108b87711..8e49605250f222ece16d2b1266c83707a5dcab99 100644 (file)
@@ -844,7 +844,7 @@ do_sony_cd_cmd(unsigned char cmd,
       while (sony_inuse)
       {
          interruptible_sleep_on(&sony_wait);
-         if (current->signal & ~current->blocked)
+         if (signal_pending(current))
          {
             result_buffer[0] = 0x20;
             result_buffer[1] = SONY_SIGNAL_OP_ERR;
@@ -1556,7 +1556,7 @@ do_cdu31a_request(void)
    while (sony_inuse)
    {
       interruptible_sleep_on(&sony_wait);
-      if (current->signal & ~current->blocked)
+      if (signal_pending(current))
       {
          restore_flags(flags);
          if (CURRENT && CURRENT->rq_status != RQ_INACTIVE)
@@ -2262,7 +2262,7 @@ read_audio(struct cdrom_read_audio *ra,
    while (sony_inuse)
    {
       interruptible_sleep_on(&sony_wait);
-      if (current->signal & ~current->blocked)
+      if (signal_pending(current))
       {
          restore_flags(flags);
          return -EAGAIN;
index 242508f9d557c1022e9bdc67157705432808cb48..dea15234954991565d4f2da40d860cf88194d150 100644 (file)
@@ -947,7 +947,7 @@ static void mcdx_delay(struct s_drive_stuff *stuff, long jifs)
                xtrace(SLEEP, "*** delay: sleepq\n");
                interruptible_sleep_on(&stuff->sleepq);
                xtrace(SLEEP, "delay awoken\n");
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        xtrace(SLEEP, "got signal\n");
                }
        }
@@ -1410,7 +1410,7 @@ static int mcdx_xfer(struct s_drive_stuff *stuffp,
 
                        if (!stuffp->introk) { xtrace(XFER, "error via interrupt\n"); }
                        else if (current->timeout == 0) { xtrace(XFER, "timeout\n"); }
-                       else if (current->signal & ~current->blocked) {
+                       else if (signal_pending(current)) {
                                xtrace(XFER, "signal\n");
                        } else continue;
 
index 0a722b5e6c9dfaceb9fd05ad3541d70dd8137eb6..1be093ebfda65152b759b1389a3d14f366be1ae7 100644 (file)
@@ -831,8 +831,7 @@ static long do_read(struct inode *inode, struct file *fp,
                add_wait_queue(&process_list, &wait);
 repeat:
                current->state = TASK_INTERRUPTIBLE;
-               if (queue_empty(as)
-                   && !(current->signal & ~current->blocked)) {
+               if (queue_empty(as) && !signal_pending(current)) {
                        schedule();
                        goto repeat;
                }
@@ -859,7 +858,7 @@ repeat:
        }
        if (i < count)
                return count - i;
-       if (current->signal & ~current->blocked)
+       if (signal_pending(current))
                return -ERESTARTSYS;
        return 0;
 }
@@ -958,7 +957,7 @@ static int do_open(struct inode * inode, struct file * filp)
 
        as = (struct apm_bios_struct *)kmalloc(sizeof(*as), GFP_KERNEL);
        if (as == NULL) {
-               printk(KERN_ER "apm_bios: cannot allocate struct of size %d bytes",
+               printk(KERN_ERR "apm_bios: cannot allocate struct of size %d bytes",
                       sizeof(*as));
                return -ENOMEM;
        }
index fa4134dda2a7abfcf4707c58d22d0de6a0756c85..32237f2c652ec9310b79a48562f446114e0f3e7e 100644 (file)
@@ -2217,7 +2217,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
                        break;
                }
            restore_flags(flags);
-           if (current->signal & ~current->blocked) {
+           if (signal_pending(current)) {
                retval = -ERESTARTSYS;
                break;
            }
@@ -2275,7 +2275,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
              || (ch_ctrl[channel].rs_status & C_RS_DCD))) {
                break;
            }
-           if (current->signal & ~current->blocked) {
+           if (signal_pending(current)) {
                retval = -ERESTARTSYS;
                break;
            }
index 63da8b5cbd9df04e77a64312db64a8ce0c883a21..bc25dca1d0ace25b489fc563f91af46889913bb7 100644 (file)
@@ -1384,7 +1384,7 @@ static int block_til_ready(struct tty_struct *tty,
                          (do_clocal || (ch->imodem & ch->dcd)))
                        break;
 
-               if (current->signal & ~current->blocked
+               if (signal_pending(current)
                {
                        retval = -ERESTARTSYS;
                        break;
index 636c6369db6201df76fb78d876644a047bf28770..7c42399da5c62ca0fc779a279198a60087a51a83 100644 (file)
@@ -1733,7 +1733,7 @@ static void send_break(   struct esp_struct * info, int duration)
 
        interruptible_sleep_on(&info->break_wait);
 
-       if (current->signal & ~current->blocked) {
+       if (signal_pending(current)) {
                serial_out(info, UART_ESI_CMD1, ESI_ISSUE_BREAK);
                serial_out(info, UART_ESI_CMD2, 0x00);
                sti();
@@ -1775,11 +1775,11 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
                        if (retval)
                                return retval;
                        tty_wait_until_sent(tty, 0);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -EINTR;
                        if (!arg) {
                                send_break(info, HZ/4); /* 1/4 second */
-                               if (current->signal & ~current->blocked)
+                               if (signal_pending(current))
                                        return -EINTR;
                        }
                        return 0;
@@ -1788,10 +1788,10 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
                        if (retval)
                                return retval;
                        tty_wait_until_sent(tty, 0);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -EINTR;
                        send_break(info, arg ? arg*(HZ/10) : HZ/4);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -EINTR;
                        return 0;
                case TIOCGSOFTCAR:
@@ -1845,7 +1845,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
                        while (1) {
                                interruptible_sleep_on(&info->delta_msr_wait);
                                /* see if a signal did it */
-                               if (current->signal & ~current->blocked)
+                               if (signal_pending(current))
                                        return -ERESTARTSYS;
                                cli();
                                cnow = info->icount;    /* atomic copy */
@@ -2086,7 +2086,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
                current->timeout = jiffies + char_time;
                schedule();
 
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        break;
 
                if (timeout && ((orig_jiffies + timeout) < jiffies))
@@ -2243,7 +2243,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
                    !(info->flags & ASYNC_CLOSING) &&
                    (do_clocal))
                        break;
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        retval = -ERESTARTSYS;
                        break;
                }
index 51fc128d8b93945de7198b79f35ab909836f62f6..3ebc5a8686600faec72fa95c93b463ecdf0c4088 100644 (file)
@@ -335,12 +335,12 @@ int fdc_interrupt_wait(int time)
 /*** remove me when sure this doesn't happen ***/
                        if (current->timeout > 0) {
                                TRACE(-1, "*** BUG: unexpected schedule exit ***");
-                               if (current->signal & ~current->blocked) {
+                               if (signal_pending(current)) {
                                        TRACE(4, "caused by signal ?");
                                }
                        }
 #endif
-                       if (current->signal & ~current->blocked) {
+                       if (signal_pending(current)) {
                                result = -EINTR;
                        } else {
                                result = -ETIME;
index 3957bc8abf679c8099e2d596587b468228241b4a..1f15eef8ab4c2b58045eecfc6ab61ef30460ecd9 100644 (file)
@@ -138,7 +138,7 @@ void ftape_sleep(unsigned int time)
                        while (current->state != TASK_RUNNING) {
                                schedule();
                        }
-                       if (current->signal & ~current->blocked) {
+                       if (signal_pending(current)) {
                                TRACE(1, "awoken by non-blocked signal :-(");
                                break;  /* exit on signal */
                        }
index f18d25d9abb684d81329287568e8ee9bd0fbdd47..25647ab2fc4df97240ab2417050cd8fed464ee9a 100644 (file)
@@ -813,7 +813,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
        portp->refcount++;
 
        while (test_bit(ST_INITIALIZING, &portp->state)) {
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        return(-ERESTARTSYS);
                interruptible_sleep_on(&portp->raw_wait);
        }
@@ -1048,7 +1048,7 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i
  *     memory, so we must wait until it is complete.
  */
        while (test_bit(ST_CLOSING, &portp->state)) {
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        restore_flags(flags);
                        return(-ERESTARTSYS);
                }
@@ -1081,7 +1081,7 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i
        rc = 0;
        set_bit(ST_OPENING, &portp->state);
        while (test_bit(ST_OPENING, &portp->state)) {
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        rc = -ERESTARTSYS;
                        break;
                }
@@ -1123,7 +1123,7 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg,
  */
        if (wait) {
                while (test_bit(ST_CLOSING, &portp->state)) {
-                       if (current->signal & ~current->blocked) {
+                       if (signal_pending(current)) {
                                restore_flags(flags);
                                return(-ERESTARTSYS);
                        }
@@ -1155,7 +1155,7 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg,
  */
        rc = 0;
        while (test_bit(ST_CLOSING, &portp->state)) {
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        rc = -ERESTARTSYS;
                        break;
                }
@@ -1188,7 +1188,7 @@ static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, v
        save_flags(flags);
        cli();
        while (test_bit(ST_CMDING, &portp->state)) {
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        restore_flags(flags);
                        return(-ERESTARTSYS);
                }
@@ -1198,7 +1198,7 @@ static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, v
        stli_sendcmd(brdp, portp, cmd, arg, size, copyback);
 
        while (test_bit(ST_CMDING, &portp->state)) {
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        restore_flags(flags);
                        return(-ERESTARTSYS);
                }
@@ -1312,7 +1312,7 @@ static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *fil
                                (doclocal || (portp->sigs & TIOCM_CD))) {
                        break;
                }
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        rc = -ERESTARTSYS;
                        break;
                }
index 49a6c65dbfe0b762ab60e301eb70f54dab6f4884..0ee0c535981fa01f3f6b8cb9c999eb1c70069c88 100644 (file)
@@ -11,6 +11,9 @@
  * lp_read (Status readback) support added by Carsten Gross,
  *                                             carsten@sol.wohnheim.uni-ulm.de
  * Support for parport by Philip Blundell <Philip.Blundell@pobox.com>
+ * Reverted interrupt to polling at runtime if more than one device is parport
+ * registered and joined the interrupt and polling code.
+ *                               by Andrea Arcangeli <arcangeli@mbox.queen.it>
  */
 
 /* This driver is about due for a rewrite. */
@@ -251,7 +254,7 @@ static inline int lp_write_buf(unsigned int minor, const char *buf, int count)
                                        sti();
                                }
 
-                               if (current->signal & ~current->blocked) {
+                               if (signal_pending(current)) {
                                        if (total_bytes_written + bytes_written)
                                                return total_bytes_written + bytes_written;
                                        else
@@ -376,7 +379,7 @@ static long lp_read(struct inode * inode, struct file * file,
 #ifdef LP_READ_DEBUG
                        printk(KERN_DEBUG "lp_read: (Autofeed low) timeout\n");
 #endif
-                       if (current->signal & ~current->blocked) {
+                       if (signal_pending(current)) {
                                lp_select_in_high(minor);
                                parport_release(lp_table[minor].dev);
                                if (temp !=buf)
index bdb3405cae8ebc230d14c38ce7df32a9685c7bdd..a36903c7a45faad4bb1c14d4ddc4a1ec5f811e25 100644 (file)
@@ -222,7 +222,7 @@ static long lp_write_interrupt(struct inode *inode, struct file *file,
       lp_table[dev]->do_print = 0;
       rc = total_bytes_written + lp_table[dev]->bytes_written;
 
-      if (current->signal & ~current->blocked) {
+      if (signal_pending(current)) {
        if (rc)
          return rc;
        else
@@ -320,7 +320,7 @@ static long lp_write_polled(struct inode *inode, struct file *file,
                        }
 
                        /* check for signals before going to sleep */
-                       if (current->signal & ~current->blocked) {
+                       if (signal_pending(current)) {
                                if (temp != buf)
                                        return temp-buf;
                                else
index 32dc3a51de6a952b0eb8375c3e9ccbc2ea86ff99..f6a02b7bbc54ca6675afcdfd3b6b4f0b3521319c 100644 (file)
@@ -924,7 +924,7 @@ do_it_again:
                                retval = -EAGAIN;
                                break;
                        }
-                       if (current->signal & ~current->blocked) {
+                       if (signal_pending(current)) {
                                retval = -ERESTARTSYS;
                                break;
                        }
@@ -1022,7 +1022,7 @@ static int write_chan(struct tty_struct * tty, struct file * file,
        add_wait_queue(&tty->write_wait, &wait);
        while (1) {
                current->state = TASK_INTERRUPTIBLE;
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        retval = -ERESTARTSYS;
                        break;
                }
index 9a68bb472e606675ccc2d99b4b4a82263415b637..eecdaee5a97d1f4217e83050b2bbc3679d1f5707 100644 (file)
@@ -368,7 +368,7 @@ static int pcxx_waitcarrier(struct tty_struct *tty,struct file *filp,struct chan
                    (info->asyncflags & ASYNC_CLOSING) == 0 &&
                        (do_clocal || (info->imodem & info->dcd)))
                        break;
-               if(current->signal & ~current->blocked) {
+               if(signal_pending(current)) {
                        retval = -ERESTARTSYS;
                        break;
                }
index 52e5d2babd4e081f573737b59415590ac7e2bc80..9a90ffc4bf054e2d26abd686e350b7d5895ecb54 100644 (file)
@@ -540,7 +540,7 @@ static long read_aux(struct inode * inode, struct file * file,
                add_wait_queue(&queue->proc_list, &wait);
 repeat:
                current->state = TASK_INTERRUPTIBLE;
-               if (queue_empty() && !(current->signal & ~current->blocked)) {
+               if (queue_empty() && !signal_pending(current)) {
                        schedule();
                        goto repeat;
                }
@@ -557,7 +557,7 @@ repeat:
                inode->i_atime = CURRENT_TIME;
                return count-i;
        }
-       if (current->signal & ~current->blocked)
+       if (signal_pending(current))
                return -ERESTARTSYS;
        return 0;
 }
index 527ac860930a8a0e682053b1e0be3aea5fb905ec..e5ecf0cf94c5ae1ac9dc9c8d23b3d7042a1da776 100644 (file)
@@ -1098,7 +1098,7 @@ random_read(struct inode * inode, struct file * file, char * buf, unsigned long
                                retval = -EAGAIN;
                                break;
                        }
-                       if (current->signal & ~current->blocked) {
+                       if (signal_pending(current)) {
                                retval = -ERESTARTSYS;
                                break;
                        }
index 806caf3702b95855a7d2fe2d896fc671eb6a4493..ef6b347ab29c46776903ca825acd0a6455808ab7 100644 (file)
@@ -1040,7 +1040,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
                    !(port->flags & ASYNC_CLOSING) &&
                    (do_clocal || CD))
                        break;
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        retval = -ERESTARTSYS;
                        break;
                }
index 59d2666ab760e567c325f4eebdbe6725093d7e6b..ea5d4135674aa53b1fcdc1d1ab99f3b146e3978f 100644 (file)
@@ -836,7 +836,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
                    (do_clocal || (sGetChanStatusLo(&info->channel) &
                                   CD_ACT)))
                        break;
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        retval = -ERESTARTSYS;
                        break;
                }
@@ -1333,11 +1333,11 @@ static int rp_ioctl(struct tty_struct *tty, struct file * file,
                        if (retval)
                                return retval;
                        tty_wait_until_sent(tty, 0);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -EINTR;
                        if (!arg) {
                                send_break(info, HZ/4); /* 1/4 second */
-                               if (current->signal & ~current->blocked)
+                               if (signal_pending(current))
                                        return -EINTR;
                        }
                        return 0;
@@ -1346,10 +1346,10 @@ static int rp_ioctl(struct tty_struct *tty, struct file * file,
                        if (retval)
                                return retval;
                        tty_wait_until_sent(tty, 0);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -EINTR;
                        send_break(info, arg ? arg*(HZ/10) : HZ/4);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -EINTR;
                        return 0;
                case TIOCGSOFTCAR:
@@ -1548,7 +1548,7 @@ static void rp_wait_until_sent(struct tty_struct *tty, int timeout)
                current->counter = 0;   /* make us low-priority */
                current->timeout = jiffies + check_time;
                schedule();
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        break;
        }
        current->state = TASK_RUNNING;
index b150dd7e16388e09cda87b444f0b9b5bc8426bf6..c310fe9691f4634908767ecce528d10ec629a654 100644 (file)
@@ -164,7 +164,7 @@ static long rtc_read(struct inode *inode, struct file *file, char *buf,
                        retval = -EAGAIN;
                        break;
                }
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        retval = -ERESTARTSYS;
                        break;
                }
index 4a1a25d382561c3288f5bbcfc54e10157311b248..5e8d14004f8939040c0b56d1836fbce2286161ee 100644 (file)
@@ -2207,11 +2207,11 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
                        if (retval)
                                return retval;
                        tty_wait_until_sent(tty, 0);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -EINTR;
                        if (!arg) {
                                send_break(info, HZ/4); /* 1/4 second */
-                               if (current->signal & ~current->blocked)
+                               if (signal_pending(current))
                                        return -EINTR;
                        }
                        return 0;
@@ -2220,10 +2220,10 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
                        if (retval)
                                return retval;
                        tty_wait_until_sent(tty, 0);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -EINTR;
                        send_break(info, arg ? arg*(HZ/10) : HZ/4);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -EINTR;
                        return 0;
                case TIOCSBRK:
@@ -2310,7 +2310,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
                        while (1) {
                                interruptible_sleep_on(&info->delta_msr_wait);
                                /* see if a signal did it */
-                               if (current->signal & ~current->blocked)
+                               if (signal_pending(current))
                                        return -ERESTARTSYS;
                                cli();
                                cnow = info->state->icount; /* atomic copy */
@@ -2562,7 +2562,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
                current->counter = 0;   /* make us low-priority */
                current->timeout = jiffies + char_time;
                schedule();
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        break;
                if (timeout && ((orig_jiffies + timeout) < jiffies))
                        break;
@@ -2709,7 +2709,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
                    (do_clocal || (serial_in(info, UART_MSR) &
                                   UART_MSR_DCD)))
                        break;
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        retval = -ERESTARTSYS;
                        break;
                }
index 1ec03230b0b5cebb5b3fa875add0fef834aeacf7..8e378215f9014ab8b44b18fe2e2ada0b59c044a6 100644 (file)
@@ -889,7 +889,7 @@ static int stl_waitcarrier(stlport_t *portp, struct file *filp)
                                (doclocal || (portp->sigs & TIOCM_CD))) {
                        break;
                }
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        rc = -ERESTARTSYS;
                        break;
                }
index 2148a06a6c75cc1af8cd1a7d26d273afafab75f5..c6aa9ffd505f620f077c93892d20e5d702fbb3b2 100644 (file)
@@ -607,7 +607,7 @@ static inline int do_tty_write(
                if (!count)
                        break;
                ret = -ERESTARTSYS;
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        break;
                if (need_resched)
                        schedule();
@@ -1217,7 +1217,7 @@ retry_open:
                release_dev(filp);
                if (retval != -ERESTARTSYS)
                        return retval;
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        return retval;
                schedule();
                /*
index 02f42ec8720f0c5d2a763b6bba132a68d9d05215..630b2ed4217d8dd4da65a9241300fcad0612b547 100644 (file)
@@ -60,7 +60,7 @@ void tty_wait_until_sent(struct tty_struct * tty, int timeout)
                printk("waiting %s...(%d)\n", tty_name(tty), tty->driver.chars_in_buffer(tty));
 #endif
                current->state = TASK_INTERRUPTIBLE;
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        goto stop_waiting;
                if (!tty->driver.chars_in_buffer(tty))
                        break;
@@ -170,7 +170,7 @@ static int set_termios(struct tty_struct * tty, unsigned long arg, int opt)
 
        if (opt & TERMIOS_WAIT) {
                tty_wait_until_sent(tty, 0);
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        return -EINTR;
        }
 
@@ -516,7 +516,7 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
                        if (retval)
                                return retval;
                        tty_wait_until_sent(tty, 0);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -EINTR;
                        if (!tty->driver.ioctl)
                                return 0;
index 64e8e585a0bfbcc5f4a52d17271b8a3f8d8437bf..18a68c82ebebc8911991b48d5170e2aac168099e 100644 (file)
@@ -1089,7 +1089,7 @@ int vt_waitactive(int vt)
                if (vt == fg_console)
                        break;
                retval = -EINTR;
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        break;
                schedule();
        }
index b379d8f7dae80f931032fafb3bfcda38595c3001..a9f06c880c59cdfbe9f542715cb080a428b76fd7 100644 (file)
@@ -760,7 +760,7 @@ static int capi_manufacturer(unsigned int cmd, void *data)
                        current->state = TASK_INTERRUPTIBLE;
                        schedule();
 
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -EINTR;
                }
                return 0;
index b21a9f8687d1ce3266a25b814238e81d11deb883..41e225e5b59f173e77655459e010e14c827c53f7 100644 (file)
@@ -138,7 +138,7 @@ static long capi_read(struct inode *inode, struct file *file,
                        interruptible_sleep_on(&cdev->recv_wait);
                        if ((skb = skb_dequeue(&cdev->recv_queue)) != 0)
                                break;
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                break;
                }
                if (skb == 0)
index a5f31eaf3e29356f97f1fc595b0b90e769202bc2..4b21f83f99c20d42aec1612c05bceb46c08b9570 100644 (file)
@@ -1576,7 +1576,7 @@ isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *
                    (do_clocal || (info->msr & UART_MSR_DCD))) {
                        break;
                }
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        retval = -ERESTARTSYS;
                        break;
                }
index 6e1f5fadf36e6479312cd292d866cdc53c4f9de4..b6aad25ab38152e6d26e23c93f937cd3617c9f45 100644 (file)
@@ -36,7 +36,7 @@ static int adb_wait_reply(struct adbdev_state *state, struct file *file)
                        ret = -EAGAIN;
                        break;
                }
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        ret = -ERESTARTSYS;
                        break;
                }
index 724950cfe6e19d26fbc7edbd7db784e1458168c1..967f13d86830c5a69aad1bc81746999f8f199ba8 100644 (file)
@@ -1562,7 +1562,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
                    !(info->flags & ZILOG_CLOSING) &&
                    (do_clocal || (read_zsreg(info->zs_channel, 0) & DCD)))
                        break;
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        retval = -ERESTARTSYS;
                        break;
                }
index eea6a01fd2088697c51c7a6117578dd6ba4c53eb..5ffe406fa15e27d05c105324d7c5dcbebace764b 100644 (file)
@@ -6,7 +6,7 @@ Things to be done.
 
 2. Overhaul lp.c:
 
-   a) It's a mess, and there is a lot of code duplication.
+   a) It's a _mess_
 
    b) ECP support would be nice.  This can only work if both the port and
       the printer support it.
index 740bfc1ffe9e524b78811e56edbb6fd40b9e9ddd..dcdc2661fd73a167945ea1c7c6534f67832891a4 100644 (file)
@@ -1711,7 +1711,7 @@ ppp_tty_read (struct tty_struct *tty, struct file *file, __u8 * buf,
                        current->state   = TASK_INTERRUPTIBLE;
                        schedule ();
 
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -EINTR;
                        continue;
                }
@@ -1753,7 +1753,7 @@ ppp_tty_read (struct tty_struct *tty, struct file *file, __u8 * buf,
                                        "ppp_tty_read: sleeping(read_wait)\n");
 
                        interruptible_sleep_on (&ppp->read_wait);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -EINTR;
                        continue;
                }
@@ -2104,7 +2104,7 @@ ppp_tty_write (struct tty_struct *tty, struct file *file, const __u8 * data,
                        return 0;
                }
 
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        kfree (new_data);
                        return -EINTR;
                }
index ded93c8e66152164d7cc2a0c287e82efccd8624f..ae77b145572636cfca56745ec0c84587d35093b6 100644 (file)
@@ -183,7 +183,7 @@ static int sparcaudio_write(struct inode * inode, struct file * file,
                /* Check to make sure that an output buffer is available. */
                if (driver->output_count == driver->num_output_buffers) {
                        interruptible_sleep_on(&driver->output_write_wait);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return bytes_written > 0 ? bytes_written : -EINTR;
                }
 
@@ -226,7 +226,7 @@ static int sparcaudio_ioctl(struct inode * inode, struct file * file,
        case AUDIO_DRAIN:
                if (driver->output_count > 0) {
                        interruptible_sleep_on(&driver->output_drain_wait);
-                       retval = (current->signal & ~current->blocked) ? -EINTR : 0;
+                       retval = signal_pending(current) ? -EINTR : 0;
                }
                break;
 
@@ -270,7 +270,7 @@ static int sparcaudio_open(struct inode * inode, struct file * file)
                        return -EBUSY;
 
                interruptible_sleep_on(&driver->open_wait);
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        return -EINTR;
                goto retry_open;
        }
@@ -279,7 +279,7 @@ static int sparcaudio_open(struct inode * inode, struct file * file)
                        return -EBUSY;
 
                interruptible_sleep_on(&driver->open_wait);
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        return -EINTR;
                goto retry_open;
        }
index 86f5270277e7cd862784064295353fd99edfcc23..8d90f85d660c96388bc6f6942f2eb0468993deb0 100644 (file)
@@ -740,7 +740,7 @@ static long read_aux(struct inode * inode, struct file * file,
                add_wait_queue(&queue->proc_list, &wait);
 repeat:
                current->state = TASK_INTERRUPTIBLE;
-               if (queue_empty() && !(current->signal & ~current->blocked)) {
+               if (queue_empty() && !signal_pending(current)) {
                        schedule();
                        goto repeat;
                }
@@ -757,7 +757,7 @@ repeat:
                inode->i_atime = CURRENT_TIME;
                return count-i;
        }
-       if (current->signal & ~current->blocked)
+       if (signal_pending(current))
                return -ERESTARTSYS;
        return 0;
 }
index 775fbbe5a997e0b18c56af9ab0f4f4d568ff9e24..2134d3d75b39ac019ad7a148025bb89c32b5d99f 100644 (file)
@@ -1247,11 +1247,11 @@ static int sab82532_ioctl(struct tty_struct *tty, struct file * file,
                        if (retval)
                                return retval;
                        tty_wait_until_sent(tty, 0);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -EINTR;
                        if (!arg) {
                                send_break(info, HZ/4); /* 1/4 second */
-                               if (current->signal & ~current->blocked)
+                               if (signal_pending(current))
                                        return -EINTR;
                        }
                        return 0;
@@ -1260,10 +1260,10 @@ static int sab82532_ioctl(struct tty_struct *tty, struct file * file,
                        if (retval)
                                return retval;
                        tty_wait_until_sent(tty, 0);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -EINTR;
                        send_break(info, arg ? arg*(HZ/10) : HZ/4);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -EINTR;
                        return 0;
                case TIOCSBRK:
@@ -1325,7 +1325,7 @@ static int sab82532_ioctl(struct tty_struct *tty, struct file * file,
                        while (1) {
                                interruptible_sleep_on(&info->delta_msr_wait);
                                /* see if a signal did it */
-                               if (current->signal & ~current->blocked)
+                               if (signal_pending(current))
                                        return -ERESTARTSYS;
                                cli();
                                cnow = info->icount; /* atomic copy */
@@ -1699,7 +1699,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
                    !(info->flags & ASYNC_CLOSING) &&
                    (do_clocal || !(info->regs->r.vstr & SAB82532_VSTR_CD)))
                        break;
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        retval = -ERESTARTSYS;
                        break;
                }
index dd4d933d95cecb0f8432002ec309a5b21c106d70..1340e3f7cccc3b774ab1d9363bb9233d06dd0a6f 100644 (file)
@@ -1256,7 +1256,7 @@ kbd_read (struct inode *inode, struct file *f, char *buffer, unsigned long count
                if (f->f_flags & O_NONBLOCK)
                        return -EWOULDBLOCK;
                add_wait_queue (&kbd_wait, &wait);
-               while (kbd_head == kbd_tail && !(current->signal & ~current->blocked)){
+               while (kbd_head == kbd_tail && !signal_pending(current)) {
                        current->state = TASK_INTERRUPTIBLE;
                        schedule ();
                }
index 9f5bbb5b6336f40c154a686678758a8e543b661e..2f8f8b3c9a72e8d011af58ca3800dd34541b309e 100644 (file)
@@ -367,7 +367,7 @@ sun_mouse_read(struct inode *inode, struct file *file, char *buffer,
                if (file->f_flags & O_NONBLOCK)
                        return -EWOULDBLOCK;
                add_wait_queue (&sunmouse.proc_list, &wait);
-               while (queue_empty () && !(current->signal & ~current->blocked)){
+               while (queue_empty () && !signal_pending(current)) {
                        current->state = TASK_INTERRUPTIBLE;
                        schedule ();
                }
@@ -414,7 +414,7 @@ sun_mouse_read(struct inode *inode, struct file *file, char *buffer,
                return count-c;
        }
        /* Only called if nothing was sent */
-       if (current->signal & ~current->blocked)
+       if (signal_pending(current))
                return -ERESTARTSYS;
        return 0;
 }
index 3d6759a7c04eba102dd05c74b71169dd0038f6a6..8875f7dc768dec0693faaad1fb60f8771990c441 100644 (file)
@@ -1775,7 +1775,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
                    !(info->flags & ZILOG_CLOSING) &&
                    (do_clocal || (DCD & r0)))
                        break;
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        retval = -ERESTARTSYS;
                        break;
                }
index ecfd09676ee3ca81e16fd4c5f93f3a7bff5f61ed..3a110ce40a5822164a8bf1bc3698b0f8c2bc2252 100644 (file)
@@ -1,4 +1,24 @@
-Thu Aug 23 23:43 1997 Gerard Roudier (groudier@club-internet.fr)
+Sat Sep 20 21:00 1997 Gerard Roudier (groudier@club-internet.fr)
+       * revision 2.5c
+       - Several PCI configuration registers fix-ups for powerpc.
+         (Patch sent by Cort).
+
+Thu Aug 28 10:00 1997 Gerard Roudier (groudier@club-internet.fr)
+       * revision 2.5b
+       - Add 'ncr53c8xx' char pointer variable. This variable allows to 
+         pass a boot command to the driver when it is loaded as a module.
+         Option separator is ' ' instead of ','. Example:
+           insmod <mod_path>/ncr53c8xx.o ncr53c8xx='verb:2 sync:0 specf:n'
+       - Always use 'driver_setup.settle_delay' for internal resets.
+         2 seconds hardcoded is sometimes too short. Suggested by Richard W. 
+         This delay may be shortenned in order to avoid spurious timeouts.
+       - Fix release module stuff that failed for more than 1 controller.
+       - For linux versions > 1.3.70, trust the 'dev_id' parameter passed 
+         to the interrupt handler (dev_id = struct ncb *).
+       - Fix up in 'ncr_log_hard_error()' when the DSP points outside scripts.
+         Suggested by Stefan Esser.
+
+Tue Aug 23 23:43 1997 Gerard Roudier (groudier@club-internet.fr)
        * revision 2.5a
        - Update Configure.help for inclusion in linux-2.1.51/2/3
        - Use BASE_2 address from PCI config space instead of some 
index baaad345ea187f416ca4985a98ac1fbe86a88c17..4b6462a7997711b51210f7a3cf7157e6eee1dc36 100644 (file)
@@ -67,7 +67,7 @@
 */
 
 /*
-**     23 August 1997, version 2.5a
+**     20 September 1997, version 2.5c
 **
 **     Supported SCSI-II features:
 **         Synchronous negotiation
@@ -457,9 +457,9 @@ static int guess_xfer_direction(int opcode);
 /*
 **     Head of list of NCR boards
 **
-**     Host is retrieved by its irq level.
-**     If interrupts are shared, the internal host control block 
-**     address (struct ncb) is used as device id.
+**     For kernel version < 1.3.70, host is retrieved by its irq level.
+**     For later kernels, the internal host control block address 
+**     (struct ncb) is used as device id parameter of the irq stuff.
 */
 
 static struct Scsi_Host                *first_host     = NULL;
@@ -528,6 +528,9 @@ static struct ncr_driver_setup
 #ifdef SCSI_NCR_BOOT_COMMAND_LINE_SUPPORT
 static struct ncr_driver_setup
        driver_safe_setup __initdata    = SCSI_NCR_DRIVER_SAFE_SETUP;
+#ifdef MODULE
+char *ncr53c8xx = 0;   /* command line passed by insmod */
+#endif
 #endif
 
 /*
@@ -4579,7 +4582,7 @@ printf(KERN_INFO "ncr53c%s-%d: rev=0x%02x, base=0x%x, io_port=0x%x, irq=%d\n",
                        SA_INTERRUPT|SA_SHIRQ, "ncr53c8xx", np)) {
 #else
        if (request_irq(device->slot.irq, ncr53c8xx_intr,
-                       SA_INTERRUPT, "ncr53c8xx", NULL)) {
+                       SA_INTERRUPT, "ncr53c8xx", np)) {
 #endif
 #else
        if (request_irq(device->slot.irq, ncr53c8xx_intr,
@@ -4736,7 +4739,9 @@ int ncr_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *))
 
        /*---------------------------------------------------
        **
-       **      Assign a ccb / bind cmd
+       **      Assign a ccb / bind cmd.
+       **      If resetting, shorten settle_time if necessary
+       **      in order to avoid spurious timeouts.
        **      If resetting or no free ccb,
        **      insert cmd into the waiting list.
        **
@@ -4744,6 +4749,11 @@ int ncr_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *))
        */
        save_flags(flags); cli();
 
+       if (np->settle_time && cmd->timeout_per_command >= HZ &&
+               np->settle_time > jiffies + cmd->timeout_per_command - HZ) {
+               np->settle_time = jiffies + cmd->timeout_per_command - HZ;
+       }
+
         if (np->settle_time || !(cp=ncr_get_ccb (np, cmd->target, cmd->lun))) {
                insert_into_waiting_list(np, cmd);
                restore_flags(flags);
@@ -5234,7 +5244,7 @@ int ncr_reset_bus (Scsi_Cmnd *cmd, int sync_reset)
  * Commands will now be queued in the waiting list until a settle 
  * delay of 2 seconds will be completed.
  */
-       ncr_start_reset(np, 2);
+       ncr_start_reset(np, driver_setup.settle_delay);
 /*
  * First, look in the wakeup list
  */
@@ -5382,7 +5392,7 @@ static int ncr_abort_command (Scsi_Cmnd *cmd)
 */
 
 #ifdef MODULE
-static int ncr_detach(ncb_p np, int irq)
+static int ncr_detach(ncb_p np)
 {
        ccb_p cp;
        tcb_p tp;
@@ -5421,16 +5431,12 @@ static int ncr_detach(ncb_p np, int irq)
 */
 
 #ifdef DEBUG_NCR53C8XX
-       printf("%s: freeing irq %d\n", ncr_name(np), irq);
+       printf("%s: freeing irq %d\n", ncr_name(np), np->irq);
 #endif
 #if LINUX_VERSION_CODE >= LinuxVersionCode(1,3,70)
-#   ifdef SCSI_NCR_SHARE_IRQ
-       free_irq(irq, np);
-#   else
-       free_irq(irq, NULL);
-#   endif
+       free_irq(np->irq, np);
 #else
-       free_irq(irq);
+       free_irq(np->irq);
 #endif
 
        /*
@@ -6786,14 +6792,20 @@ static void ncr_log_hard_error(ncb_p np, u_short sist, u_char dstat)
                script_base     = (u_char *) np->script;
                script_name     = "script";
        }
-       else {
+       else if (np->p_scripth < dsp && 
+                dsp <= np->p_scripth + sizeof(struct scripth)) {
                script_ofs      = dsp - np->p_scripth;
                script_size     = sizeof(struct scripth);
                script_base     = (u_char *) np->scripth;
                script_name     = "scripth";
+       } else {
+               script_ofs      = dsp;
+               script_size     = 0;
+               script_base     = 0;
+               script_name     = "mem";
        }
 
-       printf ("%s:%d: ERROR (%x:%x) (%x-%x-%x) (%x/%x) @ %s (%x:%08x).\n",
+       printf ("%s:%d: ERROR (%x:%x) (%x-%x-%x) (%x/%x) @ (%s %x:%08x).\n",
                ncr_name (np), (unsigned)INB (nc_ctest0)&0x0f, dstat, sist,
                (unsigned)INB (nc_socl), (unsigned)INB (nc_sbcl), (unsigned)INB (nc_sbdl),
                (unsigned)INB (nc_sxfer),(unsigned)INB (nc_scntl3), script_name, script_ofs,
@@ -6978,13 +6990,13 @@ void ncr_exception (ncb_p np)
 
        if ((sist & (SGE)) ||
                (dstat & (MDPE|BF|ABORT|IID))) {
-               ncr_start_reset(np, 2);
+               ncr_start_reset(np, driver_setup.settle_delay);
                return;
        };
 
        if (sist & HTH) {
                printf ("%s: handshake timeout\n", ncr_name(np));
-               ncr_start_reset(np, 2);
+               ncr_start_reset(np, driver_setup.settle_delay);
                return;
        };
 
@@ -6994,7 +7006,7 @@ void ncr_exception (ncb_p np)
                        OUTB (nc_scr1, HS_UNEXPECTED);
                        OUTL (nc_dsp, NCB_SCRIPT_PHYS (np, cleanup));
                };
-               ncr_start_reset(np, 2);
+               ncr_start_reset(np, driver_setup.settle_delay);
                return;
        };
 
@@ -7085,7 +7097,7 @@ static int ncr_int_sbmc (ncb_p np)
                ncr_name(np), np->scsi_mode, scsi_mode);
 
        np->scsi_mode = scsi_mode;
-       ncr_start_reset(np, 2);
+       ncr_start_reset(np, driver_setup.settle_delay);
 
        return 1;
 }
@@ -8913,7 +8925,11 @@ void ncr53c8xx_setup(char *str, int *ints)
                else
                        printf("ncr53c8xx_setup: unexpected boot option '%.*s' ignored\n", (int)(pc-cur+1), cur);
 
+#ifdef MODULE
+               if ((cur = strchr(cur, ' ')) != NULL)
+#else
                if ((cur = strchr(cur, ',')) != NULL)
+#endif
                        ++cur;
        }
 #endif /* SCSI_NCR_BOOT_COMMAND_LINE_SUPPORT */
@@ -9089,6 +9105,11 @@ int ncr53c8xx_detect(Scsi_Host_Template *tpnt)
 # endif
 #endif
 
+#if    defined(SCSI_NCR_BOOT_COMMAND_LINE_SUPPORT) && defined(MODULE)
+if (ncr53c8xx)
+       ncr53c8xx_setup(ncr53c8xx, (int *) 0);
+#endif
+
        /* 
        ** Detect all 53c8xx hosts and then attach them.
        **
@@ -9248,6 +9269,28 @@ static int ncr53c8xx_pci_init(Scsi_Host_Template *tpnt,
                return -1;
        }
 
+#ifdef __powerpc__
+       /*
+        *      Severall fix-up for power/pc.
+        *      Should not be performed by the driver.
+        */
+       if ((command &
+               (PCI_COMMAND_MASTER|PCI_COMMAND_IO|PCI_COMMAND_MEMORY)) !=
+               (PCI_COMMAND_MASTER|PCI_COMMAND_IO|PCI_COMMAND_MEMORY)) {
+               printk("ncr53c8xx : setting PCI master/io/command bit\n");
+               command |= PCI_COMMAND_MASTER|PCI_COMMAND_IO|PCI_COMMAND_MEMORY;
+               pcibios_write_config_word(bus, device_fn, PCI_COMMAND, command);
+       }
+       if (io_port >= 0x10000000) {
+               io_port = (io_port & 0x00FFFFFF) | 0x01000000;
+               pcibios_write_config_dword(bus, device_fn, PCI_BASE_ADDRESS_0, io_port);
+       }
+       if (base >= 0x10000000) {
+               base = (base & 0x00FFFFFF) | 0x01000000;
+               pcibios_write_config_dword(bus, device_fn, PCI_BASE_ADDRESS_1, base);
+       }
+#endif
+
        /*
         * Check availability of IO space, memory space and master capability.
         */
@@ -9510,47 +9553,41 @@ printk("ncr53c8xx : command successfully queued\n");
 }
 
 /*
-**   Linux entry point of the interrupt handler
+**   Linux entry point of the interrupt handler.
+**   Fort linux versions > 1.3.70, we trust the kernel for 
+**   passing the internal host descriptor as 'dev_id'.
+**   Otherwise, we scan the host list and call the interrupt 
+**   routine for each host that uses this IRQ.
 */
 
 #if LINUX_VERSION_CODE >= LinuxVersionCode(1,3,70)
 static void ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs)
+{
+#ifdef DEBUG_NCR53C8XX
+     printk("ncr53c8xx : interrupt received\n");
+#endif
+
+     if (DEBUG_FLAGS & DEBUG_TINY) printf ("[");
+     ncr_exception((ncb_p) dev_id);
+     if (DEBUG_FLAGS & DEBUG_TINY) printf ("]\n");
+}
+
 #else
 static void ncr53c8xx_intr(int irq, struct pt_regs * regs)
-#endif
 {
      struct Scsi_Host *host;
      struct host_data *host_data;
-#if 0
-     u_long flags;
-
-     save_flags(flags); cli();
-#endif
-
-#ifdef DEBUG_NCR53C8XX
-printk("ncr53c8xx : interrupt received\n");
-#endif
 
      for (host = first_host; host; host = host->next) {
          if (host->hostt == the_template && host->irq == irq) {
               host_data = (struct host_data *) host->hostdata;
-#if LINUX_VERSION_CODE >= LinuxVersionCode(1,3,70)
-#   ifdef SCSI_NCR_SHARE_IRQ
-               if (dev_id == host_data->ncb) {
-#else
-               if (1) {
-#   endif
-#endif
-                    if (DEBUG_FLAGS & DEBUG_TINY) printf ("[");
-                   ncr_exception(host_data->ncb);
-                    if (DEBUG_FLAGS & DEBUG_TINY) printf ("]\n");
-               }
+               if (DEBUG_FLAGS & DEBUG_TINY) printf ("[");
+               ncr_exception(host_data->ncb);
+               if (DEBUG_FLAGS & DEBUG_TINY) printf ("]\n");
          }
      }
-#if 0
-     restore_flags(flags);
-#endif
 }
+#endif
 
 /*
 **   Linux entry point of the timer handler
@@ -9656,17 +9693,10 @@ int ncr53c8xx_abort(Scsi_Cmnd *cmd)
 #ifdef MODULE
 int ncr53c8xx_release(struct Scsi_Host *host)
 {
-     struct host_data *host_data;
 #ifdef DEBUG_NCR53C8XX
 printk("ncr53c8xx : release\n");
 #endif
-
-     for (host = first_host; host; host = host->next) {
-         if (host->hostt == the_template) {
-              host_data = (struct host_data *) host->hostdata;
-              ncr_detach(host_data->ncb, host->irq);
-         }
-     }
+     ncr_detach(((struct host_data *) host->hostdata)->ncb);
 
      return 1;
 }
index b22565b11e267a30555a51ef61fbca80b9e7c621..0f8cb78764527cac74ceef94544108bbeb75e5e3 100644 (file)
@@ -45,7 +45,7 @@
 /*
 **     Name and revision of the driver
 */
-#define SCSI_NCR_DRIVER_NAME           "ncr53c8xx - revision 2.5a"
+#define SCSI_NCR_DRIVER_NAME           "ncr53c8xx - revision 2.5c"
 
 /*
 **     Check supported Linux versions
index 5316e2e642ee24ca8af9b57562a735b6cba7b9ef..8a0de132a0b28c6341553f5efe876804f2f8a8ff 100644 (file)
 int init_module(void) {
     driver_template.module = &__this_module;
     scsi_register_module(MODULE_SCSI_HA, &driver_template);
-    return (driver_template.present == 0);
+    if (driver_template.present)
+       return 0;
+
+    scsi_unregister_module(MODULE_SCSI_HA, &driver_template);
+    return -1;
 }
 
 void cleanup_module( void) {
index d83b94e26aa30d0ea9960cd5999258e4e724fe4c..dcf0c02fef03c450253e19b0a10dc2052d568876 100644 (file)
@@ -106,7 +106,7 @@ static int sg_open(struct inode * inode, struct file * filp)
            if (flags & O_NONBLOCK)
                return -EBUSY;
            interruptible_sleep_on(&scsi_generics[dev].generic_wait);
-           if (current->signal & ~current->blocked)
+           if (signal_pending(current))
                return -ERESTARTSYS;
        }
        scsi_generics[dev].exclude=1;
@@ -121,7 +121,7 @@ static int sg_open(struct inode * inode, struct file * filp)
            if (flags & O_NONBLOCK)
                return -EBUSY;
            interruptible_sleep_on(&scsi_generics[dev].generic_wait);
-           if (current->signal & ~current->blocked)
+           if (signal_pending(current))
                return -ERESTARTSYS;
        }
 
@@ -172,7 +172,7 @@ static char *sg_malloc(int size)
        while(big_inuse)
        {
            interruptible_sleep_on(&big_wait);
-           if (current->signal & ~current->blocked)
+           if (signal_pending(current))
                return NULL;
        }
        big_inuse=1;
@@ -222,7 +222,7 @@ static long sg_read(struct inode *inode,struct file *filp,char *buf,unsigned lon
            return -EAGAIN;
        }
        interruptible_sleep_on(&device->read_wait);
-       if (current->signal & ~current->blocked)
+       if (signal_pending(current))
        {
            restore_flags(flags);
            return -ERESTARTSYS;
@@ -355,7 +355,7 @@ static long sg_write(struct inode *inode,struct file *filp,const char *buf,unsig
        printk("sg_write: sleeping on pending request\n");
 #endif
        interruptible_sleep_on(&device->write_wait);
-       if (current->signal & ~current->blocked)
+       if (signal_pending(current))
            return -ERESTARTSYS;
     }
 
index 54523d88f176c332e4deb199892a0acb56c967db..8133b3500c8b5ca71628954be212d58c3f083273 100644 (file)
@@ -277,7 +277,7 @@ dma_reset_output (int dev)
   audio_devs[dev]->dmap_out->flags |= DMA_SYNCING;
 
   audio_devs[dev]->dmap_out->underrun_count = 0;
-  if (!(current->signal & ~current->blocked)
+  if (!signal_pending(current)
       && audio_devs[dev]->dmap_out->qlen
       && audio_devs[dev]->dmap_out->underrun_count == 0)
     {
@@ -416,7 +416,7 @@ DMAbuf_sync (int dev)
       audio_devs[dev]->dmap_out->flags |= DMA_SYNCING;
 
       audio_devs[dev]->dmap_out->underrun_count = 0;
-      while (!(current->signal & ~current->blocked)
+      while (!signal_pending(current)
             && n++ <= audio_devs[dev]->dmap_out->nbufs
             && audio_devs[dev]->dmap_out->qlen
             && audio_devs[dev]->dmap_out->underrun_count == 0)
@@ -456,7 +456,7 @@ DMAbuf_sync (int dev)
       cli ();
       if (audio_devs[dev]->d->local_qlen)      /* Device has hidden buffers */
        {
-         while (!((current->signal & ~current->blocked))
+         while (!signal_pending(current)
                 && audio_devs[dev]->d->local_qlen (dev))
            {
 
@@ -496,7 +496,7 @@ DMAbuf_release (int dev, int mode)
 
   if (audio_devs[dev]->open_mode & OPEN_WRITE)
     if (!(audio_devs[dev]->dmap_in->mapping_flags & DMA_MAP_MAPPED))
-      if (!((current->signal & ~current->blocked))
+      if (!signal_pending(current)
          && (audio_devs[dev]->dmap_out->dma_mode == DMODE_OUTPUT))
        {
          DMAbuf_sync (dev);
@@ -856,7 +856,7 @@ output_sleep (int dev, int dontblock)
        tmout = 20 * HZ;
     }
 
-  if ((current->signal & ~current->blocked))
+  if (signal_pending(current))
     return -EIO;
 
 
@@ -882,7 +882,7 @@ output_sleep (int dev, int dontblock)
       ;
       dma_reset_output (dev);
     }
-  else if ((current->signal & ~current->blocked))
+  else if (signal_pending(current))
     {
       err = -EINTR;
     }
index 1c37f9f5a93d97647361fd4475cd076d6ced878c..7588c3e1108f8299d2082a3f86dadaa367e260b7 100644 (file)
@@ -628,7 +628,7 @@ struct sound_queue {
 static struct sound_queue sq;
 
 #define sq_block_address(i)    (sq.buffers[i])
-#define SIGNAL_RECEIVED        (current->signal & ~current->blocked)
+#define SIGNAL_RECEIVED        (signal_pending(current))
 #define NON_BLOCKING(open_mode)        (open_mode & O_NONBLOCK)
 #define ONE_SECOND     HZ      /* in jiffies (100ths of a second) */
 #define NO_TIME_LIMIT  0xffffffff
index 6fa104905ad6702b56d6b1c891a464b198275928..166b41c227d12d3400e0280c437d427687aaa299 100644 (file)
@@ -95,8 +95,8 @@ maui_wait (int mask)
              maui_sleep_flag.opts |= WK_TIMEOUT;
          }
        maui_sleep_flag.opts &= ~WK_SLEEP;
-      };
-      if ((current->signal & ~current->blocked))
+      }
+      if (signal_pending(current))
        {
          return 0;
        }
index 454fc74719281260fffe230374cb9b3b40c70ccb..8685b9307069f0a083815ec6c083ae253ef2c0f3 100644 (file)
@@ -533,7 +533,7 @@ midi_synth_load_patch (int dev, int format, const char *addr,
 
   sysex_sleep_flag.opts = WK_NONE;
 
-  for (i = 0; i < left && !(current->signal & ~current->blocked); i++)
+  for (i = 0; i < left && !signal_pending(current); i++)
     {
       unsigned char   data;
 
@@ -554,7 +554,7 @@ midi_synth_load_patch (int dev, int format, const char *addr,
        }
 
       while (!midi_devs[orig_dev]->outputc (orig_dev, (unsigned char) (data & 0xff)) &&
-            !(current->signal & ~current->blocked))
+            !signal_pending(current))
 
        {
          unsigned long   tlimit;
index c4271e87b10212adff9ababc4e4e4b1d84627d08..3309a165afe161a097ba484af7d99ae681ba0cc6 100644 (file)
@@ -93,7 +93,7 @@ drain_midi_queue (int dev)
    */
 
   if (midi_devs[dev]->buffer_status != NULL)
-    while (!(current->signal & ~current->blocked) &&
+    while (!signal_pending(current) &&
           midi_devs[dev]->buffer_status (dev))
 
       {
@@ -289,7 +289,7 @@ MIDIbuf_release (int dev, struct fileinfo *file)
                                                   * devices
                                                 */
 
-      while (!(current->signal & ~current->blocked) &&
+      while (!signal_pending(current) &&
             DATA_AVAIL (midi_out_buf[dev]))
 
        {
@@ -370,8 +370,8 @@ MIDIbuf_write (int dev, struct fileinfo *file, const char *buf, int count)
                  midi_sleep_flag[dev].opts |= WK_TIMEOUT;
              }
            midi_sleep_flag[dev].opts &= ~WK_SLEEP;
-         };
-         if ((current->signal & ~current->blocked))
+         }
+         if (signal_pending(current))
            {
              restore_flags (flags);
              return -EINTR;
@@ -430,7 +430,7 @@ MIDIbuf_read (int dev, struct fileinfo *file, char *buf, int count)
          }
        input_sleep_flag[dev].opts &= ~WK_SLEEP;
       };
-      if ((current->signal & ~current->blocked))
+      if (signal_pending(current))
        c = -EINTR;             /*
                                   * The user is getting restless
                                 */
index 14d2f24de7b8ae3b672a229d54347c897f8b00e0..10e293372f5838770a9ae60c2b19bd52355f6b8c 100644 (file)
@@ -1227,7 +1227,7 @@ seq_drain_midi_queues (void)
 
   n = 1;
 
-  while (!(current->signal & ~current->blocked) && n)
+  while (!signal_pending(current) && n)
     {
       n = 0;
 
@@ -1279,7 +1279,7 @@ sequencer_release (int dev, struct fileinfo *file)
 
   if (mode != OPEN_READ && !(file->flags & (O_NONBLOCK) ?
                             1 : 0))
-    while (!(current->signal & ~current->blocked) && qlen > 0)
+    while (!signal_pending(current) && qlen > 0)
       {
        seq_sync ();
 
@@ -1344,7 +1344,7 @@ seq_sync (void)
 {
   unsigned long   flags;
 
-  if (qlen && !seq_playing && !(current->signal & ~current->blocked))
+  if (qlen && !seq_playing && !signal_pending(current))
     seq_startplay ();
 
   save_flags (flags);
@@ -1572,7 +1572,7 @@ sequencer_ioctl (int dev, struct fileinfo *file,
 
       if (mode == OPEN_READ)
        return 0;
-      while (qlen > 0 && !(current->signal & ~current->blocked))
+      while (qlen > 0 && !signal_pending(current))
        seq_sync ();
       if (qlen)
        return -EINTR;
index d2b121b1848373803d89540ddd197948c5f857ac..919e61b7662131b266c1add9abd7f876ee7fa803 100644 (file)
@@ -223,7 +223,7 @@ static int autofs_root_lookup(struct inode *dir, struct dentry * dentry)
         * a signal. If so we can force a restart..
         */
        if (dentry->d_flags & DCACHE_AUTOFS_PENDING) {
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        return -ERESTARTNOINTR;
        }
 
index ce00e439f7794d442a8d7451b8d3e84b77aa5de2..99561051d158d7d3fb432b4a3b395fdca517ab3d 100644 (file)
@@ -179,7 +179,7 @@ static void send_sigio(int pid, uid_t uid, uid_t euid)
                    (uid ^ p->suid) && (uid ^ p->uid))
                        continue;
                p->signal |= 1 << (SIGIO-1);
-               if (p->state == TASK_INTERRUPTIBLE && (p->signal & ~p->blocked))
+               if (p->state == TASK_INTERRUPTIBLE && signal_pending(p))
                        wake_up_process(p);
        }
        read_unlock(&tasklist_lock);
index d2eb7a80ea5badc87232a7f0e0dca6db21d05369..76fb7a5309b0ae989f28f6a607e81487ed383963 100644 (file)
--- a/fs/fifo.c
+++ b/fs/fifo.c
@@ -29,7 +29,7 @@ static int fifo_open(struct inode * inode,struct file * filp)
                if (!(filp->f_flags & O_NONBLOCK) && !PIPE_WRITERS(*inode)) {
                        PIPE_RD_OPENERS(*inode)++;
                        while (!PIPE_WRITERS(*inode)) {
-                               if (current->signal & ~current->blocked) {
+                               if (signal_pending(current)) {
                                        retval = -ERESTARTSYS;
                                        break;
                                }
@@ -62,7 +62,7 @@ static int fifo_open(struct inode * inode,struct file * filp)
                if (!PIPE_READERS(*inode)) {
                        PIPE_WR_OPENERS(*inode)++;
                        while (!PIPE_READERS(*inode)) {
-                               if (current->signal & ~current->blocked) {
+                               if (signal_pending(current)) {
                                        retval = -ERESTARTSYS;
                                        break;
                                }
index 738fa0bcab09847390099d7b2053f5a3622c4480..27e23f77dfc35eb8bbdd3e3afa2f7ce04bef6644 100644 (file)
@@ -560,7 +560,7 @@ repeat:
                if (posix_locks_conflict(fl, &tfl)) {
                        if (filp && (filp->f_flags & O_NONBLOCK))
                                return (-EAGAIN);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return (-ERESTARTSYS);
                        if (posix_locks_deadlock(&tfl, fl))
                                return (-EDEADLK);
@@ -569,7 +569,7 @@ repeat:
                        interruptible_sleep_on(&tfl.fl_wait);
                        locks_delete_block(fl, &tfl);
 
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return (-ERESTARTSYS);
                        /* If we've been sleeping someone might have
                         * changed the permissions behind our back.
@@ -822,7 +822,7 @@ search:
 repeat:
        /* Check signals each time we start */
        error = -ERESTARTSYS;
-       if (current->signal & ~current->blocked)
+       if (signal_pending(current))
                goto out;
        for (fl = inode->i_flock; (fl != NULL) && (fl->fl_flags & FL_FLOCK);
             fl = fl->fl_next) {
@@ -882,7 +882,7 @@ int posix_lock_file(struct file *filp, struct file_lock *caller,
        if (caller->fl_type != F_UNLCK) {
   repeat:
                error = -ERESTARTSYS;
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        goto out;
                for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) {
                        if (!(fl->fl_flags & FL_POSIX))
index e88176f957702be50112c5c906c44ca21b3cdab1..30421571febea92ff9a5b64a14d404a9b06513bf 100644 (file)
@@ -167,7 +167,7 @@ static int do_ncp_rpc_call(struct ncp_server *server, int size)
                        schedule();
                        remove_wait_queue(entry.wait_address, &entry.wait);
                        current->state = TASK_RUNNING;
-                       if (current->signal & ~current->blocked) {
+                       if (signal_pending(current)) {
                                current->timeout = 0;
                                result = -ERESTARTSYS;
                                break;
index acee50754544da39617d84d2ecdadc3e813d443f..c05f792476442dcb54c158dcceb28884c9a43bf2 100644 (file)
@@ -148,7 +148,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
 again:
        if (waitp) {
                interruptible_sleep_on(waitp);
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        return -ERESTARTSYS;
                waitp = NULL;
        }
index 4587950efded3cdb9465e0d5699722dfd875c4cd..3a576e5d1de53d4d31a42436adad9689696e1f5d 100644 (file)
@@ -209,7 +209,7 @@ nfs_lock(struct file *filp, int cmd, struct file_lock *fl)
        /* If unlocking a file region, flush dirty pages (unless we've
         * been killed by a signal, that is). */
        if (cmd == F_SETLK && fl->fl_type == F_UNLCK
-        && !(current->signal & ~current->blocked)) {
+           && !signal_pending(current)) {
                status = nfs_flush_dirty_pages(inode,
                        fl->fl_start, fl->fl_end == NLM_OFFSET_MAX? 0 :
                        fl->fl_end - fl->fl_start + 1);
index 1a0267abe58c00a2b2909a923f0b1f41a4820b7e..94666436fc275d311df9a26bc89c291c731db978 100644 (file)
@@ -404,7 +404,7 @@ exp_writelock(void)
        while (hash_count || hash_lock)
                interruptible_sleep_on(&hash_wait);
        want_lock--;
-       if (current->signal & ~current->blocked)
+       if (signal_pending(current))
                return -EINTR;
        hash_lock = 1;
        return 0;
index f5688541d10943eae9d011d9a2574e81639795c9..35cb232ee0ac86cdc0c975748d9c6fbfe5b16856 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -52,7 +52,7 @@ static long pipe_read(struct inode * inode, struct file * filp,
                        if (!PIPE_WRITERS(*inode))
                                return 0;
                }
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        return -ERESTARTSYS;
                interruptible_sleep_on(&PIPE_WAIT(*inode));
        }
@@ -104,7 +104,7 @@ static long pipe_write(struct inode * inode, struct file * filp,
                                send_sig(SIGPIPE,current,0);
                                return written? :-EPIPE;
                        }
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return written? :-ERESTARTSYS;
                        if (filp->f_flags & O_NONBLOCK)
                                return written? :-EAGAIN;
index bf8c4a3018104e01087652d111d78538f817be08..5211ad4da048fb4430b7d9bb7977b893e2823766 100644 (file)
@@ -900,18 +900,18 @@ static int get_statm(int pid, char * buffer)
  * For the /proc/<pid>/maps file, we use fixed length records, each containing
  * a single line.
  */
-#define MAPS_LINE_LENGTH       1024
-#define MAPS_LINE_SHIFT                10
+#define MAPS_LINE_LENGTH       4096
+#define MAPS_LINE_SHIFT                12
 /*
  * f_pos = (number of the vma in the task->mm->mmap list) * MAPS_LINE_LENGTH
  *         + (index into the line)
  */
 /* for systems with sizeof(void*) == 4: */
-#define MAPS_LINE_FORMAT4        "%08lx-%08lx %s %08lx %s %lu\n"
+#define MAPS_LINE_FORMAT4        "%08lx-%08lx %s %08lx %s %lu"
 #define MAPS_LINE_MAX4 49 /* sum of 8  1  8  1 4 1 8 1 5 1 10 1 */
 
 /* for systems with sizeof(void*) == 8: */
-#define MAPS_LINE_FORMAT8        "%016lx-%016lx %s %016lx %s %lu\n"
+#define MAPS_LINE_FORMAT8        "%016lx-%016lx %s %016lx %s %lu"
 #define MAPS_LINE_MAX8 73 /* sum of 16  1  16  1 4 1 16 1 5 1 10 1 */
 
 #define MAPS_LINE_MAX  MAPS_LINE_MAX8
@@ -926,6 +926,7 @@ static long read_maps (int pid, struct file * file,
        int column;
        struct vm_area_struct * map;
        int i;
+       char * buffer;
 
        if (!p)
                return -EINVAL;
@@ -933,6 +934,8 @@ static long read_maps (int pid, struct file * file,
        if (!p->mm || p->mm == &init_mm || count == 0)
                return 0;
 
+       buffer = (char*)__get_free_page(GFP_KERNEL);
+
        /* decode f_pos */
        lineno = file->f_pos >> MAPS_LINE_SHIFT;
        column = file->f_pos & (MAPS_LINE_LENGTH-1);
@@ -945,11 +948,13 @@ static long read_maps (int pid, struct file * file,
 
        for ( ; map ; ) {
                /* produce the next line */
-               char line[MAPS_LINE_MAX+1];
+               char *line;
                char str[5], *cp = str;
                int flags;
                kdev_t dev;
                unsigned long ino;
+               int maxlen = (sizeof(void*) == 4) ? 
+                       MAPS_LINE_MAX4 :  MAPS_LINE_MAX8;
                int len;
 
                flags = map->vm_flags;
@@ -965,13 +970,26 @@ static long read_maps (int pid, struct file * file,
                if (map->vm_dentry != NULL) {
                        dev = map->vm_dentry->d_inode->i_dev;
                        ino = map->vm_dentry->d_inode->i_ino;
-               }
+                       line = d_path(map->vm_dentry, buffer, PAGE_SIZE);
+                       buffer[PAGE_SIZE-1] = '\n';
+                       line -= maxlen;
+                       if(line < buffer)
+                               line = buffer;
+               } else
+                       line = buffer;
 
                len = sprintf(line,
                              sizeof(void*) == 4 ? MAPS_LINE_FORMAT4 : MAPS_LINE_FORMAT8,
                              map->vm_start, map->vm_end, str, map->vm_offset,
                              kdevname(dev), ino);
 
+               if(map->vm_dentry) {
+                       int i;
+                       for(i = len; i < maxlen; i++)
+                               line[i] = ' ';
+                       len = buffer + PAGE_SIZE - line;
+               } else
+                       line[len++] = '\n';
                if (column >= len) {
                        column = 0; /* continue with next line at column 0 */
                        lineno++;
@@ -1005,6 +1023,7 @@ static long read_maps (int pid, struct file * file,
        /* encode f_pos */
        file->f_pos = (lineno << MAPS_LINE_SHIFT) + column;
 
+       free_page((unsigned long)buffer);
        return destptr-buf;
 }
 
index 126683ea4eae8b32499455a0adf904ec43746c36..9f03867994896c7379313d35db59306ec60607da 100644 (file)
@@ -91,7 +91,7 @@ static long mem_read(struct inode * inode, struct file * file,
                return count;
        tmp = buf;
        while (count > 0) {
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        break;
                page_dir = pgd_offset(tsk->mm,addr);
                if (pgd_none(*page_dir))
@@ -145,7 +145,7 @@ static long mem_write(struct inode * inode, struct file * file,
                return -ESRCH;
        tmp = buf;
        while (count > 0) {
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        break;
                page_dir = pgd_offset(tsk,addr);
                if (pgd_none(*page_dir))
@@ -180,7 +180,7 @@ static long mem_write(struct inode * inode, struct file * file,
        file->f_pos = addr;
        if (tmp != buf)
                return tmp-buf;
-       if (current->signal & ~current->blocked)
+       if (signal_pending(current))
                return -ERESTARTSYS;
        return 0;
 }
index c11682f342c28d38e7e729b3baab82068a0a57b8..fab0b3e762f80d489863600ccd89086a3a70e2ba 100644 (file)
@@ -87,7 +87,13 @@ asmlinkage int old_readdir(unsigned int fd, void * dirent, unsigned int count)
        if (!file->f_op || !file->f_op->readdir)
                goto out;
 
+       /*
+        * Get the inode's semaphore to prevent changes
+        * to the directory while we read it.
+        */
+       down(&inode->i_sem);
        error = file->f_op->readdir(file, &buf, fillonedir);
+       up(&inode->i_sem);
        if (error < 0)
                goto out;
        error = buf.count;
@@ -173,7 +179,13 @@ asmlinkage int sys_getdents(unsigned int fd, void * dirent, unsigned int count)
        if (!file->f_op || !file->f_op->readdir)
                goto out;
 
+       /*
+        * Get the inode's semaphore to prevent changes
+        * to the directory while we read it.
+        */
+       down(&inode->i_sem);
        error = file->f_op->readdir(file, &buf, filldir);
+       up(&inode->i_sem);
        if (error < 0)
                goto out;
        lastdirent = buf.previous;
index 5cb06164b7bd3287f0a7a8a6b1cb47736bbfa40f..e857d6e7eaebffd8f10b973f6f7bd03189d5118c 100644 (file)
@@ -184,7 +184,7 @@ static int do_select(int n, fd_set_buffer *fds, poll_table *wait)
                        }
                }
                wait = NULL;
-               if (retval || !current->timeout || (current->signal & ~current->blocked))
+               if (retval || !current->timeout || signal_pending(current))
                        break;
                schedule();
        }
@@ -333,7 +333,7 @@ asmlinkage int sys_select(int n, fd_set *inp, fd_set *outp, fd_set *exp, struct
                goto out;
        if (!error) {
                error = -ERESTARTNOHAND;
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        goto out;
                error = 0;
        }
@@ -384,7 +384,7 @@ static int do_poll(unsigned int nfds, struct pollfd *fds, poll_table *wait)
                }
 
                wait = NULL;
-               if (count || !current->timeout || (current->signal & ~current->blocked))
+               if (count || !current->timeout || signal_pending(current))
                        break;
                schedule();
        }
@@ -439,7 +439,7 @@ asmlinkage int sys_poll(struct pollfd * ufds, unsigned int nfds, int timeout)
                __put_user(fds->revents, &ufds->revents);
        }
        kfree(fds1);
-       if (!fdcount && (current->signal & ~current->blocked))
+       if (!fdcount && signal_pending(current))
                err = -EINTR;
        else
                err = fdcount;
index 39513df4bc620350a0a9ca5e9e5ccd3d936a221b..8fc3409851aff6d1478a455e776961b05a617747 100644 (file)
 #include <linux/nfs_fs_sb.h>
 #include <linux/nfs_mount.h>
 
+/*
+ * We use a semaphore to synchronize all mount/umount
+ * activity - imagine the mess if we have a race between
+ * unmounting a filesystem and re-mounting it (or something
+ * else).
+ */
+static struct semaphore mount_sem = MUTEX;
+
 extern void wait_for_keypress(void);
 extern struct file_operations * get_blkfops(unsigned int major);
 
@@ -665,6 +673,9 @@ static int umount_dev(kdev_t dev)
                goto out_iput;
 
        fsync_dev(dev);
+
+       down(&mount_sem);
+
        retval = do_umount(dev,0);
        if (!retval) {
                fsync_dev(dev);
@@ -673,6 +684,8 @@ static int umount_dev(kdev_t dev)
                        put_unnamed_dev(dev);
                }
        }
+
+       up(&mount_sem);
 out_iput:
        iput(inode);
 out:
@@ -767,6 +780,7 @@ int do_mount(kdev_t dev, const char * dev_name, const char * dir_name, const cha
        struct vfsmount *vfsmnt;
        int error;
 
+       down(&mount_sem);
        error = -EACCES;
        if (!(flags & MS_RDONLY) && dev && is_read_only(dev))
                goto out;
@@ -810,12 +824,14 @@ int do_mount(kdev_t dev, const char * dev_name, const char * dir_name, const cha
                vfsmnt->mnt_sb = sb;
                vfsmnt->mnt_flags = flags;
                d_mount(dir_d, sb->s_root);
-               return 0;               /* we don't dput(dir) - see umount */
+               error = 0;
+               goto out;               /* we don't dput(dir) - see umount */
        }
 
 dput_and_out:
        dput(dir_d);
 out:
+       up(&mount_sem);
        return error;   
 }
 
index bca9bbfea8902bc4569d61af1c17075313bdd352..eb5df17f6fe9d26c8d0215f0c59f2310bdd5d1f5 100644 (file)
@@ -28,7 +28,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
  * These are used to set parameters in the core dumps.
  */
 #define ELF_CLASS      ELFCLASS64
-#define ELF_DATA       ELFDATA2LSB;
+#define ELF_DATA       ELFDATA2LSB
 #define ELF_ARCH       EM_ALPHA
 
 #define USE_ELF_CORE_DUMP
index f8061c34788e1726505993b17f87733f611de91a..a32bb728a0a4483e793ba510d80345a84ce5cd09 100644 (file)
 #define __NR_pciconfig_read            345
 #define __NR_pciconfig_write           346
 #define __NR_query_module              347
+#define __NR_prctl                     348
 
 #if defined(__LIBRARY__) && defined(__GNUC__)
 
index 46a4a7ada116db6bab857299ce6d643bb2352244..1eae23267f5b16b625bfaf6275fdfd15f094041c 100644 (file)
@@ -24,7 +24,7 @@ typedef struct user_i387_struct elf_fpregset_t;
  * These are used to set parameters in the core dumps.
  */
 #define ELF_CLASS      ELFCLASS32
-#define ELF_DATA       ELFDATA2LSB;
+#define ELF_DATA       ELFDATA2LSB
 #define ELF_ARCH       EM_386
 
 /* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program starts %edx
index 66efafee95b61ca67453c9579ac083e8b5eeb98c..30641193e5c3f87c6d3361b3c2c5e3645c0a9024 100644 (file)
 #define __NR_nfsservctl                169
 #define __NR_setresgid         170
 #define __NR_getresgid         171
+#define __NR_prctl              172
 
 /* user-visible error numbers are in the range -1 - -122: see <asm-i386/errno.h> */
 
index ee282c0a983f1cd15b15c5f84a98606f4ba83a1e..0925126adfbe49b6608056d27536bbb31fb18586 100644 (file)
@@ -24,7 +24,7 @@ typedef struct user_m68kfp_struct elf_fpregset_t;
  * These are used to set parameters in the core dumps.
  */
 #define ELF_CLASS      ELFCLASS32
-#define ELF_DATA       ELFDATA2MSB;
+#define ELF_DATA       ELFDATA2MSB
 #define ELF_ARCH       EM_68K
 
 /* For SVR4/m68k the function pointer to be registered with `atexit' is
index 79e78c2a41238665f03e364584f3e10b4fd2e391..410bce3933f065c3e6857bacdc1c33c99639aabf 100644 (file)
 #define __NR_query_module      167
 #define __NR_poll              168
 #define __NR_nfsservctl                169
+#define __NR_prctl             170
 
 /* user-visible error numbers are in the range -1 - -122: see
    <asm-m68k/errno.h> */
index 87dae378ff7baf6f1571b557b49d8ad1da488d6b..b08f69181f1e50f1628a1c4aa9a2837a088e9ea9 100644 (file)
@@ -22,9 +22,9 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
  */
 #define ELF_CLASS      ELFCLASS32
 #ifdef __MIPSEB__
-#define ELF_DATA       ELFDATA2MSB;
+#define ELF_DATA       ELFDATA2MSB
 #elif __MIPSEL__
-#define ELF_DATA       ELFDATA2LSB;
+#define ELF_DATA       ELFDATA2LSB
 #endif
 #define ELF_ARCH       EM_MIPS
 
index 4517106ca25c9dabc72d0d88af8ed682467dc32f..f0511957c0c093049ef499e180a29618016500d4 100644 (file)
 #define __NR_nfsservctl                        (__NR_Linux + 189)
 #define __NR_setresgid                 (__NR_Linux + 190)
 #define __NR_getresgid                 (__NR_Linux + 191)
+#define __NR_prctl                     (__NR_Linux + 192)
 
 /*
  * Offset of the last Linux flavoured syscall
  */
-#define __NR_Linux_syscalls            191
+#define __NR_Linux_syscalls            192
 
 #ifndef __LANGUAGE_ASSEMBLY__
 
index a63612ffa1e9dfc923495e52ef05ea147fb21fe1..76684b4ed45f5576fee11a404d686dc1837c7a51 100644 (file)
@@ -19,7 +19,7 @@
  */
 #define ELF_ARCH       EM_PPC
 #define ELF_CLASS      ELFCLASS32
-#define ELF_DATA       ELFDATA2MSB;
+#define ELF_DATA       ELFDATA2MSB
 
 #define USE_ELF_CORE_DUMP
 #define ELF_EXEC_PAGESIZE      4096
index 5665d906c8541f1dec423ea0512d58fda179dc44..227d9f1552ef7c02490f7061c5bc29d6bc81bde8 100644 (file)
 #define __NR_query_module      166
 #define __NR_poll              167
 #define __NR_nfsservctl                168
+#define __NR_prctl             169
 
 #define __NR(n)        #n
 #define __do_syscall(n) \
index 326d7d8e9286c5ab14de0558c6cf87c0fd002f15..f9a6d836f8d0d62504148e49e670dac07dd01500 100644 (file)
@@ -25,7 +25,7 @@ typedef unsigned long elf_fpregset_t;
  */
 #define ELF_ARCH       EM_SPARC
 #define ELF_CLASS      ELFCLASS32
-#define ELF_DATA       ELFDATA2MSB;
+#define ELF_DATA       ELFDATA2MSB
 
 #define USE_ELF_CORE_DUMP
 #define ELF_EXEC_PAGESIZE      4096
index 3655fd34f47739a10d1a2dd919534ffc3fc36759..a99623c74c99f6d6fa5c798191da8bbfc9ea396b 100644 (file)
 #define __NR_fdatasync          253
 #define __NR_nfsservctl         254
 #define __NR_aplib              255
+#define __NR_prctl              256
 
 #define _syscall0(type,name) \
 type name(void) \
index 39b07b1664892757e72049e5973d95735d2955d3..caf1c94344269a5f280fcf0dcb259333ab99c1df 100644 (file)
@@ -22,7 +22,7 @@ typedef unsigned long elf_fpregset_t;
 #ifndef ELF_ARCH
 #define ELF_ARCH               EM_SPARC64
 #define ELF_CLASS              ELFCLASS64
-#define ELF_DATA               ELFDATA2MSB;
+#define ELF_DATA               ELFDATA2MSB
 #endif
 
 #ifndef ELF_FLAGS_INIT
index 27afe645edc6c22914d06af18550240d3429a1ac..f8b34f6a5e9df5d7176e1450456ad545dfcaf872 100644 (file)
 #define __NR_fdatasync          253
 #define __NR_nfsservctl         254
 #define __NR_aplib              255
+#define __NR_prctl              256
 
 #define _syscall0(type,name) \
 type name(void) \
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
new file mode 100644 (file)
index 0000000..f08f3c3
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef _LINUX_PRCTL_H
+#define _LINUX_PRCTL_H
+
+/*  Values to pass as first argument to prctl()  */
+
+#define PR_SET_PDEATHSIG  1  /*  Second arg is a signal  */
+
+
+#endif /* _LINUX_PRCTL_H */
index 9e11e12ab1a6fb5ce371fcd9e47837da5d321b3f..765be1c5471fe237b540e8925a6548308b48a103 100644 (file)
@@ -191,6 +191,7 @@ struct task_struct {
        struct task_struct *next_task, *prev_task;
        struct task_struct *next_run,  *prev_run;
        int exit_code, exit_signal;
+       int pdeath_signal;  /*  The signal sent when the parent dies  */
        /* ??? */
        unsigned long personality;
        int dumpable:1;
@@ -312,7 +313,7 @@ struct task_struct {
 /* exec domain */&default_exec_domain, \
 /* binfmt */   NULL, \
 /* schedlink */        &init_task,&init_task, &init_task, &init_task, \
-/* ec,brk... */        0,0,0,0,0, \
+/* ec,brk... */        0,0,0,0,0,0, \
 /* pid etc.. */        0,0,0,0,0, \
 /* suppl grps*/ 0, {0,}, \
 /* proc links*/ &init_task,&init_task,NULL,NULL,NULL, \
@@ -449,6 +450,11 @@ extern void force_sig(unsigned long sig,struct task_struct * p);
 extern int send_sig(unsigned long sig,struct task_struct * p,int priv);
 extern int in_group_p(gid_t grp);
 
+extern inline int signal_pending(struct task_struct *p)
+{
+       return (p->signal &~ p->blocked) != 0;
+}
+
 extern int request_irq(unsigned int irq,
                       void (*handler)(int, void *, struct pt_regs *),
                       unsigned long flags, 
index 3183a310906a179a6028cac1d04fc9c00bd00b8a..467445e06db93398d0e6545eed673172f072f3b3 100644 (file)
@@ -70,6 +70,6 @@ __rpc_remove_list(struct rpc_listitem **q, struct rpc_listitem *item)
 /*
  * Shorthands
  */
-#define signalled()            (current->signal & ~current->blocked)
+#define signalled()            (signal_pending(current))
 
 #endif /* _LINUX_SUNRPC_TYPES_H_ */
index 2d6d4719f0b37fd4dbf60020d5f63d0f6a2a97d8..d8a73117b35e418e85245bde4495b4e104c99f44 100644 (file)
@@ -8,7 +8,7 @@
 #define file_operation_handle file_operations
 
 #define connect_wrapper(x) 0
-#define current_got_fatal_signal() (current->signal & ~current->blocked)
+#define current_got_fatal_signal() (signal_pending(current))
 #define current_set_timeout(val) current->timeout = val
 
 #define module_interruptible_sleep_on interruptible_sleep_on
index 49d8f043f6a48619cc447b096a842416c5caa97c..0bf4a695ee7711e0ad9a0a72e39fa5a3ad1cbee1 100644 (file)
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -136,7 +136,7 @@ static int real_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg
                        /* still no space in queue */
                        if (msgflg & IPC_NOWAIT)
                                return -EAGAIN;
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -EINTR;
                        if (in_interrupt()) {
                                /* Very unlikely, but better safe than sorry */
@@ -383,7 +383,7 @@ static int real_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, long msgty
                                DROP_TIMER;
                                return -ENOMSG;
                        }
-                       if (current->signal & ~current->blocked) {
+                       if (signal_pending(current)) {
                                DROP_TIMER;
                                return -EINTR; 
                        }
index 76c38483422394d04d5a97aa9f7fe28e68889296..a9a3bf9d9f44dc0a219f670a067664ee1d1b4355 100644 (file)
@@ -55,7 +55,7 @@ static inline void generate(unsigned long sig, struct task_struct * p)
        spin_lock(&p->sigmask_lock);
        p->signal |= mask;
        spin_unlock(&p->sigmask_lock);
-       if (p->state == TASK_INTERRUPTIBLE && (p->signal & ~p->blocked))
+       if (p->state == TASK_INTERRUPTIBLE && signal_pending(p))
                wake_up_process(p);
 out:
        spin_unlock_irqrestore(&p->sig->siglock, flags);
@@ -349,7 +349,8 @@ static inline void forget_original_parent(struct task_struct * father)
        for_each_task(p) {
                if (p->p_opptr == father) {
                        p->exit_signal = SIGCHLD;
-                       p->p_opptr = task[smp_num_cpus] ? : task[0];    /* init */
+                       p->p_opptr = task[smp_num_cpus] ? : task[0]; /* init */
+                       if (p->pdeath_signal) send_sig(p->pdeath_signal, p, 0);
                }
        }
        read_unlock(&tasklist_lock);
@@ -659,7 +660,7 @@ repeat:
                if (options & WNOHANG)
                        goto end_wait4;
                retval = -ERESTARTSYS;
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        goto end_wait4;
                current->state=TASK_INTERRUPTIBLE;
                schedule();
index 4974d5dac69ba27dc2bbb364e8d87b6f5d9d5cc7..6ed9eb8c0a3fcc87c3e42f10250780547d750778 100644 (file)
@@ -497,6 +497,7 @@ int do_fork(unsigned long clone_flags, unsigned long usp, struct pt_regs *regs)
        /* ok, now we should be set up.. */
        p->swappable = 1;
        p->exit_signal = clone_flags & CSIGNAL;
+       p->pdeath_signal = 0;
 
        /*
         * "share" dynamic priority between parent and child, thus the
index 3d409f2d55270b58b3ea704ff8750d32e6383d40..ea6ec2eb8d1cbf50f520c093f075887bfd8a7531 100644 (file)
@@ -96,7 +96,7 @@ asmlinkage int sys_syslog(int type, char * buf, int len)
                cli();
                error = -ERESTARTSYS;
                while (!log_size) {
-                       if (current->signal & ~current->blocked) {
+                       if (signal_pending(current)) {
                                sti();
                                goto out;
                        }
index 8b0290518c7a4fbe3d6a00c75c6684d5e00a1ab9..645e441702136e6a4ea7b217d9dd2c5f87761c38 100644 (file)
@@ -400,7 +400,7 @@ asmlinkage void schedule(void)
        timeout = 0;
        switch (prev->state) {
                case TASK_INTERRUPTIBLE:
-                       if (prev->signal & ~prev->blocked)
+                       if (signal_pending(prev))
                                goto makerunnable;
                        timeout = prev->timeout;
                        if (timeout && (timeout <= jiffies)) {
@@ -623,9 +623,7 @@ static inline int __do_down(struct semaphore * sem, int task_state)
                if (waking_non_zero(sem))       /* are we waking up?  */
                        break;                  /* yes, exit loop */
 
-               if (   task_state == TASK_INTERRUPTIBLE
-                   && (tsk->signal & ~tsk->blocked)    /* signalled */
-                  ) {
+               if (task_state == TASK_INTERRUPTIBLE && signal_pending(tsk)) {
                        ret = -EINTR;                   /* interrupted */
                        atomic_inc(&sem->count);        /* give up on down operation */
                        break;
index 9459f9b4e3e211a46f6ef77e9263fc5848ecc42c..9416811663469f3ef0437fcf3dcc46b8a8a7be73 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/smp_lock.h>
 #include <linux/notifier.h>
 #include <linux/reboot.h>
+#include <linux/prctl.h>
 
 #include <asm/uaccess.h>
 #include <asm/io.h>
@@ -1005,3 +1006,25 @@ asmlinkage int sys_umask(int mask)
        mask = xchg(&current->fs->umask, mask & S_IRWXUGO);
        return mask;
 }
+    
+asmlinkage int sys_prctl(int option, unsigned long arg2, unsigned long arg3,
+                         unsigned long arg4, unsigned long arg5)
+{
+       int error = 0;
+       int sig;
+
+       switch (option) {
+               case PR_SET_PDEATHSIG:
+                       sig = arg2;
+                       if (sig > _NSIG) {
+                               error = -EINVAL;
+                                break;
+                        }
+                        current->pdeath_signal = sig;
+                        break;
+               default:
+                       error = -EINVAL;
+                       break;
+        }
+        return error;
+}
index 8f1ab1faeec3220fb35f545266c9395403d2e830..570a86f7c391bc855d646d01cbe6bea444f9dd9f 100644 (file)
@@ -355,6 +355,9 @@ static inline int do_try_to_free_page(int priority, int dma, int wait)
        int i=6;
        int stop;
 
+       /* Always trim SLAB caches when memory gets low. */
+       (void) kmem_cache_reap(0, dma, wait);
+
        /* we don't try as hard if we're not waiting.. */
        stop = 3;
        if (wait)
@@ -366,19 +369,9 @@ static inline int do_try_to_free_page(int priority, int dma, int wait)
                                return 1;
                        state = 1;
                case 1:
-                       /*
-                        * We shouldn't have a priority here:
-                        * If we're low on memory we should
-                        * unconditionally throw away _all_
-                        * kmalloc caches!
-                        */
-                       if (kmem_cache_reap(0, dma, wait))
-                               return 1;
-                       state = 2;
-               case 2:
                        if (shm_swap(i, dma))
                                return 1;
-                       state = 3;
+                       state = 2;
                default:
                        if (swap_out(i, dma, wait))
                                return 1;
index baa5bb40e12da0f426171b21ac8bda431c24e2cf..2fa92c4ad88d40645bcdbd5b7be8efa88e8d4a2a 100644 (file)
@@ -1174,7 +1174,7 @@ static int ax25_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le
        /* A DM or timeout will go to closed, a UA will go to ABM */
        while (sk->state == TCP_SYN_SENT) {
                interruptible_sleep_on(sk->sleep);
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        sti();
                        return -ERESTARTSYS;
                }
@@ -1227,7 +1227,7 @@ static int ax25_accept(struct socket *sock, struct socket *newsock, int flags)
                                return -EWOULDBLOCK;
                        }
                        interruptible_sleep_on(sk->sleep);
-                       if (current->signal & ~current->blocked) {
+                       if (signal_pending(current)) {
                                sti();
                                return -ERESTARTSYS;
                        }
index 70c939dbd852c90e7998ea158a7f200b84420150..cd6e9500066d4028a53afbbfa7f9d50640f5b1e4 100644 (file)
@@ -114,7 +114,7 @@ restart:
 
                /* handle signals */
                error = -ERESTARTSYS;
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        goto no_packet;
 
                /* User doesn't want to wait */
index 0d4109e202264e1092ce04c77f78df7e4f60961b..65cee3b62169ca1a154b7a3fad343d7cbc5c25ec 100644 (file)
@@ -674,7 +674,7 @@ struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size, unsigne
                        {
                                sk->socket->flags &= ~SO_NOSPACE;
                                interruptible_sleep_on(sk->sleep);
-                               if (current->signal & ~current->blocked
+                               if (signal_pending(current)
                                {
                                        sti();
                                        *errcode = -ERESTARTSYS;
index f789f398de4a43c781e74a133e06354f225fdd93..4bf4bf1660c2362824af5924a9e7ff8053152b4a 100644 (file)
@@ -605,7 +605,7 @@ int inet_stream_connect(struct socket *sock, struct sockaddr * uaddr,
        cli();
        while(sk->state == TCP_SYN_SENT || sk->state == TCP_SYN_RECV) {
                interruptible_sleep_on(sk->sleep);
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        sti();
                        return(-ERESTARTSYS);
                }
@@ -670,7 +670,7 @@ int inet_accept(struct socket *sock, struct socket *newsock, int flags)
        cli();
        while (sk2->state == TCP_SYN_RECV) {
                interruptible_sleep_on(sk2->sleep);
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        goto do_interrupted;
        }
        sti();
index 2c28ab6118fa5138f5cbae47c7103d4f133ebf37..b62035e3bb9ca8eb02348eecbe089b7055fd1cd2 100644 (file)
@@ -724,7 +724,7 @@ static void wait_for_tcp_memory(struct sock * sk)
                sk->socket->flags &= ~SO_NOSPACE;
                add_wait_queue(sk->sleep, &wait);
                for (;;) {
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                break;
                        current->state = TASK_INTERRUPTIBLE;
                        if (tcp_memory_free(sk))
@@ -792,7 +792,7 @@ int tcp_do_sendmsg(struct sock *sk, int iovlen, struct iovec *iov, int flags)
                if (flags&MSG_DONTWAIT)
                        return -EAGAIN;
                
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        return -ERESTARTSYS;
                
                wait_for_tcp_connect(sk);
@@ -915,7 +915,7 @@ int tcp_do_sendmsg(struct sock *sk, int iovlen, struct iovec *iov, int flags)
                                        return -EAGAIN;
                                }
 
-                               if (current->signal & ~current->blocked) {
+                               if (signal_pending(current)) {
                                        if (copied)
                                                return copied;
                                        return -ERESTARTSYS;
@@ -1155,7 +1155,7 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg,
                 * handling. FIXME: Need to check this doesnt impact 1003.1g
                 * and move it down to the bottom of the loop
                 */
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        if (copied)
                                break;
                        copied = -ERESTARTSYS;
@@ -1473,7 +1473,7 @@ void tcp_close(struct sock *sk, unsigned long timeout)
                current->timeout = timeout;
                while(closing(sk) && current->timeout) {
                        interruptible_sleep_on(sk->sleep);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                break;
                }
                current->timeout=0;
@@ -1518,7 +1518,7 @@ static struct open_request * wait_for_connect(struct sock * sk,
                req = tcp_find_established(&(sk->tp_pinfo.af_tcp), pprev);
                if (req) 
                        break;
-               if (current->signal & ~current->blocked)
+               if (signal_pending(current))
                        break;
        }
        remove_wait_queue(sk->sleep, &wait);
index 9bf31a126e45929e877496f3a96a3ee8d341db48..40cee309e5871866243c8d3bb4d2ceb2e82e9499 100644 (file)
@@ -111,7 +111,7 @@ static long netlink_read(struct inode * inode, struct file * file, char * buf,
                        return -EAGAIN;
                }
                interruptible_sleep_on(&read_space_wait[minor]);
-               if(current->signal & ~current->blocked)
+               if(signal_pending(current))
                {
                        sti();
                        return -ERESTARTSYS;
index 2d6b825934c6c6efb3155ceea082bd554fb26649..8b51f71208554d76a990aad1572111defb7f8ab7 100644 (file)
@@ -699,7 +699,7 @@ static int nr_connect(struct socket *sock, struct sockaddr *uaddr,
         */
        while (sk->state == TCP_SYN_SENT) {
                interruptible_sleep_on(sk->sleep);
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        sti();
                        return -ERESTARTSYS;
                }
@@ -750,7 +750,7 @@ static int nr_accept(struct socket *sock, struct socket *newsock, int flags)
                                return -EWOULDBLOCK;
                        }
                        interruptible_sleep_on(sk->sleep);
-                       if (current->signal & ~current->blocked) {
+                       if (signal_pending(current)) {
                                sti();
                                return -ERESTARTSYS;
                        }
index 6d22f37041f7cce82a255e6c94ab0252f49e2d6c..69b77a9f24787ab66106abe3dd421c48e6da43d6 100644 (file)
@@ -787,7 +787,7 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le
         */
        while (sk->state == TCP_SYN_SENT) {
                interruptible_sleep_on(sk->sleep);
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        sti();
                        return -ERESTARTSYS;
                }
@@ -838,7 +838,7 @@ static int rose_accept(struct socket *sock, struct socket *newsock, int flags)
                                return -EWOULDBLOCK;
                        }
                        interruptible_sleep_on(sk->sleep);
-                       if (current->signal & ~current->blocked) {
+                       if (signal_pending(current)) {
                                sti();
                                return -ERESTARTSYS;
                        }
index 971163963792db65a95074756cc648b0c597889c..cb9984ac7fa5c2ca163f4a6728111e9868cea778 100644 (file)
@@ -142,7 +142,10 @@ rpc_destroy_client(struct rpc_clnt *clnt)
        dprintk("RPC: destroying %s client for %s\n",
                        clnt->cl_protname, clnt->cl_server);
 
-       rpcauth_destroy(clnt->cl_auth);
+       if (clnt->cl_auth) {
+               rpcauth_destroy(clnt->cl_auth);
+               clnt->cl_auth = NULL;
+       }
        if (clnt->cl_xprt) {
                xprt_destroy(clnt->cl_xprt);
                clnt->cl_xprt = NULL;
index 8622da797a4517aa45a6ed9fd54290a892d7e6a3..936d6122017339dd1f94661f6295c9e479a750b7 100644 (file)
@@ -705,7 +705,7 @@ static int unix_stream_connect1(struct socket *sock, struct msghdr *msg,
                if(nonblock)
                        return -EINPROGRESS;
                interruptible_sleep_on(sk->sleep);
-               if(current->signal & ~current->blocked)
+               if(signal_pending(current))
                        return -ERESTARTSYS;
        }
        
@@ -802,7 +802,7 @@ static int unix_accept(struct socket *sock, struct socket *newsock, int flags)
                        if(flags&O_NONBLOCK)
                                return -EAGAIN;
                        interruptible_sleep_on(sk->sleep);
-                       if(current->signal & ~current->blocked)
+                       if(signal_pending(current))
                                return -ERESTARTSYS;
                        continue;
                }
@@ -1219,7 +1219,7 @@ static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg, int size
                        if (noblock)
                                return -EAGAIN;
                        unix_data_wait(sk);
-                       if (current->signal & ~current->blocked)
+                       if (signal_pending(current))
                                return -ERESTARTSYS;
                        down(&sk->protinfo.af_unix.readsem);
                        continue;
index a9a12f092c0c97fbe244d1247879fbb341cd4ac7..2970a82b9de185621a6b0e848b6628bcfbb1950b 100644 (file)
@@ -653,7 +653,7 @@ static int x25_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len
         */
        while (sk->state == TCP_SYN_SENT) {
                interruptible_sleep_on(sk->sleep);
-               if (current->signal & ~current->blocked) {
+               if (signal_pending(current)) {
                        sti();
                        return -ERESTARTSYS;
                }
@@ -704,7 +704,7 @@ static int x25_accept(struct socket *sock, struct socket *newsock, int flags)
                                return -EWOULDBLOCK;
                        }
                        interruptible_sleep_on(sk->sleep);
-                       if (current->signal & ~current->blocked) {
+                       if (signal_pending(current)) {
                                sti();
                                return -ERESTARTSYS;
                        }
index d1edca9c187391287e25e8554e78e076e5fc9b31..b0aa76c82940be440f65d4caca85d28f8750b94a 100644 (file)
@@ -2,6 +2,9 @@
 // Copyright (C) 1995 Greg McGary <gkm@magilla.cichlid.com>
 // compile like so: g++ -o ksymoops ksymoops.cc -liostream
 
+// Update to binutils 2.8 and handling of header text on oops lines by
+// Keith Owens <kaos@ocs.com.au>
+
 //////////////////////////////////////////////////////////////////////////////
 
 // This program is free software; you can redistribute it and/or modify
@@ -26,8 +29,6 @@
 //////////////////////////////////////////////////////////////////////////////
 
 // BUGS:
-// * Doesn't deal with line-prefixes prepended by syslog--strip
-//   these off first, before submitting to ksymoops.
 // * Only resolves operands of jump and call instructions.
 
 #include <fstream.h>
@@ -39,7 +40,6 @@
 #include <unistd.h>
 #include <ctype.h>
 
-inline int strequ(char const* x, char const* y) { return (::strcmp(x, y) == 0); }
 inline int strnequ(char const* x, char const* y, size_t n) { return (::strncmp(x, y, n) == 0); }
 
 const int code_size = 20;
@@ -188,6 +188,8 @@ NameList::decode(unsigned char* code, long eip_addr)
     int eip_seen = 0;
     long offset;
     while (fgets(buf, sizeof(buf), objdump_FILE)) {
+       if (strlen(buf) < 14)
+           continue;
        if (eip_seen && buf[4] == ':') {
            // assume objdump from binutils 2.8..., reformat to old style
            offset = strtol(buf, 0, 16);
@@ -279,6 +281,7 @@ int
 main(int argc, char** argv)
 {
     char c;
+    char *oops_column = NULL;
     program_name = (argc--, *argv++);
 
     NameList names;
@@ -299,46 +302,63 @@ main(int argc, char** argv)
     cout << endl;
 
     char buffer[1024];
-    while (!cin.eof())
-    {
+    while (1) {
        long eip_addr;
-       cin >> buffer;
-       if (strequ(buffer, "EIP:") && names.valid()) {
-           cin >> ::hex >> eip_addr;
-           cin >> c >> c >> c;
-           cin >> ::hex >> eip_addr;
-           cin >> c >> c >> buffer;
-           if (!strequ(buffer, "EFLAGS:")) {
-               clog << "Please strip the line-prefixes and rerun " << program_name << endl;
+       cin.get(buffer, sizeof(buffer));
+       if (cin.eof())
+           break;
+       cin.get(c);     /* swallow newline */
+       if (strstr(buffer, "EIP:") && names.valid()) {
+           oops_column =  strstr(buffer, "EIP:");
+           if (sscanf(oops_column+13, "[<%x>]", &eip_addr) != 1) {
+               cout << "Cannot read eip address from EIP: line.  Is this a valid oops file?" << endl;
                exit(1);
            }
+           cout << ">>EIP: ";
            KSym* ksym = names.find(eip_addr);
            if (ksym)
-               cout << ">>EIP: " << *ksym << endl;
-       } else if (strequ(buffer, "Trace:") && names.valid()) {
+               cout << *ksym << endl;
+           else
+               cout << ::hex << eip_addr << " cannot be resolved" << endl;
+       }
+       else if (oops_column && strstr(oops_column, "[<") && names.valid()) {
            unsigned long address;
-           while ((cin >> buffer) && 
-                  (sscanf(buffer, " [<%x>]", &address) == 1) &&
-                  address > 0xc) {
-               cout << "Trace: ";
-               KSym* ksym = names.find(address);
-               if (ksym)
-                   cout << *ksym;
-               else
-                   cout << ::hex << address;
-               cout << endl;
+           while (strstr(oops_column, "[<")) {
+               char *p = oops_column;
+               while (1) {
+                   while (*p && *p++ != '[')
+                       ;
+                   if (sscanf(p, "<%x>]", &address) != 1)
+                       break;
+                   cout << "Trace: ";
+                   KSym* ksym = names.find(address);
+                   if (ksym)
+                       cout << *ksym;
+                   else
+                       cout << ::hex << address;
+                   cout << endl;
+               }
+               cin.get(buffer, sizeof(buffer));
+               if (cin.eof())
+                   break;
+               cin.get(c);     /* swallow newline */
            }
-           cout << endl;
        }
-       if (strequ(buffer, "ode:") || strequ(buffer, "Code:")) {
-           // The 'C' might have been consumed as a hex number
+       if (oops_column && strnequ(oops_column, "Code:", 5)) {
            unsigned char code[code_size];
            unsigned char* cp = code;
            unsigned char* end = &code[code_size];
-           while (cp < end) {
-               int c;
-               cin >> ::hex >> c;
+           char *p = oops_column + 5;
+           int c;
+           memset(code, '\0', sizeof(code));
+           while (*p && cp < end) {
+               while (*p == ' ')
+                   ++p;
+               if (sscanf(p, "%x", &c) != 1)
+                   break;
                *cp++ = c;
+               while (*p && *p++ != ' ')
+                   ;
            }
            names.decode(code, eip_addr);
        }