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
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
VERSION = 2
PATCHLEVEL = 1
-SUBLEVEL = 56
+SUBLEVEL = 57
ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/)
.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
* 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[];
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 */
}
#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;
.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
.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
timeo = 1;
break;
}
- if(current->signal & ~(current->blocked)) return -EINTR;
+ if(signal_pending(current)) return -EINTR;
}
if(timeo) return -EAGAIN;
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();
SYS(sys_getresgid, 3)
SYS(sys_setresgid, 3) /* 4190 */
SYS(sys_getresgid, 3)
+SYS(sys_prctl, 5)
.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
tnet_check_completion();
if (resched_needed())
break;
- if (current->signal & ~current->blocked) break;
+ if (signal_pending(current)) break;
}
return 0;
}
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));
.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. */
.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)
/*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. */
/*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. */
.word sunos_nosys, sunos_nosys
/*250*/ .word sunos_nosys, sunos_nosys, sunos_nosys
.word sunos_nosys, sunos_nosys, sys_aplib
+ .word sunos_nosys
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) {
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;
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))
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)
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;
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;
}
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;
}
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);
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;
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;
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)
while (sony_inuse)
{
interruptible_sleep_on(&sony_wait);
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
{
restore_flags(flags);
return -EAGAIN;
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");
}
}
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;
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;
}
}
if (i < count)
return count - i;
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
return -ERESTARTSYS;
return 0;
}
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;
}
break;
}
restore_flags(flags);
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
|| (ch_ctrl[channel].rs_status & C_RS_DCD))) {
break;
}
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
(do_clocal || (ch->imodem & ch->dcd)))
break;
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
{
retval = -ERESTARTSYS;
break;
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();
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;
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:
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 */
current->timeout = jiffies + char_time;
schedule();
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
break;
if (timeout && ((orig_jiffies + timeout) < jiffies))
!(info->flags & ASYNC_CLOSING) &&
(do_clocal))
break;
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
/*** 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;
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 */
}
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);
}
* 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);
}
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;
}
*/
if (wait) {
while (test_bit(ST_CLOSING, &portp->state)) {
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
restore_flags(flags);
return(-ERESTARTSYS);
}
*/
rc = 0;
while (test_bit(ST_CLOSING, &portp->state)) {
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
rc = -ERESTARTSYS;
break;
}
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);
}
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);
}
(doclocal || (portp->sigs & TIOCM_CD))) {
break;
}
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
rc = -ERESTARTSYS;
break;
}
* 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. */
sti();
}
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
if (total_bytes_written + bytes_written)
return total_bytes_written + bytes_written;
else
#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)
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
}
/* check for signals before going to sleep */
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
if (temp != buf)
return temp-buf;
else
retval = -EAGAIN;
break;
}
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
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;
}
(info->asyncflags & ASYNC_CLOSING) == 0 &&
(do_clocal || (info->imodem & info->dcd)))
break;
- if(current->signal & ~current->blocked) {
+ if(signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
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;
}
inode->i_atime = CURRENT_TIME;
return count-i;
}
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
return -ERESTARTSYS;
return 0;
}
retval = -EAGAIN;
break;
}
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
!(port->flags & ASYNC_CLOSING) &&
(do_clocal || CD))
break;
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
(do_clocal || (sGetChanStatusLo(&info->channel) &
CD_ACT)))
break;
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
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;
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:
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;
retval = -EAGAIN;
break;
}
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
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;
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:
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 */
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;
(do_clocal || (serial_in(info, UART_MSR) &
UART_MSR_DCD)))
break;
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
(doclocal || (portp->sigs & TIOCM_CD))) {
break;
}
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
rc = -ERESTARTSYS;
break;
}
if (!count)
break;
ret = -ERESTARTSYS;
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
break;
if (need_resched)
schedule();
release_dev(filp);
if (retval != -ERESTARTSYS)
return retval;
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
return retval;
schedule();
/*
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;
if (opt & TERMIOS_WAIT) {
tty_wait_until_sent(tty, 0);
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
return -EINTR;
}
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;
if (vt == fg_console)
break;
retval = -EINTR;
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
break;
schedule();
}
current->state = TASK_INTERRUPTIBLE;
schedule();
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
return -EINTR;
}
return 0;
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)
(do_clocal || (info->msr & UART_MSR_DCD))) {
break;
}
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
ret = -EAGAIN;
break;
}
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
ret = -ERESTARTSYS;
break;
}
!(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;
}
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.
current->state = TASK_INTERRUPTIBLE;
schedule ();
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
return -EINTR;
continue;
}
"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;
}
return 0;
}
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
kfree (new_data);
return -EINTR;
}
/* 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;
}
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;
return -EBUSY;
interruptible_sleep_on(&driver->open_wait);
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
return -EINTR;
goto retry_open;
}
return -EBUSY;
interruptible_sleep_on(&driver->open_wait);
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
return -EINTR;
goto retry_open;
}
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;
}
inode->i_atime = CURRENT_TIME;
return count-i;
}
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
return -ERESTARTSYS;
return 0;
}
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;
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:
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 */
!(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;
}
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 ();
}
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 ();
}
return count-c;
}
/* Only called if nothing was sent */
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
return -ERESTARTSYS;
return 0;
}
!(info->flags & ZILOG_CLOSING) &&
(do_clocal || (DCD & r0)))
break;
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
-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
*/
/*
-** 23 August 1997, version 2.5a
+** 20 September 1997, version 2.5c
**
** Supported SCSI-II features:
** Synchronous negotiation
/*
** 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;
#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
/*
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,
/*---------------------------------------------------
**
- ** 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.
**
*/
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);
* 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
*/
*/
#ifdef MODULE
-static int ncr_detach(ncb_p np, int irq)
+static int ncr_detach(ncb_p np)
{
ccb_p cp;
tcb_p tp;
*/
#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
/*
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,
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;
};
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;
};
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;
}
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 */
# 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.
**
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.
*/
}
/*
-** 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
#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;
}
/*
** 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
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) {
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;
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;
}
while(big_inuse)
{
interruptible_sleep_on(&big_wait);
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
return NULL;
}
big_inuse=1;
return -EAGAIN;
}
interruptible_sleep_on(&device->read_wait);
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
{
restore_flags(flags);
return -ERESTARTSYS;
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;
}
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)
{
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)
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))
{
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);
tmout = 20 * HZ;
}
- if ((current->signal & ~current->blocked))
+ if (signal_pending(current))
return -EIO;
;
dma_reset_output (dev);
}
- else if ((current->signal & ~current->blocked))
+ else if (signal_pending(current))
{
err = -EINTR;
}
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
maui_sleep_flag.opts |= WK_TIMEOUT;
}
maui_sleep_flag.opts &= ~WK_SLEEP;
- };
- if ((current->signal & ~current->blocked))
+ }
+ if (signal_pending(current))
{
return 0;
}
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;
}
while (!midi_devs[orig_dev]->outputc (orig_dev, (unsigned char) (data & 0xff)) &&
- !(current->signal & ~current->blocked))
+ !signal_pending(current))
{
unsigned long tlimit;
*/
if (midi_devs[dev]->buffer_status != NULL)
- while (!(current->signal & ~current->blocked) &&
+ while (!signal_pending(current) &&
midi_devs[dev]->buffer_status (dev))
{
* devices
*/
- while (!(current->signal & ~current->blocked) &&
+ while (!signal_pending(current) &&
DATA_AVAIL (midi_out_buf[dev]))
{
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;
}
input_sleep_flag[dev].opts &= ~WK_SLEEP;
};
- if ((current->signal & ~current->blocked))
+ if (signal_pending(current))
c = -EINTR; /*
* The user is getting restless
*/
n = 1;
- while (!(current->signal & ~current->blocked) && n)
+ while (!signal_pending(current) && n)
{
n = 0;
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 ();
{
unsigned long flags;
- if (qlen && !seq_playing && !(current->signal & ~current->blocked))
+ if (qlen && !seq_playing && !signal_pending(current))
seq_startplay ();
save_flags (flags);
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;
* 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;
}
(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);
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;
}
if (!PIPE_READERS(*inode)) {
PIPE_WR_OPENERS(*inode)++;
while (!PIPE_READERS(*inode)) {
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
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);
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.
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) {
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))
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;
again:
if (waitp) {
interruptible_sleep_on(waitp);
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
return -ERESTARTSYS;
waitp = NULL;
}
/* 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);
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;
if (!PIPE_WRITERS(*inode))
return 0;
}
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
return -ERESTARTSYS;
interruptible_sleep_on(&PIPE_WAIT(*inode));
}
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;
* 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
int column;
struct vm_area_struct * map;
int i;
+ char * buffer;
if (!p)
return -EINVAL;
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);
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;
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++;
/* encode f_pos */
file->f_pos = (lineno << MAPS_LINE_SHIFT) + column;
+ free_page((unsigned long)buffer);
return destptr-buf;
}
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))
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))
file->f_pos = addr;
if (tmp != buf)
return tmp-buf;
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
return -ERESTARTSYS;
return 0;
}
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;
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;
}
}
wait = NULL;
- if (retval || !current->timeout || (current->signal & ~current->blocked))
+ if (retval || !current->timeout || signal_pending(current))
break;
schedule();
}
goto out;
if (!error) {
error = -ERESTARTNOHAND;
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
goto out;
error = 0;
}
}
wait = NULL;
- if (count || !current->timeout || (current->signal & ~current->blocked))
+ if (count || !current->timeout || signal_pending(current))
break;
schedule();
}
__put_user(fds->revents, &ufds->revents);
}
kfree(fds1);
- if (!fdcount && (current->signal & ~current->blocked))
+ if (!fdcount && signal_pending(current))
err = -EINTR;
else
err = fdcount;
#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);
goto out_iput;
fsync_dev(dev);
+
+ down(&mount_sem);
+
retval = do_umount(dev,0);
if (!retval) {
fsync_dev(dev);
put_unnamed_dev(dev);
}
}
+
+ up(&mount_sem);
out_iput:
iput(inode);
out:
struct vfsmount *vfsmnt;
int error;
+ down(&mount_sem);
error = -EACCES;
if (!(flags & MS_RDONLY) && dev && is_read_only(dev))
goto out;
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;
}
* 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
#define __NR_pciconfig_read 345
#define __NR_pciconfig_write 346
#define __NR_query_module 347
+#define __NR_prctl 348
#if defined(__LIBRARY__) && defined(__GNUC__)
* 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
#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> */
* 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
#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> */
*/
#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
#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__
*/
#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
#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) \
*/
#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
#define __NR_fdatasync 253
#define __NR_nfsservctl 254
#define __NR_aplib 255
+#define __NR_prctl 256
#define _syscall0(type,name) \
type name(void) \
#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
#define __NR_fdatasync 253
#define __NR_nfsservctl 254
#define __NR_aplib 255
+#define __NR_prctl 256
#define _syscall0(type,name) \
type name(void) \
--- /dev/null
+#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 */
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;
/* 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, \
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,
/*
* Shorthands
*/
-#define signalled() (current->signal & ~current->blocked)
+#define signalled() (signal_pending(current))
#endif /* _LINUX_SUNRPC_TYPES_H_ */
#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
/* 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 */
DROP_TIMER;
return -ENOMSG;
}
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
DROP_TIMER;
return -EINTR;
}
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);
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);
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();
/* 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
cli();
error = -ERESTARTSYS;
while (!log_size) {
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
sti();
goto out;
}
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)) {
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;
#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>
mask = xchg(¤t->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;
+}
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)
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;
/* 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;
}
return -EWOULDBLOCK;
}
interruptible_sleep_on(sk->sleep);
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
sti();
return -ERESTARTSYS;
}
/* handle signals */
error = -ERESTARTSYS;
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
goto no_packet;
/* User doesn't want to wait */
{
sk->socket->flags &= ~SO_NOSPACE;
interruptible_sleep_on(sk->sleep);
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
{
sti();
*errcode = -ERESTARTSYS;
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);
}
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();
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))
if (flags&MSG_DONTWAIT)
return -EAGAIN;
- if (current->signal & ~current->blocked)
+ if (signal_pending(current))
return -ERESTARTSYS;
wait_for_tcp_connect(sk);
return -EAGAIN;
}
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
if (copied)
return copied;
return -ERESTARTSYS;
* 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;
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;
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);
return -EAGAIN;
}
interruptible_sleep_on(&read_space_wait[minor]);
- if(current->signal & ~current->blocked)
+ if(signal_pending(current))
{
sti();
return -ERESTARTSYS;
*/
while (sk->state == TCP_SYN_SENT) {
interruptible_sleep_on(sk->sleep);
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
sti();
return -ERESTARTSYS;
}
return -EWOULDBLOCK;
}
interruptible_sleep_on(sk->sleep);
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
sti();
return -ERESTARTSYS;
}
*/
while (sk->state == TCP_SYN_SENT) {
interruptible_sleep_on(sk->sleep);
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
sti();
return -ERESTARTSYS;
}
return -EWOULDBLOCK;
}
interruptible_sleep_on(sk->sleep);
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
sti();
return -ERESTARTSYS;
}
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;
if(nonblock)
return -EINPROGRESS;
interruptible_sleep_on(sk->sleep);
- if(current->signal & ~current->blocked)
+ if(signal_pending(current))
return -ERESTARTSYS;
}
if(flags&O_NONBLOCK)
return -EAGAIN;
interruptible_sleep_on(sk->sleep);
- if(current->signal & ~current->blocked)
+ if(signal_pending(current))
return -ERESTARTSYS;
continue;
}
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;
*/
while (sk->state == TCP_SYN_SENT) {
interruptible_sleep_on(sk->sleep);
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
sti();
return -ERESTARTSYS;
}
return -EWOULDBLOCK;
}
interruptible_sleep_on(sk->sleep);
- if (current->signal & ~current->blocked) {
+ if (signal_pending(current)) {
sti();
return -ERESTARTSYS;
}
// 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
//////////////////////////////////////////////////////////////////////////////
// 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>
#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;
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);
main(int argc, char** argv)
{
char c;
+ char *oops_column = NULL;
program_name = (argc--, *argv++);
NameList names;
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);
}