Commit a35eb8da authored by Linus Torvalds's avatar Linus Torvalds

[PATCH] Linux-0.98.5 (November 15, 1992)

net-1: free_skb -> kfree_skb. More changelogs.

[Original announcement below]

0.98.5 mainly fixes the swap-partition bug that was present in pl4 (and
for which I did an earlier unofficial emergency patch).  The bug
resulted in incorrect swapping with a partition under some circumstances
(notably tty events: keypresses could make xterm dump code when swapping
was enabled etc).

pl5 also has some other changes - nothing major.  Setting and querying
termios information from a pty master will now set/query the slave info:
this seems to be what some programs (telnet) expect.  I haven't seen any
changes to any of the programs I use, but I'd like to hear if this
results in problems or if it actually does help.

NOTE! READ THIS AND PONDER:

pl5 now checks against writing to the text segment.  Older binaries
which used the original estdio library (used with the earliest gcc
versions) are liable to break: not that there should be many of these
binaries around.  So if you get "Segmentation fault (core dumped)" on
binaries you know used to work, this is the likely cause.

One problem spot that I've seen even with new binaries is due to a
library bug in 'sigaction()'.  If the second argument is NULL (ie the
pointer to the new sigaction structure), sigaction() will incorrectly
dereference it resulting in a core-dump.  The only program so far that
I've seen doing this is 'dd', but there may be others.

On my system I have found a whopping total of two binaries which didn't
like the text segment protection, so it shouldn't really be a major
problem for anybody.  Famous last words.

                Linus

PS. The strace code in pl4 was incorrectly credited in the announcement.
The code was written by Branko Lankester, not Ross Biro (who did the
tcp/ip changes).
parent 3820d961
......@@ -119,15 +119,15 @@ all: Version Image
lilo: Image
if [ -f /vmlinux ]; then mv /vmlinux /vmlinux.old; fi
dd if=Image of=/vmlinux
/etc/lilo/lilo -c -b /dev/hda /vmlinux
cat Image > /vmlinux
/etc/lilo/install
linuxsubdirs: dummy
@for i in $(SUBDIRS); do (cd $$i && echo $$i && $(MAKE)) || exit; done
Version:
@./makever.sh
@echo \#define UTS_RELEASE \"0.98.pl4-`cat .version`\" > tools/version.h
@echo \#define UTS_RELEASE \"0.98.pl5-`cat .version`\" > tools/version.h
@echo \#define UTS_VERSION \"`date +%D`\" >> tools/version.h
@echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> tools/version.h
@echo \#define LINUX_COMPILE_BY \"`whoami`\" >> tools/version.h
......
......@@ -283,10 +283,8 @@ struct buffer_head * get_hash_table(dev_t dev, int block, int size)
return NULL;
bh->b_count++;
wait_on_buffer(bh);
if (bh->b_dev == dev && bh->b_blocknr == block && bh->b_size == size) {
put_last_free(bh);
if (bh->b_dev == dev && bh->b_blocknr == block && bh->b_size == size)
return bh;
}
bh->b_count--;
}
}
......@@ -308,8 +306,11 @@ struct buffer_head * getblk(dev_t dev, int block, int size)
int buffers;
repeat:
if (bh = get_hash_table(dev, block, size))
if (bh = get_hash_table(dev, block, size)) {
if (bh->b_uptodate && !bh->b_dirt)
put_last_free(bh);
return bh;
}
if (nr_free_pages > 30)
grow_buffers(size);
......@@ -369,9 +370,13 @@ void brelse(struct buffer_head * buf)
if (!buf)
return;
wait_on_buffer(buf);
if (!(buf->b_count--))
panic("Trying to free free buffer");
wake_up(&buffer_wait);
if (buf->b_count) {
if (--buf->b_count)
return;
wake_up(&buffer_wait);
return;
}
printk("Trying to free free buffer\n");
}
/*
......
......@@ -15,7 +15,8 @@ static void cp_old_stat(struct inode * inode, struct old_stat * statbuf)
{
struct old_stat tmp;
printk("Warning: using old stat() call. Recompile your binary.\n");
printk("Warning: %s using old stat() call. Recompile your binary.\n",
current->comm);
verify_area(statbuf,sizeof (*statbuf));
tmp.st_dev = inode->i_dev;
tmp.st_ino = inode->i_ino;
......
#ifndef _LINUX_IOCTL_H
#define _LINUX_IOCTL_H
/*
* linux/ioctl.h for Linux by H.H. Bergman.
*/
/* ioctl command encoding: 32 bits total, command in lower 16 bits,
* size of the parameter structure in the upper 14 bits.
* Encoding size in ioctl request is useful for catching old versions
* and to avoid overwriting user space outside the user buffer area.
* The highest 2 bits are reserved.
* NOTE: This limits the max blocksize to 16kB -1 !
*/
#define IOC_VOID 0x00000000 /* param in size field */
#define IOC_IN 0x40000000 /* user --> kernel */
#define IOC_OUT 0x80000000 /* kernel --> user */
#define IOC_INOUT (IOC_IN | IOC_OUT) /* both */
#define IOCSIZE_MASK 0x3fff0000 /* size (max 16k-1 bytes) */
#define IOCSIZE_SHIFT 16 /* how to get the size */
#define IOCCMD_MASK 0x0000ffff /* command code */
#define IOCCMD_SHIFT 0
#define _IO(c,d) (IOC_VOID | (d)<<16) | c) /* param encoded */
/* use _IOXX(magic, subcode, arg_t) where arg_t is the type of the
* (last) argument field in the ioctl call, if present.
*/
#define _IOW(c,d,t) (IOC_IN | ((sizeof(t)<<16) & IOCSIZE_MASK) | \
(c<<8) | d)
#define _IOR(c,d,t) (IOC_OUT | ((sizeof(t)<<16) & IOCSIZE_MASK) | \
(c<<8) | d)
/* WR rather than RW to avoid conflict with stdio.h */
#define _IOWR(c,d,t) (IOC_INOUT | (sizeof(t)<<16) & IOCSIZE_MASK) | \
(c<<8) | d)
#endif
#ifndef _LINUX_MTIO_H
#define _LINUX_MTIO_H
/*
* linux/mtio.h header file for Linux. Written by H. Bergman
*/
/*
* Structures and definitions for mag tape io control commands
*/
/* structure for MTIOCTOP - mag tape op command */
struct mtop {
short mt_op; /* operations defined below */
int mt_count; /* how many of them */
};
/* Magnetic Tape operations [Not all operations supported by all drivers]: */
#define MTRESET 0 /* +reset drive in case of problems */
#define MTFSF 1 /* forward space over FileMark,
* position at first record of next file
*/
#define MTBSF 2 /* backward space FileMark (position before FM) */
#define MTFSR 3 /* forward space record */
#define MTBSR 4 /* backward space record */
#define MTWEOF 5 /* write an end-of-file record (mark) */
#define MTREW 6 /* rewind */
#define MTOFFL 7 /* rewind and put the drive offline (eject?) */
#define MTNOP 8 /* no op, set status only (read with MTIOCGET) */
#define MTRETEN 9 /* retension tape */
#define MTBSFM 10 /* +backward space FileMark, position at FM */
#define MTFSFM 11 /* +forward space FileMark, position at FM */
#define MTEOM 12 /* goto end of recorded media (for appending files).
* MTEOM positions after the last FM, ready for
* appending another file.
*/
#define MTERASE 13 /* erase tape -- be careful! */
#define MTRAS1 14 /* run self test 1 (nondestructive) */
#define MTRAS2 15 /* run self test 2 (destructive) */
#define MTRAS3 16 /* reserved for self test 3 */
#define MTSETBLK 20 /* set block length (SCSI) */
/* may need to add
#define MTFORMAT
* or something similar for QIC-40/80 type tapes.
*/
/* structure for MTIOCGET - mag tape get status command */
struct mtget {
long mt_type; /* type of magtape device */
long mt_resid; /* residual count: (not sure)
* number of bytes ignored, or
* number of files not skipped, or
* number of records not skipped.
*/
/* the following registers are device dependent */
long mt_dsreg; /* status register */
long mt_gstat; /* generic (device independent) status */
long mt_erreg; /* error register */
/* The next two fields are not always used */
daddr_t mt_fileno; /* number of current file on tape */
daddr_t mt_blkno; /* current block number */
};
/*
* Constants for mt_type. Not all of these are supported.
*/
#define MT_ISUNKNOWN 0x01
#define MT_ISQIC02 0x02 /* Generic QIC-02 tape streamer */
#define MT_ISWT5150 0x03 /* Wangtek 5150EQ, QIC-150, QIC-02 */
#define MT_ISARCHIVE_5945L2 0x04 /* Archive 5945L-2, QIC-24, QIC-02? */
#define MT_ISCMSJ500 0x05 /* CMS Jumbo 500 (QIC-02?) */
#define MT_ISTDC3610 0x06 /* Tandberg 6310, QIC-24 */
#define MT_ISARCHIVE_VP60I 0x07 /* Archive VP60i, QIC-02 */
#define MT_ISARCHIVE_2150L 0x08 /* Archive Viper 2150L */
#define MT_ISQIC02_ALL_FEATURES 0x0F /* Generic QIC-02 with all features */
#define MT_ISWT5099EEN24 0x11 /* Wangtek 5099-een24, 60MB, QIC-24 */
#define MT_ISEVEREX_FT40A 0x32 /* Everex FT40A (QIC-40) */
#define MT_ISDDS1 0x51 /* DDS device without partitions */
#define MT_ISDDS2 0x52 /* DDS device with partitions */
#define MT_ISSCSI1 0x71 /* Generic ANSI SCSI-1 tape unit */
struct mt_tape_info {
long t_type; /* device type id (mt_type) */
char *t_name; /* descriptive name */
};
#define MT_TAPE_INFO { \
{MT_ISUNKNOWN, "Unknown type of tape device"}, \
{MT_ISQIC02, "Generic QIC-02 tape streamer"}, \
{MT_ISWT5150, "Wangtek 5150, QIC-150"}, \
{MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \
{MT_ISCMSJ500, "CMS Jumbo 500"}, \
{MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \
{MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \
{MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, \
{MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \
{MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \
{MT_ISSCSI1, "Generic SCSI-1 tape"}, \
{0, NULL} \
}
/* mag tape io control commands */
#define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */
#define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */
/* Generic Mag Tape (device independent) status macros for examining
* mt_gstat -- HP-UX compatible.
* There is room for more generic status bits here, but I don't
* know which of them are reserved. At least three or so should
* be added to make this really useful.
*/
#define GMT_EOF(x) ((x) & 0x80000000)
#define GMT_BOT(x) ((x) & 0x40000000)
#define GMT_EOT(x) ((x) & 0x20000000)
#define GMT_SM(x) ((x) & 0x10000000) /* DDS setmark */
#define GMT_EOD(x) ((x) & 0x08000000) /* DDS EOD */
#define GMT_WR_PROT(x) ((x) & 0x04000000)
/* #define GMT_ ? ((x) & 0x02000000) */
#define GMT_ONLINE(x) ((x) & 0x01000000)
#define GMT_D_6250(x) ((x) & 0x00800000)
#define GMT_D_1600(x) ((x) & 0x00400000)
#define GMT_D_800(x) ((x) & 0x00200000)
/* #define GMT_ ? ((x) & 0x00100000) */
/* #define GMT_ ? ((x) & 0x00080000) */
#define GMT_DR_OPEN(x) ((x) & 0x00040000) /* door open (no tape) */
/* #define GMT_ ? ((x) & 0x00020000) */
#define GMT_IM_REP_EN(x) ((x) & 0x00010000) /* immediate report mode */
/* 16 generic status bits unused */
/* DDS drives have 'setmarks', sort of like filemarks but used to group
* files, rather than blocks. Not used. Not supported.
* I think DDS drives are DAT drives.
*/
#endif /* not _LINUX_MTIO_H */
......@@ -71,6 +71,7 @@
#define TASK_UNINTERRUPTIBLE 2
#define TASK_ZOMBIE 3
#define TASK_STOPPED 4
#define TASK_SWAPPING 5
#ifndef NULL
#define NULL ((void *) 0)
......@@ -270,7 +271,7 @@ extern void add_timer(long jiffies, void (*fn)(void));
extern void sleep_on(struct wait_queue ** p);
extern void interruptible_sleep_on(struct wait_queue ** p);
extern void wake_up(struct wait_queue ** p);
extern void wake_one_task(struct task_struct * p);
extern void wake_up_interruptible(struct wait_queue ** p);
extern int send_sig(long sig,struct task_struct * p,int priv);
extern int in_group_p(gid_t grp);
......
......@@ -92,7 +92,7 @@ __asm__("cld\n"
"xorl %%eax,%%eax\n\t"
"jmp 3f\n"
"2:\tmovl $1,%%eax\n\t"
"jl 3f\n\t"
"jb 3f\n\t"
"negl %%eax\n"
"3:"
:"=a" (__res):"D" (cs),"S" (ct):"si","di");
......@@ -113,7 +113,7 @@ __asm__("cld\n"
"2:\txorl %%eax,%%eax\n\t"
"jmp 4f\n"
"3:\tmovl $1,%%eax\n\t"
"jl 4f\n\t"
"jb 4f\n\t"
"negl %%eax\n"
"4:"
:"=a" (__res):"D" (cs),"S" (ct),"c" (count):"si","di","cx");
......@@ -372,7 +372,7 @@ __asm__("cld\n\t"
"cmpsb\n\t"
"je 1f\n\t"
"movl $1,%%eax\n\t"
"jl 1f\n\t"
"jb 1f\n\t"
"negl %%eax\n"
"1:"
:"=a" (__res):"0" (0),"D" (cs),"S" (ct),"c" (count)
......
......@@ -11,6 +11,8 @@ struct timezone {
int tz_dsttime; /* type of dst correction */
};
#define NFDBITS __NFDBITS
#define FD_SETSIZE __FD_SETSIZE
#define FD_SET(fd,fdsetp) __FD_SET(fd,fdsetp)
#define FD_CLR(fd,fdsetp) __FD_CLR(fd,fdsetp)
......
......@@ -73,31 +73,48 @@ typedef unsigned long tcflag_t;
* (and thus <linux/time.h>) - but this is a more logical place for them. Solved
* by having dummy defines in <sys/time.h>.
*/
/*
* Those macros may have been defined in <gnu/types.h>. But we always
* use the ones here.
*/
#undef __FDSET_LONGS
#define __FDSET_LONGS 8
typedef struct fd_set {
unsigned long fd_mask[__FDSET_LONGS];
unsigned long __bits [__FDSET_LONGS];
} fd_set;
#define __FD_SETSIZE (__FDSET_LONGS*32)
#undef __NFDBITS
#define __NFDBITS (8 * sizeof(unsigned long))
#undef __FD_SETSIZE
#define __FD_SETSIZE (__FDSET_LONGS*__NFDBITS)
#undef __FD_SET
#define __FD_SET(fd,fdsetp) \
__asm__ __volatile__("btsl %1,%0":"=m" (*(struct fd_set *)fdsetp):"r" ((int) fd))
__asm__ __volatile__("btsl %1,%0": \
"=m" (*(fd_set *) (fdsetp)):"r" ((int) (fd)))
#undef __FD_CLR
#define __FD_CLR(fd,fdsetp) \
__asm__ __volatile__("btrl %1,%0":"=m" (*(struct fd_set *)fdsetp):"r" ((int) fd))
#define __FD_ISSET(fd,fdsetp) \
({ char __result; \
__asm__ __volatile__("btl %1,%2 ; setb %0" \
:"=q" (__result) \
:"r" ((int) fd),"m" (*(struct fd_set *) fdsetp)); \
__result; })
__asm__ __volatile__("btrl %1,%0": \
"=m" (*(fd_set *) (fdsetp)):"r" ((int) (fd)))
#undef __FD_ISSET
#define __FD_ISSET(fd,fdsetp) ({ \
char __result; \
__asm__ __volatile__("btl %1,%2 ; setb %0" \
:"=q" (__result) :"r" ((int) (fd)), \
"m" (*(fd_set *) (fdsetp))); \
__result; })
#undef __FD_ZERO
#define __FD_ZERO(fdsetp) \
__asm__ __volatile__("cld ; rep ; stosl" \
:"=m" (*(struct fd_set *) fdsetp) \
:"a" (0), "c" (__FDSET_LONGS), "D" ((struct fd_set *) fdsetp) \
:"cx","di")
__asm__ __volatile__("cld ; rep ; stosl" \
:"=m" (*(fd_set *) (fdsetp)) \
:"a" (0), "c" (__FDSET_LONGS), \
"D" ((fd_set *) (fdsetp)) :"cx","di")
struct ustat {
daddr_t f_tfree;
......
......@@ -140,10 +140,10 @@ static int controller_ready(unsigned int drive, unsigned int head)
static int status_ok(void)
{
unsigned char status = controller_busy();
unsigned char status = inb_p(HD_STATUS);
if (status & BUSY_STAT)
return 0;
return 1;
if (status & WRERR_STAT)
return 0;
if (!(status & READY_STAT))
......@@ -716,8 +716,8 @@ static int revalidate_hddisk(int dev, int maxusage)
sync_dev(major | start | i);
invalidate_inodes(major | start | i);
invalidate_buffers(major | start | i);
gdev->part[i].start_sect = 0;
gdev->part[i].nr_sects = 0;
gdev->part[start+i].start_sect = 0;
gdev->part[start+i].nr_sects = 0;
};
#ifdef MAYBE_REINIT
......
......@@ -238,7 +238,7 @@ void ll_rw_page(int rw, int dev, int page, char * buffer)
req->waiting = current;
req->bh = NULL;
req->next = NULL;
current->state = TASK_UNINTERRUPTIBLE;
current->state = TASK_SWAPPING;
add_request(major+blk_dev,req);
schedule();
}
......
......@@ -637,8 +637,8 @@ int revalidate_scsidisk(int dev, int maxusage){
sync_dev(major | start | i);
invalidate_inodes(major | start | i);
invalidate_buffers(major | start | i);
gdev->part[i].start_sect = 0;
gdev->part[i].nr_sects = 0;
gdev->part[start+i].start_sect = 0;
gdev->part[start+i].nr_sects = 0;
};
#ifdef MAYBE_REINIT
......
......@@ -73,7 +73,7 @@ void mouse_interrupt(int unused)
mouse.latch_buttons |= inb( ATIXL_MSE_DATA_PORT);
ATIXL_MSE_ENABLE_UPDATE();
mouse.ready = 1;
wake_up(&mouse.wait);
wake_up_interruptible(&mouse.wait);
}
static void release_mouse(struct inode * inode, struct file * file)
......
......@@ -53,7 +53,7 @@ static void mouse_interrupt(int unused)
mouse.dx += dx;
mouse.dy += dy;
mouse.ready = 1;
wake_up(&mouse.wait);
wake_up_interruptible(&mouse.wait);
MSE_INT_ON();
}
......
......@@ -905,7 +905,7 @@ void con_write(struct tty_struct * tty)
int c;
unsigned int currcons;
wake_up(&tty->write_q.proc_list);
wake_up_interruptible(&tty->write_q.proc_list);
currcons = tty->line - 1;
if (currcons >= NR_CONSOLES) {
printk("con_write: illegal tty (%d)\n", currcons);
......
......@@ -145,7 +145,7 @@ static void put_queue(int ch)
struct tty_struct *tty = TTY_TABLE(0);
unsigned long new_head;
wake_up(&keypress_wait);
wake_up_interruptible(&keypress_wait);
if (!tty)
return;
qp = &tty->read_q;
......@@ -153,7 +153,7 @@ static void put_queue(int ch)
qp->buf[qp->head]=ch;
if ((new_head=(qp->head+1)&(TTY_BUF_SIZE-1)) != qp->tail)
qp->head=new_head;
wake_up(&qp->proc_list);
wake_up_interruptible(&qp->proc_list);
}
static void puts_queue(char *cp)
......@@ -163,7 +163,7 @@ static void puts_queue(char *cp)
unsigned long new_head;
char ch;
wake_up(&keypress_wait);
wake_up_interruptible(&keypress_wait);
if (!tty)
return;
qp = &tty->read_q;
......@@ -174,7 +174,7 @@ static void puts_queue(char *cp)
!= qp->tail)
qp->head=new_head;
}
wake_up(&qp->proc_list);
wake_up_interruptible(&qp->proc_list);
}
static void ctrl(int sc)
......
......@@ -60,7 +60,7 @@ static void ms_mouse_interrupt(int unused)
mouse.dx += dx;
mouse.dy += dy;
mouse.ready = 1;
wake_up(&mouse.wait);
wake_up_interruptible(&mouse.wait);
}
static void release_mouse(struct inode * inode, struct file * file)
......
......@@ -155,7 +155,7 @@ static void aux_interrupt(int cpl)
}
queue->head = head;
aux_ready = 1;
wake_up(&queue->proc_list);
wake_up_interruptible(&queue->proc_list);
}
......@@ -222,15 +222,22 @@ static int write_aux(struct inode * inode, struct file * file, char * buffer, in
static int read_aux(struct inode * inode, struct file * file, char * buffer, int count)
{
struct wait_queue wait = { current, NULL };
int i = count;
unsigned char c;
if (queue_empty()) {
if (file->f_flags & O_NONBLOCK)
return -EAGAIN;
cli();
interruptible_sleep_on(&queue->proc_list);
sti();
add_wait_queue(&queue->proc_list, &wait);
repeat:
current->state = TASK_INTERRUPTIBLE;
if (queue_empty() && !(current->signal & ~current->blocked)) {
schedule();
goto repeat;
}
current->state = TASK_RUNNING;
}
while (i > 0 && !queue_empty()) {
c = get_from_queue();
......
......@@ -24,10 +24,10 @@ static void pty_close(struct tty_struct * tty, struct file * filp)
{
if (!tty)
return;
wake_up(&tty->read_q.proc_list);
wake_up_interruptible(&tty->read_q.proc_list);
if (!tty->link)
return;
wake_up(&tty->link->write_q.proc_list);
wake_up_interruptible(&tty->link->write_q.proc_list);
if (IS_A_PTY_MASTER(tty->line)) {
if (tty->link->pgrp > 0)
kill_pg(tty->link->pgrp,SIGHUP,1);
......@@ -51,7 +51,7 @@ static inline void pty_copy(struct tty_struct * from, struct tty_struct * to)
break;
}
TTY_READ_FLUSH(to);
wake_up(&from->write_q.proc_list);
wake_up_interruptible(&from->write_q.proc_list);
}
/*
......@@ -71,7 +71,7 @@ int pty_open(struct tty_struct *tty, struct file * filp)
return -ENODEV;
tty->write = tty->link->write = pty_write;
tty->close = tty->link->close = pty_close;
wake_up(&tty->read_q.proc_list);
wake_up_interruptible(&tty->read_q.proc_list);
if (filp->f_flags & O_NDELAY)
return 0;
while (!tty->link->count && !(current->signal & ~current->blocked))
......
......@@ -30,7 +30,17 @@
#include <asm/bitops.h>
#define WAKEUP_CHARS (3*TTY_BUF_SIZE/4)
#define AUTO_IRQ
/*
* Define this to get the AUTO_IRQ code..
*/
#undef AUTO_IRQ
/*
* Define this to get support for the nonstandard
* serial lines.
*/
#undef NONSTANDARD_PORTS
/*
* rs_event - Bitfield of serial lines that events pending
......@@ -48,18 +58,21 @@ static unsigned long rs_write_active = 0;
static async_ISR IRQ_ISR[16];
static void UART_ISR_proc(async_ISR ISR, int line);
static void FourPort_ISR_proc(async_ISR ISR, int line);
struct struct_ISR COM1_ISR = { 4, 0x3f8, UART_ISR_proc, 0, };
struct struct_ISR COM2_ISR = { 3, 0x2f8, UART_ISR_proc, 0, };
struct struct_ISR COM3_ISR = { 4, 0x3e8, UART_ISR_proc, 0, };
struct struct_ISR COM4_ISR = { 3, 0x2e8, UART_ISR_proc, 0, };
#ifdef NONSTANDARD_PORTS
static void FourPort_ISR_proc(async_ISR ISR, int line);
struct struct_ISR FourPort1_ISR = { 2, 0x1bf, FourPort_ISR_proc, 0, };
struct struct_ISR FourPort2_ISR = { 5, 0x2bf, FourPort_ISR_proc, 0, };
struct struct_ISR Accent3_ISR = { 4, 0x330, UART_ISR_proc, 0, };
struct struct_ISR Accent4_ISR = { 4, 0x338, UART_ISR_proc, 0, };
#endif
/*
* This assumes you have a 1.8432 MHz clock for your UART.
......@@ -75,7 +88,7 @@ struct async_struct rs_table[] = {
{ BASE_BAUD, 0x2F8, &COM2_ISR, 0, },
{ BASE_BAUD, 0x3E8, &COM3_ISR, 0, },
{ BASE_BAUD, 0x2E8, &COM4_ISR, 0, },
#ifdef NONSTANDARD_PORTS
{ BASE_BAUD, 0x1A0, &FourPort1_ISR, ASYNC_FOURPORT },
{ BASE_BAUD, 0x1A8, &FourPort1_ISR, ASYNC_FOURPORT },
{ BASE_BAUD, 0x1B0, &FourPort1_ISR, ASYNC_FOURPORT },
......@@ -88,6 +101,7 @@ struct async_struct rs_table[] = {
{ BASE_BAUD, 0x330, &Accent3_ISR, 0 },
{ BASE_BAUD, 0x338, &Accent4_ISR, 0 },
#endif
};
#define NR_PORTS (sizeof(rs_table)/sizeof(struct async_struct))
......@@ -268,6 +282,7 @@ static void UART_ISR_proc(async_ISR ISR, int line)
} while (!(inb(UART_IIR + info->port) & UART_IIR_NO_INT));
}
#ifdef NONSTANDARD_PORTS
/*
* Here is the fourport ISR
*/
......@@ -286,6 +301,7 @@ static void FourPort_ISR_proc(async_ISR ISR, int line)
ivec = ~inb(ISR->port) & 0x0F;
} while (ivec);
}
#endif
/*
* This is the serial driver's generic interrupt routine
......@@ -342,7 +358,7 @@ static void rs_timer(void)
TTY_READ_FLUSH(info->tty);
}
if (!clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) {
wake_up(&info->tty->write_q.proc_list);
wake_up_interruptible(&info->tty->write_q.proc_list);
}
if (!clear_bit(RS_EVENT_HUP_PGRP, &info->event)) {
if (info->tty->pgrp > 0)
......@@ -1051,6 +1067,7 @@ long rs_init(long kmem_start)
if (irq_lines & (1 << i))
free_irq(i);
}
sti();
#endif
return kmem_start;
}
......
......@@ -253,9 +253,9 @@ void copy_to_cooked(struct tty_struct * tty)
}
TTY_WRITE_FLUSH(tty);
if (!EMPTY(&tty->secondary))
wake_up(&tty->secondary.proc_list);
wake_up_interruptible(&tty->secondary.proc_list);
if (tty->write_q.proc_list && LEFT(&tty->write_q) > TTY_BUF_SIZE/2)
wake_up(&tty->write_q.proc_list);
wake_up_interruptible(&tty->write_q.proc_list);
if (tty->throttle && (LEFT(&tty->read_q) >= RQ_THRESHOLD_HW)
&& !clear_bit(TTY_RQ_THROTTLED, &tty->flags))
tty->throttle(tty, TTY_THROTTLE_RQ_AVAIL);
......@@ -366,7 +366,7 @@ static int read_chan(unsigned int channel, struct file * file, char * buf, int n
if (c==10 && L_CANON(tty))
break;
};
wake_up(&tty->read_q.proc_list);
wake_up_interruptible(&tty->read_q.proc_list);
/*
* If there is enough space in the secondary queue
* now, let the low-level driver know.
......@@ -453,7 +453,7 @@ static int write_chan(unsigned int channel, struct file * file, char * buf, int
if (channel > 255)
return -EIO;
if (redirect && ((channel == 0) || (channel+1 == fg_console)))
if (redirect && ((channel == 0) || (channel == fg_console+1)))
tty = redirect;
else
tty = TTY_TABLE(channel);
......
......@@ -26,7 +26,7 @@ static void flush(struct tty_queue * queue)
cli();
queue->head = queue->tail;
sti();
wake_up(&queue->proc_list);
wake_up_interruptible(&queue->proc_list);
}
}
......@@ -35,13 +35,13 @@ void flush_input(struct tty_struct * tty)
tty->status_changed = 1;
tty->ctrl_status |= TIOCPKT_FLUSHREAD;
flush(&tty->read_q);
wake_up(&tty->read_q.proc_list);
wake_up_interruptible(&tty->read_q.proc_list);
flush(&tty->secondary);
tty->secondary.data = 0;
if (tty = tty->link) {
flush(&tty->write_q);
wake_up(&tty->write_q.proc_list);
wake_up_interruptible(&tty->write_q.proc_list);
}
}
......@@ -50,10 +50,10 @@ void flush_output(struct tty_struct * tty)
tty->status_changed = 1;
tty->ctrl_status |= TIOCPKT_FLUSHWRITE;
flush(&tty->write_q);
wake_up(&tty->write_q.proc_list);
wake_up_interruptible(&tty->write_q.proc_list);
if (tty = tty->link) {
flush(&tty->read_q);
wake_up(&tty->read_q.proc_list);
wake_up_interruptible(&tty->read_q.proc_list);
flush(&tty->secondary);
tty->secondary.data = 0;
}
......@@ -252,8 +252,10 @@ int tty_ioctl(struct inode * inode, struct file * file,
{
struct tty_struct * tty;
struct tty_struct * other_tty;
struct tty_struct * termios_tty;
int pgrp;
int dev;
int termios_dev;
if (MAJOR(file->f_rdev) != 4) {
printk("tty_ioctl: tty pseudo-major != 4\n");
......@@ -263,15 +265,19 @@ int tty_ioctl(struct inode * inode, struct file * file,
tty = TTY_TABLE(dev);
if (!tty)
return -EINVAL;
if (IS_A_PTY(dev))
other_tty = tty_table[PTY_OTHER(dev)];
else
other_tty = NULL;
termios_tty = tty;
termios_dev = dev;
if (IS_A_PTY_MASTER(dev)) {
termios_tty = other_tty;
termios_dev = PTY_OTHER(dev);
}
switch (cmd) {
case TCGETS:
return get_termios(tty,(struct termios *) arg);
return get_termios(termios_tty,(struct termios *) arg);
case TCSETSF:
flush_input(tty);
/* fallthrough */
......@@ -279,16 +285,16 @@ int tty_ioctl(struct inode * inode, struct file * file,
wait_until_sent(tty);
/* fallthrough */
case TCSETS:
return set_termios(tty,(struct termios *) arg, dev);
return set_termios(termios_tty,(struct termios *) arg, termios_dev);
case TCGETA:
return get_termio(tty,(struct termio *) arg);
return get_termio(termios_tty,(struct termio *) arg);
case TCSETAF:
flush_input(tty);
/* fallthrough */
case TCSETAW:
wait_until_sent(tty); /* fallthrough */
case TCSETA:
return set_termio(tty,(struct termio *) arg, dev);
return set_termio(termios_tty,(struct termio *) arg, termios_dev);
case TCXONC:
switch (arg) {
case TCOOFF:
......
......@@ -35,7 +35,7 @@ int sys_syslog(int type, char * buf, int len)
i = log_page;
log_page = 0;
free_page(i);
wake_up(&log_wait);
wake_up_interruptible(&log_wait);
return 0;
case 1:
i = get_free_page(GFP_KERNEL);
......@@ -97,7 +97,7 @@ int printk(const char *fmt, ...)
log_start++;
}
if (log_page)
wake_up(&log_wait);
wake_up_interruptible(&log_wait);
console_print(buf);
return i;
}
......@@ -103,17 +103,15 @@ void schedule(void)
/* check alarm, wake up any interruptible tasks that have got a signal */
need_resched = 0;
for(p = &LAST_TASK ; p > &FIRST_TASK ; --p)
if (*p) {
if ((*p)->timeout && (*p)->timeout < jiffies)
if ((*p)->state == TASK_INTERRUPTIBLE) {
(*p)->timeout = 0;
wake_one_task(*p);
}
if (((*p)->signal & ~(*p)->blocked) &&
(*p)->state==TASK_INTERRUPTIBLE)
wake_one_task(*p);
}
for(p = &LAST_TASK ; p > &FIRST_TASK ; --p) {
if (!*p || ((*p)->state != TASK_INTERRUPTIBLE))
continue;
if ((*p)->timeout && (*p)->timeout < jiffies) {
(*p)->timeout = 0;
(*p)->state = TASK_RUNNING;
} else if ((*p)->signal & ~(*p)->blocked)
(*p)->state = TASK_RUNNING;
}
/* this is the scheduler proper: */
......@@ -155,13 +153,6 @@ int sys_pause(void)
return -EINTR;
}
void wake_one_task(struct task_struct * p)
{
p->state = TASK_RUNNING;
if (p->counter > current->counter)
need_resched = 1;
}
/*
* wake_up doesn't wake up stopped processes - they have to be awakened
* with signals or similar.
......@@ -179,9 +170,34 @@ void wake_up(struct wait_queue **q)
return;
do {
if (p = tmp->task) {
if (p->state == TASK_ZOMBIE)
printk("wake_up: TASK_ZOMBIE\n");
else if (p->state != TASK_STOPPED) {
if ((p->state == TASK_UNINTERRUPTIBLE) ||
(p->state == TASK_INTERRUPTIBLE)) {
p->state = TASK_RUNNING;
if (p->counter > current->counter)
need_resched = 1;
}
}
if (!tmp->next) {
printk("wait_queue is bad (eip = %08x)\n",((unsigned long *) q)[-1]);
printk(" q = %08x\n",q);
printk(" *q = %08x\n",*q);
printk(" tmp = %08x\n",tmp);
break;
}
tmp = tmp->next;
} while (tmp != *q);
}
void wake_up_interruptible(struct wait_queue **q)
{
struct wait_queue *tmp;
struct task_struct * p;
if (!q || !(tmp = *q))
return;
do {
if (p = tmp->task) {
if (p->state == TASK_INTERRUPTIBLE) {
p->state = TASK_RUNNING;
if (p->counter > current->counter)
need_resched = 1;
......
......@@ -255,21 +255,26 @@ void ctrl_alt_del(void)
*/
int sys_setregid(gid_t rgid, gid_t egid)
{
int old_rgid = current->gid;
if (rgid != (gid_t) -1) {
if ((current->gid == rgid) ||
if ((current->egid==rgid) ||
(old_rgid == rgid) ||
suser())
current->gid = rgid;
else
return(-EPERM);
}
if (egid != (gid_t) -1) {
if ((current->gid == egid) ||
if ((old_rgid == egid) ||
(current->egid == egid) ||
suser()) {
current->egid = egid;
current->sgid = egid;
} else
} else {
current->gid = old_rgid;
return(-EPERM);
}
}
return 0;
}
......
......@@ -55,6 +55,8 @@ __asm__("cld ; rep ; movsl"::"S" (from),"D" (to),"c" (1024):"cx","di","si")
unsigned short * mem_map = NULL;
#define CODE_SPACE(addr,p) ((addr) < (p)->end_code)
/*
* oom() prints a message (so that the user knows why the process died),
* and gives the process an untrappable SIGSEGV.
......@@ -371,8 +373,9 @@ int remap_page_range(unsigned long from, unsigned long to, unsigned long size,
* It returns the physical address of the page gotten, 0 if
* out of memory (either when trying to access page-table or
* page.)
* if wp = 1 the page will be write protected
*/
static unsigned long put_page(struct task_struct * tsk,unsigned long page,unsigned long address)
static unsigned long put_page(struct task_struct * tsk,unsigned long page,unsigned long address,int wp)
{
unsigned long tmp, *page_table;
......@@ -405,7 +408,7 @@ static unsigned long put_page(struct task_struct * tsk,unsigned long page,unsign
*page_table = 0;
invalidate();
}
*page_table = page | PAGE_ACCESSED | 7;
*page_table = page | PAGE_ACCESSED | 5 | (!wp << 1);
/* no need for invalidate */
return page;
}
......@@ -460,6 +463,15 @@ void do_wp_page(unsigned long error_code, unsigned long address,
unsigned long pde, pte, old_page, dirty;
unsigned long new_page = 0;
/* check code space write */
if (tsk == current && tsk->executable && CODE_SPACE(address, current)) {
/* don't send SIGSEGV when in kernel or v86 mode */
if (user_esp)
send_sig(SIGSEGV, tsk, 1);
/* Note that we still do the copy-on-write: if the process catches
* SIGSEGV we want things to work..
*/
}
repeat:
pde = tsk->tss.cr3 + ((address>>20) & 0xffc);
pte = *(unsigned long *) pde;
......@@ -535,7 +547,7 @@ static void get_empty_page(struct task_struct * tsk, unsigned long address)
oom(tsk);
tmp = BAD_PAGE;
}
if (!put_page(tsk,tmp,address))
if (!put_page(tsk,tmp,address,0))
free_page(tmp);
}
......@@ -573,23 +585,25 @@ static int try_to_share(unsigned long address, struct task_struct * tsk,
return 0;
if (mem_map[MAP_NR(phys_addr)] & MAP_PAGE_RESERVED)
return 0;
/* share them: write-protect */
*(unsigned long *) from_page &= ~2;
invalidate();
phys_addr >>= PAGE_SHIFT;
mem_map[phys_addr]++;
to = *(unsigned long *) to_page;
if (!(to & 1)) {
to = get_free_page(GFP_KERNEL);
if (!to)
if (!to) {
mem_map[phys_addr]--;
return 0;
}
*(unsigned long *) to_page = to | PAGE_ACCESSED | 7;
}
to &= 0xfffff000;
to_page = to + ((address>>10) & 0xffc);
if (1 & *(unsigned long *) to_page)
panic("try_to_share: to_page already exists");
/* share them: write-protect */
*(unsigned long *) from_page &= ~2;
*(unsigned long *) to_page = *(unsigned long *) from_page;
invalidate();
phys_addr >>= PAGE_SHIFT;
mem_map[phys_addr]++;
return 1;
}
......@@ -719,7 +733,7 @@ void do_no_page(unsigned long error_code, unsigned long address,
page = get_free_page(GFP_KERNEL);
if (!page) {
oom(current);
put_page(tsk,BAD_PAGE,address);
put_page(tsk,BAD_PAGE,address,0);
return;
}
if (block) {
......@@ -739,7 +753,7 @@ void do_no_page(unsigned long error_code, unsigned long address,
tmp--;
*(char *)tmp = 0;
}
if (put_page(tsk,page,address))
if (put_page(tsk,page,address,CODE_SPACE(address, tsk)))
return;
free_page(page);
oom(current);
......
/* Space.c */
/* Holds initial configuration information for devices. */
/* $Id: Space.c,v 0.8.4.2 1992/11/10 10:38:48 bir7 Exp $ */
/* $Log: Space.c,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.2 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added Id
*
*/
#include "dev.h"
#include <linux/stddef.h>
......
......@@ -19,6 +19,18 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: arp.c,v 0.8.4.2 1992/11/10 10:38:48 bir7 Exp $ */
/* $Log: arp.c,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.3 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$
*
*/
#include <linux/types.h>
#include <linux/string.h>
......@@ -308,14 +320,14 @@ arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
/* if this test doesn't pass, something fishy is going on. */
if (arp->hlen != dev->addr_len || dev->type !=NET16( arp->hrd))
{
free_skb(skb, FREE_READ);
kfree_skb(skb, FREE_READ);
return (0);
}
/* for now we will only deal with ip addresses. */
if (arp->pro != NET16(ARP_IP_PROT) || arp->plen != 4)
{
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
return (0);
}
......@@ -330,7 +342,7 @@ arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
if (!my_ip_addr(*arp_targetp(arp)))
{
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
return (0);
}
......@@ -342,13 +354,13 @@ arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
if (arp->op != NET16(ARP_REQUEST))
{
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
return (0);
}
/* now we need to create a new packet. */
ret = arp_response(arp, dev);
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
return (ret);
}
......
......@@ -19,6 +19,18 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: arp.h,v 0.8.4.1 1992/11/10 00:17:18 bir7 Exp $ */
/* $Log: arp.h,v $
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.2 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$ and $Log: arp.h,v $
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*.
* */
#ifndef _TCP_ARP_H
#define _TCP_ARP_H
......
......@@ -19,6 +19,18 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: dev.c,v 0.8.4.2 1992/11/10 10:38:48 bir7 Exp $ */
/* $Log: dev.c,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.5 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$
*
*/
#include <asm/segment.h>
#include <asm/system.h>
......@@ -124,7 +136,8 @@ dev_queue_xmit (struct sk_buff *skb, struct device *dev, int pri)
if (skb->next != NULL)
{
/* printk ("retransmitted packet still on queue. \n");*/
/* make sure we haven't missed an interrupt. */
dev->hard_start_xmit (NULL, dev);
return;
}
......@@ -314,7 +327,7 @@ dev_rint(unsigned char *buff, unsigned long len, int flags,
if (!flag)
{
PRINTK ("discarding packet type = %X\n", type);
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
}
if (buff == NULL)
......@@ -384,7 +397,7 @@ dev_tint(unsigned char *buff, struct device *dev)
if (skb->free)
{
free_skb(skb, FREE_WRITE);
kfree_skb(skb, FREE_WRITE);
}
if (tmp != 0)
......
......@@ -19,6 +19,18 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: dev.h,v 0.8.4.1 1992/11/10 00:17:18 bir7 Exp $ */
/* $Log: dev.h,v $
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.2 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$ and $Log: dev.h,v $
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*.
* */
#ifndef _TCP_DEV_H
#define _TCP_DEV_H
/* for future expansion when we will have different priorities. */
......
......@@ -19,6 +19,19 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: eth.c,v 0.8.4.2 1992/11/10 10:38:48 bir7 Exp $ */
/* $Log: eth.c,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.2 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$
*
*
*/
#include <asm/segment.h>
#include <asm/system.h>
......
......@@ -19,7 +19,17 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: eth.h,v 0.8.4.1 1992/11/10 00:17:18 bir7 Exp $ */
/* $Log: eth.h,v $
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.2 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$ and $Log: eth.h,v $
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*.
* */
#ifndef _TCP_ETH_H
#define _TCP_ETH_H
......
......@@ -23,6 +23,18 @@
The author of this file may be reached at rth@sparta.com or Sparta, Inc.
7926 Jones Branch Dr. Suite 900, McLean Va 22102.
*/
/* $Id: icmp.c,v 0.8.4.2 1992/11/10 10:38:48 bir7 Exp $ */
/* $Log: icmp.c,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.3 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$ and
*
*/
/* modified by Ross Biro bir7@leland.stanford.edu to do more than just
echo responses. */
......@@ -107,7 +119,7 @@ icmp_reply (struct sk_buff *skb_in, int type, int code, struct device *dev)
if (offset < 0)
{
skb->sk = NULL;
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
return;
}
......@@ -142,7 +154,7 @@ icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt,
if ((daddr & 0xff000000) == 0 || (daddr & 0xff000000) == 0xff000000)
{
skb1->sk = NULL;
free_skb (skb1, FREE_READ);
kfree_skb (skb1, FREE_READ);
return (0);
}
......@@ -158,7 +170,7 @@ icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt,
/* Failed checksum! */
PRINTK("\nICMP ECHO failed checksum!");
skb1->sk = NULL;
free_skb (skb1, FREE_READ);
kfree_skb (skb1, FREE_READ);
return (0);
}
}
......@@ -191,7 +203,7 @@ icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt,
iph->daddr, iph->saddr, ipprot);
}
skb1->sk = NULL;
free_skb (skb1, FREE_READ);
kfree_skb (skb1, FREE_READ);
return (0);
}
......@@ -214,7 +226,7 @@ icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt,
add_route (rt);
}
skb1->sk = NULL;
free_skb (skb1, FREE_READ);
kfree_skb (skb1, FREE_READ);
return (0);
}
......@@ -227,7 +239,7 @@ icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt,
if (skb == NULL)
{
skb1->sk = NULL;
free_skb (skb1, FREE_READ);
kfree_skb (skb1, FREE_READ);
return (0);
}
skb->sk = NULL;
......@@ -242,7 +254,7 @@ icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt,
PRINTK("\nCould not build IP Header for ICMP ECHO Response");
kfree_s (skb->mem_addr, skb->mem_len);
skb1->sk = NULL;
free_skb (skb1, FREE_READ);
kfree_skb (skb1, FREE_READ);
return( 0 ); /* just toss the received packet */
}
......@@ -265,19 +277,19 @@ icmp_rcv(struct sk_buff *skb1, struct device *dev, struct options *opt,
ip_queue_xmit( (volatile struct sock *)NULL, dev, skb, 1 );
skb1->sk = NULL;
free_skb (skb1, FREE_READ);
kfree_skb (skb1, FREE_READ);
return( 0 );
default:
PRINTK("\nUnsupported ICMP type = x%x", icmph->type );
skb1->sk = NULL;
free_skb (skb1, FREE_READ);
kfree_skb (skb1, FREE_READ);
return( 0 ); /* just toss the packet */
}
/* should be unecessary, but just in case. */
skb1->sk = NULL;
free_skb (skb1, FREE_READ);
kfree_skb (skb1, FREE_READ);
return( 0 ); /* just toss the packet */
}
/* Internet Control Message Protocol (ICMP) header file */
/* $Id: icmp.h,v 0.8.4.1 1992/11/10 00:17:18 bir7 Exp $ */
/* $Log: icmp.h,v $
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.2 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added Id and Log
*
*/
#define ICMP_ECHOREPLY 0
#define ICMP_DEST_UNREACH 3
......
......@@ -19,6 +19,18 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: ip.c,v 0.8.4.2 1992/11/10 10:38:48 bir7 Exp $ */
/* $Log: ip.c,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.3 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$ and
*
*/
#include <asm/segment.h>
#include <asm/system.h>
......@@ -688,7 +700,7 @@ ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
{
PRINTK ("ip packet thrown out. \n");
skb->sk = NULL;
free_skb(skb, 0);
kfree_skb(skb, 0);
return (0);
}
......@@ -697,7 +709,7 @@ ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
{
PRINTK ("packet meant for someone else.\n");
skb->sk = NULL;
free_skb(skb, 0);
kfree_skb(skb, 0);
return (0);
}
......@@ -706,7 +718,7 @@ ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
{
printk ("packet fragmented. \n");
skb->sk = NULL;
free_skb(skb, 0);
kfree_skb(skb, 0);
return(0);
}
......@@ -748,7 +760,7 @@ ip_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt)
{
icmp_reply (skb, ICMP_DEST_UNREACH, ICMP_PROT_UNREACH, dev);
skb->sk = NULL;
free_skb (skb, 0);
kfree_skb (skb, 0);
}
......@@ -813,7 +825,7 @@ ip_queue_xmit (volatile struct sock *sk, struct device *dev,
else
{
if (free)
free_skb (skb, FREE_WRITE);
kfree_skb (skb, FREE_WRITE);
}
}
......@@ -923,7 +935,7 @@ ip_handoff (volatile struct sock *sk)
p->handler ((unsigned char *)(skb+1), skb->dev, NULL, skb->saddr,
skb->len, skb->daddr, p->protocol, 0);
}
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock (sk);
return (0);
}
......
......@@ -19,6 +19,18 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: ip.h,v 0.8.4.1 1992/11/10 00:17:18 bir7 Exp $ */
/* $Log: ip.h,v $
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.2 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$ and $Log: ip.h,v $
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*.
* */
#ifndef _TCP_IP_H
#define _TCP_IP_H
......
......@@ -19,6 +19,18 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: loopback.c,v 0.8.4.2 1992/11/10 10:38:48 bir7 Exp $ */
/* $Log: loopback.c,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.2 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$ and
* */
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/sched.h>
......@@ -69,7 +81,7 @@ loopback_xmit(struct sk_buff *skb, struct device *dev)
done = dev_rint ((unsigned char *)(skb+1), skb->len, 0, dev);
if (skb->free)
free_skb (skb, FREE_WRITE);
kfree_skb (skb, FREE_WRITE);
while (done != 1)
{
......
......@@ -19,6 +19,17 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: pack_type.c,v 0.8.4.2 1992/11/10 10:38:48 bir7 Exp $ */
/* $Log: pack_type.c,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.2 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$
* */
#include <linux/stddef.h>
#include "dev.h"
......
......@@ -19,6 +19,17 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: packet.c,v 0.8.4.2 1992/11/10 10:38:48 bir7 Exp $ */
/* $Log: packet.c,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.3 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$
* */
#include <linux/types.h>
#include <linux/sched.h>
......@@ -64,7 +75,7 @@ packet_rcv (struct sk_buff *skb, struct device *dev, struct packet_type *pt)
Assume that the other end will retransmit if it was
important. */
skb->sk = NULL;
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
return (0);
}
......@@ -77,7 +88,7 @@ packet_rcv (struct sk_buff *skb, struct device *dev, struct packet_type *pt)
if (sk->rmem_alloc + skb->mem_len >= SK_RMEM_MAX)
{
skb->sk = NULL;
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
return (0);
}
......@@ -154,7 +165,7 @@ packet_sendto (volatile struct sock *sk, unsigned char *from, int len,
if (dev->up)
dev->queue_xmit (skb, dev, sk->priority);
else
free_skb (skb, FREE_WRITE);
kfree_skb (skb, FREE_WRITE);
return (len);
}
......@@ -264,7 +275,7 @@ packet_recvfrom (volatile struct sock *sk, unsigned char *to, int len,
if (!(flags & MSG_PEEK))
{
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
}
release_sock (sk);
......
/* protocols.c */
/* these headers are overkill, but until I clean up the socket header
files, this is the best way. */
/* $Id: protocols.c,v 0.8.4.2 1992/11/10 10:38:48 bir7 Exp $ */
/* $Log: protocols.c,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.2 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added Id and Log
*
*/
#include <asm/segment.h>
#include <asm/system.h>
#include <linux/types.h>
......
......@@ -19,6 +19,17 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: raw.c,v 0.8.4.2 1992/11/10 10:38:48 bir7 Exp $ */
/* $Log: raw.c,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.3 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$ and
* */
#include <linux/types.h>
#include <linux/sched.h>
......@@ -96,7 +107,7 @@ raw_rcv (struct sk_buff *skb, struct device *dev, struct options *opt,
if (sk->rmem_alloc + skb->mem_len >= SK_RMEM_MAX)
{
skb->sk = NULL;
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
return (0);
}
......@@ -319,7 +330,7 @@ raw_recvfrom (volatile struct sock *sk, unsigned char *to, int len,
if (!(flags & MSG_PEEK))
{
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
}
release_sock (sk);
return (copied);
......
......@@ -19,6 +19,18 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: sock.c,v 0.8.4.2 1992/11/10 10:38:48 bir7 Exp $ */
/* $Log: sock.c,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.5 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added Id and Log
* */
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/socket.h>
......@@ -183,7 +195,7 @@ lock_skb (struct sk_buff *skb)
void
free_skb (struct sk_buff *skb, int rw)
kfree_skb (struct sk_buff *skb, int rw)
{
if (skb->lock)
{
......@@ -216,7 +228,7 @@ unlock_skb (struct sk_buff *skb, int rw)
}
skb->lock = 0;
if (skb->free)
free_skb (skb, rw);
kfree_skb (skb, rw);
}
static int
......@@ -397,7 +409,7 @@ destroy_sock(volatile struct sock *sk)
{
struct sk_buff *skb2;
skb2=skb->next;
free_skb(skb, FREE_WRITE);
kfree_skb(skb, FREE_WRITE);
skb=skb2;
}
......@@ -417,7 +429,7 @@ destroy_sock(volatile struct sock *sk)
skb->sk->dead = 1;
skb->sk->prot->close (skb->sk, 0);
}
free_skb(skb, FREE_READ);
kfree_skb(skb, FREE_READ);
skb=skb2;
} while (skb != sk->rqueue);
}
......@@ -453,7 +465,7 @@ destroy_sock(volatile struct sock *sk)
}
sti();
skb2=skb->link3;
free_skb(skb, FREE_WRITE);
kfree_skb(skb, FREE_WRITE);
skb=skb2;
}
......@@ -470,7 +482,7 @@ destroy_sock(volatile struct sock *sk)
do {
struct sk_buff *skb2;
skb2=skb->next;
free_skb(skb, FREE_READ);
kfree_skb(skb, FREE_READ);
skb=skb2;
} while (skb != sk->back_log);
sti();
......@@ -478,6 +490,14 @@ destroy_sock(volatile struct sock *sk)
sk->back_log = NULL;
/* Now if it has a half accepted/ closed socket. */
if (sk->pair)
{
sk->pair->dead = 1;
sk->pair->prot->close (sk, 0);
sk->pair = NULL;
}
/* now if everything is gone we can free the socket structure,
otherwise we need to keep it around until everything is gone. */
if (sk->rmem_alloc == 0 && sk->wmem_alloc == 0)
......@@ -559,7 +579,7 @@ ip_proto_setsockopt(struct socket *sock, int level, int optname,
if (val)
sk->reuse = 1;
else
sk->reuse = 1;
sk->reuse = 0;
return (0);
case SO_KEEPALIVE:
......
......@@ -19,6 +19,23 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: sock.h,v 0.8.4.2 1992/11/10 10:38:48 bir7 Exp $ */
/* $Log: sock.h,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.4 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$ and $Log: sock.h,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*.
* */
#ifndef _TCP_SOCK_H
#define _TCP_SOCK_H
......@@ -177,7 +194,7 @@ void sock_wfree(volatile struct sock *sk, void *mem, unsigned long size);
void sock_rfree(volatile struct sock *sk, void *mem, unsigned long size);
unsigned long sock_rspace(volatile struct sock *sk);
unsigned long sock_wspace(volatile struct sock *sk);
void free_skb (struct sk_buff *skb, int rw);
void kfree_skb (struct sk_buff *skb, int rw);
void lock_skb (struct sk_buff *skb);
void unlock_skb (struct sk_buff *skb, int rw);
......
......@@ -19,6 +19,17 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: tcp.c,v 0.8.4.2 1992/11/10 10:38:48 bir7 Exp $ */
/* $Log: tcp.c,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.3 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$ and
* */
#include <linux/types.h>
#include <linux/sched.h>
......@@ -733,7 +744,7 @@ cleanup_rbuf (volatile struct sock *sk)
skb->prev->next = skb->next;
}
skb->sk = sk;
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
}
/* at this point we should send an ack if the difference in
the window, and the amount of space is bigger than
......@@ -1075,7 +1086,7 @@ tcp_conn_request(volatile struct sock *sk, struct sk_buff *skb,
{
PRINTK ("tcp_conn_request on dead socket\n");
tcp_reset (daddr, saddr, th, sk->prot, opt, dev);
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
return;
}
......@@ -1090,7 +1101,7 @@ tcp_conn_request(volatile struct sock *sk, struct sk_buff *skb,
if (newsk == NULL)
{
/* just ignore the syn. It will get retransmitted. */
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
return;
}
......@@ -1173,7 +1184,7 @@ tcp_conn_request(volatile struct sock *sk, struct sk_buff *skb,
sk->err = -ENOMEM;
newsk->dead = 1;
release_sock (newsk);
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
return;
}
......@@ -1196,7 +1207,7 @@ tcp_conn_request(volatile struct sock *sk, struct sk_buff *skb,
newsk->dead = 1;
release_sock (newsk);
skb->sk = sk;
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
return;
}
......@@ -1283,7 +1294,7 @@ tcp_close (volatile struct sock *sk, int timeout)
skb = sk->rqueue;
do {
skb2=skb->next;
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
skb=skb2;
} while (skb != sk->rqueue);
need_reset = 1;
......@@ -1490,7 +1501,7 @@ tcp_ack (volatile struct sock *sk, struct tcp_header *th, unsigned long saddr)
}
}
}
free_skb (oskb, FREE_WRITE); /* write. */
kfree_skb (oskb, FREE_WRITE); /* write. */
sti();
if (!sk->dead)
wake_up(sk->sleep);
......@@ -1601,7 +1612,7 @@ tcp_data (struct sk_buff *skb, volatile struct sock *sk,
/* don't want to keep passing ack's back and fourth. */
if (!th->ack)
tcp_send_ack (sk->send_seq, sk->acked_seq,sk, th, saddr);
free_skb(skb, FREE_READ);
kfree_skb(skb, FREE_READ);
return (0);
}
......@@ -1610,7 +1621,7 @@ tcp_data (struct sk_buff *skb, volatile struct sock *sk,
/* just ack everything. */
sk->acked_seq = th->seq + skb->len + th->syn + th->fin;
tcp_send_ack (sk->send_seq, sk->acked_seq, sk, skb->h.th, saddr);
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
if (sk->state == TCP_TIME_WAIT && sk->acked_seq == sk->fin_seq)
{
if (!sk->dead) wake_up (sk->sleep);
......@@ -1944,7 +1955,7 @@ tcp_accept (volatile struct sock *sk, int flags)
/* now all we need to do is return skb->sk. */
newsk = skb->sk;
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock (sk);
return (newsk);
}
......@@ -2144,7 +2155,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
if (th->check && tcp_check (th, len, saddr, daddr ))
{
skb->sk = NULL;
free_skb (skb, 0);
kfree_skb (skb, 0);
/* we don't release the socket because it was never
marked in use. */
return (0);
......@@ -2156,7 +2167,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
if (!th->rst)
tcp_reset (daddr, saddr, th, &tcp_prot, opt,dev);
skb->sk = NULL;
free_skb (skb, 0);
kfree_skb (skb, 0);
return (0);
}
......@@ -2214,7 +2225,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
if (sk->rmem_alloc + skb->mem_len >= SK_RMEM_MAX)
{
skb->sk = NULL;
free_skb (skb, 0);
kfree_skb (skb, 0);
release_sock (sk);
return (0);
}
......@@ -2238,7 +2249,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
{
wake_up (sk->sleep);
}
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
}
......@@ -2250,7 +2261,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
if (!tcp_sequence (sk, th, len, opt, saddr))
{
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
}
......@@ -2263,7 +2274,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
{
wake_up (sk->sleep);
}
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
}
......@@ -2276,7 +2287,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
{
wake_up (sk->sleep);
}
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
}
......@@ -2285,7 +2296,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
{
if(!tcp_ack (sk, th, saddr))
{
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
}
......@@ -2294,7 +2305,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
{
if (tcp_urg (sk, th, saddr))
{
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
}
......@@ -2302,7 +2313,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
if ( tcp_data (skb, sk, saddr, len))
{
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
}
......@@ -2322,7 +2333,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
if (sk->dead || sk->daddr)
{
PRINTK ("packet received for closed,dead socket\n");
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock (sk);
return (0);
}
......@@ -2333,21 +2344,21 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
th->ack_seq=0;
tcp_reset (daddr, saddr, th, sk->prot, opt,dev);
}
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
case TCP_LISTEN:
if (th->rst)
{
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
}
if (th->ack)
{
tcp_reset (daddr, saddr, th, sk->prot, opt,dev );
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
}
......@@ -2372,14 +2383,14 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
return (0);
}
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
default:
if (!tcp_sequence (sk, th, len, opt, saddr))
{
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
}
......@@ -2393,7 +2404,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
{
wake_up (sk->sleep);
}
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
}
......@@ -2406,7 +2417,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
{
wake_up (sk->sleep);
}
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
} */
......@@ -2418,7 +2429,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
sk->state = TCP_SYN_RECV;
}
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
}
......@@ -2429,7 +2440,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
if (!tcp_ack(sk, th, saddr))
{
tcp_reset(daddr, saddr, th, sk->prot, opt,dev);
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
}
......@@ -2439,7 +2450,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
if (!th->syn)
{
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock (sk);
return (0);
}
......@@ -2454,7 +2465,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
if (!tcp_ack(sk, th, saddr))
{
tcp_reset(daddr, saddr, th, sk->prot, opt, dev);
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
}
......@@ -2477,12 +2488,12 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
if (th->urg)
if (tcp_urg (sk, th, saddr))
{
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock(sk);
return (0);
}
if (tcp_data (skb, sk, saddr, len))
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
if (th->fin)
tcp_fin(sk, th, saddr, dev);
......@@ -2495,7 +2506,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
{
if (tcp_urg (sk, th, saddr))
{
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock (sk);
return (0);
}
......@@ -2503,7 +2514,7 @@ tcp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
if (tcp_data (skb, sk, saddr, len))
{
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
release_sock (sk);
return (0);
}
......
......@@ -19,6 +19,18 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: tcp.h,v 0.8.4.1 1992/11/10 00:17:18 bir7 Exp $ */
/* $Log: tcp.h,v $
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.2 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$ and $Log: tcp.h,v $
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*.
* */
#ifndef _TCP_TCP_H
#define _TCP_TCP_H
......
......@@ -19,6 +19,19 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: timer.c,v 0.8.4.2 1992/11/10 10:38:48 bir7 Exp $ */
/* $Log: timer.c,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.2 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$ and
* */
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/socket.h>
......
......@@ -19,6 +19,18 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: timer.h,v 0.8.4.1 1992/11/10 00:17:18 bir7 Exp $ */
/* $Log: timer.h,v $
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.2 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$ and $Log: timer.h,v $
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*.
* */
#ifndef _TCP_TIMER_H
#define _TCP_TIMER_H
......
......@@ -19,6 +19,17 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: udp.c,v 0.8.4.2 1992/11/10 10:38:48 bir7 Exp $ */
/* $Log: udp.c,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.5 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$ and
* */
#include <linux/types.h>
#include <linux/sched.h>
......@@ -44,6 +55,11 @@
static void
print_uh(struct udp_header *uh)
{
if (uh == NULL)
{
PRINTK ("(NULL)\n");
return;
}
PRINTK("source = %d, dest = %d\n", net16(uh->source), net16(uh->dest));
PRINTK("len = %d, check = %d\n", net16(uh->len), net16(uh->check));
}
......@@ -511,7 +527,7 @@ udp_recvfrom (volatile struct sock *sk, unsigned char *to, int len,
if (!(flags & MSG_PEEK))
{
free_skb (skb, FREE_READ);
kfree_skb (skb, FREE_READ);
}
release_sock (sk);
return (copied);
......@@ -576,7 +592,7 @@ udp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
icmp_reply (skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, dev);
}
skb->sk = NULL;
free_skb (skb, 0);
kfree_skb (skb, 0);
return (0);
}
......@@ -587,7 +603,7 @@ udp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
{
PRINTK ("bad udp checksum\n");
skb->sk = NULL;
free_skb (skb, 0);
kfree_skb (skb, 0);
return (0);
}
......@@ -627,7 +643,7 @@ udp_rcv(struct sk_buff *skb, struct device *dev, struct options *opt,
if (sk->rmem_alloc + skb->mem_len >= SK_RMEM_MAX)
{
skb->sk = NULL;
free_skb (skb, 0);
kfree_skb (skb, 0);
release_sock (sk);
return (0);
}
......
......@@ -19,6 +19,18 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: udp.h,v 0.8.4.1 1992/11/10 00:17:18 bir7 Exp $ */
/* $Log: udp.h,v $
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.2 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$ and $Log: udp.h,v $
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*.
* */
#ifndef _TCP_UDP_H
#define _TCP_UDP_H
......
......@@ -44,6 +44,18 @@
/* Note: My driver was full of bugs. Basically if it works, credit
Bob Harris. If it's broken blame me. -RAB */
/* $Id: we.c,v 0.8.4.2 1992/11/10 10:38:48 bir7 Exp $ */
/* $Log: we.c,v $
* Revision 0.8.4.2 1992/11/10 10:38:48 bir7
* Change free_s to kfree_s and accidently changed free_skb to kfree_skb.
*
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.4 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$ and Log
* */
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/sched.h>
......@@ -93,6 +105,8 @@ static unsigned char wd_debug = 0; /* turns on/off debug messages */
static unsigned char dconfig = WD_DCONFIG; /* default data configuration */
static int tx_aborted = 0; /* Empties tx bit bucket */
static void wd_trs (struct device *);
static int
max(int a, int b)
{
......@@ -186,6 +200,7 @@ wd8003_start_xmit(struct sk_buff *skb, struct device *dev)
{
unsigned char cmd;
int len;
cli();
if (status & TRS_BUSY)
{
......@@ -197,6 +212,12 @@ wd8003_start_xmit(struct sk_buff *skb, struct device *dev)
status |= TRS_BUSY;
sti();
if (skb == NULL)
{
wd_trs(dev);
return (0);
}
if (!skb->arp)
{
if ( dev->rebuild_header (skb+1, dev))
......@@ -234,7 +255,7 @@ wd8003_start_xmit(struct sk_buff *skb, struct device *dev)
if (skb->free)
{
free_skb (skb, FREE_WRITE);
kfree_skb (skb, FREE_WRITE);
}
return (0);
......@@ -496,7 +517,7 @@ wd8003_interrupt(int reg_ptr)
status |= IN_INT;
do{ /* find out who called */
sti();
/* Check for overrunning receive buffer first */
if ( ( isr = inb_p( ISR ) ) & OVW ) { /* Receiver overwrite warning */
stats.rx_over_errors++;
......@@ -565,7 +586,7 @@ wd8003_interrupt(int reg_ptr)
if( ++count > max_pages + 1 ){
printk("\nwd8013_interrupt - infinite loop detected, isr = x%x, count = %d", isr, count );
}
cli();
} while( inb_p( ISR ) != 0 );
status &= ~IN_INT;
......
......@@ -19,6 +19,18 @@
The Author may be reached as bir7@leland.stanford.edu or
C/O Department of Mathematics; Stanford University; Stanford, CA 94305
*/
/* $Id: wereg.h,v 0.8.4.1 1992/11/10 00:17:18 bir7 Exp $ */
/* $Log: wereg.h,v $
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*
* Revision 0.8.3.2 1992/11/10 00:14:47 bir7
* Changed malloc to kmalloc and added $iId$ and $Log: wereg.h,v $
* Revision 0.8.4.1 1992/11/10 00:17:18 bir7
* version change only.
*.
* */
/* This is based on if_wereg.h from bsd386 */
/* Uncomment the next line if you are having troubles with your
......
......@@ -329,7 +329,7 @@ unix_proto_bind(struct socket *sock, struct sockaddr *umyaddr,
PRINTK("unix_proto_bind: socket 0x%x, len=%d\n", sock,
sockaddr_len);
if (sockaddr_len <= UN_PATH_OFFSET ||
sockaddr_len >= sizeof(struct sockaddr_un)) {
sockaddr_len > sizeof(struct sockaddr_un)) {
PRINTK("unix_proto_bind: bad length %d\n", sockaddr_len);
return -EINVAL;
}
......@@ -381,7 +381,7 @@ unix_proto_connect(struct socket *sock, struct sockaddr *uservaddr,
PRINTK("unix_proto_connect: socket 0x%x, servlen=%d\n", sock,
sockaddr_len);
if (sockaddr_len <= UN_PATH_OFFSET ||
sockaddr_len >= sizeof(struct sockaddr_un)) {
sockaddr_len > sizeof(struct sockaddr_un)) {
PRINTK("unix_proto_connect: bad length %d\n", sockaddr_len);
return -EINVAL;
}
......
#define UTS_RELEASE "0.98.pl4-27"
#define UTS_VERSION "11/01/92"
#define LINUX_COMPILE_TIME "14:57:39"
#define UTS_RELEASE "0.98.pl4+-34"
#define UTS_VERSION "11/14/92"
#define LINUX_COMPILE_TIME "12:19:20"
#define LINUX_COMPILE_BY "root"
#define LINUX_COMPILE_HOST "home"
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