Patches v 2.0.17

Alan Cox (alan@lxorguk.ukuu.org.uk)
Thu, 5 Sep 96 00:13 BST


*
* Patches against 2.0.17
*
* 1. Tidy some of the TLB code for SMP up. Only generates
* different code if you enable some defines in the kernel
* that I don't want to touch until 2.1
* 2. Puts the old IRQ handler back that uses 060 not 0xE0. That
* works, as does the 2.0.14 irq handler (weird)
* 3. Tidy the serial console. If /dev/tty1 cannot be opened we
* try to open /dev/ttyS0. Handy on the Sparc, useless for now
* on the PC as the console driver doesnt check for no card
* present. (It should do!)
* 4. ICMP TOS fix from Alexey
* 5. Raw socket protocol type byte order fix
* 6. TCP sends SIGPIPE in a case previously missed
* 7. AF_UNIX SOCK_STREAM sends SIGPIPE and handles shutdown
* right.
*

diff --unified --new-file --exclude-from exclude --recursive linux.vanilla/arch/i386/mm/init.c linux/arch/i386/mm/init.c
--- linux.vanilla/arch/i386/mm/init.c Sun Jul 28 13:34:30 1996
+++ linux/arch/i386/mm/init.c Mon Aug 26 11:02:49 1996
@@ -198,7 +198,11 @@
address += PAGE_SIZE;
}
}
- flush_tlb();
+ /*
+ * We must use local_flush_tlb as current and the vma's are
+ * not yet valid.
+ */
+ local_flush_tlb();
return free_area_init(start_mem, end_mem);
}

@@ -275,7 +279,7 @@
flush_tlb();
__asm__ __volatile__("movb 0,%%al ; movb %%al,0": : :"ax", "memory");
pg0[0] = 0;
- flush_tlb();
+ local_flush_tlb();
if (wp_works_ok < 0)
wp_works_ok = 0;
}
diff --unified --new-file --exclude-from exclude --recursive linux.vanilla/include/asm-i386/irq.h linux/include/asm-i386/irq.h
--- linux.vanilla/include/asm-i386/irq.h Tue Sep 3 22:07:29 1996
+++ linux/include/asm-i386/irq.h Wed Sep 4 23:17:48 1996
@@ -90,7 +90,7 @@
"outb %al,$0x21\n\t" \
"jmp 1f\n" \
"1:\tjmp 1f\n" \
- "1:\tmovb $0xE0+"#nr",%al\n\t" \
+ "1:\tmovb $0x60+"#nr",%al\n\t" \
"outb %al,$0x20\n\t"

#define ACK_SECOND(mask,nr) \
@@ -102,11 +102,11 @@
"outb %al,$0xA1\n\t" \
"jmp 1f\n" \
"1:\tjmp 1f\n" \
- "1:\tmovb $0xE0+"#nr",%al\n\t" \
+ "1:\tmovb $0x60+"#nr",%al\n\t" \
"outb %al,$0xA0\n\t" \
"jmp 1f\n" \
"1:\tjmp 1f\n" \
- "1:\tmovb $0xE2,%al\n\t" \
+ "1:\tmovb $0x62,%al\n\t" \
"outb %al,$0x20\n\t"

#define UNBLK_FIRST(mask) \
diff --unified --new-file --exclude-from exclude --recursive linux.vanilla/include/asm-i386/pgtable.h linux/include/asm-i386/pgtable.h
--- linux.vanilla/include/asm-i386/pgtable.h Sun Jul 28 13:33:02 1996
+++ linux/include/asm-i386/pgtable.h Wed Sep 4 22:58:33 1996
@@ -53,6 +53,7 @@

#define flush_tlb() __flush_tlb()
#define flush_tlb_all() __flush_tlb()
+#define local_flush_tlb() __flush_tlb()

static inline void flush_tlb_mm(struct mm_struct *mm)
{
diff --unified --new-file --exclude-from exclude --recursive linux.vanilla/init/main.c linux/init/main.c
--- linux.vanilla/init/main.c Tue Sep 3 22:07:26 1996
+++ linux/init/main.c Wed Sep 4 23:19:41 1996
@@ -959,8 +959,17 @@
}
}
#endif
+
+ /*
+ * This keeps serial console MUCH cleaner, but does assume
+ * the console driver checks there really is a video device
+ * attached (Sparc effectively does).
+ */

- (void) open("/dev/tty1",O_RDWR,0);
+ if(open("/dev/tty1",O_RDWR,0)<0)
+ if(open("/dev/ttyS0",O_RDWR, 0)<0)
+ printk("Unable to open a initial console.\n");
+
(void) dup(0);
(void) dup(0);

diff --unified --new-file --exclude-from exclude --recursive linux.vanilla/net/ipv4/icmp.c linux/net/ipv4/icmp.c
--- linux.vanilla/net/ipv4/icmp.c Sun Jul 28 13:33:18 1996
+++ linux/net/ipv4/icmp.c Mon Aug 26 09:59:23 1996
@@ -618,7 +618,9 @@
* Build and send the packet.
*/

- icmp_build_xmit(&icmp_param, saddr, iph->saddr, ((iph->tos & 0x38) | 6));
+ icmp_build_xmit(&icmp_param, saddr, iph->saddr,
+ icmp_pointers[type].error ?
+ (iph->tos & 0x1E) | 0xC0 : iph->tos);
}


diff --unified --new-file --exclude-from exclude --recursive linux.vanilla/net/ipv4/raw.c linux/net/ipv4/raw.c
--- linux.vanilla/net/ipv4/raw.c Sun Jul 28 13:33:18 1996
+++ linux/net/ipv4/raw.c Mon Aug 26 10:00:51 1996
@@ -236,6 +236,10 @@
memcpy(&sin, usin, sizeof(sin));
if (sin.sin_family && sin.sin_family != AF_INET)
return(-EINVAL);
+ /*
+ * Protocol type is host ordered byte.
+ */
+ sin.sin_port=ntohs(sin.sin_port);
}
else
{
diff --unified --new-file --exclude-from exclude --recursive linux.vanilla/net/ipv4/tcp.c linux/net/ipv4/tcp.c
--- linux.vanilla/net/ipv4/tcp.c Tue Sep 3 22:07:21 1996
+++ linux/net/ipv4/tcp.c Wed Sep 4 23:17:48 1996
@@ -958,6 +958,7 @@
{
if (copied)
return copied;
+ send_sig(SIGPIPE,current,0);
return -EPIPE;
}

diff --unified --new-file --exclude-from exclude --recursive linux.vanilla/net/unix/af_unix.c linux/net/unix/af_unix.c
--- linux.vanilla/net/unix/af_unix.c Sun Jul 28 13:33:15 1996
+++ linux/net/unix/af_unix.c Sun Sep 1 00:27:07 1996
@@ -863,6 +863,12 @@
return -EINVAL;
}

+ if(sk->shutdown&SEND_SHUTDOWN)
+ {
+ send_sig(SIGPIPE,current,0);
+ return -EPIPE;
+ }
+
if(sunaddr!=NULL)
{
if(sock->type==SOCK_STREAM)
@@ -973,8 +979,27 @@
sock->state=SS_UNCONNECTED;
sti();
kfree_skb(skb, FREE_WRITE);
+ /*
+ * Check with 1003.1g - what should
+ * datagram error
+ */
if(!sent)
return -ECONNRESET;
+ else
+ return sent;
+ }
+ /*
+ * Stream sockets SIGPIPE
+ */
+ if(sock->type==SOCK_STREAM && other->dead)
+ {
+ kfree_skb(skb, FREE_WRITE);
+ sti();
+ if(!sent)
+ {
+ send_sig(SIGPIPE,current,0);
+ return -EPIPE;
+ }
else
return sent;
}