Linux-kernel mailing list archive 1997-48,: Re: 2.1.68 brokenness.

# Re: 2.1.68 brokenness.

Theodore Y. Ts'o (tytso@MIT.EDU)
Mon, 1 Dec 1997 09:32:15 -0500

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: PARMELAN Edouard: "de4x5.c V0.53 and SMC9332BDT"
- Previous message: Theodore Y. Ts'o: "Serial patches for 2.1.68"
- In reply to: Alex Priem: "Re: 2.1.68 brokenness."
- Next in thread: Gary White: "Re: 2.1.68 brokenness."

Date: Mon, 01 Dec 1997 10:33:30 +0100
From: Alex Priem <alexp@sci.kun.nl>

>Indeed. The signal stuff also breaks some of the other Linux platforms
>(essentially everything but x86 and alpha).

Also breaks user level stuff, when including <signal.h> (libc5):

The problem is that include/asm-i386/signal.h is trying to define
sigmask and other inline functions like sigaddset, etc. Here are
patches which fix this versus 2.1.68, as well as a few other cases where
the kernel header files are polluting the namespace unnecessarily when
they are included by non-kernel programs.

(Linus, I sent you some of these patches earlier, versus 2.1.65, but
they never got included. I believe that they are all safe; the only
place where there might be some danger is where I added a volatile
declaration in casts where the function prototype expected a volatile
pointer, but since I was adding the volatile keyword, not taking it
away, this shouldn't cause a problem. All of that was to clean up some
gcc -Wall complaints.)

- Ted

Patch generated: on Mon Dec 1 09:27:56 EST 1997 by tytso@rsts-11
against Linux version 2.1.68
===================================================================
RCS file: include/asm/RCS/signal.h,v
retrieving revision 1.1
diff -u -r1.1 include/asm/signal.h
--- include/asm/signal.h 1997/12/01 12:10:46 1.1
+++ include/asm/signal.h 1997/12/01 12:12:55
@@ -89,6 +89,7 @@
#define SA_RESTORER 0x04000000
#ifdef __KERNEL__
+
/*
* These values of sa_flags are used only by the kernel as part of the
* irq handling routines.
@@ -138,7 +139,6 @@
#ifdef __KERNEL__
#include <asm/sigcontext.h>
-#endif
#define __HAVE_ARCH_SIG_BITOPS
@@ -178,5 +178,7 @@
__asm__("bsfl %1,%0" : "=r"(word) : "rm"(word) : "cc");
return word;
}
+
+#endif
#endif
===================================================================
RCS file: include/linux/RCS/list.h,v
retrieving revision 1.1
diff -u -r1.1 include/linux/list.h
--- include/linux/list.h 1997/12/01 01:51:08 1.1
+++ include/linux/list.h 1997/12/01 01:51:18
@@ -1,6 +1,8 @@
#ifndef _LINUX_LIST_H
#define _LINUX_LIST_H
+#ifdef __KERNEL__
+
/*
* Simple doubly linked list implementation.
*
@@ -28,7 +30,7 @@
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
-static inline void __list_add(struct list_head * new,
+static __inline__ void __list_add(struct list_head * new,
struct list_head * prev,
struct list_head * next)
{
@@ -41,7 +43,7 @@
/*
* Insert a new entry after the specified head..
*/
-static inline void list_add(struct list_head *new, struct list_head *head)
+static __inline__ void list_add(struct list_head *new, struct list_head *head)
{
__list_add(new, head, head->next);
}
@@ -53,18 +55,19 @@
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
-static inline void __list_del(struct list_head * prev, struct list_head * next)
+static __inline__ void __list_del(struct list_head * prev,
+ struct list_head * next)
{
next->prev = prev;
prev->next = next;
}
-static inline void list_del(struct list_head *entry)
+static __inline__ void list_del(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
}
-static inline int list_empty(struct list_head *head)
+static __inline__ int list_empty(struct list_head *head)
{
return head->next == head;
}
@@ -72,7 +75,7 @@
/*
* Splice in "list" into "head"
*/
-static inline void list_splice(struct list_head *list, struct list_head *head)
+static __inline__ void list_splice(struct list_head *list, struct list_head *head)
{
struct list_head *first = list->next;
@@ -90,5 +93,7 @@
#define list_entry(ptr, type, member) \
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
+
+#endif /* __KERNEL__ */
#endif
===================================================================
RCS file: include/linux/RCS/dcache.h,v
retrieving revision 1.1
diff -u -r1.1 include/linux/dcache.h
--- include/linux/dcache.h 1997/12/01 01:51:08 1.1
+++ include/linux/dcache.h 1997/12/01 01:51:18
@@ -1,6 +1,8 @@
#ifndef __LINUX_DCACHE_H
#define __LINUX_DCACHE_H
+#ifdef __KERNEL__
+
/*
* linux/include/linux/dcache.h
*
@@ -25,14 +27,14 @@
#define init_name_hash() 0
/* partial hash update function. Assume roughly 4 bits per character */
-static inline unsigned long partial_name_hash(unsigned char c, unsigned long prevhash)
+static __inline__ unsigned long partial_name_hash(unsigned char c, unsigned long prevhash)
{
prevhash = (prevhash << 4) | (prevhash >> (8*sizeof(unsigned long)-4));
return prevhash ^ c;
}
/* Finally: cut down the number of bits to a int value (and try to avoid losing bits) */
-static inline unsigned long end_name_hash(unsigned long hash)
+static __inline__ unsigned long end_name_hash(unsigned long hash)
{
if (sizeof(hash) > sizeof(unsigned int))
hash += hash >> 4*sizeof(hash);
@@ -40,7 +42,7 @@
}
/* Compute the hash for a name string. */
-static inline unsigned int full_name_hash(const char * name, unsigned int len)
+static __inline__ unsigned int full_name_hash(const char * name, unsigned int len)
{
unsigned long hash = init_name_hash();
while (len--)
@@ -102,7 +104,7 @@
* to invalidate a dentry for some reason (NFS
* timeouts or autofs deletes).
*/
-static inline void d_drop(struct dentry * dentry)
+static __inline__ void d_drop(struct dentry * dentry)
{
list_del(&dentry->d_hash);
INIT_LIST_HEAD(&dentry->d_hash);
@@ -152,7 +154,7 @@
extern char * d_path(struct dentry * entry, char * buf, int buflen);
/* Allocation counts.. */
-static inline struct dentry * dget(struct dentry *dentry)
+static __inline__ struct dentry * dget(struct dentry *dentry)
{
if (dentry)
dentry->d_count++;
@@ -160,5 +162,7 @@
}
extern void dput(struct dentry *);
+
+#endif /* __KERNEL__ */
#endif /* __LINUX_DCACHE_H */
===================================================================
RCS file: include/asm-i386/RCS/atomic.h,v
retrieving revision 1.1
diff -u -r1.1 include/asm-i386/atomic.h
--- include/asm-i386/atomic.h 1997/12/01 01:51:08 1.1
+++ include/asm-i386/atomic.h 1997/12/01 01:51:18
@@ -17,7 +17,7 @@
* on us. We need to use _exactly_ the address the user gave us,
* not some alias that contains the same information.
*/
-#define __atomic_fool_gcc(x) (*(struct { int a[100]; } *)x)
+#define __atomic_fool_gcc(x) (*(volatile struct { int a[100]; } *)x)
#ifdef __SMP__
typedef struct { volatile int counter; } atomic_t;
===================================================================
RCS file: include/asm-i386/RCS/bitops.h,v
retrieving revision 1.1
diff -u -r1.1 include/asm-i386/bitops.h
--- include/asm-i386/bitops.h 1997/12/01 01:51:08 1.1
+++ include/asm-i386/bitops.h 1997/12/01 01:51:18
@@ -20,11 +20,26 @@
#endif
/*
+ * Function prototypes to keep gcc -Wall happy
+ */
+extern void set_bit(int nr, volatile void * addr);
+extern void clear_bit(int nr, volatile void * addr);
+extern void change_bit(int nr, volatile void * addr);
+extern int test_and_set_bit(int nr, volatile void * addr);
+extern int test_and_clear_bit(int nr, volatile void * addr);
+extern int test_and_change_bit(int nr, volatile void * addr);
+extern int __constant_test_bit(int nr, const volatile void * addr);
+extern int __test_bit(int nr, volatile void * addr);
+extern int find_first_zero_bit(void * addr, unsigned size);
+extern int find_next_zero_bit (void * addr, int size, int offset);
+extern unsigned long ffz(unsigned long word);
+
+/*
* Some hacks to defeat gcc over-optimizations..
*/
struct __dummy { unsigned long a[100]; };
-#define ADDR (*(struct __dummy *) addr)
-#define CONST_ADDR (*(const struct __dummy *) addr)
+#define ADDR (*(volatile struct __dummy *) addr)
+#define CONST_ADDR (*(volatile const struct __dummy *) addr)
extern __inline__ void set_bit(int nr, volatile void * addr)
{

- Next message: PARMELAN Edouard: "de4x5.c V0.53 and SMC9332BDT"
- Previous message: Theodore Y. Ts'o: "Serial patches for 2.1.68"
- In reply to: Alex Priem: "Re: 2.1.68 brokenness."
- Next in thread: Gary White: "Re: 2.1.68 brokenness."