Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit b5127d9b1a517ab767af426b29bf28d5fb2892da
- Author: Linus Torvalds <torvalds@linuxfoundation.org>
- Date: Fri Nov 23 15:12:52 2007 -0500
- Import 2.1.23pre1
- diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
- index 6c8f5a2..c08bab0 100644
- --- a/arch/alpha/kernel/entry.S
- +++ b/arch/alpha/kernel/entry.S
- @@ -718,7 +718,7 @@ sys_call_table:
- .quad do_entSys, sys_ptrace, do_entSys, do_entSys, do_entSys
- .quad do_entSys, do_entSys, do_entSys, sys_access, do_entSys
- .quad do_entSys, sys_sync, sys_kill, do_entSys, sys_setpgid
- - .quad do_entSys, sys_dup, sys_pipe, do_entSys, do_entSys
- + .quad do_entSys, sys_dup, sys_pipe, osf_set_program_attributes, do_entSys
- .quad sys_open, do_entSys, sys_getxgid, osf_sigprocmask, do_entSys
- /*50*/ .quad do_entSys, sys_acct, sys_sigpending, do_entSys, sys_ioctl
- .quad do_entSys, do_entSys, sys_symlink, sys_readlink, sys_execve
- @@ -729,7 +729,7 @@ sys_call_table:
- /* map BSD's setpgrp to sys_setpgid for binary compatibility: */
- .quad sys_setgroups, do_entSys, sys_setpgid, sys_setitimer, do_entSys
- .quad do_entSys, sys_getitimer, sys_gethostname, sys_sethostname, sys_getdtablesize
- - .quad sys_dup2, sys_newfstat, sys_fcntl, sys_select, do_entSys
- + .quad sys_dup2, sys_newfstat, sys_fcntl, sys_select, sys_poll
- .quad sys_fsync, sys_setpriority, sys_socket, sys_connect, sys_accept
- /*100*/ .quad osf_getpriority, sys_send, sys_recv, sys_sigreturn, sys_bind
- .quad sys_setsockopt, sys_listen, do_entSys, do_entSys, do_entSys
- @@ -759,7 +759,7 @@ sys_call_table:
- .quad do_entSys, do_entSys, do_entSys, do_entSys, do_entSys
- .quad do_entSys, do_entSys, do_entSys, sys_getpgid, sys_getsid
- .quad do_entSys, do_entSys, do_entSys, do_entSys, do_entSys
- - .quad do_entSys, do_entSys, do_entSys, do_entSys, osf_proplist_syscall
- + .quad do_entSys, osf_sysinfo, do_entSys, do_entSys, osf_proplist_syscall
- .quad do_entSys, do_entSys, do_entSys, do_entSys, do_entSys
- /*250*/ .quad do_entSys, osf_usleep_thread, do_entSys, do_entSys, sys_sysfs
- .quad do_entSys, osf_getsysinfo, osf_setsysinfo, do_entSys, do_entSys
- diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
- index 003775d..5dc11cb 100644
- --- a/arch/alpha/kernel/osf_sys.c
- +++ b/arch/alpha/kernel/osf_sys.c
- @@ -43,6 +43,23 @@ extern void put_unnamed_dev(kdev_t);
- extern asmlinkage int sys_umount(char *);
- extern asmlinkage int sys_swapon(const char *specialfile, int swap_flags);
- +extern asmlinkage unsigned long sys_brk(unsigned long);
- +
- +/*
- + * This is pure guess-work..
- + */
- +asmlinkage int osf_set_program_attributes(
- + unsigned long text_start, unsigned long text_len,
- + unsigned long bss_start, unsigned long bss_len)
- +{
- + struct mm_struct *mm = current->mm;
- +
- + mm->end_code = bss_start + bss_len;
- + mm->brk = bss_start + bss_len;
- + printk("set_program_attributes(%lx %lx %lx %lx)\n",
- + text_start, text_len, bss_start, bss_len);
- + return 0;
- +}
- /*
- * OSF/1 directory handling functions...
- @@ -699,6 +716,37 @@ asmlinkage unsigned long alpha_create_module(char *module_name, unsigned long si
- return retval;
- }
- +asmlinkage long osf_sysinfo(int command, char *buf, long count)
- +{
- + static char * sysinfo_table[] = {
- + system_utsname.sysname,
- + system_utsname.nodename,
- + system_utsname.release,
- + system_utsname.version,
- + system_utsname.machine,
- + "alpha", /* instruction set architecture */
- + "dummy", /* hardware serial number */
- + "dummy", /* hardware manufacturer */
- + "dummy", /* secure RPC domain */
- + };
- + unsigned long offset;
- + char *res;
- + long len;
- +
- + offset = command-1;
- + if (offset >= sizeof(sysinfo_table)/sizeof(char *)) {
- + /* Digital unix has a few unpublished interfaces here */
- + printk("sysinfo(%d)", command);
- + return -EINVAL;
- + }
- + res = sysinfo_table[offset];
- + len = strlen(res)+1;
- + if (len > count)
- + len = count;
- + if (copy_to_user(buf, res, len))
- + return -EFAULT;
- + return 0;
- +}
- asmlinkage unsigned long osf_getsysinfo(unsigned long op, void *buffer, unsigned long nbytes,
- int *start, void *arg)
- diff --git a/arch/alpha/mm/extable.c b/arch/alpha/mm/extable.c
- index 9b82329..12a1f480 100644
- --- a/arch/alpha/mm/extable.c
- +++ b/arch/alpha/mm/extable.c
- @@ -34,6 +34,8 @@ search_one_table(const struct exception_table_entry *first,
- return 0;
- }
- +register unsigned long gp __asm__("$29");
- +
- unsigned
- search_exception_table(unsigned long addr)
- {
- @@ -41,7 +43,6 @@ search_exception_table(unsigned long addr)
- #ifndef CONFIG_MODULE
- /* There is only the kernel to search. */
- - register unsigned long gp __asm__("$29");
- ret = search_one_table(__start___ex_table, __stop___ex_table - 1,
- addr - gp);
- if (ret) return ret;
- diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
- index 94f77e6..9e72942 100644
- --- a/arch/i386/kernel/entry.S
- +++ b/arch/i386/kernel/entry.S
- @@ -630,6 +630,7 @@ ENTRY(sys_call_table)
- .long SYMBOL_NAME(sys_getresuid) /* 165 */
- .long SYMBOL_NAME(sys_vm86)
- .long SYMBOL_NAME(sys_query_module)
- - .rept NR_syscalls-167
- + .long SYMBOL_NAME(sys_poll)
- + .rept NR_syscalls-168
- .long SYMBOL_NAME(sys_ni_syscall)
- .endr
- diff --git a/drivers/block/ide-floppy.c b/drivers/block/ide-floppy.c
- index ae0c366..5809264 100644
- --- a/drivers/block/ide-floppy.c
- +++ b/drivers/block/ide-floppy.c
- @@ -1,7 +1,7 @@
- /*
- - * linux/drivers/block/ide-floppy.c Version 0.3 - ALPHA Dec 2, 1996
- + * linux/drivers/block/ide-floppy.c Version 0.4 - ALPHA Jan 26, 1997
- *
- - * Copyright (C) 1996 Gadi Oxman <gadio@netvision.net.il>
- + * Copyright (C) 1996, 1997 Gadi Oxman <gadio@netvision.net.il>
- */
- /*
- @@ -16,6 +16,7 @@
- * Ver 0.1 Oct 17 96 Initial test version, mostly based on ide-tape.c.
- * Ver 0.2 Oct 31 96 Minor changes.
- * Ver 0.3 Dec 2 96 Fixed error recovery bug.
- + * Ver 0.4 Jan 26 97 Add support for the HDIO_GETGEO ioctl.
- */
- #include <linux/config.h>
- @@ -1048,6 +1049,9 @@ static int idefloppy_get_flexible_disk_page (ide_drive_t *drive)
- drive->name, capacity / 1024, page->cyls, page->heads, page->sectors,
- page->transfer_rate / 8, page->sector_size, page->rpm);
- floppy->flexible_disk_page = *page;
- + drive->bios_cyl = page->cyls;
- + drive->bios_head = page->heads;
- + drive->bios_sect = page->sectors;
- if (capacity != floppy->blocks * floppy->block_size)
- printk (KERN_NOTICE "%s: The drive reports both %d and %d bytes as its capacity\n",
- drive->name, capacity, floppy->blocks * floppy->block_size);
- diff --git a/drivers/block/ide-probe.c b/drivers/block/ide-probe.c
- index e2380e5..76e10c0 100644
- --- a/drivers/block/ide-probe.c
- +++ b/drivers/block/ide-probe.c
- @@ -1,5 +1,5 @@
- /*
- - * linux/drivers/block/ide-probe.c Version 1.0 Oct 31, 1996
- + * linux/drivers/block/ide-probe.c Version 1.01 Jan 26, 1997
- *
- * Copyright (C) 1994-1996 Linus Torvalds & authors (see below)
- */
- @@ -36,7 +36,8 @@
- * code is still sprinkled about. Think of it as a major evolution, with
- * inspiration from lots of linux users, esp. hamish@zot.apana.org.au
- *
- - * Version 1.0 move drive probing code from ide.c to ide-probe.c
- + * Version 1.00 move drive probing code from ide.c to ide-probe.c
- + * Version 1.01 fix compilation problem for m68k
- */
- #undef REALLY_SLOW_IO /* most systems can safely undef this */
- @@ -494,9 +495,7 @@ static void save_match (ide_hwif_t *hwif, ide_hwif_t *new, ide_hwif_t **match)
- static int init_irq (ide_hwif_t *hwif)
- {
- unsigned long flags;
- -#if MAX_HWIFS > 1
- unsigned int index;
- -#endif /* MAX_HWIFS > 1 */
- ide_hwgroup_t *hwgroup;
- ide_hwif_t *match = NULL;
- diff --git a/drivers/block/ide.c b/drivers/block/ide.c
- index a7f688f..9906534 100644
- --- a/drivers/block/ide.c
- +++ b/drivers/block/ide.c
- @@ -1,7 +1,7 @@
- /*
- - * linux/drivers/block/ide.c Version 6.00 Dec 4, 1996
- + * linux/drivers/block/ide.c Version 6.01 Jan 26, 1997
- *
- - * Copyright (C) 1994-1996 Linus Torvalds & authors (see below)
- + * Copyright (C) 1994-1997 Linus Torvalds & authors (see below)
- */
- #define _IDE_C /* needed by <linux/blk.h> */
- @@ -276,6 +276,8 @@
- * fix bug in ide_error()
- * fix bug in the first ide_get_lock() call for Atari
- * don't flush leftover data for ATAPI devices
- + * Version 6.01 clear hwgroup->active while the hwgroup sleeps
- + * support HDIO_GETGEO for floppies
- *
- * Some additional driver compile-time options are in ide.h
- *
- @@ -1240,10 +1242,9 @@ static inline void ide_leave_hwgroup (ide_hwgroup_t *hwgroup)
- sleep = jiffies + WAIT_MIN_SLEEP;
- hwgroup->timer.expires = sleep;
- add_timer(&hwgroup->timer);
- - } else { /* Ugly, but how can we sleep for the lock otherwise? perhaps from tq_scheduler? */
- + } else /* Ugly, but how can we sleep for the lock otherwise? perhaps from tq_scheduler? */
- ide_release_lock(&ide_lock);
- - hwgroup->active = 0;
- - }
- + hwgroup->active = 0;
- }
- /*
- @@ -1876,7 +1877,7 @@ static int ide_ioctl (struct inode *inode, struct file *file,
- case HDIO_GETGEO:
- {
- struct hd_geometry *loc = (struct hd_geometry *) arg;
- - if (!loc || drive->media != ide_disk) return -EINVAL;
- + if (!loc || (drive->media != ide_disk && drive->media != ide_floppy)) return -EINVAL;
- if (put_user(drive->bios_head, (byte *) &loc->heads)) return -EFAULT;
- if (put_user(drive->bios_sect, (byte *) &loc->sectors)) return -EFAULT;
- if (put_user(drive->bios_cyl, (unsigned short *) &loc->cylinders)) return -EFAULT;
- diff --git a/drivers/char/amigamouse.c b/drivers/char/amigamouse.c
- index 558564c..d6227d9 100644
- --- a/drivers/char/amigamouse.c
- +++ b/drivers/char/amigamouse.c
- @@ -11,13 +11,13 @@
- *
- * Heavily modified by David Giller
- * changed from queue- to counter- driven
- - * hacked out a (probably incorrect) mouse_select
- + * hacked out a (probably incorrect) mouse_poll
- *
- * Modified again by Nathan Laredo to interface with
- * 0.96c-pl1 IRQ handling changes (13JUL92)
- - * didn't bother touching select code.
- + * didn't bother touching poll code.
- *
- - * Modified the select() code blindly to conform to the VFS
- + * Modified the poll() code blindly to conform to the VFS
- * requirements. 92.07.14 - Linus. Somebody should test it out.
- *
- * Modified by Johan Myreen to make room for other mice (9AUG92)
- @@ -42,6 +42,7 @@
- #include <linux/errno.h>
- #include <linux/miscdevice.h>
- #include <linux/random.h>
- +#include <linux/poll.h>
- #include <asm/setup.h>
- #include <asm/system.h>
- @@ -277,16 +278,14 @@ static long read_mouse(struct inode * inode, struct file * file,
- }
- /*
- - * select for mouse input
- + * poll for mouse input
- */
- -static int mouse_select(struct inode *inode, struct file *file, int sel_type, select_table * wait)
- +static unsigned int mouse_poll(struct file *file, poll_table * wait)
- {
- - if (sel_type == SEL_IN) {
- - if (mouse.ready)
- - return 1;
- - select_wait(&mouse.wait, wait);
- - }
- + poll_wait(&mouse.wait, wait);
- + if (mouse.ready)
- + return POLLIN | POLLRDNORM;
- return 0;
- }
- @@ -295,7 +294,7 @@ struct file_operations amiga_mouse_fops = {
- read_mouse,
- write_mouse,
- NULL, /* mouse_readdir */
- - mouse_select, /* mouse_select */
- + mouse_poll, /* mouse_poll */
- NULL, /* mouse_ioctl */
- NULL, /* mouse_mmap */
- open_mouse,
- diff --git a/drivers/char/apm_bios.c b/drivers/char/apm_bios.c
- index 96962fa..2fac5b2 100644
- --- a/drivers/char/apm_bios.c
- +++ b/drivers/char/apm_bios.c
- @@ -302,8 +302,7 @@ static void do_apm_timer(unsigned long);
- static int do_open(struct inode *, struct file *);
- static void do_release(struct inode *, struct file *);
- static long do_read(struct inode *, struct file *, char *, unsigned long);
- -static int do_select(struct inode *, struct file *, int,
- - select_table *);
- +static unsigned int do_poll(struct file *, poll_table *);
- static int do_ioctl(struct inode *, struct file *, u_int, u_long);
- #ifdef CONFIG_PROC_FS
- @@ -360,7 +359,7 @@ static struct file_operations apm_bios_fops = {
- do_read,
- NULL, /* write */
- NULL, /* readdir */
- - do_select,
- + do_poll,
- do_ioctl,
- NULL, /* mmap */
- do_open,
- @@ -865,19 +864,16 @@ repeat:
- return 0;
- }
- -static int do_select(struct inode *inode, struct file *fp, int sel_type,
- - select_table * wait)
- +static unsigned int do_poll(struct file *fp, poll_table * wait)
- {
- - struct apm_bios_struct * as;
- + struct apm_bios_struct * as;
- as = fp->private_data;
- if (check_apm_bios_struct(as, "select"))
- return 0;
- - if (sel_type != SEL_IN)
- - return 0;
- + poll_wait(&process_list, wait);
- if (!queue_empty(as))
- - return 1;
- - select_wait(&process_list, wait);
- + return POLLIN | POLLRDNORM;
- return 0;
- }
- diff --git a/drivers/char/mem.c b/drivers/char/mem.c
- index 8f223e9..3b347ef 100644
- --- a/drivers/char/mem.c
- +++ b/drivers/char/mem.c
- @@ -372,7 +372,7 @@ static struct file_operations mem_fops = {
- read_mem,
- write_mem,
- NULL, /* mem_readdir */
- - NULL, /* mem_select */
- + NULL, /* mem_poll */
- NULL, /* mem_ioctl */
- mmap_mem,
- NULL, /* no special open code */
- @@ -385,7 +385,7 @@ static struct file_operations kmem_fops = {
- read_kmem,
- write_kmem,
- NULL, /* kmem_readdir */
- - NULL, /* kmem_select */
- + NULL, /* kmem_poll */
- NULL, /* kmem_ioctl */
- mmap_kmem,
- NULL, /* no special open code */
- @@ -398,7 +398,7 @@ static struct file_operations null_fops = {
- read_null,
- write_null,
- NULL, /* null_readdir */
- - NULL, /* null_select */
- + NULL, /* null_poll */
- NULL, /* null_ioctl */
- NULL, /* null_mmap */
- NULL, /* no special open code */
- @@ -411,7 +411,7 @@ static struct file_operations port_fops = {
- read_port,
- write_port,
- NULL, /* port_readdir */
- - NULL, /* port_select */
- + NULL, /* port_poll */
- NULL, /* port_ioctl */
- NULL, /* port_mmap */
- NULL, /* no special open code */
- @@ -424,7 +424,7 @@ static struct file_operations zero_fops = {
- read_zero,
- write_zero,
- NULL, /* zero_readdir */
- - NULL, /* zero_select */
- + NULL, /* zero_poll */
- NULL, /* zero_ioctl */
- mmap_zero,
- NULL, /* no special open code */
- @@ -436,7 +436,7 @@ static struct file_operations full_fops = {
- read_full,
- write_full,
- NULL, /* full_readdir */
- - NULL, /* full_select */
- + NULL, /* full_poll */
- NULL, /* full_ioctl */
- NULL, /* full_mmap */
- NULL, /* no special open code */
- @@ -483,7 +483,7 @@ static struct file_operations memory_fops = {
- NULL, /* read */
- NULL, /* write */
- NULL, /* readdir */
- - NULL, /* select */
- + NULL, /* poll */
- NULL, /* ioctl */
- NULL, /* mmap */
- memory_open, /* just a selector for the real open */
- diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
- index 6d6a317..a786359 100644
- --- a/drivers/char/n_tty.c
- +++ b/drivers/char/n_tty.c
- @@ -33,6 +33,7 @@
- #include <linux/mm.h>
- #include <linux/string.h>
- #include <linux/malloc.h>
- +#include <linux/poll.h>
- #include <asm/uaccess.h>
- #include <asm/system.h>
- @@ -982,37 +983,29 @@ static int write_chan(struct tty_struct * tty, struct file * file,
- return (b - buf) ? b - buf : retval;
- }
- -static int normal_select(struct tty_struct * tty, struct inode * inode,
- - struct file * file, int sel_type, select_table *wait)
- +static unsigned int normal_poll(struct tty_struct * tty, struct file * file, poll_table *wait)
- {
- - switch (sel_type) {
- - case SEL_IN:
- - if (input_available_p(tty, TIME_CHAR(tty) ? 0 :
- - MIN_CHAR(tty)))
- - return 1;
- - /* fall through */
- - case SEL_EX:
- - if (tty->packet && tty->link->ctrl_status)
- - return 1;
- - if (tty->flags & (1 << TTY_OTHER_CLOSED))
- - return 1;
- - if (tty_hung_up_p(file))
- - return 1;
- - if (!waitqueue_active(&tty->read_wait)) {
- - if (MIN_CHAR(tty) && !TIME_CHAR(tty))
- - tty->minimum_to_wake = MIN_CHAR(tty);
- - else
- - tty->minimum_to_wake = 1;
- - }
- - select_wait(&tty->read_wait, wait);
- - return 0;
- - case SEL_OUT:
- - if (tty->driver.chars_in_buffer(tty) < WAKEUP_CHARS)
- - return 1;
- - select_wait(&tty->write_wait, wait);
- - return 0;
- + unsigned int mask = 0;
- +
- + poll_wait(&tty->read_wait, wait);
- + poll_wait(&tty->write_wait, wait);
- + if (input_available_p(tty, TIME_CHAR(tty) ? 0 : MIN_CHAR(tty)))
- + mask |= POLLIN | POLLRDNORM;
- + if (tty->packet && tty->link->ctrl_status)
- + mask |= POLLPRI | POLLIN | POLLRDNORM;
- + if (tty->flags & (1 << TTY_OTHER_CLOSED))
- + mask |= POLLHUP;
- + if (tty_hung_up_p(file))
- + mask |= POLLHUP;
- + if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) {
- + if (MIN_CHAR(tty) && !TIME_CHAR(tty))
- + tty->minimum_to_wake = MIN_CHAR(tty);
- + else
- + tty->minimum_to_wake = 1;
- }
- - return 0;
- + if (tty->driver.chars_in_buffer(tty) < WAKEUP_CHARS)
- + mask |= POLLOUT | POLLWRNORM;
- + return mask;
- }
- struct tty_ldisc tty_ldisc_N_TTY = {
- @@ -1027,7 +1020,7 @@ struct tty_ldisc tty_ldisc_N_TTY = {
- write_chan, /* write */
- n_tty_ioctl, /* ioctl */
- n_tty_set_termios, /* set_termios */
- - normal_select, /* select */
- + normal_poll, /* poll */
- n_tty_receive_buf, /* receive_buf */
- n_tty_receive_room, /* receive_room */
- 0 /* write_wakeup */
- diff --git a/drivers/char/psaux.c b/drivers/char/psaux.c
- index d9f9525..7f7ec75 100644
- --- a/drivers/char/psaux.c
- +++ b/drivers/char/psaux.c
- @@ -45,6 +45,7 @@
- #include <linux/malloc.h>
- #include <linux/miscdevice.h>
- #include <linux/random.h>
- +#include <linux/poll.h>
- #include <asm/io.h>
- #include <asm/uaccess.h>
- @@ -494,13 +495,11 @@ repeat:
- }
- -static int aux_select(struct inode *inode, struct file *file, int sel_type, select_table * wait)
- +static unsigned int aux_poll(struct file *file, poll_table * wait)
- {
- - if (sel_type != SEL_IN)
- - return 0;
- + poll_wait(&queue->proc_list, wait);
- if (aux_ready)
- - return 1;
- - select_wait(&queue->proc_list, wait);
- + return POLLIN | POLLRDNORM;
- return 0;
- }
- @@ -510,7 +509,7 @@ struct file_operations psaux_fops = {
- read_aux,
- write_aux,
- NULL, /* readdir */
- - aux_select,
- + aux_poll,
- NULL, /* ioctl */
- NULL, /* mmap */
- open_aux,
- diff --git a/drivers/char/random.c b/drivers/char/random.c
- index 64ffdf4..bd04db6 100644
- --- a/drivers/char/random.c
- +++ b/drivers/char/random.c
- @@ -233,6 +233,7 @@
- #include <linux/fcntl.h>
- #include <linux/malloc.h>
- #include <linux/random.h>
- +#include <linux/poll.h>
- #include <asm/uaccess.h>
- #include <asm/irq.h>
- @@ -332,8 +333,7 @@ static long random_read(struct inode * inode, struct file * file,
- char * buf, unsigned long nbytes);
- static long random_read_unlimited(struct inode * inode, struct file * file,
- char * buf, unsigned long nbytes);
- -static int random_select(struct inode *inode, struct file *file,
- - int sel_type, select_table * wait);
- +static unsigned int random_poll(struct file *file, poll_table * wait);
- static long random_write(struct inode * inode, struct file * file,
- const char * buffer, unsigned long count);
- static int random_ioctl(struct inode * inode, struct file * file,
- @@ -1086,23 +1086,18 @@ random_read_unlimited(struct inode * inode, struct file * file,
- return extract_entropy(&random_state, buf, nbytes, 1);
- }
- -static int
- -random_select(struct inode *inode, struct file *file,
- - int sel_type, select_table * wait)
- +static unsigned int
- +random_poll(struct file *file, poll_table * wait)
- {
- - switch (sel_type) {
- - case SEL_IN:
- - if (random_state.entropy_count >= 8)
- - return 1;
- - select_wait(&random_wait, wait);
- - break;
- - case SEL_OUT:
- - if (random_state.entropy_count < WAIT_OUTPUT_BITS)
- - return 1;
- - select_wait(&random_wait, wait);
- - break;
- - }
- - return 0;
- + unsigned int mask;
- +
- + poll_wait(&random_wait, wait);
- + mask = 0;
- + if (random_state.entropy_count >= 8)
- + mask |= POLLIN | POLLRDNORM;
- + if (random_state.entropy_count < WAIT_OUTPUT_BITS)
- + mask |= POLLOUT | POLLWRNORM;
- + return mask;
- }
- static long
- @@ -1270,7 +1265,7 @@ struct file_operations random_fops = {
- random_read,
- random_write,
- NULL, /* random_readdir */
- - random_select, /* random_select */
- + random_poll, /* random_poll */
- random_ioctl,
- NULL, /* random_mmap */
- NULL, /* no special open code */
- @@ -1282,7 +1277,7 @@ struct file_operations urandom_fops = {
- random_read_unlimited,
- random_write,
- NULL, /* urandom_readdir */
- - NULL, /* urandom_select */
- + NULL, /* urandom_poll */
- random_ioctl,
- NULL, /* urandom_mmap */
- NULL, /* no special open code */
- diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
- index baf0816..483178b 100644
- --- a/drivers/char/rtc.c
- +++ b/drivers/char/rtc.c
- @@ -75,8 +75,7 @@ static long rtc_read(struct inode *inode, struct file *file,
- static int rtc_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg);
- -static int rtc_select(struct inode *inode, struct file *file,
- - int sel_type, select_table *wait);
- +static unsigned int rtc_poll(struct file *file, poll_table *wait);
- void get_rtc_time (struct rtc_time *rtc_tm);
- void get_rtc_alm_time (struct rtc_time *alm_tm);
- @@ -492,14 +491,11 @@ static void rtc_release(struct inode *inode, struct file *file)
- rtc_status &= ~RTC_IS_OPEN;
- }
- -static int rtc_select(struct inode *inode, struct file *file,
- - int sel_type, select_table *wait)
- +static unsigned int rtc_poll(struct file *file, poll_table *wait)
- {
- - if (sel_type == SEL_IN) {
- - if (rtc_irq_data != 0)
- - return 1;
- - select_wait(&rtc_wait, wait);
- - }
- + poll_wait(&rtc_wait, wait);
- + if (rtc_irq_data != 0)
- + return POLLIN | POLLRDNORM;
- return 0;
- }
- @@ -512,7 +508,7 @@ static struct file_operations rtc_fops = {
- rtc_read,
- NULL, /* No write */
- NULL, /* No readdir */
- - rtc_select,
- + rtc_poll,
- rtc_ioctl,
- NULL, /* No mmap */
- rtc_open,
- diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
- index ca2fdd8..59d2c27 100644
- --- a/drivers/char/tty_io.c
- +++ b/drivers/char/tty_io.c
- @@ -62,6 +62,7 @@
- #include <linux/mm.h>
- #include <linux/string.h>
- #include <linux/malloc.h>
- +#include <linux/poll.h>
- #include <asm/uaccess.h>
- #include <asm/system.h>
- @@ -110,7 +111,7 @@ static void initialize_tty_struct(struct tty_struct *tty);
- static long tty_read(struct inode *, struct file *, char *, unsigned long);
- static long tty_write(struct inode *, struct file *, const char *, unsigned long);
- -static int tty_select(struct inode *, struct file *, int, select_table *);
- +static unsigned int tty_poll(struct file *, poll_table *);
- static int tty_open(struct inode *, struct file *);
- static void tty_release(struct inode *, struct file *);
- static int tty_ioctl(struct inode * inode, struct file * file,
- @@ -322,10 +323,9 @@ static long hung_up_tty_write(struct inode * inode,
- return -EIO;
- }
- -static int hung_up_tty_select(struct inode * inode, struct file * filp,
- - int sel_type, select_table * wait)
- +static unsigned int hung_up_tty_poll(struct file * filp, poll_table * wait)
- {
- - return 1;
- + return POLLIN | POLLOUT | POLLERR | POLLHUP | POLLRDNORM | POLLWRNORM;
- }
- static int hung_up_tty_ioctl(struct inode * inode, struct file * file,
- @@ -345,7 +345,7 @@ static struct file_operations tty_fops = {
- tty_read,
- tty_write,
- NULL, /* tty_readdir */
- - tty_select,
- + tty_poll,
- tty_ioctl,
- NULL, /* tty_mmap */
- tty_open,
- @@ -359,7 +359,7 @@ static struct file_operations hung_up_tty_fops = {
- hung_up_tty_read,
- hung_up_tty_write,
- NULL, /* hung_up_tty_readdir */
- - hung_up_tty_select,
- + hung_up_tty_poll,
- hung_up_tty_ioctl,
- NULL, /* hung_up_tty_mmap */
- NULL, /* hung_up_tty_open */
- @@ -1287,16 +1287,16 @@ static void tty_release(struct inode * inode, struct file * filp)
- release_dev(filp);
- }
- -static int tty_select(struct inode * inode, struct file * filp, int sel_type, select_table * wait)
- +static unsigned int tty_poll(struct file * filp, poll_table * wait)
- {
- struct tty_struct * tty;
- tty = (struct tty_struct *)filp->private_data;
- - if (tty_paranoia_check(tty, inode->i_rdev, "tty_select"))
- + if (tty_paranoia_check(tty, filp->f_inode->i_rdev, "tty_poll"))
- return 0;
- - if (tty->ldisc.select)
- - return (tty->ldisc.select)(tty, inode, filp, sel_type, wait);
- + if (tty->ldisc.poll)
- + return (tty->ldisc.poll)(tty, filp, wait);
- return 0;
- }
- diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c
- index b218da3..705afe0 100644
- --- a/drivers/char/vc_screen.c
- +++ b/drivers/char/vc_screen.c
- @@ -243,7 +243,7 @@ static struct file_operations vcs_fops = {
- vcs_read, /* read */
- vcs_write, /* write */
- NULL, /* readdir */
- - NULL, /* select */
- + NULL, /* poll */
- NULL, /* ioctl */
- NULL, /* mmap */
- vcs_open, /* open */
- diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
- index b053aaf..6c6ffd3 100644
- --- a/drivers/pci/pci.c
- +++ b/drivers/pci/pci.c
- @@ -93,6 +93,7 @@ struct pci_dev_info dev_info[] = {
- DEVICE( MATROX, MATROX_MGA_IMP, "MGA Impression"),
- DEVICE( CT, CT_65545, "65545"),
- DEVICE( CT, CT_65548, "65548"),
- + DEVICE( CT, CT_65550, "65550"),
- DEVICE( MIRO, MIRO_36050, "ZR36050"),
- DEVICE( FD, FD_36C70, "TMC-18C30"),
- DEVICE( SI, SI_6201, "6201"),
- diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
- index 658a2da..3772453 100644
- --- a/drivers/scsi/Makefile
- +++ b/drivers/scsi/Makefile
- @@ -392,7 +392,7 @@ aic7xxx_seq.h: aic7xxx_asm aic7xxx.seq
- ./aic7xxx_asm -o $@ aic7xxx.seq
- seagate.o: seagate.c
- - $(CC) $(CFLAGS) -DARBITRATE -DSLOW_HANDSHAKE -DFAST32 -c seagate.c
- + $(CC) $(CFLAGS) -DARBITRATE -DSLOW_HANDSHAKE -DFAST32 -DPARITY -c seagate.c
- # For debugging, use the -g flag
- 53c7,8xx.o : 53c7,8xx.c
- diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
- index ca1d1a7..a8fa2cc 100644
- --- a/drivers/scsi/ide-scsi.c
- +++ b/drivers/scsi/ide-scsi.c
- @@ -1,7 +1,7 @@
- /*
- - * linux/drivers/scsi/ide-scsi.c Version 0.1 - ALPHA Dec 3, 1996
- + * linux/drivers/scsi/ide-scsi.c Version 0.2 - ALPHA Jan 26, 1997
- *
- - * Copyright (C) 1996 Gadi Oxman <gadio@netvision.net.il>
- + * Copyright (C) 1996, 1997 Gadi Oxman <gadio@netvision.net.il>
- */
- /*
- @@ -11,6 +11,11 @@
- * native IDE ATAPI drivers.
- *
- * Ver 0.1 Dec 3 96 Initial version.
- + * Ver 0.2 Jan 26 97 Fixed bug in cleanup_module() and added emulation
- + * of MODE_SENSE_6/MODE_SELECT_6 for cdroms. Thanks
- + * to Janos Farkas for pointing this out.
- + * Avoid using bitfields in structures for m68k.
- + * Added Scather/Gather and DMA support.
- */
- #include <linux/module.h>
- @@ -44,49 +49,40 @@ typedef struct idescsi_pc_s {
- struct request *rq; /* The corresponding request */
- byte *buffer; /* Data buffer */
- byte *current_position; /* Pointer into the above buffer */
- + struct scatterlist *sg; /* Scather gather table */
- + int b_count; /* Bytes transferred from current entry */
- Scsi_Cmnd *scsi_cmd; /* SCSI command */
- void (*done)(Scsi_Cmnd *); /* Scsi completion routine */
- + unsigned int flags; /* Status/Action flags */
- } idescsi_pc_t;
- +/*
- + * Packet command status bits.
- + */
- +#define PC_DMA_IN_PROGRESS 0 /* 1 while DMA in progress */
- +#define PC_WRITING 1 /* Data direction */
- +
- typedef struct {
- ide_drive_t *drive;
- idescsi_pc_t *pc; /* Current packet command */
- unsigned int flags; /* Status/Action flags */
- } idescsi_scsi_t;
- +/*
- + * Per ATAPI device status bits.
- + */
- #define IDESCSI_DRQ_INTERRUPT 0 /* DRQ interrupt device */
- +
- +/*
- + * ide-scsi requests.
- + */
- #define IDESCSI_PC_RQ 90
- -typedef union {
- - unsigned all :8;
- - struct {
- - unsigned check :1; /* Error occurred */
- - unsigned idx :1; /* Reserved */
- - unsigned corr :1; /* Correctable error occurred */
- - unsigned drq :1; /* Data is request by the device */
- - unsigned dsc :1; /* Media access command finished */
- - unsigned reserved5 :1; /* Reserved */
- - unsigned drdy :1; /* Ignored for ATAPI commands (ready to accept ATA command) */
- - unsigned bsy :1; /* The device has access to the command block */
- - } b;
- -} idescsi_status_reg_t;
- -
- -typedef union {
- - unsigned all :16;
- - struct {
- - unsigned low :8; /* LSB */
- - unsigned high :8; /* MSB */
- - } b;
- -} idescsi_bcount_reg_t;
- -
- -typedef union {
- - unsigned all :8;
- - struct {
- - unsigned cod :1; /* Information transferred is command (1) or data (0) */
- - unsigned io :1; /* The device requests us to read (1) or write (0) */
- - unsigned reserved :6; /* Reserved */
- - } b;
- -} idescsi_ireason_reg_t;
- +/*
- + * Bits of the interrupt reason register.
- + */
- +#define IDESCSI_IREASON_COD 0x1 /* Information transferred is command */
- +#define IDESCSI_IREASON_IO 0x2 /* The device requests us to read */
- static void idescsi_discard_data (ide_drive_t *drive, unsigned int bcount)
- {
- @@ -94,6 +90,107 @@ static void idescsi_discard_data (ide_drive_t *drive, unsigned int bcount)
- IN_BYTE (IDE_DATA_REG);
- }
- +static void idescsi_output_zeros (ide_drive_t *drive, unsigned int bcount)
- +{
- + while (bcount--)
- + OUT_BYTE (0, IDE_DATA_REG);
- +}
- +
- +/*
- + * PIO data transfer routines using the scather gather table.
- + */
- +static void idescsi_input_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigned int bcount)
- +{
- + int count;
- +
- + while (bcount) {
- + if (pc->sg - (struct scatterlist *) pc->scsi_cmd->request_buffer > pc->scsi_cmd->use_sg) {
- + printk (KERN_ERR "ide-scsi: scather gather table too small, discarding data\n");
- + idescsi_discard_data (drive, bcount);
- + return;
- + }
- + count = IDE_MIN (pc->sg->length - pc->b_count, bcount);
- + atapi_input_bytes (drive, pc->sg->address + pc->b_count, count);
- + bcount -= count; pc->b_count += count;
- + if (pc->b_count == pc->sg->length) {
- + pc->sg++;
- + pc->b_count = 0;
- + }
- + }
- +}
- +
- +static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigned int bcount)
- +{
- + int count;
- +
- + while (bcount) {
- + if (pc->sg - (struct scatterlist *) pc->scsi_cmd->request_buffer > pc->scsi_cmd->use_sg) {
- + printk (KERN_ERR "ide-scsi: scather gather table too small, padding with zeros\n");
- + idescsi_output_zeros (drive, bcount);
- + return;
- + }
- + count = IDE_MIN (pc->sg->length - pc->b_count, bcount);
- + atapi_output_bytes (drive, pc->sg->address + pc->b_count, count);
- + bcount -= count; pc->b_count += count;
- + if (pc->b_count == pc->sg->length) {
- + pc->sg++;
- + pc->b_count = 0;
- + }
- + }
- +}
- +
- +/*
- + * Most of the SCSI commands are supported directly by ATAPI devices.
- + * idescsi_transform_pc handles the few exceptions.
- + */
- +static inline void idescsi_transform_pc1 (ide_drive_t *drive, idescsi_pc_t *pc)
- +{
- + u8 *c = pc->c, *buf = pc->buffer, *sc = pc->scsi_cmd->cmnd;
- + int i;
- +
- + if (drive->media == ide_cdrom) {
- + if (c[0] == READ_6) {
- + c[8] = c[4]; c[5] = c[3]; c[4] = c[2];
- + c[3] = c[1] & 0x1f; c[2] = 0; c[1] &= 0xe0;
- + c[0] = READ_10;
- + }
- + if (c[0] == MODE_SENSE || (c[0] == MODE_SELECT && buf[3] == 8)) {
- + pc->request_transfer -= 4;
- + memset (c, 0, 12);
- + c[0] = sc[0] | 0x40; c[2] = sc[2]; c[8] = sc[4] - 4;
- + if (c[0] == MODE_SENSE_10) return;
- + for (i = 0; i <= 7; i++) buf[i] = 0;
- + for (i = 8; i < pc->buffer_size - 4; i++) buf[i] = buf[i + 4];
- + }
- + }
- +}
- +
- +static inline void idescsi_transform_pc2 (ide_drive_t *drive, idescsi_pc_t *pc)
- +{
- + u8 *buf = pc->buffer;
- + int i;
- +
- + if (drive->media == ide_cdrom) {
- + if (pc->c[0] == MODE_SENSE_10 && pc->scsi_cmd->cmnd[0] == MODE_SENSE) {
- + buf[0] = buf[1]; buf[1] = buf[2];
- + buf[2] = 0; buf[3] = 8;
- + for (i = pc->buffer_size - 1; i >= 12; i--) buf[i] = buf[i - 4];
- + for (i = 11; i >= 4; i--) buf[i] = 0;
- + }
- + }
- +}
- +
- +static inline void idescsi_free_bh (struct buffer_head *bh)
- +{
- + struct buffer_head *bhp;
- +
- + while (bh) {
- + bhp = bh;
- + bh = bh->b_reqnext;
- + kfree (bhp);
- + }
- +}
- +
- static void idescsi_end_request (byte uptodate, ide_hwgroup_t *hwgroup)
- {
- ide_drive_t *drive = hwgroup->drive;
- @@ -121,18 +218,22 @@ static void idescsi_end_request (byte uptodate, ide_hwgroup_t *hwgroup)
- printk ("ide-scsi: %s: success for %lu\n", drive->name, pc->scsi_cmd->serial_number);
- #endif /* IDESCSI_DEBUG_LOG */
- pc->scsi_cmd->result = DID_OK << 16;
- + idescsi_transform_pc2 (drive, pc);
- }
- pc->done(pc->scsi_cmd);
- + idescsi_free_bh (rq->bh);
- kfree(pc); kfree(rq);
- scsi->pc = NULL;
- }
- +/*
- + * Our interrupt handler.
- + */
- static void idescsi_pc_intr (ide_drive_t *drive)
- {
- idescsi_scsi_t *scsi = drive->driver_data;
- - idescsi_status_reg_t status;
- - idescsi_bcount_reg_t bcount;
- - idescsi_ireason_reg_t ireason;
- + byte status, ireason;
- + int bcount;
- idescsi_pc_t *pc=scsi->pc;
- struct request *rq = pc->rq;
- unsigned int temp;
- @@ -141,33 +242,40 @@ static void idescsi_pc_intr (ide_drive_t *drive)
- printk (KERN_INFO "ide-scsi: Reached idescsi_pc_intr interrupt handler\n");
- #endif /* IDESCSI_DEBUG_LOG */
- - status.all = GET_STAT(); /* Clear the interrupt */
- + if (clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) {
- +#if IDESCSI_DEBUG_LOG
- + printk ("ide-scsi: %s: DMA complete\n", drive->name);
- +#endif /* IDESCSI_DEBUG_LOG */
- + pc->actually_transferred=pc->request_transfer;
- + (void) (HWIF(drive)->dmaproc(ide_dma_abort, drive));
- + }
- +
- + status = GET_STAT(); /* Clear the interrupt */
- - if (!status.b.drq) { /* No more interrupts */
- + if ((status & DRQ_STAT) == 0) { /* No more interrupts */
- #if IDESCSI_DEBUG_LOG
- printk (KERN_INFO "Packet command completed, %d bytes transferred\n", pc->actually_transferred);
- #endif /* IDESCSI_DEBUG_LOG */
- ide_sti();
- - if (status.b.check)
- + if (status & ERR_STAT)
- rq->errors++;
- idescsi_end_request (1, HWGROUP(drive));
- return;
- }
- - bcount.b.high=IN_BYTE (IDE_BCOUNTH_REG);
- - bcount.b.low=IN_BYTE (IDE_BCOUNTL_REG);
- - ireason.all=IN_BYTE (IDE_IREASON_REG);
- + bcount = IN_BYTE (IDE_BCOUNTH_REG) << 8 | IN_BYTE (IDE_BCOUNTL_REG);
- + ireason = IN_BYTE (IDE_IREASON_REG);
- - if (ireason.b.cod) {
- + if (ireason & IDESCSI_IREASON_COD) {
- printk (KERN_ERR "ide-scsi: CoD != 0 in idescsi_pc_intr\n");
- ide_do_reset (drive);
- return;
- }
- - if (ireason.b.io) {
- - temp = pc->actually_transferred + bcount.all;
- + if (ireason & IDESCSI_IREASON_IO) {
- + temp = pc->actually_transferred + bcount;
- if ( temp > pc->request_transfer) {
- if (temp > pc->buffer_size) {
- printk (KERN_ERR "ide-scsi: The scsi wants to send us more data than expected - discarding data\n");
- - idescsi_discard_data (drive,bcount.all);
- + idescsi_discard_data (drive,bcount);
- ide_set_handler (drive,&idescsi_pc_intr,WAIT_CMD);
- return;
- }
- @@ -176,12 +284,19 @@ static void idescsi_pc_intr (ide_drive_t *drive)
- #endif /* IDESCSI_DEBUG_LOG */
- }
- }
- - if (ireason.b.io)
- - atapi_input_bytes (drive,pc->current_position,bcount.all); /* Read the current buffer */
- - else
- - atapi_output_bytes (drive,pc->current_position,bcount.all); /* Write the current buffer */
- - pc->actually_transferred+=bcount.all; /* Update the current position */
- - pc->current_position+=bcount.all;
- + if (ireason & IDESCSI_IREASON_IO) {
- + if (pc->sg)
- + idescsi_input_buffers (drive, pc, bcount);
- + else
- + atapi_input_bytes (drive,pc->current_position,bcount);
- + } else {
- + if (pc->sg)
- + idescsi_output_buffers (drive, pc, bcount);
- + else
- + atapi_output_bytes (drive,pc->current_position,bcount);
- + }
- + pc->actually_transferred+=bcount; /* Update the current position */
- + pc->current_position+=bcount;
- ide_set_handler (drive,&idescsi_pc_intr,WAIT_CMD); /* And set the interrupt handler again */
- }
- @@ -189,14 +304,14 @@ static void idescsi_pc_intr (ide_drive_t *drive)
- static void idescsi_transfer_pc (ide_drive_t *drive)
- {
- idescsi_scsi_t *scsi = drive->driver_data;
- - idescsi_ireason_reg_t ireason;
- + byte ireason;
- if (ide_wait_stat (drive,DRQ_STAT,BUSY_STAT,WAIT_READY)) {
- printk (KERN_ERR "ide-scsi: Strange, packet command initiated yet DRQ isn't asserted\n");
- return;
- }
- - ireason.all=IN_BYTE (IDE_IREASON_REG);
- - if (!ireason.b.cod || ireason.b.io) {
- + ireason = IN_BYTE (IDE_IREASON_REG);
- + if ((ireason & (IDESCSI_IREASON_IO | IDESCSI_IREASON_COD)) != IDESCSI_IREASON_COD) {
- printk (KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while issuing a packet command\n");
- ide_do_reset (drive);
- return;
- @@ -211,19 +326,28 @@ static void idescsi_transfer_pc (ide_drive_t *drive)
- static void idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc)
- {
- idescsi_scsi_t *scsi = drive->driver_data;
- - idescsi_bcount_reg_t bcount;
- + int bcount;
- + struct request *rq = pc->rq;
- + int dma_ok = 0;
- scsi->pc=pc; /* Set the current packet command */
- pc->actually_transferred=0; /* We haven't transferred any data yet */
- pc->current_position=pc->buffer;
- - bcount.all = IDE_MIN (pc->request_transfer, 63 * 1024); /* Request to transfer the entire buffer at once */
- + bcount = IDE_MIN (pc->request_transfer, 63 * 1024); /* Request to transfer the entire buffer at once */
- +
- + if (drive->using_dma && rq->bh)
- + dma_ok=!HWIF(drive)->dmaproc(test_bit (PC_WRITING, &pc->flags) ? ide_dma_write : ide_dma_read, drive);
- OUT_BYTE (drive->ctl,IDE_CONTROL_REG);
- - OUT_BYTE (0,IDE_FEATURE_REG);
- - OUT_BYTE (bcount.b.high,IDE_BCOUNTH_REG);
- - OUT_BYTE (bcount.b.low,IDE_BCOUNTL_REG);
- + OUT_BYTE (dma_ok,IDE_FEATURE_REG);
- + OUT_BYTE (bcount >> 8,IDE_BCOUNTH_REG);
- + OUT_BYTE (bcount & 0xff,IDE_BCOUNTL_REG);
- OUT_BYTE (drive->select.all,IDE_SELECT_REG);
- + if (dma_ok) {
- + set_bit (PC_DMA_IN_PROGRESS, &pc->flags);
- + (void) (HWIF(drive)->dmaproc(ide_dma_begin, drive));
- + }
- if (test_bit (IDESCSI_DRQ_INTERRUPT, &scsi->flags)) {
- ide_set_handler (drive, &idescsi_transfer_pc, WAIT_CMD);
- OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* Issue the packet command */
- @@ -304,7 +428,7 @@ static ide_module_t idescsi_module = {
- static ide_driver_t idescsi_driver = {
- ide_scsi, /* media */
- 0, /* busy */
- - 0, /* supports_dma */
- + 1, /* supports_dma */
- 0, /* supports_dsc_overlap */
- idescsi_cleanup, /* cleanup */
- idescsi_do_request, /* do_request */
- @@ -389,23 +513,74 @@ const char *idescsi_info (struct Scsi_Host *host)
- return "SCSI host adapter emulation for IDE ATAPI devices";
- }
- -/*
- - * Most of the SCSI commands are supported directly by ATAPI devices.
- - * idescsi_transform_pc handles the few exceptions.
- - */
- -static inline void idescsi_transform_pc (ide_drive_t *drive, idescsi_pc_t *pc)
- +static inline struct buffer_head *idescsi_kmalloc_bh (int count)
- {
- - if (drive->media == ide_cdrom) {
- - if (pc->c[0] == READ_6) {
- - pc->c[8] = pc->c[4];
- - pc->c[5] = pc->c[3];
- - pc->c[4] = pc->c[2];
- - pc->c[3] = pc->c[1] & 0x1f;
- - pc->c[2] = 0;
- - pc->c[1] &= 0xe0;
- - pc->c[0] = READ_10;
- + struct buffer_head *bh, *bhp, *first_bh;
- +
- + if ((first_bh = bhp = bh = kmalloc (sizeof(struct buffer_head), GFP_ATOMIC)) == NULL)
- + goto abort;
- + memset (bh, 0, sizeof (struct buffer_head));
- + bh->b_reqnext = NULL;
- + while (--count) {
- + if ((bh = kmalloc (sizeof(struct buffer_head), GFP_ATOMIC)) == NULL)
- + goto abort;
- + memset (bh, 0, sizeof (struct buffer_head));
- + bhp->b_reqnext = bh;
- + bhp = bh;
- + bh->b_reqnext = NULL;
- + }
- + return first_bh;
- +abort:
- + idescsi_free_bh (first_bh);
- + return NULL;
- +}
- +
- +static inline int idescsi_set_direction (idescsi_pc_t *pc)
- +{
- + switch (pc->c[0]) {
- + case READ_6: case READ_10: case READ_12:
- + clear_bit (PC_WRITING, &pc->flags);
- + return 0;
- + case WRITE_6: case WRITE_10: case WRITE_12:
- + set_bit (PC_WRITING, &pc->flags);
- + return 0;
- + default:
- + return 1;
- + }
- +}
- +
- +static inline struct buffer_head *idescsi_dma_bh (ide_drive_t *drive, idescsi_pc_t *pc)
- +{
- + struct buffer_head *bh = NULL, *first_bh = NULL;
- + int segments = pc->scsi_cmd->use_sg;
- + struct scatterlist *sg = pc->scsi_cmd->request_buffer;
- +
- + if (!drive->using_dma || pc->request_transfer % 1024)
- + return NULL;
- + if (idescsi_set_direction(pc))
- + return NULL;
- + if (segments) {
- + if ((first_bh = bh = idescsi_kmalloc_bh (segments)) == NULL)
- + return NULL;
- +#if IDESCSI_DEBUG_LOG
- + printk ("ide-scsi: %s: building DMA table, %d segments, %dkB total\n", drive->name, segments, pc->request_transfer >> 10);
- +#endif /* IDESCSI_DEBUG_LOG */
- + while (segments--) {
- + bh->b_data = sg->address;
- + bh->b_size = sg->length;
- + bh = bh->b_reqnext;
- + sg++;
- }
- + } else {
- + if ((first_bh = bh = idescsi_kmalloc_bh (1)) == NULL)
- + return NULL;
- +#if IDESCSI_DEBUG_LOG
- + printk ("ide-scsi: %s: building DMA table for a single buffer (%dkB)\n", drive->name, pc->request_transfer >> 10);
- +#endif /* IDESCSI_DEBUG_LOG */
- + bh->b_data = pc->scsi_cmd->request_buffer;
- + bh->b_size = pc->request_transfer;
- }
- + return first_bh;
- }
- int idescsi_queue (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
- @@ -430,16 +605,25 @@ int idescsi_queue (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
- }
- memset (pc->c, 0, 12);
- + pc->flags = 0;
- pc->rq = rq;
- memcpy (pc->c, cmd->cmnd, cmd->cmd_len);
- - pc->buffer = cmd->request_buffer;
- + if (cmd->use_sg) {
- + pc->buffer = NULL;
- + pc->sg = cmd->request_buffer;
- + } else {
- + pc->buffer = cmd->request_buffer;
- + pc->sg = NULL;
- + }
- + pc->b_count = 0;
- pc->request_transfer = pc->buffer_size = cmd->request_bufflen;
- pc->scsi_cmd = cmd;
- pc->done = done;
- - idescsi_transform_pc (drive, pc);
- + idescsi_transform_pc1 (drive, pc);
- ide_init_drive_cmd (rq);
- rq->buffer = (char *) pc;
- + rq->bh = idescsi_dma_bh (drive, pc);
- rq->cmd = IDESCSI_PC_RQ;
- (void) ide_do_drive_cmd (drive, rq, ide_end);
- return 0;
- @@ -481,7 +665,7 @@ void cleanup_module (void)
- scsi_unregister_module (MODULE_SCSI_HA, &idescsi_template);
- for (i = 0; media[i] != 255; i++) {
- failed = 0;
- - while ((drive = ide_scan_devices (media[i], &idescsi_driver, failed++)) != NULL)
- + while ((drive = ide_scan_devices (media[i], &idescsi_driver, failed)) != NULL)
- if (idescsi_cleanup (drive)) {
- printk ("%s: cleanup_module() called while still busy\n", drive->name);
- failed++;
- diff --git a/drivers/scsi/ide-scsi.h b/drivers/scsi/ide-scsi.h
- index cc687fe..94edaa1 100644
- --- a/drivers/scsi/ide-scsi.h
- +++ b/drivers/scsi/ide-scsi.h
- @@ -1,7 +1,7 @@
- /*
- * linux/drivers/scsi/ide-scsi.h
- *
- - * Copyright (C) 1996 Gadi Oxman <gadio@netvision.net.il>
- + * Copyright (C) 1996, 1997 Gadi Oxman <gadio@netvision.net.il>
- */
- #ifndef IDESCSI_H
- @@ -31,7 +31,7 @@ extern int idescsi_reset (Scsi_Cmnd *cmd, unsigned int resetflags);
- NULL, /* bios_param */ \
- 10, /* can_queue */ \
- -1, /* this_id */ \
- - SG_NONE, /* sg_tablesize */ \
- + 256, /* sg_tablesize */ \
- 5, /* cmd_per_lun */ \
- 0, /* present */ \
- 0, /* isa_dma */ \
- diff --git a/drivers/scsi/seagate.c b/drivers/scsi/seagate.c
- index 6ff5209..d084923 100644
- --- a/drivers/scsi/seagate.c
- +++ b/drivers/scsi/seagate.c
- @@ -43,20 +43,41 @@
- * will configure the driver for a TMC-8xx style controller using IRQ 15
- * with a base address of 0xC8000.
- *
- - * -DFAST or -DFAST32 will use blind transfers where possible
- - *
- - * -DARBITRATE will cause the host adapter to arbitrate for the
- + * -DARBITRATE
- + * Will cause the host adapter to arbitrate for the
- * bus for better SCSI-II compatibility, rather than just
- * waiting for BUS FREE and then doing its thing. Should
- * let us do one command per Lun when I integrate my
- * reorganization changes into the distribution sources.
- *
- - * -DSLOW_HANDSHAKE will allow compatibility with broken devices that don't
- + * -DDEBUG
- + * Will activate debug code.
- + *
- + * -DFAST or -DFAST32
- + * Will use blind transfers where possible
- + *
- + * -DPARITY
- + * This will enable parity.
- + *
- + * -DSEAGATE_USE_ASM
- + * Will use older seagate assembly code. should be (very small amount)
- + * Faster.
- + *
- + * -DSLOW_HANDSHAKE
- + * Will allow compatibility with broken devices that don't
- * handshake fast enough (ie, some CD ROM's) for the Seagate
- * code.
- *
- - * -DSLOW_RATE=x, x some number will let you specify a default
- + * -DSLOW_RATE=x
- + * x is some number, It will let you specify a default
- * transfer rate if handshaking isn't working correctly.
- + *
- + * The following to options are patches from the SCSI.HOWTO
- + *
- + * -DSWAPSTAT This will swap the definitions for STAT_MSG and STAT_CD.
- + *
- + * -DSWAPCNTDATA This will swap the order that seagate.c messes with
- + * the CONTROL an DATA registers.
- */
- #include <linux/module.h>
- @@ -396,8 +417,8 @@ int seagate_st0x_detect (Scsi_Host_Template * tpnt)
- #ifdef ARBITRATE
- " ARBITRATE"
- #endif
- -#ifdef SLOW_HANDSHAKE
- - " SLOW_HANDSHAKE"
- +#ifdef DEBUG
- + " DEBUG"
- #endif
- #ifdef FAST
- #ifdef FAST32
- @@ -409,6 +430,21 @@ int seagate_st0x_detect (Scsi_Host_Template * tpnt)
- #ifdef LINKED
- " LINKED"
- #endif
- +#ifdef PARITY
- + " PARITY"
- +#endif
- +#ifdef SEAGATE_USE_ASM
- + " SEAGATE_USE_ASM"
- +#endif
- +#ifdef SLOW_HANDSHAKE
- + " SLOW_HANDSHAKE"
- +#endif
- +#ifdef SWAPSTAT
- + " SWAPSTAT"
- +#endif
- +#ifdef SWAPCNTDATA
- + " SWAPCNTDATA"
- +#endif
- "\n", tpnt->name);
- return 1;
- }
- @@ -926,12 +962,21 @@ static int internal_command (unsigned char target, unsigned char lun,
- * try this with a SCSI protocol or logic analyzer to see what is
- * going on.
- */
- +#ifdef SWAPCNTDATA
- + cli();
- + WRITE_CONTROL (BASE_CMD | CMD_DRVR_ENABLE | CMD_SEL |
- + (reselect ? CMD_ATTN : 0));
- + WRITE_DATA ((unsigned char) ((1 << target) |
- + (controller_type == SEAGATE ? 0x80 : 0x40)));
- + sti();
- +#else
- cli ();
- WRITE_DATA ((unsigned char) ((1 << target) |
- (controller_type == SEAGATE ? 0x80 : 0x40)));
- WRITE_CONTROL (BASE_CMD | CMD_DRVR_ENABLE | CMD_SEL |
- (reselect ? CMD_ATTN : 0));
- sti ();
- +#endif
- while (!((status_read = STATUS) & STAT_BSY) && (jiffies < clock)
- && !st0x_aborted)
- #if 0 && (DEBUG & PHASE_SELECTION)
- diff --git a/drivers/scsi/seagate.h b/drivers/scsi/seagate.h
- index da18dbe..e56b174 100644
- --- a/drivers/scsi/seagate.h
- +++ b/drivers/scsi/seagate.h
- @@ -37,14 +37,6 @@ int seagate_st0x_biosparam(Disk *, kdev_t, int*);
- 1, 7, SG_ALL, 1, 0, 0, DISABLE_CLUSTERING}
- #endif
- -
- -/*
- - defining PARITY causes parity data to be checked
- -*/
- -
- -#define PARITY
- -
- -
- /*
- Thanks to Brian Antoine for the example code in his Messy-Loss ST-01
- driver, and Mitsugu Suzuki for information on the ST-01
- @@ -67,11 +59,16 @@ int seagate_st0x_biosparam(Disk *, kdev_t, int*);
- /*
- STATUS
- */
- +#ifdef SWAPSTAT
- + #define STAT_MSG 0x08
- + #define STAT_CD 0x02
- +#else
- + #define STAT_MSG 0x02
- + #define STAT_CD 0x08
- +#endif
- #define STAT_BSY 0x01
- -#define STAT_MSG 0x02
- #define STAT_IO 0x04
- -#define STAT_CD 0x08
- #define STAT_REQ 0x10
- #define STAT_SEL 0x20
- #define STAT_PARITY 0x40
- diff --git a/fs/devices.c b/fs/devices.c
- index c9af466..c604a55 100644
- --- a/fs/devices.c
- +++ b/fs/devices.c
- @@ -253,7 +253,7 @@ struct file_operations def_blk_fops = {
- NULL, /* read */
- NULL, /* write */
- NULL, /* readdir */
- - NULL, /* select */
- + NULL, /* poll */
- NULL, /* ioctl */
- NULL, /* mmap */
- blkdev_open, /* open */
- @@ -306,7 +306,7 @@ struct file_operations def_chr_fops = {
- NULL, /* read */
- NULL, /* write */
- NULL, /* readdir */
- - NULL, /* select */
- + NULL, /* poll */
- NULL, /* ioctl */
- NULL, /* mmap */
- chrdev_open, /* open */
- diff --git a/fs/ext2/symlink.c b/fs/ext2/symlink.c
- index ef4dd52..31f8276 100644
- --- a/fs/ext2/symlink.c
- +++ b/fs/ext2/symlink.c
- @@ -122,12 +122,11 @@ static int ext2_readlink (struct inode * inode, char * buffer, int buflen)
- }
- else
- link = (char *) inode->u.ext2_i.i_data;
- -
- - /* XXX I hope link is always '\0'-terminated. */
- - i = strlen(link);
- - if (i >= buflen)
- - i = buflen-1;
- - if (copy_to_user(buffer, link, i+1))
- +
- + i = 0;
- + while (i < buflen && link[i])
- + i++;
- + if (copy_to_user(buffer, link, i))
- i = -EFAULT;
- if (DO_UPDATE_ATIME(inode)) {
- inode->i_atime = CURRENT_TIME;
- diff --git a/fs/nfs/rpcsock.c b/fs/nfs/rpcsock.c
- index d341504..3d6d5c0 100644
- --- a/fs/nfs/rpcsock.c
- +++ b/fs/nfs/rpcsock.c
- @@ -40,6 +40,7 @@
- #include <linux/net.h>
- #include <linux/mm.h>
- #include <linux/rpcsock.h>
- +#include <linux/poll.h>
- #include <linux/udp.h>
- #include <net/sock.h>
- @@ -159,21 +160,20 @@ rpc_recvmsg(struct rpc_sock *rsock, struct iovec *iov,
- /*
- * This code is slightly complicated. Since the networking code does not
- - * honor the current->timeout value, we have to select on the socket.
- + * honor the current->timeout value, we have to poll on the socket.
- */
- static inline int
- rpc_select(struct rpc_sock *rsock)
- {
- - struct select_table_entry entry;
- + struct poll_table_entry entry;
- struct file *file = rsock->file;
- - select_table wait_table;
- + poll_table wait_table;
- - dprintk("RPC: selecting on socket...\n");
- + dprintk("RPC: polling socket...\n");
- wait_table.nr = 0;
- wait_table.entry = &entry;
- current->state = TASK_INTERRUPTIBLE;
- - if (!file->f_op->select(file->f_inode, file, SEL_IN, &wait_table)
- - && !file->f_op->select(file->f_inode, file, SEL_IN, NULL)) {
- + if (!(file->f_op->poll(file, &wait_table) & POLLIN)) {
- schedule();
- remove_wait_queue(entry.wait_address, &entry.wait);
- current->state = TASK_RUNNING;
- diff --git a/fs/pipe.c b/fs/pipe.c
- index d43e604..0196e07 100644
- --- a/fs/pipe.c
- +++ b/fs/pipe.c
- @@ -12,6 +12,7 @@
- #include <linux/termios.h>
- #include <linux/mm.h>
- +#include <asm/poll.h>
- #include <asm/uaccess.h>
- /*
- @@ -159,57 +160,43 @@ static int pipe_ioctl(struct inode *pino, struct file * filp,
- }
- }
- -static int pipe_select(struct inode * inode, struct file * filp, int sel_type, select_table * wait)
- +static unsigned int pipe_poll(struct file * filp, poll_table * wait)
- {
- - switch (sel_type) {
- - case SEL_IN:
- - if (!PIPE_EMPTY(*inode) || !PIPE_WRITERS(*inode))
- - return 1;
- - select_wait(&PIPE_WAIT(*inode), wait);
- - return 0;
- - case SEL_OUT:
- - if (PIPE_EMPTY(*inode) || !PIPE_READERS(*inode))
- - return 1;
- - select_wait(&PIPE_WAIT(*inode), wait);
- - return 0;
- - case SEL_EX:
- - if (!PIPE_READERS(*inode) || !PIPE_WRITERS(*inode))
- - return 1;
- - select_wait(&inode->i_wait,wait);
- - return 0;
- - }
- - return 0;
- + unsigned int mask;
- + struct inode * inode = filp->f_inode;
- +
- + poll_wait(&PIPE_WAIT(*inode), wait);
- + mask = POLLIN | POLLRDNORM;
- + if (PIPE_EMPTY(*inode))
- + mask = POLLOUT | POLLWRNORM;
- + if (!PIPE_WRITERS(*inode))
- + mask |= POLLHUP;
- + if (!PIPE_READERS(*inode))
- + mask |= POLLERR;
- + return mask;
- }
- #ifdef FIFO_SUNOS_BRAINDAMAGE
- /*
- * Arggh. Why does SunOS have to have different select() behaviour
- - * for pipes and fifos? Hate-Hate-Hate. See difference in SEL_IN..
- + * for pipes and fifos? Hate-Hate-Hate. SunOS lacks POLLHUP..
- */
- -static int fifo_select(struct inode * inode, struct file * filp, int sel_type, select_table * wait)
- +static unsigned int fifo_poll(struct file * filp, poll_table * wait)
- {
- - switch (sel_type) {
- - case SEL_IN:
- - if (!PIPE_EMPTY(*inode))
- - return 1;
- - select_wait(&PIPE_WAIT(*inode), wait);
- - return 0;
- - case SEL_OUT:
- - if (!PIPE_FULL(*inode) || !PIPE_READERS(*inode))
- - return 1;
- - select_wait(&PIPE_WAIT(*inode), wait);
- - return 0;
- - case SEL_EX:
- - if (!PIPE_READERS(*inode) || !PIPE_WRITERS(*inode))
- - return 1;
- - select_wait(&inode->i_wait,wait);
- - return 0;
- - }
- - return 0;
- + unsigned int mask;
- + struct inode * inode = filp->f_inode;
- +
- + poll_wait(&PIPE_WAIT(*inode), wait);
- + mask = POLLIN | POLLRDNORM;
- + if (PIPE_EMPTY(*inode))
- + mask = POLLOUT | POLLWRNORM;
- + if (!PIPE_READERS(*inode))
- + mask |= POLLERR;
- + return mask;
- }
- #else
- -#define fifo_select pipe_select
- +#define fifo_poll pipe_poll
- #endif /* FIFO_SUNOS_BRAINDAMAGE */
- @@ -227,31 +214,18 @@ static long connect_read(struct inode * inode, struct file * filp,
- return pipe_read(inode,filp,buf,count);
- }
- -static int connect_select(struct inode * inode, struct file * filp, int sel_type, select_table * wait)
- +static unsigned int connect_poll(struct file * filp, poll_table * wait)
- {
- - switch (sel_type) {
- - case SEL_IN:
- - if (!PIPE_EMPTY(*inode)) {
- - filp->f_op = &read_fifo_fops;
- - return 1;
- - }
- - if (PIPE_WRITERS(*inode)) {
- - filp->f_op = &read_fifo_fops;
- - }
- - select_wait(&PIPE_WAIT(*inode), wait);
- - return 0;
- - case SEL_OUT:
- - if (!PIPE_FULL(*inode))
- - return 1;
- - select_wait(&PIPE_WAIT(*inode), wait);
- - return 0;
- - case SEL_EX:
- - if (!PIPE_READERS(*inode) || !PIPE_WRITERS(*inode))
- - return 1;
- - select_wait(&inode->i_wait,wait);
- - return 0;
- + struct inode * inode = filp->f_inode;
- +
- + poll_wait(&PIPE_WAIT(*inode), wait);
- + if (!PIPE_EMPTY(*inode)) {
- + filp->f_op = &read_fifo_fops;
- + return POLLIN | POLLRDNORM;
- }
- - return 0;
- + if (PIPE_WRITERS(*inode))
- + filp->f_op = &read_fifo_fops;
- + return POLLOUT | POLLWRNORM;
- }
- static void pipe_read_release(struct inode * inode, struct file * filp)
- @@ -305,7 +279,7 @@ struct file_operations connecting_fifo_fops = {
- connect_read,
- bad_pipe_w,
- NULL, /* no readdir */
- - connect_select,
- + connect_poll,
- pipe_ioctl,
- NULL, /* no mmap on pipes.. surprise */
- pipe_read_open,
- @@ -318,7 +292,7 @@ struct file_operations read_fifo_fops = {
- pipe_read,
- bad_pipe_w,
- NULL, /* no readdir */
- - fifo_select,
- + fifo_poll,
- pipe_ioctl,
- NULL, /* no mmap on pipes.. surprise */
- pipe_read_open,
- @@ -331,7 +305,7 @@ struct file_operations write_fifo_fops = {
- bad_pipe_r,
- pipe_write,
- NULL, /* no readdir */
- - fifo_select,
- + fifo_poll,
- pipe_ioctl,
- NULL, /* mmap */
- pipe_write_open,
- @@ -344,7 +318,7 @@ struct file_operations rdwr_fifo_fops = {
- pipe_read,
- pipe_write,
- NULL, /* no readdir */
- - fifo_select,
- + fifo_poll,
- pipe_ioctl,
- NULL, /* mmap */
- pipe_rdwr_open,
- @@ -357,7 +331,7 @@ struct file_operations read_pipe_fops = {
- pipe_read,
- bad_pipe_w,
- NULL, /* no readdir */
- - pipe_select,
- + pipe_poll,
- pipe_ioctl,
- NULL, /* no mmap on pipes.. surprise */
- pipe_read_open,
- @@ -370,7 +344,7 @@ struct file_operations write_pipe_fops = {
- bad_pipe_r,
- pipe_write,
- NULL, /* no readdir */
- - pipe_select,
- + pipe_poll,
- pipe_ioctl,
- NULL, /* mmap */
- pipe_write_open,
- @@ -383,7 +357,7 @@ struct file_operations rdwr_pipe_fops = {
- pipe_read,
- pipe_write,
- NULL, /* no readdir */
- - pipe_select,
- + pipe_poll,
- pipe_ioctl,
- NULL, /* mmap */
- pipe_rdwr_open,
- diff --git a/fs/proc/kmsg.c b/fs/proc/kmsg.c
- index add1121..2696769 100644
- --- a/fs/proc/kmsg.c
- +++ b/fs/proc/kmsg.c
- @@ -9,6 +9,7 @@
- #include <linux/errno.h>
- #include <linux/sched.h>
- #include <linux/kernel.h>
- +#include <linux/poll.h>
- #include <asm/uaccess.h>
- #include <asm/io.h>
- @@ -34,13 +35,11 @@ static long kmsg_read(struct inode * inode, struct file * file,
- return sys_syslog(2,buf,count);
- }
- -static int kmsg_select(struct inode *inode, struct file *file, int sel_type, select_table * wait)
- +static unsigned int kmsg_poll(struct file *file, poll_table * wait)
- {
- - if (sel_type != SEL_IN)
- - return 0;
- + poll_wait(&log_wait, wait);
- if (log_size)
- - return 1;
- - select_wait(&log_wait, wait);
- + return POLLIN | POLLRDNORM;
- return 0;
- }
- @@ -50,7 +49,7 @@ static struct file_operations proc_kmsg_operations = {
- kmsg_read,
- NULL, /* kmsg_write */
- NULL, /* kmsg_readdir */
- - kmsg_select, /* kmsg_select */
- + kmsg_poll, /* kmsg_poll */
- NULL, /* kmsg_ioctl */
- NULL, /* mmap */
- kmsg_open,
- diff --git a/fs/select.c b/fs/select.c
- index 3d87796..1528072 100644
- --- a/fs/select.c
- +++ b/fs/select.c
- @@ -1,5 +1,5 @@
- /*
- - * This file contains the procedures for the handling of select
- + * This file contains the procedures for the handling of select and poll
- *
- * Created for Linux based loosely upon Mathius Lattner's minix
- * patches by Peter MacDonald. Heavily edited by Linus.
- @@ -21,11 +21,14 @@
- #include <linux/errno.h>
- #include <linux/personality.h>
- #include <linux/mm.h>
- +#include <linux/malloc.h>
- #include <asm/uaccess.h>
- #include <asm/system.h>
- +#include <asm/poll.h>
- #define ROUND_UP(x,y) (((x)+(y)-1)/(y))
- +#define DEFAULT_POLLMASK (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
- /*
- * Ok, Peter made a complicated, but straightforward multiple_wait() function.
- @@ -34,20 +37,20 @@
- * understand what I'm doing here, then you understand how the linux
- * sleep/wakeup mechanism works.
- *
- - * Two very simple procedures, select_wait() and free_wait() make all the work.
- - * select_wait() is an inline-function defined in <linux/sched.h>, as all select
- - * functions have to call it to add an entry to the select table.
- + * Two very simple procedures, poll_wait() and free_wait() make all the work.
- + * poll_wait() is an inline-function defined in <linux/sched.h>, as all select/poll
- + * functions have to call it to add an entry to the poll table.
- */
- /*
- - * I rewrote this again to make the select_table size variable, take some
- + * I rewrote this again to make the poll_table size variable, take some
- * more shortcuts, improve responsiveness, and remove another race that
- * Linus noticed. -- jrs
- */
- -static void free_wait(select_table * p)
- +static void free_wait(poll_table * p)
- {
- - struct select_table_entry * entry = p->entry + p->nr;
- + struct poll_table_entry * entry = p->entry + p->nr;
- while (p->nr > 0) {
- p->nr--;
- @@ -57,34 +60,6 @@ static void free_wait(select_table * p)
- }
- /*
- - * The check function checks the ready status of a file using the vfs layer.
- - *
- - * If the file was not ready we were added to its wait queue. But in
- - * case it became ready just after the check and just before it called
- - * select_wait, we call it again, knowing we are already on its
- - * wait queue this time. The second call is not necessary if the
- - * select_table is NULL indicating an earlier file check was ready
- - * and we aren't going to sleep on the select_table. -- jrs
- - */
- -
- -static inline int __check(
- - int (*select) (struct inode *, struct file *, int, select_table *),
- - struct inode *inode,
- - struct file *file,
- - int flag,
- - select_table * wait)
- -{
- - return select(inode, file, flag, wait) ||
- - (wait && select(inode, file, flag, NULL));
- -}
- -
- -#define check(flag,wait,file) \
- -(((file)->f_op && (file)->f_op->select) ? \
- - __check((file)->f_op->select,(file)->f_inode,file,flag,wait) \
- - : \
- - (flag != SEL_EX))
- -
- -/*
- * Due to kernel stack usage, we use a _limited_ fd_set type here, and once
- * we really start supporting >256 file descriptors we'll probably have to
- * allocate the kernel fd_set copies dynamically.. (The kernel select routines
- @@ -154,11 +129,15 @@ get_max:
- #define ISSET(i,m) (((i)&*(m)) != 0)
- #define SET(i,m) (*(m) |= (i))
- +#define POLLIN_SET (POLLRDNORM | POLLRDBAND | POLLIN | POLLHUP | POLLERR)
- +#define POLLOUT_SET (POLLWRBAND | POLLWRNORM | POLLOUT | POLLERR)
- +#define POLLEX_SET (POLLPRI)
- +
- static int do_select(int n, fd_set_buffer *fds)
- {
- int retval;
- - select_table wait_table, *wait;
- - struct select_table_entry *entry;
- + poll_table wait_table, *wait;
- + struct poll_table_entry *entry;
- int i;
- retval = max_select_fd(n, fds);
- @@ -166,7 +145,8 @@ static int do_select(int n, fd_set_buffer *fds)
- goto out;
- n = retval;
- retval = -ENOMEM;
- - if(!(entry = (struct select_table_entry*) __get_free_page(GFP_KERNEL)))
- + entry = (struct poll_table_entry *) __get_free_page(GFP_KERNEL);
- + if (!entry)
- goto out;
- retval = 0;
- wait_table.nr = 0;
- @@ -178,24 +158,30 @@ static int do_select(int n, fd_set_buffer *fds)
- for (i = 0 ; i < n ; i++,fd++) {
- unsigned long bit = BIT(i);
- unsigned long *in = MEM(i,fds->in);
- - struct file * file = *fd;
- - if (!file)
- - continue;
- - if (ISSET(bit,__IN(in)) && check(SEL_IN,wait,file)) {
- - SET(bit, __RES_IN(in));
- - retval++;
- - wait = NULL;
- - }
- - if (ISSET(bit,__OUT(in)) && check(SEL_OUT,wait,file)) {
- - SET(bit, __RES_OUT(in));
- - retval++;
- - wait = NULL;
- - }
- - if (ISSET(bit,__EX(in)) && check(SEL_EX,wait,file)) {
- - SET(bit, __RES_EX(in));
- - retval++;
- - wait = NULL;
- + if (bit & BITS(in)) {
- + struct file * file = *fd;
- + unsigned int mask = POLLNVAL;
- + if (file) {
- + mask = DEFAULT_POLLMASK;
- + if (file->f_op && file->f_op->poll)
- + mask = file->f_op->poll(file, wait);
- + }
- + if ((mask & POLLIN_SET) && ISSET(bit, __IN(in))) {
- + SET(bit, __RES_IN(in));
- + retval++;
- + wait = NULL;
- + }
- + if ((mask & POLLOUT_SET) && ISSET(bit, __OUT(in))) {
- + SET(bit, __RES_OUT(in));
- + retval++;
- + wait = NULL;
- + }
- + if ((mask & POLLEX_SET) && ISSET(bit, __EX(in))) {
- + SET(bit, __RES_EX(in));
- + retval++;
- + wait = NULL;
- + }
- }
- }
- wait = NULL;
- @@ -344,3 +330,95 @@ asmlinkage int sys_select(int n, fd_set *inp, fd_set *outp, fd_set *exp, struct
- out:
- return error;
- }
- +
- +static int do_poll(unsigned int nfds, struct pollfd *fds, poll_table *wait)
- +{
- + int count;
- + struct file ** fd = current->files->fd;
- +
- + count = 0;
- + for (;;) {
- + unsigned int j;
- + struct pollfd * fdpnt;
- +
- + current->state = TASK_INTERRUPTIBLE;
- + for (fdpnt = fds, j = 0; j < nfds; j++, fdpnt++) {
- + unsigned int i;
- + unsigned int mask;
- + struct file * file;
- +
- + mask = POLLNVAL;
- + i = fdpnt->fd;
- + if (i < NR_OPEN && (file = fd[i]) != NULL) {
- + mask = DEFAULT_POLLMASK;
- + if (file->f_op && file->f_op->poll)
- + mask = file->f_op->poll(file, wait);
- + mask &= fdpnt->events | POLLERR | POLLHUP;
- + }
- + if (mask) {
- + wait = NULL;
- + count++;
- + }
- + fdpnt->revents = mask;
- + }
- +
- + wait = NULL;
- + if (count || !current->timeout || (current->signal & ~current->blocked))
- + break;
- + schedule();
- + }
- + current->state = TASK_RUNNING;
- + return count;
- +}
- +
- +asmlinkage int sys_poll(struct pollfd * ufds, unsigned int nfds, int timeout)
- +{
- + int i, count, fdcount;
- + struct pollfd * fds, *fds1;
- + poll_table wait_table;
- + struct poll_table_entry *entry;
- +
- + if (nfds > NR_OPEN)
- + return -EINVAL;
- +
- + entry = (struct poll_table_entry *) __get_free_page(GFP_KERNEL);
- + if (!entry)
- + return -ENOMEM;
- + fds = (struct pollfd *) kmalloc(nfds*sizeof(struct pollfd), GFP_KERNEL);
- + if (!fds) {
- + free_page((unsigned long) entry);
- + return -ENOMEM;
- + }
- +
- + if (copy_from_user(fds, ufds, nfds*sizeof(struct pollfd))) {
- + free_page((unsigned long)entry);
- + kfree(fds);
- + return -EFAULT;
- + }
- +
- + if (timeout < 0)
- + timeout = 0x7fffffff;
- + else if (timeout)
- + timeout = ((unsigned long)timeout*HZ+999)/1000+jiffies+1;
- + current->timeout = timeout;
- +
- + count = 0;
- + wait_table.nr = 0;
- + wait_table.entry = entry;
- +
- + fdcount = do_poll(nfds, fds, &wait_table);
- + current->timeout = 0;
- +
- + free_wait(&wait_table);
- + free_page((unsigned long) entry);
- +
- + /* OK, now copy the revents fields back to user space. */
- + fds1 = fds;
- + for(i=0; i < (int)nfds; i++, ufds++, fds++) {
- + __put_user(fds->revents, &ufds->revents);
- + }
- + kfree(fds1);
- + if (!fdcount && (current->signal & ~current->blocked))
- + fdcount = -EINTR;
- + return fdcount;
- +}
- diff --git a/include/asm-alpha/poll.h b/include/asm-alpha/poll.h
- new file mode 100644
- index 0000000..53bf7a3
- --- /dev/null
- +++ b/include/asm-alpha/poll.h
- @@ -0,0 +1,22 @@
- +#ifndef __ALPHA_POLL_H
- +#define __ALPHA_POLL_H
- +
- +#define POLLIN 1
- +#define POLLPRI 2
- +#define POLLOUT 4
- +#define POLLERR 8
- +#define POLLHUP 16
- +#define POLLNVAL 32
- +#define POLLRDNORM 64
- +#define POLLRDBAND 128
- +#define POLLWRNORM 256
- +#define POLLWRBAND 512
- +#define POLLMSG 1024
- +
- +struct pollfd {
- + int fd;
- + short events;
- + short revents;
- +};
- +
- +#endif
- diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h
- index 3a33d8b..f8aea1e 100644
- --- a/include/asm-alpha/unistd.h
- +++ b/include/asm-alpha/unistd.h
- @@ -1,54 +1,92 @@
- #ifndef _ALPHA_UNISTD_H
- #define _ALPHA_UNISTD_H
- +#define __NR_osf_syscall 0 /* not implemented */
- #define __NR_exit 1
- #define __NR_fork 2
- #define __NR_read 3
- #define __NR_write 4
- +#define __NR_osf_old_open 5 /* not implemented */
- #define __NR_close 6
- #define __NR_wait4 7
- +#define __NR_osf_old_creat 8 /* not implemented */
- #define __NR_link 9
- #define __NR_unlink 10
- +#define __NR_osf_execve 11 /* not implemented */
- #define __NR_chdir 12
- #define __NR_fchdir 13
- #define __NR_mknod 14
- #define __NR_chmod 15
- #define __NR_chown 16
- #define __NR_brk 17
- +#define __NR_osf_getfsstat 18 /* not implemented */
- #define __NR_lseek 19
- #define __NR_getxpid 20
- +#define __NR_osf_mount 21
- +#define __NR_osf_umount 22
- #define __NR_setuid 23
- #define __NR_getxuid 24
- +#define __NR_exec_with_loader 25 /* not implemented */
- #define __NR_ptrace 26
- +#define __NR_osf_nrecvmsg 27 /* not implemented */
- +#define __NR_osf_nsendmsg 28 /* not implemented */
- +#define __NR_osf_nrecvfrom 29 /* not implemented */
- +#define __NR_osf_naccept 30 /* not implemented */
- +#define __NR_osf_ngetpeername 31 /* not implemented */
- +#define __NR_osf_ngetsockname 32 /* not implemented */
- #define __NR_access 33
- +#define __NR_osf_chflags 34 /* not implemented */
- +#define __NR_osf_fchflags 35 /* not implemented */
- #define __NR_sync 36
- #define __NR_kill 37
- +#define __NR_osf_old_stat 38 /* not implemented */
- #define __NR_setpgid 39
- +#define __NR_osf_old_lstat 40 /* not implemented */
- #define __NR_dup 41
- #define __NR_pipe 42
- +#define __NR_osf_set_program_attributes 43
- +#define __NR_osf_profil 44 /* not implemented */
- #define __NR_open 45
- +#define __NR_osf_old_sigaction 46 /* not implemented */
- #define __NR_getxgid 47
- +#define __NR_osf_sigprocmask 48
- +#define __NR_osf_getlogin 49 /* not implemented */
- +#define __NR_osf_setlogin 50 /* not implemented */
- #define __NR_acct 51
- #define __NR_sigpending 52
- +
- #define __NR_ioctl 54
- +#define __NR_osf_reboot 55 /* not implemented */
- +#define __NR_osf_revoke 56 /* not implemented */
- #define __NR_symlink 57
- #define __NR_readlink 58
- #define __NR_execve 59
- #define __NR_umask 60
- #define __NR_chroot 61
- +#define __NR_osf_old_fstat 62 /* not implemented */
- #define __NR_getpgrp 63
- #define __NR_getpagesize 64
- +#define __NR_osf_mremap 65 /* not implemented */
- +#define __NR_osf_vfork 66
- #define __NR_stat 67
- #define __NR_lstat 68
- +#define __NR_osf_sbrk 69 /* not implemented */
- +#define __NR_osf_sstk 70 /* not implemented */
- #define __NR_mmap 71 /* OSF/1 mmap is superset of Linux */
- +#define __NR_osf_old_vadvise 72 /* not implemented */
- #define __NR_munmap 73
- #define __NR_mprotect 74
- #define __NR_madvise 75
- #define __NR_vhangup 76
- +#define __NR_osf_kmodcall 77 /* not implemented */
- +#define __NR_osf_mincore 78 /* not implemented */
- #define __NR_getgroups 79
- #define __NR_setgroups 80
- +#define __NR_osf_old_getpgrp 81 /* not implemented */
- #define __NR_setpgrp 82 /* BSD alias for setpgid */
- #define __NR_setitimer 83
- +#define __NR_osf_old_wait 84 /* not implemented */
- +#define __NR_osf_table 85 /* not implemented */
- #define __NR_getitimer 86
- #define __NR_gethostname 87
- #define __NR_sethostname 88
- @@ -57,6 +95,7 @@
- #define __NR_fstat 91
- #define __NR_fcntl 92
- #define __NR_select 93
- +#define __NR_poll 94
- #define __NR_fsync 95
- #define __NR_setpriority 96
- #define __NR_socket 97
- @@ -69,12 +108,19 @@
- #define __NR_bind 104
- #define __NR_setsockopt 105
- #define __NR_listen 106
- +#define __NR_osf_plock 107 /* not implemented */
- +#define __NR_osf_old_sigvec 108 /* not implemented */
- +#define __NR_osf_old_sigblock 109 /* not implemented */
- +#define __NR_osf_old_sigsetmask 110 /* not implemented */
- #define __NR_sigsuspend 111
- +#define __NR_osf_sigstack 112 /* not implemented */
- #define __NR_recvmsg 113
- #define __NR_sendmsg 114
- +#define __NR_osf_old_vtrace 115 /* not implemented */
- #define __NR_gettimeofday 116
- #define __NR_getrusage 117
- #define __NR_getsockopt 118
- +
- #define __NR_readv 120
- #define __NR_writev 121
- #define __NR_settimeofday 122
- @@ -94,14 +140,44 @@
- #define __NR_mkdir 136
- #define __NR_rmdir 137
- #define __NR_utimes 138
- +#define __NR_osf_old_sigreturn 139 /* not implemented */
- +#define __NR_osf_adjtime 140 /* not implemented */
- #define __NR_getpeername 141
- +#define __NR_osf_gethostid 142 /* not implemented */
- +#define __NR_osf_sethostid 143 /* not implemented */
- #define __NR_getrlimit 144
- #define __NR_setrlimit 145
- +#define __NR_osf_old_killpg 146 /* not implemented */
- #define __NR_setsid 147
- #define __NR_quotactl 148
- +#define __NR_osf_oldquota 149 /* not implemented */
- #define __NR_getsockname 150
- +
- +#define __NR_osf_pid_block 153 /* not implemented */
- +#define __NR_osf_pid_unblock 154 /* not implemented */
- +
- #define __NR_sigaction 156
- +#define __NR_osf_sigwaitprim 157 /* not implemented */
- +#define __NR_osf_nfssvc 158 /* not implemented */
- +#define __NR_osf_getdirentries 159
- +#define __NR_osf_statfs 160
- +#define __NR_osf_fstatfs 161
- +
- +#define __NR_osf_asynch_daemon 163 /* not implemented */
- +#define __NR_osf_getfh 164 /* not implemented */
- +#define __NR_osf_getdomainname 165
- #define __NR_setdomainname 166
- +
- +#define __NR_osf_exportfs 169 /* not implemented */
- +
- +#define __NR_osf_alt_plock 181 /* not implemented */
- +
- +#define __NR_osf_getmnt 184 /* not implemented */
- +
- +#define __NR_osf_alt_sigpending 187 /* not implemented */
- +#define __NR_osf_alt_setsid 188 /* not implemented */
- +
- +#define __NR_osf_swapon 199
- #define __NR_msgctl 200
- #define __NR_msgget 201
- #define __NR_msgrcv 202
- @@ -109,16 +185,54 @@
- #define __NR_semctl 204
- #define __NR_semget 205
- #define __NR_semop 206
- +#define __NR_osf_utsname 207
- +#define __NR_osf_lchown 208 /* not implemented */
- +#define __NR_osf_shmat 209
- #define __NR_shmctl 210
- #define __NR_shmdt 211
- #define __NR_shmget 212
- -
- +#define __NR_osf_mvalid 213 /* not implemented */
- +#define __NR_osf_getaddressconf 214 /* not implemented */
- +#define __NR_osf_msleep 215 /* not implemented */
- +#define __NR_osf_mwakeup 216 /* not implemented */
- #define __NR_msync 217
- +#define __NR_osf_signal 218 /* not implemented */
- +#define __NR_osf_utc_gettime 219 /* not implemented */
- +#define __NR_osf_utc_adjtime 220 /* not implemented */
- +
- +#define __NR_osf_security 222 /* not implemented */
- +#define __NR_osf_kloadcall 223 /* not implemented */
- #define __NR_getpgid 233
- #define __NR_getsid 234
- -
- +#define __NR_osf_sigaltstack 235 /* not implemented */
- +#define __NR_osf_waitid 236 /* not implemented */
- +#define __NR_osf_priocntlset 237 /* not implemented */
- +#define __NR_osf_sigsendset 238 /* not implemented */
- +#define __NR_osf_set_speculative 239 /* not implemented */
- +#define __NR_osf_msfs_syscall 240 /* not implemented */
- +#define __NR_osf_sysinfo 241
- +#define __NR_osf_uadmin 242 /* not implemented */
- +#define __NR_osf_fuser 243 /* not implemented */
- +#define __NR_osf_proplist_syscall 244
- +#define __NR_osf_ntp_adjtime 245 /* not implemented */
- +#define __NR_osf_ntp_gettime 246 /* not implemented */
- +#define __NR_osf_pathconf 247 /* not implemented */
- +#define __NR_osf_fpathconf 248 /* not implemented */
- +
- +#define __NR_osf_uswitch 250 /* not implemented */
- +#define __NR_osf_usleep_thread 251
- +#define __NR_osf_audcntl 252 /* not implemented */
- +#define __NR_osf_audgen 253 /* not implemented */
- #define __NR_sysfs 254
- +#define __NR_osf_subsys_info 255 /* not implemented */
- +#define __NR_osf_getsysinfo 256
- +#define __NR_osf_setsysinfo 257
- +#define __NR_osf_afs_syscall 258 /* not implemented */
- +#define __NR_osf_swapctl 259 /* not implemented */
- +#define __NR_osf_memcntl 260 /* not implemented */
- +#define __NR_osf_fdatasync 261 /* not implemented */
- +
- /*
- * Linux-specific system calls begin at 300
- diff --git a/include/asm-i386/poll.h b/include/asm-i386/poll.h
- new file mode 100644
- index 0000000..e5feda7
- --- /dev/null
- +++ b/include/asm-i386/poll.h
- @@ -0,0 +1,25 @@
- +#ifndef __i386_POLL_H
- +#define __i386_POLL_H
- +
- +/* These are specified by iBCS2 */
- +#define POLLIN 0x0001
- +#define POLLPRI 0x0002
- +#define POLLOUT 0x0004
- +#define POLLERR 0x0008
- +#define POLLHUP 0x0010
- +#define POLLNVAL 0x0020
- +
- +/* The rest seem to be more-or-less nonstandard. Check them! */
- +#define POLLRDNORM 0x0040
- +#define POLLRDBAND 0x0080
- +#define POLLWRNORM 0x0100
- +#define POLLWRBAND 0x0200
- +#define POLLMSG 0x0400
- +
- +struct pollfd {
- + int fd;
- + short events;
- + short revents;
- +};
- +
- +#endif
- diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
- index 4241771..b6cc817 100644
- --- a/include/asm-i386/unistd.h
- +++ b/include/asm-i386/unistd.h
- @@ -173,6 +173,7 @@
- #define __NR_getresuid 165
- #define __NR_vm86 166
- #define __NR_query_module 167
- +#define __NR_poll 168
- /* user-visible error numbers are in the range -1 - -122: see <asm-i386/errno.h> */
- diff --git a/include/asm-sparc/poll.h b/include/asm-sparc/poll.h
- new file mode 100644
- index 0000000..4a7cbe6
- --- /dev/null
- +++ b/include/asm-sparc/poll.h
- @@ -0,0 +1,21 @@
- +#ifndef __SPARC_POLL_H
- +#define __SPARC_POLL_H
- +
- +#define POLLIN 1
- +#define POLLPRI 2
- +#define POLLOUT 4
- +#define POLLERR 8
- +#define POLLHUP 16
- +#define POLLNVAL 32
- +#define POLLRDNORM 64
- +#define POLLWRNORM POLLOUT
- +#define POLLRDBAND 128
- +#define POLLWRBAND 256
- +
- +struct pollfd {
- + int fd;
- + short events;
- + short revents;
- +};
- +
- +#endif
- diff --git a/include/linux/fs.h b/include/linux/fs.h
- index 201bcac..b887ce1 100644
- --- a/include/linux/fs.h
- +++ b/include/linux/fs.h
- @@ -463,7 +463,7 @@ struct file_operations {
- long (*read) (struct inode *, struct file *, char *, unsigned long);
- long (*write) (struct inode *, struct file *, const char *, unsigned long);
- int (*readdir) (struct inode *, struct file *, void *, filldir_t);
- - int (*select) (struct inode *, struct file *, int, select_table *);
- + unsigned int (*poll) (struct file *, poll_table *);
- int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
- int (*mmap) (struct inode *, struct file *, struct vm_area_struct *);
- int (*open) (struct inode *, struct file *);
- diff --git a/include/linux/net.h b/include/linux/net.h
- index df2f584..260dc8a 100644
- --- a/include/linux/net.h
- +++ b/include/linux/net.h
- @@ -93,8 +93,7 @@ struct proto_ops {
- int flags);
- int (*getname) (struct socket *sock, struct sockaddr *uaddr,
- int *usockaddr_len, int peer);
- - int (*select) (struct socket *sock, int sel_type,
- - select_table *wait);
- + unsigned int (*poll) (struct socket *sock, poll_table *wait);
- int (*ioctl) (struct socket *sock, unsigned int cmd,
- unsigned long arg);
- int (*listen) (struct socket *sock, int len);
- diff --git a/include/linux/pci.h b/include/linux/pci.h
- index b92191a..37aeb1f 100644
- --- a/include/linux/pci.h
- +++ b/include/linux/pci.h
- @@ -304,6 +304,7 @@
- #define PCI_VENDOR_ID_CT 0x102c
- #define PCI_DEVICE_ID_CT_65545 0x00d8
- #define PCI_DEVICE_ID_CT_65548 0x00dc
- +#define PCI_DEVICE_ID_CT_65550 0x00e0
- #define PCI_VENDOR_ID_MIRO 0x1031
- #define PCI_DEVICE_ID_MIRO_36050 0x5601
- diff --git a/include/linux/poll.h b/include/linux/poll.h
- new file mode 100644
- index 0000000..2001fed
- --- /dev/null
- +++ b/include/linux/poll.h
- @@ -0,0 +1 @@
- +#include <asm/poll.h>
- diff --git a/include/linux/sched.h b/include/linux/sched.h
- index 28d3237..4fe6eec 100644
- --- a/include/linux/sched.h
- +++ b/include/linux/sched.h
- @@ -445,13 +445,13 @@ extern inline void remove_wait_queue(struct wait_queue ** p, struct wait_queue *
- restore_flags(flags);
- }
- -extern inline void select_wait(struct wait_queue ** wait_address, select_table * p)
- +extern inline void poll_wait(struct wait_queue ** wait_address, poll_table * p)
- {
- - struct select_table_entry * entry;
- + struct poll_table_entry * entry;
- if (!p || !wait_address)
- return;
- - if (p->nr >= __MAX_SELECT_TABLE_ENTRIES)
- + if (p->nr >= __MAX_POLL_TABLE_ENTRIES)
- return;
- entry = p->entry + p->nr;
- entry->wait_address = wait_address;
- diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
- index 0998a97..cd9a1fe 100644
- --- a/include/linux/skbuff.h
- +++ b/include/linux/skbuff.h
- @@ -545,7 +545,7 @@ extern __inline__ void skb_orphan(struct sk_buff *skb)
- extern struct sk_buff * skb_realloc_headroom(struct sk_buff *skb, int newheadroom);
- extern struct sk_buff * skb_recv_datagram(struct sock *sk,unsigned flags,int noblock, int *err);
- -extern int datagram_select(struct socket *sock, int sel_type, select_table *wait);
- +extern unsigned int datagram_poll(struct socket *sock, poll_table *wait);
- extern int skb_copy_datagram(struct sk_buff *from, int offset, char *to,int size);
- extern int skb_copy_datagram_iovec(struct sk_buff *from, int offset, struct iovec *to,int size);
- extern void skb_free_datagram(struct sock * sk, struct sk_buff *skb);
- diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
- index 05a3326..8d69c54 100644
- --- a/include/linux/tty_ldisc.h
- +++ b/include/linux/tty_ldisc.h
- @@ -119,9 +119,7 @@ struct tty_ldisc {
- int (*ioctl)(struct tty_struct * tty, struct file * file,
- unsigned int cmd, unsigned long arg);
- void (*set_termios)(struct tty_struct *tty, struct termios * old);
- - int (*select)(struct tty_struct * tty, struct inode * inode,
- - struct file * file, int sel_type,
- - struct select_table_struct *wait);
- + unsigned int (*poll)(struct tty_struct *, struct file *, poll_table *);
- /*
- * The following routines are called from below.
- diff --git a/include/linux/wait.h b/include/linux/wait.h
- index be24fa2..0a0d11f 100644
- --- a/include/linux/wait.h
- +++ b/include/linux/wait.h
- @@ -28,17 +28,17 @@ static inline int waitqueue_active(struct wait_queue **q)
- return head && head != WAIT_QUEUE_HEAD(q);
- }
- -struct select_table_entry {
- +struct poll_table_entry {
- struct wait_queue wait;
- struct wait_queue ** wait_address;
- };
- -typedef struct select_table_struct {
- +typedef struct poll_table_struct {
- unsigned int nr;
- - struct select_table_entry * entry;
- -} select_table;
- + struct poll_table_entry * entry;
- +} poll_table;
- -#define __MAX_SELECT_TABLE_ENTRIES (PAGE_SIZE / sizeof (struct select_table_entry))
- +#define __MAX_POLL_TABLE_ENTRIES (PAGE_SIZE / sizeof (struct poll_table_entry))
- #endif /* __KERNEL__ */
- diff --git a/include/net/inet_common.h b/include/net/inet_common.h
- index bf9adea..7cdef71 100644
- --- a/include/net/inet_common.h
- +++ b/include/net/inet_common.h
- @@ -31,8 +31,7 @@ extern int inet_sendmsg(struct socket *sock,
- struct msghdr *msg,
- int size, struct scm_cookie *scm);
- extern int inet_shutdown(struct socket *sock, int how);
- -extern int inet_select(struct socket *sock, int sel_type,
- - select_table *wait);
- +extern unsigned int inet_poll(struct socket *sock, poll_table *wait);
- extern int inet_setsockopt(struct socket *sock, int level,
- int optname, char *optval,
- int optlen);
- diff --git a/include/net/sock.h b/include/net/sock.h
- index 15104ef..0ab3bea 100644
- --- a/include/net/sock.h
- +++ b/include/net/sock.h
- @@ -531,8 +531,7 @@ struct proto
- void (*write_wakeup)(struct sock *sk);
- void (*read_wakeup)(struct sock *sk);
- - int (*select)(struct socket *sock, int which,
- - select_table *wait);
- + unsigned int (*poll)(struct socket *sock, poll_table *wait);
- int (*ioctl)(struct sock *sk, int cmd,
- unsigned long arg);
- diff --git a/include/net/tcp.h b/include/net/tcp.h
- index ab8d0c3..3bb395e 100644
- --- a/include/net/tcp.h
- +++ b/include/net/tcp.h
- @@ -265,8 +265,7 @@ extern int tcp_rcv_established(struct sock *sk,
- extern void tcp_close(struct sock *sk,
- unsigned long timeout);
- extern struct sock * tcp_accept(struct sock *sk, int flags);
- -extern int tcp_select(struct socket *sock, int sel_type,
- - select_table *wait);
- +extern unsigned int tcp_poll(struct socket *sock, poll_table *wait);
- extern int tcp_getsockopt(struct sock *sk, int level,
- int optname, char *optval,
- int *optlen);
- diff --git a/kernel/sysctl.c b/kernel/sysctl.c
- index 51c0944..ce4f82d 100644
- --- a/kernel/sysctl.c
- +++ b/kernel/sysctl.c
- @@ -59,7 +59,7 @@ struct file_operations proc_sys_file_operations =
- proc_readsys, /* read */
- proc_writesys, /* write */
- NULL, /* readdir */
- - NULL, /* select */
- + NULL, /* poll */
- NULL, /* ioctl */
- NULL, /* mmap */
- NULL, /* no special open code */
- diff --git a/net/core/datagram.c b/net/core/datagram.c
- index 35af151..64308bb 100644
- --- a/net/core/datagram.c
- +++ b/net/core/datagram.c
- @@ -3,17 +3,17 @@
- *
- * Generic datagram handling routines. These are generic for all protocols. Possibly a generic IP version on top
- * of these would make sense. Not tonight however 8-).
- - * This is used because UDP, RAW, PACKET, DDP, IPX, AX.25 and NetROM layer all have identical select code and mostly
- - * identical recvmsg() code. So we share it here. The select was shared before but buried in udp.c so I moved it.
- + * This is used because UDP, RAW, PACKET, DDP, IPX, AX.25 and NetROM layer all have identical poll code and mostly
- + * identical recvmsg() code. So we share it here. The poll was shared before but buried in udp.c so I moved it.
- *
- - * Authors: Alan Cox <alan@cymru.net>. (datagram_select() from old udp.c code)
- + * Authors: Alan Cox <alan@cymru.net>. (datagram_poll() from old udp.c code)
- *
- * Fixes:
- * Alan Cox : NULL return from skb_peek_copy() understood
- * Alan Cox : Rewrote skb_read_datagram to avoid the skb_peek_copy stuff.
- * Alan Cox : Added support for SOCK_SEQPACKET. IPX can no longer use the SO_TYPE hack but
- * AX.25 now works right, and SPX is feasible.
- - * Alan Cox : Fixed write select of non IP protocol crash.
- + * Alan Cox : Fixed write poll of non IP protocol crash.
- * Florian La Roche: Changed for my new skbuff handling.
- * Darryl Miles : Fixed non-blocking SOCK_SEQPACKET.
- * Linus Torvalds : BSD semantic fixes.
- @@ -34,6 +34,8 @@
- #include <linux/sched.h>
- #include <linux/inet.h>
- #include <linux/netdevice.h>
- +#include <linux/poll.h>
- +
- #include <net/ip.h>
- #include <net/protocol.h>
- #include <net/route.h>
- @@ -188,57 +190,48 @@ int skb_copy_datagram_iovec(struct sk_buff *skb, int offset, struct iovec *to,
- }
- /*
- - * Datagram select: Again totally generic. This also handles
- + * Datagram poll: Again totally generic. This also handles
- * sequenced packet sockets providing the socket receive queue
- * is only ever holding data ready to receive.
- */
- -int datagram_select(struct socket *sock, int sel_type, select_table *wait)
- +unsigned int datagram_poll(struct socket *sock, poll_table *wait)
- {
- struct sock *sk = sock->sk;
- + unsigned int mask;
- +
- + poll_wait(sk->sleep, wait);
- + mask = 0;
- + /* exceptional events? */
- if (sk->err)
- - return 1;
- - switch(sel_type)
- - {
- - case SEL_IN:
- - if (sk->shutdown & RCV_SHUTDOWN)
- - return 1;
- - if (connection_based(sk) && sk->state==TCP_CLOSE)
- - {
- - /* Connection closed: Wake up */
- - return 1;
- - }
- - if (!skb_queue_empty(&sk->receive_queue))
- - { /* This appears to be consistent
- - with other stacks */
- - return 1;
- - }
- - break;
- -
- - case SEL_OUT:
- - if (sk->shutdown & SEND_SHUTDOWN)
- - return 1;
- - if (connection_based(sk) && sk->state==TCP_SYN_SENT)
- - {
- - /* Connection still in progress */
- - break;
- - }
- - if (sk->prot && sock_wspace(sk) >= MIN_WRITE_SPACE)
- - {
- - return 1;
- - }
- - if (sk->prot==NULL && sk->sndbuf-sk->wmem_alloc >= MIN_WRITE_SPACE)
- - {
- - return 1;
- - }
- - break;
- -
- - case SEL_EX:
- - break;
- + mask |= POLLERR;
- + if (sk->shutdown & RCV_SHUTDOWN)
- + mask |= POLLHUP;
- +
- + /* readable? */
- + if (!skb_queue_empty(&sk->receive_queue))
- + mask |= POLLIN | POLLRDNORM;
- +
- + /* Connection-based need to check for termination and startup */
- + if (connection_based(sk)) {
- + if (sk->state==TCP_CLOSE)
- + mask |= POLLHUP;
- + /* connection hasn't started yet? */
- + if (sk->state == TCP_SYN_SENT)
- + return mask;
- + }
- +
- + /* writable? */
- + if (!(sk->shutdown & SEND_SHUTDOWN)) {
- + if (sk->prot) {
- + if (sock_wspace(sk) >= MIN_WRITE_SPACE)
- + mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
- + } else {
- + if (sk->sndbuf-sk->wmem_alloc >= MIN_WRITE_SPACE)
- + mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
- + }
- }
- - /* select failed.. */
- - select_wait(sk->sleep, wait);
- - return 0;
- + return mask;
- }
- diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
- index ff390e6..1c67348 100644
- --- a/net/ipv4/af_inet.c
- +++ b/net/ipv4/af_inet.c
- @@ -1188,13 +1188,13 @@ int inet_shutdown(struct socket *sock, int how)
- }
- -int inet_select(struct socket *sock, int sel_type, select_table *wait)
- +unsigned int inet_poll(struct socket *sock, poll_table *wait)
- {
- struct sock *sk = sock->sk;
- - if (sk->prot->select == NULL)
- + if (sk->prot->poll == NULL)
- return(0);
- - return sk->prot->select(sock, sel_type, wait);
- + return sk->prot->poll(sock, wait);
- }
- /*
- @@ -1589,7 +1589,7 @@ struct proto_ops inet_stream_ops = {
- NULL,
- inet_accept,
- inet_getname,
- - inet_select,
- + inet_poll,
- inet_ioctl,
- inet_listen,
- inet_shutdown,
- @@ -1610,7 +1610,7 @@ struct proto_ops inet_dgram_ops = {
- NULL,
- NULL,
- inet_getname,
- - datagram_select,
- + datagram_poll,
- inet_ioctl,
- NULL,
- inet_shutdown,
- diff --git a/net/ipv4/ip_fw.c b/net/ipv4/ip_fw.c
- index d643ef9..1d4df36 100644
- --- a/net/ipv4/ip_fw.c
- +++ b/net/ipv4/ip_fw.c
- @@ -209,9 +209,9 @@ extern inline int port_match(unsigned short *portptr,int nports,unsigned short p
- int ip_fw_chk(struct iphdr *ip, struct device *rif, __u16 *redirport, struct ip_fw *chain, int policy, int mode)
- {
- struct ip_fw *f;
- - struct tcphdr *tcp=(struct tcphdr *)((unsigned long *)ip+ip->ihl);
- - struct udphdr *udp=(struct udphdr *)((unsigned long *)ip+ip->ihl);
- - struct icmphdr *icmp=(struct icmphdr *)((unsigned long *)ip+ip->ihl);
- + struct tcphdr *tcp=(struct tcphdr *)((__u32 *)ip+ip->ihl);
- + struct udphdr *udp=(struct udphdr *)((__u32 *)ip+ip->ihl);
- + struct icmphdr *icmp=(struct icmphdr *)((__u32 *)ip+ip->ihl);
- __u32 src, dst;
- __u16 src_port=0xFFFF, dst_port=0xFFFF, icmp_type=0xFF;
- unsigned short f_prt=0, prt;
- diff --git a/net/ipv4/packet.c b/net/ipv4/packet.c
- index 8187b20..365a294 100644
- --- a/net/ipv4/packet.c
- +++ b/net/ipv4/packet.c
- @@ -497,7 +497,7 @@ struct proto packet_prot =
- NULL,
- NULL,
- NULL,
- - datagram_select,
- + datagram_poll,
- NULL, /* No ioctl */
- packet_init,
- NULL,
- diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
- index 69a2bd4..279778f 100644
- --- a/net/ipv4/raw.c
- +++ b/net/ipv4/raw.c
- @@ -412,7 +412,7 @@ struct proto raw_prot = {
- NULL,
- NULL,
- NULL,
- - datagram_select,
- + datagram_poll,
- #ifdef CONFIG_IP_MROUTE
- ipmr_ioctl,
- #else
- diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
- index bfb3259..4e16792 100644
- --- a/net/ipv4/tcp.c
- +++ b/net/ipv4/tcp.c
- @@ -30,7 +30,7 @@
- * socket was looked up backwards. Nobody
- * tested any icmp error code obviously.
- * Alan Cox : tcp_err() now handled properly. It
- - * wakes people on errors. select
- + * wakes people on errors. poll
- * behaves and the icmp error race
- * has gone by moving it into sock.c
- * Alan Cox : tcp_send_reset() fixed to work for
- @@ -102,12 +102,12 @@
- * Alan Cox : BSD accept semantics.
- * Alan Cox : Reset on closedown bug.
- * Peter De Schrijver : ENOTCONN check missing in tcp_sendto().
- - * Michael Pall : Handle select() after URG properly in
- + * Michael Pall : Handle poll() after URG properly in
- * all cases.
- * Michael Pall : Undo the last fix in tcp_read_urg()
- * (multi URG PUSH broke rlogin).
- * Michael Pall : Fix the multi URG PUSH problem in
- - * tcp_readable(), select() after URG
- + * tcp_readable(), poll() after URG
- * works now.
- * Michael Pall : recv(...,MSG_OOB) never blocks in the
- * BSD api.
- @@ -128,7 +128,7 @@
- * Alan Cox : Reset tracing code.
- * Alan Cox : Spurious resets on shutdown.
- * Alan Cox : Giant 15 minute/60 second timer error
- - * Alan Cox : Small whoops in selecting before an
- + * Alan Cox : Small whoops in polling before an
- * accept.
- * Alan Cox : Kept the state trace facility since
- * it's handy for debugging.
- @@ -162,7 +162,7 @@
- * generates them.
- * Alan Cox : Cache last socket.
- * Alan Cox : Per route irtt.
- - * Matt Day : Select() match BSD precisely on error
- + * Matt Day : poll()->select() match BSD precisely on error
- * Alan Cox : New buffers
- * Marc Tamsky : Various sk->prot->retransmits and
- * sk->retransmits misupdating fixed.
- @@ -419,6 +419,7 @@
- #include <linux/types.h>
- #include <linux/fcntl.h>
- +#include <linux/poll.h>
- #include <net/icmp.h>
- #include <net/tcp.h>
- @@ -573,9 +574,9 @@ static int tcp_readable(struct sock *sk)
- * though there was normal data available. If we subtract
- * the urg data right here, we even get it to work for more
- * than one URG PUSH skb without normal data.
- - * This means that select() finally works now with urg data
- + * This means that poll() finally works now with urg data
- * in the queue. Note that rlogin was never affected
- - * because it doesn't use select(); it uses two processes
- + * because it doesn't use poll(); it uses two processes
- * and a blocking read(). And the queue scan in tcp_read()
- * was correct. Mike <pall@rz.uni-karlsruhe.de>
- */
- @@ -597,81 +598,60 @@ static int tcp_readable(struct sock *sk)
- }
- /*
- - * LISTEN is a special case for select..
- + * LISTEN is a special case for poll..
- */
- -static int tcp_listen_select(struct sock *sk, int sel_type, select_table *wait)
- +static unsigned int tcp_listen_poll(struct sock *sk, poll_table *wait)
- {
- - if (sel_type == SEL_IN) {
- - struct open_request *req;
- + struct open_request *req;
- - lock_sock(sk);
- - req = tcp_find_established(&sk->tp_pinfo.af_tcp);
- - release_sock(sk);
- - if (req)
- - return 1;
- - select_wait(sk->sleep,wait);
- - return 0;
- - }
- + lock_sock(sk);
- + req = tcp_find_established(&sk->tp_pinfo.af_tcp);
- + release_sock(sk);
- + if (req)
- + return POLLIN | POLLRDNORM;
- return 0;
- }
- /*
- * Wait for a TCP event.
- *
- - * Note that we don't need to lock the socket, as the upper select layers
- + * Note that we don't need to lock the socket, as the upper poll layers
- * take care of normal races (between the test and the event) and we don't
- * go look at any of the socket buffers directly.
- */
- -int tcp_select(struct socket *sock, int sel_type, select_table *wait)
- +unsigned int tcp_poll(struct socket *sock, poll_table *wait)
- {
- + unsigned int mask;
- struct sock *sk = sock->sk;
- struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
- + poll_wait(sk->sleep, wait);
- if (sk->state == TCP_LISTEN)
- - return tcp_listen_select(sk, sel_type, wait);
- + return tcp_listen_poll(sk, wait);
- - switch(sel_type) {
- - case SEL_IN:
- - if (sk->err)
- - return 1;
- - if (sk->state == TCP_SYN_SENT || sk->state == TCP_SYN_RECV)
- - break;
- + mask = 0;
- + if (sk->err)
- + mask = POLLERR;
- + /* connected ? */
- + if (sk->state != TCP_SYN_SENT && sk->state != TCP_SYN_RECV) {
- if (sk->shutdown & RCV_SHUTDOWN)
- - return 1;
- + mask |= POLLHUP;
- - if (tp->rcv_nxt == sk->copied_seq)
- - break;
- -
- - if (sk->urg_seq != sk->copied_seq ||
- - tp->rcv_nxt != sk->copied_seq+1 ||
- - sk->urginline || !sk->urg_data)
- - return 1;
- - break;
- -
- - case SEL_OUT:
- - if (sk->err)
- - return 1;
- - if (sk->shutdown & SEND_SHUTDOWN)
- - return 0;
- - if (sk->state == TCP_SYN_SENT || sk->state == TCP_SYN_RECV)
- - break;
- - /*
- - * This is now right thanks to a small fix
- - * by Matt Dillon.
- - */
- + if ((tp->rcv_nxt != sk->copied_seq) &&
- + (sk->urg_seq != sk->copied_seq ||
- + tp->rcv_nxt != sk->copied_seq+1 ||
- + sk->urginline || !sk->urg_data))
- + mask |= POLLIN | POLLRDNORM;
- - if (sock_wspace(sk) < sk->mtu+128+sk->prot->max_header)
- - break;
- - return 1;
- + if (!(sk->shutdown & SEND_SHUTDOWN) &&
- + (sock_wspace(sk) >= sk->mtu+128+sk->prot->max_header))
- + mask |= POLLOUT | POLLWRNORM;
- - case SEL_EX:
- if (sk->urg_data)
- - return 1;
- - break;
- + mask |= POLLPRI;
- }
- - select_wait(sk->sleep, wait);
- - return 0;
- + return mask;
- }
- int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg)
- diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
- index 9e5a87e..d63f3d5 100644
- --- a/net/ipv4/tcp_ipv4.c
- +++ b/net/ipv4/tcp_ipv4.c
- @@ -1212,7 +1212,7 @@ struct proto tcp_prot = {
- NULL,
- tcp_write_wakeup,
- tcp_read_wakeup,
- - tcp_select,
- + tcp_poll,
- tcp_ioctl,
- tcp_v4_init_sock,
- tcp_v4_destroy_sock,
- diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
- index 705c9df..cc124d3 100644
- --- a/net/ipv4/udp.c
- +++ b/net/ipv4/udp.c
- @@ -851,7 +851,7 @@ struct proto udp_prot = {
- NULL,
- NULL,
- NULL,
- - datagram_select,
- + datagram_poll,
- udp_ioctl,
- NULL,
- NULL,
- diff --git a/net/netlink.c b/net/netlink.c
- index 32421a4..daf35f3b 100644
- --- a/net/netlink.c
- +++ b/net/netlink.c
- @@ -26,6 +26,7 @@
- #include <net/netlink.h>
- +#include <asm/poll.h>
- #include <asm/io.h>
- #include <asm/uaccess.h>
- #include <asm/system.h>
- @@ -63,19 +64,16 @@ int netlink_donothing(int minor, struct sk_buff *skb)
- return -EINVAL;
- }
- -static int netlink_select(struct inode *inode, struct file *file, int sel_type, select_table * wait)
- +static unsigned int netlink_poll(struct file *file, poll_table * wait)
- {
- - unsigned int minor = MINOR(inode->i_rdev);
- - switch (sel_type) {
- - case SEL_IN:
- - if (skb_peek(&skb_queue_rd[minor])!=NULL)
- - return 1;
- - select_wait(&read_space_wait[minor], wait);
- - break;
- - case SEL_OUT:
- - return 1;
- - }
- - return 0;
- + unsigned int mask;
- + unsigned int minor = MINOR(file->f_inode->i_rdev);
- +
- + poll_wait(&read_space_wait[minor], wait);
- + mask = POLLOUT | POLLWRNORM;
- + if (skb_peek(&skb_queue_rd[minor]))
- + mask |= POLLIN | POLLRDNORM;
- + return mask;
- }
- /*
- @@ -183,7 +181,7 @@ static struct file_operations netlink_fops = {
- netlink_read,
- netlink_write,
- NULL, /* netlink_readdir */
- - netlink_select,
- + netlink_poll,
- netlink_ioctl,
- NULL, /* netlink_mmap */
- netlink_open,
- diff --git a/net/netsyms.c b/net/netsyms.c
- index 09bd3a9..822ff0e 100644
- --- a/net/netsyms.c
- +++ b/net/netsyms.c
- @@ -99,7 +99,7 @@ EXPORT_SYMBOL(skb_free_datagram);
- EXPORT_SYMBOL(skb_copy_datagram);
- EXPORT_SYMBOL(skb_copy_datagram_iovec);
- EXPORT_SYMBOL(skb_realloc_headroom);
- -EXPORT_SYMBOL(datagram_select);
- +EXPORT_SYMBOL(datagram_poll);
- /* Needed by smbfs.o */
- EXPORT_SYMBOL(__scm_destroy);
- @@ -144,7 +144,7 @@ EXPORT_SYMBOL(inet_release);
- EXPORT_SYMBOL(inet_stream_connect);
- EXPORT_SYMBOL(inet_dgram_connect);
- EXPORT_SYMBOL(inet_accept);
- -EXPORT_SYMBOL(inet_select);
- +EXPORT_SYMBOL(inet_poll);
- EXPORT_SYMBOL(inet_listen);
- EXPORT_SYMBOL(inet_shutdown);
- EXPORT_SYMBOL(inet_setsockopt);
- @@ -174,7 +174,7 @@ EXPORT_SYMBOL(tcp_close);
- EXPORT_SYMBOL(tcp_accept);
- EXPORT_SYMBOL(tcp_write_wakeup);
- EXPORT_SYMBOL(tcp_read_wakeup);
- -EXPORT_SYMBOL(tcp_select);
- +EXPORT_SYMBOL(tcp_poll);
- EXPORT_SYMBOL(tcp_ioctl);
- EXPORT_SYMBOL(tcp_shutdown);
- EXPORT_SYMBOL(tcp_setsockopt);
- diff --git a/net/socket.c b/net/socket.c
- index bb2ca90..42b202b 100644
- --- a/net/socket.c
- +++ b/net/socket.c
- @@ -101,7 +101,7 @@ static long sock_write(struct inode *inode, struct file *file,
- const char *buf, unsigned long size);
- static void sock_close(struct inode *inode, struct file *file);
- -static int sock_select(struct inode *inode, struct file *file, int which, select_table *seltable);
- +static unsigned int sock_poll(struct file *file, poll_table *wait);
- static int sock_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg);
- static int sock_fasync(struct inode *inode, struct file *filp, int on);
- @@ -117,7 +117,7 @@ static struct file_operations socket_file_ops = {
- sock_read,
- sock_write,
- NULL, /* readdir */
- - sock_select,
- + sock_poll,
- sock_ioctl,
- NULL, /* mmap */
- NULL, /* no special open code... */
- @@ -444,19 +444,19 @@ int sock_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
- }
- -static int sock_select(struct inode *inode, struct file *file, int sel_type, select_table * wait)
- +static unsigned int sock_poll(struct file *file, poll_table * wait)
- {
- struct socket *sock;
- - sock = socki_lookup(inode);
- + sock = socki_lookup(file->f_inode);
- /*
- - * We can't return errors to select, so it's either yes or no.
- + * We can't return errors to poll, so it's either yes or no.
- */
- - if (sock->ops->select)
- - return sock->ops->select(sock, sel_type, wait);
- - return(0);
- + if (sock->ops->poll)
- + return sock->ops->poll(sock, wait);
- + return 0;
- }
- @@ -1249,7 +1249,7 @@ int sock_fcntl(struct file *filp, unsigned int cmd, unsigned long arg)
- /*
- * System call vectors. Since I (RIB) want to rewrite sockets as streams,
- * we have this level of indirection. Not a lot of overhead, since more of
- - * the work is done via read/write/select directly.
- + * the work is done via read/write/poll directly.
- *
- * I'm now expanding this up to a higher level to separate the assorted
- * kernel/user space manipulations and global assumptions from the protocol
- diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
- index 9490c29..c3bd7ff 100644
- --- a/net/unix/af_unix.c
- +++ b/net/unix/af_unix.c
- @@ -1429,7 +1429,7 @@ struct proto_ops unix_stream_ops = {
- unix_socketpair,
- unix_accept,
- unix_getname,
- - datagram_select,
- + datagram_poll,
- unix_ioctl,
- unix_listen,
- unix_shutdown,
- @@ -1450,7 +1450,7 @@ struct proto_ops unix_dgram_ops = {
- unix_socketpair,
- NULL,
- unix_getname,
- - datagram_select,
- + datagram_poll,
- unix_ioctl,
- NULL,
- unix_shutdown,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement