Commit 121c2c4c authored by Linus Torvalds's avatar Linus Torvalds

Import 2.1.3

parent 56307bd2
......@@ -285,6 +285,7 @@ S: United Kingdom
N: Ray Dassen
E: jdassen@wi.LeidenUniv.nl
W: http://www.wi.leidenuniv.nl/~jdassen/
P: 1024/672D05C1 DD 60 32 60 F7 90 64 80 E7 6F D4 E4 F8 C9 4A 58
D: Debian GNU/Linux: www.debian.org maintainer, FAQ co-maintainer,
D: packages testing, nit-picking & fixing. Enjoying BugFree (TM) kernels.
S: Zuidsingel 10A
......
VERSION = 2
PATCHLEVEL = 1
SUBLEVEL = 2
SUBLEVEL = 3
ARCH = i386
......
......@@ -54,10 +54,12 @@ static struct symbol_table arch_symbol_table = {
X(__remlu),
X(__divqu),
X(__remqu),
X(insl),
X(insb),
X(insw),
X(outsl),
X(insl),
X(outsb),
X(outsw),
X(outsl),
X(strcat),
X(strcmp),
X(strcpy),
......
......@@ -429,7 +429,7 @@ void lca_machine_check (unsigned long vector, unsigned long la, struct pt_regs *
switch (el.c->size) {
case sizeof(struct el_lca_mcheck_short):
printk(KERN_CRIT
" Reason: %s (short frame%s, dc_stat=%lx):\pn",
" Reason: %s (short frame%s, dc_stat=%lx):\n",
reason, el.c->retry ? ", retryable" : "", el.s->dc_stat);
if (el.s->esr & ESR_EAV) {
mem_error(el.s->esr, el.s->ear);
......
......@@ -18,7 +18,6 @@
#include <linux/unistd.h>
#include <linux/ptrace.h>
#include <linux/malloc.h>
#include <linux/ldt.h>
#include <linux/user.h>
#include <linux/a.out.h>
#include <linux/utsname.h>
......
......@@ -17,7 +17,6 @@
#include <linux/unistd.h>
#include <linux/ptrace.h>
#include <linux/malloc.h>
#include <linux/ldt.h>
#include <linux/user.h>
#include <linux/a.out.h>
#include <linux/utsname.h>
......
......@@ -16,7 +16,6 @@
#include <linux/unistd.h>
#include <linux/ptrace.h>
#include <linux/malloc.h>
#include <linux/ldt.h>
#include <linux/user.h>
#include <linux/a.out.h>
#include <linux/tty.h>
......
......@@ -4,6 +4,7 @@
#include <linux/elfcore.h>
#include <asm/semaphore.h>
#include <asm/processor.h>
#include <asm/io.h>
extern void dump_thread(struct pt_regs *, struct user *);
......@@ -12,6 +13,8 @@ extern int dump_fpu(elf_fpregset_t *);
static struct symbol_table arch_symbol_table = {
#include <linux/symtab_begin.h>
/* platform dependent support */
X(EISA_bus),
X(wp_works_ok),
X(dump_thread),
X(dump_fpu),
X(ioremap),
......
......@@ -292,7 +292,7 @@ static struct {
0x242 in div_Xsig.S
*/
void exception(int n)
void FPU_exception(int n)
{
int i, int_type;
......@@ -482,7 +482,7 @@ int set_precision_flag(int flags)
}
else
{
exception(flags);
EXCEPTION(flags);
return 1;
}
}
......@@ -494,7 +494,7 @@ asmlinkage void set_precision_flag_up(void)
if ( control_word & CW_Precision )
partial_status |= (SW_Precision | SW_C1); /* The masked response */
else
exception(EX_Precision | SW_C1);
EXCEPTION(EX_Precision | SW_C1);
}
......@@ -508,7 +508,7 @@ asmlinkage void set_precision_flag_down(void)
partial_status |= SW_Precision;
}
else
exception(EX_Precision);
EXCEPTION(EX_Precision);
}
......@@ -521,7 +521,7 @@ asmlinkage int denormal_operand(void)
}
else
{
exception(EX_Denormal);
EXCEPTION(EX_Denormal);
return 1;
}
}
......
......@@ -43,9 +43,9 @@
#ifdef DEBUG
#define EXCEPTION(x) { printk("exception in %s at line %d\n", \
__FILE__, __LINE__); exception(x); }
__FILE__, __LINE__); FPU_exception(x); }
#else
#define EXCEPTION(x) exception(x)
#define EXCEPTION(x) FPU_exception(x)
#endif
#endif __ASSEMBLY__
......
......@@ -12,7 +12,7 @@
#include <linux/linkage.h>
#define EXCEPTION SYMBOL_NAME(exception)
#define EXCEPTION SYMBOL_NAME(FPU_exception)
#define PARAM1 8(%ebp)
......
......@@ -7,7 +7,7 @@ extern void stack_underflow(void);
extern void stack_underflow_i(int i);
extern void stack_underflow_pop(int i);
extern int set_precision_flag(int flags);
asmlinkage void exception(int n);
asmlinkage void FPU_exception(int n);
asmlinkage int real_2op_NaN(FPU_REG const *a, FPU_REG const *b, FPU_REG *dest);
asmlinkage int arith_invalid(FPU_REG *dest);
asmlinkage int divide_by_zero(int sign, FPU_REG *dest);
......
......@@ -30,7 +30,7 @@ ENTRY(normalize)
je L_ok
pushl $0x220
call SYMBOL_NAME(exception)
call SYMBOL_NAME(FPU_exception)
addl $4,%esp
L_ok:
......@@ -107,7 +107,7 @@ ENTRY(normalize_nuo)
je L_ok_nuo
pushl $0x221
call SYMBOL_NAME(exception)
call SYMBOL_NAME(FPU_exception)
addl $4,%esp
L_ok_nuo:
......
......@@ -596,7 +596,7 @@ LNormalise_shift_done:
/* There must be a masked underflow */
push %eax
pushl EX_Underflow
call SYMBOL_NAME(exception)
call SYMBOL_NAME(FPU_exception)
popl %eax
popl %eax
jmp xL_Normalised
......@@ -613,7 +613,7 @@ L_underflow_to_zero:
push %eax
pushl EX_Underflow
call SYMBOL_NAME(exception)
call SYMBOL_NAME(FPU_exception)
popl %eax
popl %eax
......
......@@ -21,6 +21,57 @@
extern void die_if_kernel(const char *,struct pt_regs *,long);
/*
* Ugly, ugly, but the goto's result in better assembly..
*/
int __verify_write(const void * addr, unsigned long size)
{
struct vm_area_struct * vma;
unsigned long start = (unsigned long) addr;
if (!size)
return 0;
vma = find_vma(current->mm, start);
if (!vma)
goto bad_area;
if (vma->vm_start > start)
goto check_stack;
good_area:
if (!(vma->vm_flags & VM_WRITE))
goto bad_area;
size--;
size += start & ~PAGE_MASK;
size >>= PAGE_SHIFT;
start &= PAGE_MASK;
for (;;) {
do_wp_page(current, vma, start, 1);
if (!size)
break;
size--;
start += PAGE_SIZE;
if (start < vma->vm_end)
continue;
vma = vma->vm_next;
if (!vma || vma->vm_start != start)
goto bad_area;
if (!(vma->vm_flags & VM_WRITE))
goto bad_area;;
}
return 0;
check_stack:
if (!(vma->vm_flags & VM_GROWSDOWN))
goto bad_area;
if (expand_stack(vma, start) == 0)
goto good_area;
bad_area:
return -EFAULT;
}
/*
* This routine handles page faults. It determines the address,
* and the problem, and then passes it off to one of the appropriate
......
......@@ -439,6 +439,10 @@ static struct symbol_table md_symbol_table=
#include <linux/symtab_end.h>
};
static struct proc_dir_entry proc_md = {
PROC_MD, 6, "mdstat",
S_IFREG | S_IRUGO, 1, 0, 0,
};
static void md_geninit (struct gendisk *gdisk)
{
......@@ -455,12 +459,7 @@ static void md_geninit (struct gendisk *gdisk)
blksize_size[MAJOR_NR] = md_blocksizes;
register_symtab (&md_symbol_table);
proc_register(&proc_root,
&(struct proc_dir_entry)
{
PROC_MD, 6, "mdstat",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &proc_md);
}
......
......@@ -184,16 +184,18 @@ static struct symbol_table misc_syms = {
#include <linux/symtab_end.h>
};
static struct proc_dir_entry proc_misc = {
0, 4, "misc",
S_IFREG | S_IRUGO, 1, 0, 0,
0, NULL /* ops -- default to array */,
&proc_misc_read /* get_info */,
};
int misc_init(void)
{
#ifndef MODULE
#ifdef CONFIG_PROC_FS
proc_register_dynamic(&proc_root, &(struct proc_dir_entry) {
0, 4, "misc",
S_IFREG | S_IRUGO, 1, 0, 0,
0, NULL /* ops -- default to array */,
&proc_misc_read /* get_info */,
});
proc_register_dynamic(&proc_root, &proc_misc);
#endif /* PROC_FS */
#ifdef CONFIG_BUSMOUSE
bus_mouse_init();
......
......@@ -471,12 +471,12 @@ static void ifc_init(void)
} /* ifc_init */
static void report_exception(unsigned n)
static void report_qic_exception(unsigned n)
{
if (n >= NR_OF_EXC) { tpqputs(TPQD_ALWAYS, "Oops -- report_exception"); n = 0; }
if (n >= NR_OF_EXC) { tpqputs(TPQD_ALWAYS, "Oops -- report_qic_exception"); n = 0; }
if (TPQDBG(SENSE_TEXT) || n==0)
printk(TPQIC02_NAME ": sense: %s\n", exception_list[n].msg);
} /* report_exception */
} /* report_qic_exception */
/* Try to map the drive-exception bits `s' to a predefined "exception number",
......@@ -484,7 +484,7 @@ static void report_exception(unsigned n)
* exception table (`exception_list[]').
* It is assumed that s!=0.
*/
static int decode_exception_nr(unsigned s)
static int decode_qic_exception_nr(unsigned s)
{
int i;
......@@ -492,9 +492,9 @@ static int decode_exception_nr(unsigned s)
if ((s & exception_list[i].mask)==exception_list[i].code)
return i;
}
printk(TPQIC02_NAME ": decode_exception_nr: exception(%x) not recognized\n", s);
printk(TPQIC02_NAME ": decode_qic_exception_nr: exception(%x) not recognized\n", s);
return 0;
} /* decode_exception_nr */
} /* decode_qic_exception_nr */
#ifdef OBSOLETE
......@@ -576,7 +576,7 @@ static void report_error(int s)
/* Perform appropriate action for certain exceptions.
* should return a value to indicate stop/continue (in case of bad blocks)
*/
static void handle_exception(int exnr, int exbits)
static void handle_qic_exception(int exnr, int exbits)
{
if (exnr==EXC_NCART) {
/* Cartridge was changed. Redo sense().
......@@ -600,7 +600,7 @@ static void handle_exception(int exnr, int exbits)
doing_read = NO;
} else if (exnr==EXC_FM)
doing_read = NO;
} /* handle_exception */
} /* handle_qic_exception */
static inline int is_exception(void)
......@@ -1035,9 +1035,9 @@ static int tp_sense(int ignore)
if (err & (TP_ST0|TP_ST1)) {
/* My Wangtek occasionally reports `status' 1212 which should be ignored. */
exnr = decode_exception_nr(err);
handle_exception(exnr, err); /* update driver state wrt drive status */
report_exception(exnr);
exnr = decode_qic_exception_nr(err);
handle_qic_exception(exnr, err); /* update driver state wrt drive status */
report_qic_exception(exnr);
}
err &= ~ignore; /* mask unwanted errors -- not the correct way, use exception nrs?? */
if (((err & TP_ST0) && (err & REPORT_ERR0)) ||
......
......@@ -82,10 +82,8 @@ if [ "$CONFIG_NET_ETHERNET" = "y" ]; then
tristate 'ICL EtherTeam 16i/32 support' CONFIG_ETH16I
fi
tristate 'NE2000/NE1000 support' CONFIG_NE2000
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
tristate 'NI5210 support' CONFIG_NI52
bool 'NI6510 support' CONFIG_NI65
fi
tristate 'NI5210 support' CONFIG_NI52
tristate 'NI6510 support' CONFIG_NI65
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
bool 'SEEQ8005 support (EXPERIMENTAL)' CONFIG_SEEQ8005
fi
......
......@@ -360,6 +360,10 @@ endif
ifeq ($(CONFIG_NI65),y)
L_OBJS += ni65.o
else
ifeq ($(CONFIG_NI65),m)
M_OBJS += ni65.o
endif
endif
ifeq ($(CONFIG_ELPLUS),y)
......
......@@ -195,6 +195,9 @@ ethif_probe(struct device *dev)
#ifdef CONFIG_NI52
&& ni52_probe(dev)
#endif
#ifdef CONFIG_NI65
&& ni65_probe(dev)
#endif
#ifdef CONFIG_ATARILANCE /* Lance-based Atari ethernet boards */
&& atarilance_probe(dev)
#endif
......
......@@ -4,13 +4,15 @@
* This is an extension to the Linux operating system, and is covered by the
* same Gnu Public License that covers that work.
*
* Alphacode 0.80 (96/02/19) for Linux 1.3.66 (or later)
* Alphacode 0.82 (96/09/29) for Linux 2.0.0 (or later)
* Copyrights (c) 1994,1995,1996 by M.Hipp (Michael.Hipp@student.uni-tuebingen.de)
* [feel free to mail ....]
*
* when using as module: (no autoprobing!)
* compile with: gcc -D__KERNEL__ -DMODULE -O2 -c ni52.c
* run with e.g: insmod ni52.o io=0x360 irq=9 memstart=0xd0000 memend=0xd4000
* compile with:
* gcc -O2 -fomit-frame-pointer -m486 -D__KERNEL__ -DMODULE -c ni52.c
* run with e.g:
* insmod ni52.o io=0x360 irq=9 memstart=0xd0000 memend=0xd4000
*
* CAN YOU PLEASE REPORT ME YOUR PERFORMANCE EXPERIENCES !!.
*
......@@ -62,6 +64,7 @@
*/
/*
* 29.Sept.96: virt_to_bus changes for new memory scheme
* 19.Feb.96: more Mcast changes, module support (MH)
*
* 18.Nov.95: Mcast changes (AC).
......@@ -129,8 +132,8 @@ static int fifo=0x8; /* don't change */
#define ni_enaint() {outb(0,dev->base_addr+NI52_INTENA);}
#define make32(ptr16) (p->memtop + (short) (ptr16) )
#define make24(ptr32) ((char *) (ptr32) - p->base)
#define make16(ptr32) ((unsigned short) ((unsigned long) (ptr32) - (unsigned long) p->memtop ))
#define make24(ptr32) ( ((char *) (ptr32)) - p->base)
#define make16(ptr32) ((unsigned short) ((unsigned long)(ptr32) - (unsigned long) p->memtop ))
/******************* how to calculate the buffers *****************************
......@@ -285,8 +288,8 @@ static int check586(struct device *dev,char *where,unsigned size)
char *iscp_addrs[2];
int i;
p->base = (unsigned long) where + size - 0x01000000;
p->memtop = where + size;
p->base = (unsigned long) bus_to_virt((unsigned long)where) + size - 0x01000000;
p->memtop = bus_to_virt((unsigned long)where) + size;
p->scp = (struct scp_struct *)(p->base + SCP_DEFAULT_ADDRESS);
memset((char *)p->scp,0, sizeof(struct scp_struct));
for(i=0;i<sizeof(struct scp_struct);i++) /* memory was writeable? */
......@@ -296,7 +299,7 @@ static int check586(struct device *dev,char *where,unsigned size)
if(p->scp->sysbus != SYSBUSVAL)
return 0;
iscp_addrs[0] = where;
iscp_addrs[0] = bus_to_virt((unsigned long)where);
iscp_addrs[1]= (char *) p->scp - sizeof(struct iscp_struct);
for(i=0;i<2;i++)
......@@ -328,7 +331,7 @@ void alloc586(struct device *dev)
DELAY(1);
p->scp = (struct scp_struct *) (p->base + SCP_DEFAULT_ADDRESS);
p->scb = (struct scb_struct *) (dev->mem_start);
p->scb = (struct scb_struct *) bus_to_virt(dev->mem_start);
p->iscp = (struct iscp_struct *) ((char *)p->scp - sizeof(struct iscp_struct));
memset((char *) p->iscp,0,sizeof(struct iscp_struct));
......@@ -479,8 +482,8 @@ static int ni52_probe1(struct device *dev,int ioaddr)
/* warning: we don't free it on errors */
memset((char *) dev->priv,0,sizeof(struct priv));
((struct priv *) (dev->priv))->memtop = (char *) dev->mem_start + size;
((struct priv *) (dev->priv))->base = dev->mem_start + size - 0x01000000;
((struct priv *) (dev->priv))->memtop = bus_to_virt(dev->mem_start) + size;
((struct priv *) (dev->priv))->base = (unsigned long) bus_to_virt(dev->mem_start) + size - 0x01000000;
alloc586(dev);
/* set number of receive-buffs according to memsize */
......
This diff is collapsed.
......@@ -92,23 +92,23 @@ struct init_block
unsigned char eaddr[6];
unsigned char filter[8];
/* bit 29-31: number of rmd's (power of 2) */
unsigned long rrp; /* receive ring pointer (align 8) */
u32 rrp; /* receive ring pointer (align 8) */
/* bit 29-31: number of tmd's (power of 2) */
unsigned long trp; /* transmit ring pointer (align 8) */
u32 trp; /* transmit ring pointer (align 8) */
};
struct rmd /* Receive Message Descriptor */
{
union
{
volatile unsigned long buffer;
volatile u32 buffer;
struct
{
volatile unsigned char dummy[3];
volatile unsigned char status;
} s;
} u;
short blen;
volatile short blen;
volatile unsigned short mlen;
};
......@@ -116,14 +116,14 @@ struct tmd
{
union
{
volatile unsigned long buffer;
volatile u32 buffer;
struct
{
volatile unsigned char dummy[3];
volatile unsigned char status;
} s;
} u;
unsigned short blen;
volatile unsigned short blen;
volatile unsigned short status2;
};
......
......@@ -3080,6 +3080,14 @@ ppp_dev_xmit (sk_buff *skb, struct device *dev)
*/
len = skb->len;
data = skb_data(skb);
/*
* Bug trap for null data. Release the skb and bail out.
*/
if(data == NULL) {
printk("ppp_dev_xmit: data=NULL before ppp_dev_xmit_ip.\n");
dev_kfree_skb (skb, FREE_WRITE);
return 0;
}
/*
* Look at the protocol in the skb to determine the difference between
* an IP frame and an IPX frame.
......
......@@ -1096,7 +1096,7 @@ static void set_multicast_list(struct device *dev)
/* Log any net taps. */
printk("%s: Promiscuous mode enabled.\n", dev->name);
}
else if (dev->mc_count > 15 || (dev->flags&IFF_ALLMULTI))
else if (dev->mc_count > 14 || (dev->flags&IFF_ALLMULTI))
{
/* Too many to filter perfectly -- accept all multicasts. */
tio_write(csr6 | TCMOD_ALLMCAST, CSR6);
......@@ -1109,7 +1109,7 @@ static void set_multicast_list(struct device *dev)
unsigned short *eaddrs;
int i;
/* We have <= 15 addresses that we can use the wonderful
/* We have < 15 addresses that we can use the wonderful
16 address perfect filtering of the Tulip. Note that only
the low shortword of setup_frame[] is valid. */
tio_write(csr6 | 0x0000, CSR6);
......@@ -1122,11 +1122,15 @@ static void set_multicast_list(struct device *dev)
}
/* Fill the rest of the table with our physical address. */
eaddrs = (unsigned short *)dev->dev_addr;
/* Always accept broadcast packets */
*setup_frm++ = 0xffff;
*setup_frm++ = 0xffff;
*setup_frm++ = 0xffff;
do {
*setup_frm++ = eaddrs[0];
*setup_frm++ = eaddrs[1];
*setup_frm++ = eaddrs[2];
} while (++i < 16);
} while (++i < 15);
/* Now add this frame to the Tx list. */
}
......
......@@ -156,77 +156,66 @@ void __wait_on_buffer(struct buffer_head * bh)
static int sync_buffers(kdev_t dev, int wait)
{
int i, retry, pass = 0, err = 0;
int nlist, ncount;
struct buffer_head * bh, *next;
/* One pass for no-wait, three for wait:
0) write out all dirty, unlocked buffers;
1) write out all dirty buffers, waiting if locked;
2) wait for completion by waiting for all buffers to unlock. */
repeat:
retry = 0;
repeat2:
ncount = 0;
do {
retry = 0;
repeat:
/* We search all lists as a failsafe mechanism, not because we expect
there to be dirty buffers on any of the other lists. */
for(nlist = 0; nlist < NR_LIST; nlist++)
{
repeat1:
bh = lru_list[nlist];
if(!bh) continue;
for (i = nr_buffers_type[nlist]*2 ; i-- > 0 ; bh = next) {
if(bh->b_list != nlist) goto repeat1;
next = bh->b_next_free;
if(!lru_list[nlist]) break;
if (dev && bh->b_dev != dev)
continue;
if (buffer_locked(bh))
{
/* Buffer is locked; skip it unless wait is
requested AND pass > 0. */
if (!wait || !pass) {
retry = 1;
continue;
}
wait_on_buffer (bh);
goto repeat2;
}
/* If an unlocked buffer is not uptodate, there has
been an IO error. Skip it. */
if (wait && buffer_req(bh) && !buffer_locked(bh) &&
!buffer_dirty(bh) && !buffer_uptodate(bh)) {
err = 1;
continue;
}
/* Don't write clean buffers. Don't write ANY buffers
on the third pass. */
if (!buffer_dirty(bh) || pass>=2)
continue;
/* don't bother about locked buffers */
if (buffer_locked(bh))
continue;
bh->b_count++;
bh->b_flushtime = 0;
ll_rw_block(WRITE, 1, &bh);
if(nlist != BUF_DIRTY) {
printk("[%d %s %ld] ", nlist,
kdevname(bh->b_dev), bh->b_blocknr);
ncount++;
}
bh->b_count--;
retry = 1;
}
}
if (ncount)
printk("sys_sync: %d dirty buffers not on dirty list\n", ncount);
bh = lru_list[BUF_DIRTY];
if (!bh)
break;
for (i = nr_buffers_type[BUF_DIRTY]*2 ; i-- > 0 ; bh = next) {
if (bh->b_list != BUF_DIRTY)
goto repeat;
next = bh->b_next_free;
if (!lru_list[BUF_DIRTY])
break;
if (dev && bh->b_dev != dev)
continue;
if (buffer_locked(bh)) {
/* Buffer is locked; skip it unless wait is
requested AND pass > 0. */
if (!wait || !pass) {
retry = 1;
continue;
}
wait_on_buffer (bh);
goto repeat;
}
/* If an unlocked buffer is not uptodate, there has
been an IO error. Skip it. */
if (wait && buffer_req(bh) && !buffer_locked(bh) &&
!buffer_dirty(bh) && !buffer_uptodate(bh)) {
err = 1;
continue;
}
/* Don't write clean buffers. Don't write ANY buffers
on the third pass. */
if (!buffer_dirty(bh) || pass >= 2)
continue;
/* don't bother about locked buffers */
if (buffer_locked(bh))
continue;
bh->b_count++;
next->b_count++;
bh->b_flushtime = 0;
ll_rw_block(WRITE, 1, &bh);
bh->b_count--;
next->b_count--;
retry = 1;
}
/* If we are waiting for the sync to succeed, and if any dirty
blocks were written, then repeat; on the second pass, only
wait for buffers being written (do not pass to write any
more buffers on the second pass). */
if (wait && retry && ++pass<=2)
goto repeat;
} while (wait && retry && ++pass<=2);
return err;
}
......
......@@ -20,30 +20,6 @@
#define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE])
/*
* How long a filename can we get from user space?
* -EFAULT if invalid area
* 0 if ok (ENAMETOOLONG before EFAULT)
* >0 EFAULT after xx bytes
*/
static inline int get_max_filename(unsigned long address)
{
struct vm_area_struct * vma;
if (get_fs() == KERNEL_DS)
return 0;
vma = find_vma(current->mm, address);
if (!vma || vma->vm_start > address || !(vma->vm_flags & VM_READ))
return -EFAULT;
address = vma->vm_end - address;
if (address > PAGE_SIZE)
return 0;
if (vma->vm_next && vma->vm_next->vm_start == vma->vm_end &&
(vma->vm_next->vm_flags & VM_READ))
return 0;
return address;
}
/*
* In order to reduce some races, while at the same time doing additional
* checking and hopefully speeding things up, we copy filenames to the
......@@ -51,38 +27,60 @@ static inline int get_max_filename(unsigned long address)
*
* POSIX.1 2.4: an empty pathname is invalid (ENOENT).
*/
int getname(const char * filename, char **result)
static inline int do_getname(const char * filename, char *buf)
{
int i, error;
unsigned long page;
char * tmp, c;
i = get_max_filename((unsigned long) filename);
if (i < 0)
return i;
error = -EFAULT;
if (!i) {
error = -ENAMETOOLONG;
i = PAGE_SIZE;
}
c = get_user(filename++);
int error, maxlen = PAGE_SIZE;
int c;
error = -ENAMETOOLONG;
if (get_fs() != KERNEL_DS) {
error = -EFAULT;
if (TASK_SIZE <= (unsigned long) filename)
return error;
maxlen = TASK_SIZE - (unsigned long) filename;
if (maxlen >= PAGE_SIZE) {
maxlen = PAGE_SIZE;
error = -ENAMETOOLONG;
}
}
c = (unsigned char) get_user(filename++);
if (!c)
return -ENOENT;
if(!(page = __get_free_page(GFP_KERNEL)))
return -ENOMEM;
*result = tmp = (char *) page;
while (--i) {
*(tmp++) = c;
while (--maxlen) {
*(buf++) = c;
c = get_user(filename++);
if (!c) {
*tmp = '\0';
*buf = '\0';
return 0;
}
}
free_page(page);
return error;
}
int getname(const char *filename, char **result)
{
int error;
unsigned long page = __get_free_page(GFP_KERNEL);
error = -ENOMEM;
if (page) {
error = -EFAULT;
if (!exception()) {
int retval = do_getname(filename, (char *) page);
end_exception();
if (!retval) {
*result = (char *) page;
return 0;
}
error = retval;
}
free_page(page);
}
return error;
}
void putname(char * name)
{
free_page((unsigned long) name);
......
......@@ -80,72 +80,83 @@ struct proc_dir_entry proc_pid = {
NULL, &proc_root, NULL
};
static struct proc_dir_entry proc_pid_status = {
PROC_PID_STATUS, 6, "status",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_array_inode_operations,
NULL, proc_pid_fill_inode,
};
static struct proc_dir_entry proc_pid_mem = {
PROC_PID_MEM, 3, "mem",
S_IFREG | S_IRUSR | S_IWUSR, 1, 0, 0,
0, &proc_mem_inode_operations,
NULL, proc_pid_fill_inode,
};
static struct proc_dir_entry proc_pid_cwd = {
PROC_PID_CWD, 3, "cwd",
S_IFLNK | S_IRWXU, 1, 0, 0,
0, &proc_link_inode_operations,
NULL, proc_pid_fill_inode,
};
static struct proc_dir_entry proc_pid_root = {
PROC_PID_ROOT, 4, "root",
S_IFLNK | S_IRWXU, 1, 0, 0,
0, &proc_link_inode_operations,
NULL, proc_pid_fill_inode,
};
static struct proc_dir_entry proc_pid_exe = {
PROC_PID_EXE, 3, "exe",
S_IFLNK | S_IRWXU, 1, 0, 0,
0, &proc_link_inode_operations,
NULL, proc_pid_fill_inode,
};
static struct proc_dir_entry proc_pid_fd = {
PROC_PID_FD, 2, "fd",
S_IFDIR | S_IRUSR | S_IXUSR, 1, 0, 0,
0, &proc_fd_inode_operations,
NULL, proc_pid_fill_inode,
};
static struct proc_dir_entry proc_pid_environ = {
PROC_PID_ENVIRON, 7, "environ",
S_IFREG | S_IRUSR, 1, 0, 0,
0, &proc_array_inode_operations,
NULL, proc_pid_fill_inode,
};
static struct proc_dir_entry proc_pid_cmdline = {
PROC_PID_CMDLINE, 7, "cmdline",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_array_inode_operations,
NULL, proc_pid_fill_inode,
};
static struct proc_dir_entry proc_pid_stat = {
PROC_PID_STAT, 4, "stat",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_array_inode_operations,
NULL, proc_pid_fill_inode,
};
static struct proc_dir_entry proc_pid_statm = {
PROC_PID_STATM, 5, "statm",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_array_inode_operations,
NULL, proc_pid_fill_inode,
};
static struct proc_dir_entry proc_pid_maps = {
PROC_PID_MAPS, 4, "maps",
S_IFIFO | S_IRUGO, 1, 0, 0,
0, &proc_arraylong_inode_operations,
NULL, proc_pid_fill_inode,
};
void proc_base_init(void)
{
proc_register(&proc_pid, &(struct proc_dir_entry) {
PROC_PID_STATUS, 6, "status",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_array_inode_operations,
NULL, proc_pid_fill_inode,
});
proc_register(&proc_pid, &(struct proc_dir_entry) {
PROC_PID_MEM, 3, "mem",
S_IFREG | S_IRUSR | S_IWUSR, 1, 0, 0,
0, &proc_mem_inode_operations,
NULL, proc_pid_fill_inode,
});
proc_register(&proc_pid, &(struct proc_dir_entry) {
PROC_PID_CWD, 3, "cwd",
S_IFLNK | S_IRWXU, 1, 0, 0,
0, &proc_link_inode_operations,
NULL, proc_pid_fill_inode,
});
proc_register(&proc_pid, &(struct proc_dir_entry) {
PROC_PID_ROOT, 4, "root",
S_IFLNK | S_IRWXU, 1, 0, 0,
0, &proc_link_inode_operations,
NULL, proc_pid_fill_inode,
});
proc_register(&proc_pid, &(struct proc_dir_entry) {
PROC_PID_EXE, 3, "exe",
S_IFLNK | S_IRWXU, 1, 0, 0,
0, &proc_link_inode_operations,
NULL, proc_pid_fill_inode,
});
proc_register(&proc_pid, &(struct proc_dir_entry) {
PROC_PID_FD, 2, "fd",
S_IFDIR | S_IRUSR | S_IXUSR, 1, 0, 0,
0, &proc_fd_inode_operations,
NULL, proc_pid_fill_inode,
});
proc_register(&proc_pid, &(struct proc_dir_entry) {
PROC_PID_ENVIRON, 7, "environ",
S_IFREG | S_IRUSR, 1, 0, 0,
0, &proc_array_inode_operations,
NULL, proc_pid_fill_inode,
});
proc_register(&proc_pid, &(struct proc_dir_entry) {
PROC_PID_CMDLINE, 7, "cmdline",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_array_inode_operations,
NULL, proc_pid_fill_inode,
});
proc_register(&proc_pid, &(struct proc_dir_entry) {
PROC_PID_STAT, 4, "stat",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_array_inode_operations,
NULL, proc_pid_fill_inode,
});
proc_register(&proc_pid, &(struct proc_dir_entry) {
PROC_PID_STATM, 5, "statm",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_array_inode_operations,
NULL, proc_pid_fill_inode,
});
proc_register(&proc_pid, &(struct proc_dir_entry) {
PROC_PID_MAPS, 4, "maps",
S_IFIFO | S_IRUGO, 1, 0, 0,
0, &proc_arraylong_inode_operations,
NULL, proc_pid_fill_inode,
});
proc_register(&proc_pid, &proc_pid_status);
proc_register(&proc_pid, &proc_pid_mem);
proc_register(&proc_pid, &proc_pid_cwd);
proc_register(&proc_pid, &proc_pid_root);
proc_register(&proc_pid, &proc_pid_exe);
proc_register(&proc_pid, &proc_pid_fd);
proc_register(&proc_pid, &proc_pid_environ);
proc_register(&proc_pid, &proc_pid_cmdline);
proc_register(&proc_pid, &proc_pid_stat);
proc_register(&proc_pid, &proc_pid_statm);
proc_register(&proc_pid, &proc_pid_maps);
};
......@@ -250,6 +250,114 @@ static struct inode_operations proc_self_inode_operations = {
NULL /* permission */
};
static struct proc_dir_entry proc_root_loadavg = {
PROC_LOADAVG, 7, "loadavg",
S_IFREG | S_IRUGO, 1, 0, 0,
};
static struct proc_dir_entry proc_root_uptime = {
PROC_UPTIME, 6, "uptime",
S_IFREG | S_IRUGO, 1, 0, 0,
};
static struct proc_dir_entry proc_root_meminfo = {
PROC_MEMINFO, 7, "meminfo",
S_IFREG | S_IRUGO, 1, 0, 0,
};
static struct proc_dir_entry proc_root_kmsg = {
PROC_KMSG, 4, "kmsg",
S_IFREG | S_IRUSR, 1, 0, 0,
};
static struct proc_dir_entry proc_root_version = {
PROC_VERSION, 7, "version",
S_IFREG | S_IRUGO, 1, 0, 0,
};
#ifdef CONFIG_PCI
static struct proc_dir_entry proc_root_pci = {
PROC_PCI, 3, "pci",
S_IFREG | S_IRUGO, 1, 0, 0,
};
#endif
static struct proc_dir_entry proc_root_cpuinfo = {
PROC_CPUINFO, 7, "cpuinfo",
S_IFREG | S_IRUGO, 1, 0, 0,
};
static struct proc_dir_entry proc_root_self = {
PROC_SELF, 4, "self",
S_IFLNK | S_IRUGO | S_IWUGO | S_IXUGO, 1, 0, 0,
64, &proc_self_inode_operations,
};
#ifdef CONFIG_DEBUG_MALLOC
static struct proc_dir_entry proc_root_malloc = {
PROC_MALLOC, 6, "malloc",
S_IFREG | S_IRUGO, 1, 0, 0,
};
#endif
static struct proc_dir_entry proc_root_kcore = {
PROC_KCORE, 5, "kcore",
S_IFREG | S_IRUSR, 1, 0, 0,
};
#ifdef CONFIG_MODULES
static struct proc_dir_entry proc_root_modules = {
PROC_MODULES, 7, "modules",
S_IFREG | S_IRUGO, 1, 0, 0,
};
static struct proc_dir_entry proc_root_ksyms = {
PROC_KSYMS, 5, "ksyms",
S_IFREG | S_IRUGO, 1, 0, 0,
};
#endif
static struct proc_dir_entry proc_root_stat = {
PROC_STAT, 4, "stat",
S_IFREG | S_IRUGO, 1, 0, 0,
};
static struct proc_dir_entry proc_root_devices = {
PROC_DEVICES, 7, "devices",
S_IFREG | S_IRUGO, 1, 0, 0,
};
static struct proc_dir_entry proc_root_interrupts = {
PROC_INTERRUPTS, 10,"interrupts",
S_IFREG | S_IRUGO, 1, 0, 0,
};
#ifdef __SMP_PROF__
static struct proc_dir_entry proc_root_smp = {
PROC_SMP_PROF, 3,"smp",
S_IFREG | S_IRUGO, 1, 0, 0,
};
#endif
static struct proc_dir_entry proc_root_filesystems = {
PROC_FILESYSTEMS, 11,"filesystems",
S_IFREG | S_IRUGO, 1, 0, 0,
};
static struct proc_dir_entry proc_root_dma = {
PROC_DMA, 3, "dma",
S_IFREG | S_IRUGO, 1, 0, 0,
};
static struct proc_dir_entry proc_root_ioports = {
PROC_IOPORTS, 7, "ioports",
S_IFREG | S_IRUGO, 1, 0, 0,
};
static struct proc_dir_entry proc_root_cmdline = {
PROC_CMDLINE, 7, "cmdline",
S_IFREG | S_IRUGO, 1, 0, 0,
};
#ifdef CONFIG_RTC
static struct proc_dir_entry proc_root_rtc = {
PROC_RTC, 3, "rtc",
S_IFREG | S_IRUGO, 1, 0, 0,
};
#endif
static struct proc_dir_entry proc_root_locks = {
PROC_LOCKS, 5, "locks",
S_IFREG | S_IRUGO, 1, 0, 0,
};
static struct proc_dir_entry proc_root_mounts = {
PROC_MTAB, 6, "mounts",
S_IFREG | S_IRUGO, 1, 0, 0,
};
static struct proc_dir_entry proc_root_profile = {
PROC_PROFILE, 7, "profile",
S_IFREG | S_IRUGO | S_IWUSR, 1, 0, 0,
};
void proc_root_init(void)
{
static int done = 0;
......@@ -258,119 +366,48 @@ void proc_root_init(void)
return;
done = 1;
proc_base_init();
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_LOADAVG, 7, "loadavg",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_UPTIME, 6, "uptime",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_MEMINFO, 7, "meminfo",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_KMSG, 4, "kmsg",
S_IFREG | S_IRUSR, 1, 0, 0,
});
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_VERSION, 7, "version",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &proc_root_loadavg);
proc_register(&proc_root, &proc_root_uptime);
proc_register(&proc_root, &proc_root_meminfo);
proc_register(&proc_root, &proc_root_kmsg);
proc_register(&proc_root, &proc_root_version);
#ifdef CONFIG_PCI
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_PCI, 3, "pci",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &proc_root_pci);
#endif
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_CPUINFO, 7, "cpuinfo",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_SELF, 4, "self",
S_IFLNK | S_IRUGO | S_IWUGO | S_IXUGO, 1, 0, 0,
64, &proc_self_inode_operations,
});
proc_register(&proc_root, &proc_root_cpuinfo);
proc_register(&proc_root, &proc_root_self);
proc_register(&proc_root, &proc_net);
proc_register(&proc_root, &proc_scsi);
proc_register(&proc_root, &proc_sys_root);
#ifdef CONFIG_DEBUG_MALLOC
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_MALLOC, 6, "malloc",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &proc_root_malloc);
#endif
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_KCORE, 5, "kcore",
S_IFREG | S_IRUSR, 1, 0, 0,
});
proc_register(&proc_root, &proc_root_kcore);
#ifdef CONFIG_MODULES
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_MODULES, 7, "modules",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_KSYMS, 5, "ksyms",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &proc_root_modules);
proc_register(&proc_root, &proc_root_ksyms);
#endif
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_STAT, 4, "stat",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_DEVICES, 7, "devices",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_INTERRUPTS, 10,"interrupts",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &proc_root_stat);
proc_register(&proc_root, &proc_root_devices);
proc_register(&proc_root, &proc_root_interrupts);
#ifdef __SMP_PROF__
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_SMP_PROF, 3,"smp",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &proc_root_smp);
#endif
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_FILESYSTEMS, 11,"filesystems",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_DMA, 3, "dma",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_IOPORTS, 7, "ioports",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_CMDLINE, 7, "cmdline",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &proc_root_filesystems);
proc_register(&proc_root, &proc_root_dma);
proc_register(&proc_root, &proc_root_ioports);
proc_register(&proc_root, &proc_root_cmdline);
#ifdef CONFIG_RTC
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_RTC, 3, "rtc",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &proc_root_rtc);
#endif
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_LOCKS, 5, "locks",
S_IFREG | S_IRUGO, 1, 0, 0,
});
proc_register(&proc_root, &proc_root_locks);
proc_register( &proc_root, &(struct proc_dir_entry)
{ PROC_MTAB, 6, "mounts", S_IFREG | S_IRUGO, 1, 0, 0, } );
proc_register(&proc_root, &proc_root_mounts);
if (prof_shift) {
proc_register(&proc_root, &(struct proc_dir_entry) {
PROC_PROFILE, 7, "profile",
S_IFREG | S_IRUGO | S_IWUSR, 1, 0, 0,
});
proc_register(&proc_root, &proc_root_profile);
}
}
......
......@@ -95,6 +95,8 @@ extern inline void __set_hae(unsigned long addr)
set_hae(addr);
}
#ifdef __KERNEL__
/*
* IO functions
*
......@@ -259,6 +261,8 @@ extern inline void __writel(unsigned int b, unsigned long addr)
#define outb(x, port) \
(__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
#endif /* __KERNEL__ */
/*
* The Alpha Jensen hardware for some rather strange reason puts
* the RTC clock at 0x170 instead of 0x70. Probably due to some
......
......@@ -20,12 +20,6 @@
#define MCA_bus 0
#define MCA_bus__is_a_macro /* for versions in ksyms.c */
/*
* The alpha has no problems with write protection
*/
#define wp_works_ok 1
#define wp_works_ok__is_a_macro /* for versions in ksyms.c */
/*
* The VM exception save area. We need to save
* return address (r26)
......
......@@ -51,4 +51,7 @@ static inline unsigned long get_ds(void)
return 0;
}
/* Hardware write protection */
#define verify_write(type, addr, size) 0
#endif /* _ASM_SEGMENT_H */
......@@ -37,58 +37,6 @@
#define SLOW_DOWN_IO __SLOW_DOWN_IO
#endif
#include <asm/page.h>
#define __io_virt(x) ((void *)(PAGE_OFFSET | (unsigned long)(x)))
#define __io_phys(x) ((unsigned long)(x) & ~PAGE_OFFSET)
/*
* Change virtual addresses to physical addresses and vv.
* These are pretty trivial
*/
extern inline unsigned long virt_to_phys(volatile void * address)
{
return __io_phys(address);
}
extern inline void * phys_to_virt(unsigned long address)
{
return __io_virt(address);
}
extern void * ioremap(unsigned long offset, unsigned long size);
extern void iounmap(void *addr);
/*
* IO bus memory addresses are also 1:1 with the physical address
*/
#define virt_to_bus virt_to_phys
#define bus_to_virt phys_to_virt
/*
* readX/writeX() are used to access memory mapped devices. On some
* architectures the memory mapped IO stuff needs to be accessed
* differently. On the x86 architecture, we just read/write the
* memory location directly.
*/
#define readb(addr) (*(volatile unsigned char *) __io_virt(addr))
#define readw(addr) (*(volatile unsigned short *) __io_virt(addr))
#define readl(addr) (*(volatile unsigned int *) __io_virt(addr))
#define writeb(b,addr) (*(volatile unsigned char *) __io_virt(addr) = (b))
#define writew(b,addr) (*(volatile unsigned short *) __io_virt(addr) = (b))
#define writel(b,addr) (*(volatile unsigned int *) __io_virt(addr) = (b))
#define memset_io(a,b,c) memset(__io_virt(a),(b),(c))
#define memcpy_fromio(a,b,c) memcpy((a),__io_virt(b),(c))
#define memcpy_toio(a,b,c) memcpy(__io_virt(a),(b),(c))
/*
* Again, i386 does not require mem IO specific function.
*/
#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),__io_virt(b),(c),(d))
/*
* Talk about misusing macros..
*/
......@@ -216,6 +164,60 @@ __OUTS(l)
__inlc_p(port) : \
__inl_p(port))
#ifdef __KERNEL__
#include <asm/page.h>
#define __io_virt(x) ((void *)(PAGE_OFFSET | (unsigned long)(x)))
#define __io_phys(x) ((unsigned long)(x) & ~PAGE_OFFSET)
/*
* Change virtual addresses to physical addresses and vv.
* These are pretty trivial
*/
extern inline unsigned long virt_to_phys(volatile void * address)
{
return __io_phys(address);
}
extern inline void * phys_to_virt(unsigned long address)
{
return __io_virt(address);
}
extern void * ioremap(unsigned long offset, unsigned long size);
extern void iounmap(void *addr);
/*
* IO bus memory addresses are also 1:1 with the physical address
*/
#define virt_to_bus virt_to_phys
#define bus_to_virt phys_to_virt
/*
* readX/writeX() are used to access memory mapped devices. On some
* architectures the memory mapped IO stuff needs to be accessed
* differently. On the x86 architecture, we just read/write the
* memory location directly.
*/
#define readb(addr) (*(volatile unsigned char *) __io_virt(addr))
#define readw(addr) (*(volatile unsigned short *) __io_virt(addr))
#define readl(addr) (*(volatile unsigned int *) __io_virt(addr))
#define writeb(b,addr) (*(volatile unsigned char *) __io_virt(addr) = (b))
#define writew(b,addr) (*(volatile unsigned short *) __io_virt(addr) = (b))
#define writel(b,addr) (*(volatile unsigned int *) __io_virt(addr) = (b))
#define memset_io(a,b,c) memset(__io_virt(a),(b),(c))
#define memcpy_fromio(a,b,c) memcpy((a),__io_virt(b),(c))
#define memcpy_toio(a,b,c) memcpy(__io_virt(a),(b),(c))
/*
* Again, i386 does not require mem IO specific function.
*/
#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),__io_virt(b),(c),(d))
static inline int check_signature(unsigned long io_addr,
const unsigned char *signature, int length)
{
......@@ -232,4 +234,6 @@ static inline int check_signature(unsigned long io_addr,
return retval;
}
#endif /* __KERNEL__ */
#endif
......@@ -33,7 +33,6 @@ extern int have_cpuid; /* We have a CPUID */
*/
extern int EISA_bus;
#define MCA_bus 0
#define MCA_bus__is_a_macro /* for versions in ksyms.c */
/*
* User space process size: 3GB. This is hardcoded into a few places,
......
......@@ -48,6 +48,23 @@
#define set_fs(x) (current->tss.segment = (x))
#define get_ds() (KERNEL_DS)
extern int __verify_write(const void *addr, unsigned long size);
#if CPU > 386
#define verify_write(type,addr,size) 0
#else
/*
* The intel i386 CPU needs to check writability by hand, as the
* CPU does not honour the write protect bit in supervisor mode
*/
#define verify_write(type,addr,size) \
(((type) && !wp_works_ok)?__verify_write((addr),(size)):0)
#endif
#endif /* __ASSEMBLY__ */
#endif /* _ASM_SEGMENT_H */
......@@ -43,7 +43,7 @@ struct user_i387_struct {
/*
* This is the old layout of "struct pt_regs", and
* is still the layout used by user more (the new
* is still the layout used by user mode (the new
* pt_regs doesn't have all registers as the kernel
* doesn't use the extra segment registers)
*/
......
......@@ -19,11 +19,6 @@ extern void * high_memory;
#define VERIFY_READ 0
#define VERIFY_WRITE 1
extern int __verify_write(const void *, unsigned long);
#define verify_write(type,addr,size) \
(((type) && !wp_works_ok)?__verify_write((addr),(size)):0)
extern inline int verify_area(int type, const void * addr, unsigned long size)
{
int retval = 0;
......
......@@ -167,6 +167,7 @@ struct sock
unsigned short rcv_ack_cnt; /* count of same ack */
__u32 window_seq;
__u32 fin_seq;
__u32 syn_seq;
__u32 urg_seq;
__u32 urg_data;
int users; /* user count */
......
......@@ -92,18 +92,6 @@ struct symbol_table symbol_table = {
#endif
X(get_options),
/* system info variables */
/* These check that they aren't defines (0/1) */
#ifndef EISA_bus__is_a_macro
X(EISA_bus),
#endif
#ifndef MCA_bus__is_a_macro
X(MCA_bus),
#endif
#ifndef wp_works_ok__is_a_macro
X(wp_works_ok),
#endif
#ifdef CONFIG_PCI
/* PCI BIOS support */
X(pcibios_present),
......
......@@ -675,57 +675,6 @@ void do_wp_page(struct task_struct * tsk, struct vm_area_struct * vma,
return;
}
/*
* Ugly, ugly, but the goto's result in better assembly..
*/
int __verify_write(const void * addr, unsigned long size)
{
struct vm_area_struct * vma;
unsigned long start = (unsigned long) addr;
if (!size)
return 0;
vma = find_vma(current->mm, start);
if (!vma)
goto bad_area;
if (vma->vm_start > start)
goto check_stack;
good_area:
if (!(vma->vm_flags & VM_WRITE))
goto bad_area;
size--;
size += start & ~PAGE_MASK;
size >>= PAGE_SHIFT;
start &= PAGE_MASK;
for (;;) {
do_wp_page(current, vma, start, 1);
if (!size)
break;
size--;
start += PAGE_SIZE;
if (start < vma->vm_end)
continue;
vma = vma->vm_next;
if (!vma || vma->vm_start != start)
goto bad_area;
if (!(vma->vm_flags & VM_WRITE))
goto bad_area;;
}
return 0;
check_stack:
if (!(vma->vm_flags & VM_GROWSDOWN))
goto bad_area;
if (expand_stack(vma, start) == 0)
goto good_area;
bad_area:
return -EFAULT;
}
/*
* This function zeroes out partial mmap'ed pages at truncation time..
*/
......
......@@ -2006,6 +2006,26 @@ struct packet_type ppptalk_packet_type=
static char ddp_snap_id[]={0x08,0x00,0x07,0x80,0x9B};
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry proc_appletalk = {
PROC_NET_ATALK, 9, "appletalk",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
atalk_get_info
};
static struct proc_dir_entry proc_atalk_route = {
PROC_NET_AT_ROUTE, 11,"atalk_route",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
atalk_rt_get_info
};
static struct proc_dir_entry proc_atalk_iface = {
PROC_NET_ATIF, 11,"atalk_iface",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
atalk_if_get_info
};
#endif
/* Called by proto.c on kernel start up */
......@@ -2025,24 +2045,9 @@ void atalk_proto_init(struct net_proto *pro)
aarp_proto_init();
#ifdef CONFIG_PROC_FS
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_ATALK, 9, "appletalk",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
atalk_get_info
});
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_AT_ROUTE, 11,"atalk_route",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
atalk_rt_get_info
});
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_ATIF, 11,"atalk_iface",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
atalk_if_get_info
});
proc_net_register(&proc_appletalk);
proc_net_register(&proc_atalk_route);
proc_net_register(&proc_atalk_iface);
#endif
printk(KERN_INFO "Appletalk 0.17 for Linux NET3.035\n");
......
......@@ -2365,6 +2365,35 @@ static struct notifier_block ax25_dev_notifier = {
0
};
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry proc_ax25_route = {
PROC_NET_AX25_ROUTE, 10, "ax25_route",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ax25_rt_get_info
};
static struct proc_dir_entry proc_ax25 = {
PROC_NET_AX25, 4, "ax25",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ax25_get_info
};
static struct proc_dir_entry proc_ax25_calls = {
PROC_NET_AX25_CALLS, 10, "ax25_calls",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ax25_cs_get_info
};
#endif
#ifdef CONFIG_BPQETHER
static struct proc_dir_entry proc_ax25_bpqether = {
PROC_NET_AX25_BPQETHER, 13, "ax25_bpqether",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ax25_bpq_get_info
};
#endif
void ax25_proto_init(struct net_proto *pro)
{
sock_register(ax25_proto_ops.family, &ax25_proto_ops);
......@@ -2376,35 +2405,15 @@ void ax25_proto_init(struct net_proto *pro)
#endif
register_netdevice_notifier(&ax25_dev_notifier);
#ifdef CONFIG_PROC_FS
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_AX25_ROUTE, 10, "ax25_route",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ax25_rt_get_info
});
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_AX25, 4, "ax25",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ax25_get_info
});
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_AX25_CALLS, 10, "ax25_calls",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ax25_cs_get_info
});
proc_net_register(&proc_ax25_route);
proc_net_register(&proc_ax25);
proc_net_register(&proc_ax25_calls);
#endif
printk(KERN_INFO "G4KLX/GW4PTS AX.25 for Linux. Version 0.32 for Linux NET3.035 (Linux 2.0)\n");
#ifdef CONFIG_BPQETHER
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_AX25_BPQETHER, 13, "ax25_bpqether",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ax25_bpq_get_info
});
proc_net_register(&proc_ax25_bpqether);
printk(KERN_INFO "G8BPQ Encapsulation of AX.25 frames enabled\n");
#endif
......
......@@ -1369,6 +1369,15 @@ extern int pi_init(void);
extern void sdla_setup(void);
extern void dlci_setup(void);
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry proc_net_dev = {
PROC_NET_DEV, 3, "dev",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
dev_get_info
};
#endif
int net_dev_init(void)
{
struct device *dev, **dp;
......@@ -1395,9 +1404,6 @@ int net_dev_init(void)
#if defined(CONFIG_LANCE)
lance_init();
#endif
#if defined(CONFIG_NI65)
ni65_init();
#endif
#if defined(CONFIG_PI)
pi_init();
#endif
......@@ -1449,12 +1455,7 @@ int net_dev_init(void)
}
#ifdef CONFIG_PROC_FS
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_DEV, 3, "dev",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
dev_get_info
});
proc_net_register(&proc_net_dev);
#endif
/*
......
......@@ -1278,6 +1278,22 @@ static struct notifier_block net_alias_dev_notifier = {
0
};
#ifndef ALIAS_USER_LAND_DEBUG
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry proc_net_alias_types = {
PROC_NET_ALIAS_TYPES, 11, "alias_types",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
net_alias_types_getinfo
};
static struct proc_dir_entry proc_net_aliases = {
PROC_NET_ALIASES, 7, "aliases",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
net_alias_getinfo
};
#endif
#endif
/*
* net_alias initialisation
......@@ -1299,18 +1315,8 @@ void net_alias_init(void)
#ifndef ALIAS_USER_LAND_DEBUG
#ifdef CONFIG_PROC_FS
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_ALIAS_TYPES, 11, "alias_types",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
net_alias_types_getinfo
});
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_ALIASES, 7, "aliases",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
net_alias_getinfo
});
proc_net_register(&proc_net_alias_types);
proc_net_register(&proc_net_aliases);
#endif
#endif
......
......@@ -1593,6 +1593,59 @@ static struct proto_ops inet_proto_ops = {
extern unsigned long seq_offset;
#ifdef CONFIG_PROC_FS
#ifdef CONFIG_INET_RARP
static struct proc_dir_entry proc_net_rarp = {
PROC_NET_RARP, 4, "rarp",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
rarp_get_info
};
#endif /* RARP */
static struct proc_dir_entry proc_net_raw = {
PROC_NET_RAW, 3, "raw",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
raw_get_info
};
static struct proc_dir_entry proc_net_snmp = {
PROC_NET_SNMP, 4, "snmp",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
snmp_get_info
};
static struct proc_dir_entry proc_net_sockstat = {
PROC_NET_SOCKSTAT, 8, "sockstat",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
afinet_get_info
};
static struct proc_dir_entry proc_net_tcp = {
PROC_NET_TCP, 3, "tcp",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
tcp_get_info
};
static struct proc_dir_entry proc_net_udp = {
PROC_NET_UDP, 3, "udp",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
udp_get_info
};
static struct proc_dir_entry proc_net_route = {
PROC_NET_ROUTE, 5, "route",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
rt_get_info
};
static struct proc_dir_entry proc_net_rtcache = {
PROC_NET_RTCACHE, 8, "rt_cache",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
rt_cache_get_info
};
#endif /* CONFIG_PROC_FS */
/*
* Called by socket.c on kernel startup.
*/
......@@ -1683,55 +1736,15 @@ void inet_proto_init(struct net_proto *pro)
#ifdef CONFIG_PROC_FS
#ifdef CONFIG_INET_RARP
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_RARP, 4, "rarp",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
rarp_get_info
});
proc_net_register(&proc_net_rarp);
#endif /* RARP */
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_RAW, 3, "raw",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
raw_get_info
});
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_SNMP, 4, "snmp",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
snmp_get_info
});
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_SOCKSTAT, 8, "sockstat",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
afinet_get_info
});
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_TCP, 3, "tcp",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
tcp_get_info
});
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_UDP, 3, "udp",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
udp_get_info
});
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_ROUTE, 5, "route",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
rt_get_info
});
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_RTCACHE, 8, "rt_cache",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
rt_cache_get_info
});
proc_net_register(&proc_net_raw);
proc_net_register(&proc_net_snmp);
proc_net_register(&proc_net_sockstat);
proc_net_register(&proc_net_tcp);
proc_net_register(&proc_net_udp);
proc_net_register(&proc_net_route);
proc_net_register(&proc_net_rtcache);
#endif /* CONFIG_PROC_FS */
}
......@@ -2389,6 +2389,15 @@ static struct notifier_block arp_dev_notifier={
0
};
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry proc_net_arp = {
PROC_NET_ARP, 3, "arp",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
arp_get_info
};
#endif
void arp_init (void)
{
/* Register the packet type */
......@@ -2400,12 +2409,7 @@ void arp_init (void)
register_netdevice_notifier(&arp_dev_notifier);
#ifdef CONFIG_PROC_FS
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_ARP, 3, "arp",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
arp_get_info
});
proc_net_register(&proc_net_arp);
#endif
#ifdef CONFIG_ARPD
......
......@@ -264,8 +264,12 @@ int ip_forward(struct sk_buff *skb, struct device *dev, int is_frag,
if (iph->protocol == IPPROTO_ICMP)
{
if ((fw_res = ip_fw_masq_icmp(&skb, dev2)) < 0)
{
if (rt)
ip_rt_put(rt);
/* Problem - ie bad checksum */
return -1;
}
if (fw_res)
/* ICMP matched - skip firewall */
......
......@@ -1244,16 +1244,45 @@ static struct notifier_block ipfw_dev_notifier={
#endif
#ifdef CONFIG_PROC_FS
#ifdef CONFIG_IP_ACCT
static struct proc_dir_entry proc_net_ipacct = {
PROC_NET_IPACCT, 7, "ip_acct",
S_IFREG | S_IRUGO | S_IWUSR, 1, 0, 0,
0, &proc_net_inode_operations,
ip_acct_procinfo
};
#endif
#endif
#ifdef CONFIG_IP_FIREWALL
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry proc_net_ipfwin = {
PROC_NET_IPFWIN, 8, "ip_input",
S_IFREG | S_IRUGO | S_IWUSR, 1, 0, 0,
0, &proc_net_inode_operations,
ip_fw_in_procinfo
};
static struct proc_dir_entry proc_net_ipfwout = {
PROC_NET_IPFWOUT, 9, "ip_output",
S_IFREG | S_IRUGO | S_IWUSR, 1, 0, 0,
0, &proc_net_inode_operations,
ip_fw_out_procinfo
};
static struct proc_dir_entry proc_net_ipfwfwd = {
PROC_NET_IPFWFWD, 10, "ip_forward",
S_IFREG | S_IRUGO | S_IWUSR, 1, 0, 0,
0, &proc_net_inode_operations,
ip_fw_fwd_procinfo
};
#endif
#endif
void ip_fw_init(void)
{
#ifdef CONFIG_PROC_FS
#ifdef CONFIG_IP_ACCT
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_IPACCT, 7, "ip_acct",
S_IFREG | S_IRUGO | S_IWUSR, 1, 0, 0,
0, &proc_net_inode_operations,
ip_acct_procinfo
});
proc_net_register(&proc_net_ipacct);
#endif
#endif
#ifdef CONFIG_IP_FIREWALL
......@@ -1262,24 +1291,9 @@ void ip_fw_init(void)
panic("Unable to register IP firewall.\n");
#ifdef CONFIG_PROC_FS
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_IPFWIN, 8, "ip_input",
S_IFREG | S_IRUGO | S_IWUSR, 1, 0, 0,
0, &proc_net_inode_operations,
ip_fw_in_procinfo
});
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_IPFWOUT, 9, "ip_output",
S_IFREG | S_IRUGO | S_IWUSR, 1, 0, 0,
0, &proc_net_inode_operations,
ip_fw_out_procinfo
});
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_IPFWFWD, 10, "ip_forward",
S_IFREG | S_IRUGO | S_IWUSR, 1, 0, 0,
0, &proc_net_inode_operations,
ip_fw_fwd_procinfo
});
proc_net_register(&proc_net_ipfwin);
proc_net_register(&proc_net_ipfwout);
proc_net_register(&proc_net_ipfwfwd);
#endif
#endif
#ifdef CONFIG_IP_MASQUERADE
......
......@@ -994,6 +994,15 @@ static int ip_msqhst_procinfo(char *buffer, char **start, off_t offset,
return len;
}
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry proc_net_ipmsqhst = {
PROC_NET_IPMSQHST, 13, "ip_masquerade",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ip_msqhst_procinfo
};
#endif
/*
* Initialize ip masquerading
*/
......@@ -1001,12 +1010,7 @@ int ip_masq_init(void)
{
register_symtab (&ip_masq_syms);
#ifdef CONFIG_PROC_FS
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_IPMSQHST, 13, "ip_masquerade",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ip_msqhst_procinfo
});
proc_net_register(&proc_net_ipmsqhst);
#endif
ip_masq_app_init();
......
......@@ -473,6 +473,15 @@ int ip_masq_app_getinfo(char *buffer, char **start, off_t offset, int length, in
}
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry proc_net_ip_masq_app = {
PROC_NET_IP_MASQ_APP, 11, "ip_masq_app",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ip_masq_app_getinfo
};
#endif
/*
* Initialization routine
*/
......@@ -482,12 +491,7 @@ int ip_masq_app_init(void)
register_symtab (&ip_masq_app_syms);
#ifdef CONFIG_PROC_FS
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_IP_MASQ_APP, 11, "ip_masq_app",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ip_masq_app_getinfo
});
proc_net_register(&proc_net_ip_masq_app);
#endif
return 0;
}
......
......@@ -1086,6 +1086,17 @@ struct notifier_block ip_rt_notifier={
0
};
#ifdef CONFIG_IP_MULTICAST
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry proc_net_igmp = {
PROC_NET_IGMP, 4, "igmp",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ip_mc_procinfo
};
#endif
#endif
/*
* IP registers the packet type and then calls the subprotocol initialisers
*/
......@@ -1105,12 +1116,7 @@ void ip_init(void)
#ifdef CONFIG_IP_MULTICAST
#ifdef CONFIG_PROC_FS
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_IGMP, 4, "igmp",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ip_mc_procinfo
});
proc_net_register(&proc_net_igmp);
#endif
#endif
}
......
......@@ -913,6 +913,21 @@ int ipmr_mfc_info(char *buffer, char **start, off_t offset, int length, int dumm
return len;
}
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry proc_net_ipmr_vif = {
PROC_NET_IPMR_VIF, 9 ,"ip_mr_vif",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ipmr_vif_info
};
static struct proc_dir_entry proc_net_ipmr_mfc = {
PROC_NET_IPMR_MFC, 11 ,"ip_mr_cache",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ipmr_mfc_info
};
#endif
/*
* Setup for IP multicast routing
*/
......@@ -922,17 +937,7 @@ void ip_mr_init(void)
printk(KERN_INFO "Linux IP multicast router 0.06.\n");
register_netdevice_notifier(&ip_mr_notifier);
#ifdef CONFIG_PROC_FS
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_IPMR_VIF, 9 ,"ip_mr_vif",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ipmr_vif_info
});
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_IPMR_MFC, 11 ,"ip_mr_cache",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
ipmr_mfc_info
});
proc_net_register(&proc_net_ipmr_vif);
proc_net_register(&proc_net_ipmr_mfc);
#endif
}
......@@ -544,15 +544,17 @@ int rarp_get_info(char *buffer, char **start, off_t offset, int length, int dumm
return len;
}
struct proc_dir_entry proc_net_rarp = {
PROC_NET_RARP, 4, "rarp",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
rarp_get_info
};
void
rarp_init(void)
{
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_RARP, 4, "rarp",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
rarp_get_info
});
proc_net_register(&proc_net_rarp);
rarp_ioctl_hook = rarp_ioctl;
}
......
......@@ -873,6 +873,8 @@ static void wait_for_tcp_memory(struct sock * sk)
sk->socket->flags &= ~SO_NOSPACE;
add_wait_queue(sk->sleep, &wait);
for (;;) {
if (current->signal & ~current->blocked)
break;
current->state = TASK_INTERRUPTIBLE;
if (tcp_memory_free(sk))
break;
......@@ -930,6 +932,7 @@ static int fill_in_partial_skb(struct sock *sk, struct sk_buff *skb,
skb->tail += copy;
skb->len += copy;
skb->csum = csum_partial(skb->tail - tcp_size, tcp_size, 0);
sk->write_seq += copy;
if (!sk->packets_out)
send = tcp_send_skb;
send(sk, skb);
......@@ -1064,7 +1067,6 @@ static int do_tcp_sendmsg(struct sock *sk,
from += retval;
copied += retval;
len -= retval;
sk->write_seq += retval;
continue;
}
tcp_send_skb(sk, skb);
......
......@@ -470,6 +470,7 @@ static void tcp_conn_request(struct sock *sk, struct sk_buff *skb,
newsk->delay_acks = 1;
newsk->copied_seq = skb->seq+1;
newsk->fin_seq = skb->seq;
newsk->syn_seq = skb->seq;
newsk->state = TCP_SYN_RECV;
newsk->timeout = 0;
newsk->ip_xmit_timeout = 0;
......@@ -1587,6 +1588,9 @@ static int tcp_data(struct sk_buff *skb, struct sock *sk,
* moved inline now as tcp_urg is only called from one
* place. We handle URGent data wrong. We have to - as
* BSD still doesn't use the correction from RFC961.
*
* For 1003.1g we should support a new option TCP_STDURG to permit
* either form.
*/
static void tcp_check_urg(struct sock * sk, struct tcphdr * th)
......@@ -1613,6 +1617,15 @@ static void tcp_check_urg(struct sock * sk, struct tcphdr * th)
kill_pg(-sk->proc, SIGURG, 1);
}
}
/*
* We may be adding urgent data when the last byte read was
* urgent. To do this requires some care. We cannot just ignore
* sk->copied_seq since we would read the last urgent byte again
* as data, nor can we alter copied_seq until this data arrives
* or we break the sematics of SIOCATMARK (and thus sockatmark())
*/
if (sk->urg_seq == sk->copied_seq)
sk->copied_seq++; /* Move the copied sequence on correctly */
sk->urg_data = URG_NOTYET;
sk->urg_seq = ptr;
}
......@@ -1735,7 +1748,6 @@ int tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
{
struct tcphdr *th;
struct sock *sk;
int syn_ok=0;
__u32 seq;
#ifdef CONFIG_IP_TRANSPARENT_PROXY
int r;
......@@ -1959,7 +1971,6 @@ int tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
* Ok.. it's good. Set up sequence numbers and
* move to established.
*/
syn_ok=1; /* Don't reset this connection for the syn */
sk->acked_seq = skb->seq+1;
sk->lastwin_seq = skb->seq+1;
sk->fin_seq = skb->seq;
......@@ -2074,10 +2085,21 @@ int tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
return tcp_reset(sk,skb);
/*
* !syn_ok is effectively the state test in RFC793.
* Check for a SYN, and ensure it matches the SYN we were
* first sent. We have to handle the rather unusual (but valid)
* sequence that KA9Q derived products may generate of
*
* SYN
* SYN|ACK Data
* ACK (lost)
* SYN|ACK Data + More Data
* .. we must ACK not RST...
*
* We keep syn_seq as the sequence space occupied by the
* original syn.
*/
if(th->syn && !syn_ok)
if(th->syn && skb->seq!=sk->syn_seq)
{
tcp_send_reset(daddr,saddr,th, &tcp_prot, opt, dev, skb->ip_hdr->tos, 255);
return tcp_reset(sk,skb);
......
......@@ -1401,6 +1401,27 @@ static struct notifier_block nr_dev_notifier = {
0
};
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry proc_net_nr = {
PROC_NET_NR, 2, "nr",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
nr_get_info
};
static struct proc_dir_entry proc_net_nr_neigh = {
PROC_NET_NR_NEIGH, 8, "nr_neigh",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
nr_neigh_get_info
};
static struct proc_dir_entry proc_net_nr_nodes = {
PROC_NET_NR_NODES, 8, "nr_nodes",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
nr_nodes_get_info
};
#endif
void nr_proto_init(struct net_proto *pro)
{
sock_register(nr_proto_ops.family, &nr_proto_ops);
......@@ -1418,24 +1439,9 @@ void nr_proto_init(struct net_proto *pro)
nr_default.paclen = NR_DEFAULT_PACLEN;
#ifdef CONFIG_PROC_FS
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_NR, 2, "nr",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
nr_get_info
});
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_NR_NEIGH, 8, "nr_neigh",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
nr_neigh_get_info
});
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_NR_NODES, 8, "nr_nodes",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
nr_nodes_get_info
});
proc_net_register(&proc_net_nr);
proc_net_register(&proc_net_nr_neigh);
proc_net_register(&proc_net_nr_nodes);
#endif
}
......
......@@ -1294,18 +1294,21 @@ struct proto_ops unix_proto_ops = {
unix_recvmsg
};
#ifdef CONFIG_PROC_FS
static struct proc_dir_entry proc_net_unix = {
PROC_NET_UNIX, 4, "unix",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
unix_get_info
};
#endif
void unix_proto_init(struct net_proto *pro)
{
printk(KERN_INFO "NET3: Unix domain sockets 0.12 for Linux NET3.035.\n");
sock_register(unix_proto_ops.family, &unix_proto_ops);
#ifdef CONFIG_PROC_FS
proc_net_register(&(struct proc_dir_entry) {
PROC_NET_UNIX, 4, "unix",
S_IFREG | S_IRUGO, 1, 0, 0,
0, &proc_net_inode_operations,
unix_get_info
});
proc_net_register(&proc_net_unix);
#endif
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment