updated asm-sparc/{processor,signal,sigcontext}.h to
Quoted 6 lines · Jeremy Huddleston
asm-sparc/signal.hneeds:#include <linux/compiler>
because it uses
__useraround line 214. Without this include, userland code includingasm/signal.hwill fail to compile.
I've updated the patch to fix a few more problems with redefined structs, etc when using they are included after glibc headers.
Signature · 1 line
Jeremy Huddleston <[email protected]>
include/asm-sparc/signal.h renamed from include/asm-sparc/signal.h.orig +8 -0
@@ -3,6 +3,7 @@#define _ASMSPARC_SIGNAL_H#include <asm/sigcontext.h> +#include <linux/compiler.h> #ifdef __KERNEL__#ifndef __ASSEMBLY__
@@ -113,11 +114,14 @@unsigned long sig[_NSIG_WORDS]; } __new_sigset_t; + +#ifndef _SIGNAL_H/* A SunOS sigstack */ struct sigstack {char *the_stack;int cur_status; }; +#endif /* Sigvec flags */ #define _SV_SSTACK 1u/* This signal handler should use sig-stack */
@@ -191,12 +195,14 @@#define SIG_IGN ((__sighandler_t)1)/* ignore signal */ #define SIG_ERR ((__sighandler_t)-1)/* error return from signal */ +#ifndef _SIGNAL_Hstruct __new_sigaction {__sighandler_t sa_handler;unsigned long sa_flags;void (*sa_restorer)(void );/* Not used by Linux/SPARC */ __new_sigset_t sa_mask; }; +#endif #ifdef __KERNEL__ struct k_sigaction {
@@ -205,6 +211,7 @@ };#endif +#ifndef _SIGNAL_H struct __old_sigaction { __sighandler_t sa_handler; __old_sigset_t sa_mask;
@@ -217,6 +224,7 @@int ss_flags;size_t ss_size; } stack_t; +#endif #ifdef __KERNEL__ struct sparc_deliver_cookie {
include/asm-sparc/sigcontext.h renamed from include/asm-sparc/sigcontext.h.orig +7 -4
@@ -4,9 +4,9 @@#ifdef __KERNEL__#include <asm/ptrace.h> -#endif #ifndef __ASSEMBLY__ +#ifndef _SIGNAL_H#define __SUNOS_MAXWIN 31
@@ -57,8 +57,6 @@ } si_fpqueue [16 ]; } __siginfo_fpu_t; -#ifdef __KERNEL__ -/* This magic should be in g_upper[0] for all upper parts to be valid. This is generated by sparc64 only, but for 32bit processes,
@@ -69,8 +67,13 @@unsigned int o_upper[8 ]; } siginfo_extra_v8plus_t; -#endif +#endif /* !(_SIGNAL_H) */ #endif /* !(__ASSEMBLY__) */ +#else /* !(__KERNEL__) */ +#include <signal.h> /* Pulls in <bits/sigcontext.h> which contains both /* +/* of these structures... */ +#endif +#endif /* !(__SPARC_SIGCONTEXT_H) */
include/asm-sparc/processor.h renamed from include/asm-sparc/processor.h.orig +2 -0
@@ -43,10 +43,12 @@struct task_struct ; +#ifndef _SYS_UCONTEXT_Hstruct fpq {unsigned long *insn_addr;unsigned long insn; }; +#endif typedef struct { int seg;
Quoted 10 lines · On Wed, 08 Dec 2004 02:53:23 -0800 Jeremy Huddleston <[email protected]>…
Quoted 6 lines · Jeremy Huddleston
asm-sparc/signal.hneeds:#include <linux/compiler>
because it uses
__useraround line 214. Without this include, userland code includingasm/signal.hwill fail to compile.I've updated the patch to fix a few more problems with redefined structs, etc when using they are included after glibc headers.
Please use __KERNEL__ instead of things like _SIGNAL_H Thanks.
Quoted 6 lines · On Wed, 08 Dec 2004 21:25:51 -0800 Jeremy Huddleston <[email protected]>…
Quoted 2 lines · David S. Miller
Please use
__KERNEL__instead of things like_SIGNAL_HThanks.Ok, I'll keep that in mind for next time. I was just copying the same behavior from asm-x86_64. Do you want me to update/resend the patch?
Please do, I'd like to apply your patch and have this fixed. :-)
Quoted 2 lines · David S. Miller
Please use
__KERNEL__instead of things like_SIGNAL_HThanks.
Ok, I'll keep that in mind for next time. I was just copying the same behavior from asm-x86_64. Do you want me to update/resend the patch?
Signature · 1 line
Jeremy Huddleston <[email protected]>
Quoted 4 lines · David S. Miller
Quoted 2 lines
Ok, I'll keep that in mind for next time. I was just copying the same behavior from asm-x86_64. Do you want me to update/resend the patch?
Please do, I'd like to apply your patch and have this fixed. :-)
Ok, here's the updated one. It's much cleaner now, and I also did NOT do asm-x86_64's '#include <signal.h>' if we're !__KERNEL__. I found that to be a rather ugly kludge. It's the userland code that should change there, not us.
Signature · 1 line
Jeremy Huddleston <[email protected]>
include/asm-sparc/processor.h +2 -0
@@ -43,10 +43,12 @@struct task_struct ; +#ifdef __KERNEL__struct fpq {unsigned long *insn_addr;unsigned long insn; }; +#endif typedef struct { int seg;
include/asm-sparc/sigcontext.h +3 -5
@@ -4,7 +4,6 @@#ifdef __KERNEL__#include <asm/ptrace.h> -#endif #ifndef __ASSEMBLY__
@@ -57,8 +56,6 @@ } si_fpqueue [16 ]; } __siginfo_fpu_t; -#ifdef __KERNEL__ -/* This magic should be in g_upper[0] for all upper parts to be valid. This is generated by sparc64 only, but for 32bit processes,
@@ -69,8 +66,9 @@unsigned int o_upper[8 ]; } siginfo_extra_v8plus_t; -#endif -#endif /* !(__ASSEMBLY__) */ +#endif /* (__KERNEL__) */ +#endif /* !(__SPARC_SIGCONTEXT_H) */ +
include/asm-sparc/signal.h +5 -3
@@ -3,6 +3,7 @@#define _ASMSPARC_SIGNAL_H#include <asm/sigcontext.h> +#include <linux/compiler.h> #ifdef __KERNEL__#ifndef __ASSEMBLY__
@@ -111,11 +112,14 @@unsigned long sig[_NSIG_WORDS]; } __new_sigset_t; + +#ifdef __KERNEL__/* A SunOS sigstack */ struct sigstack {char *the_stack;int cur_status; }; +#endif /* Sigvec flags */ #define _SV_SSTACK 1u/* This signal handler should use sig-stack */
@@ -189,6 +193,7 @@#define SIG_IGN ((__sighandler_t)1)/* ignore signal */ #define SIG_ERR ((__sighandler_t)-1)/* error return from signal */ +#ifdef __KERNEL__ struct __new_sigaction { __sighandler_t sa_handler; unsigned long sa_flags;
@@ -196,12 +201,10 @@__new_sigset_t sa_mask; }; -#ifdef __KERNEL__struct k_sigaction {struct __new_sigaction sa;void __user *ka_restorer; }; -#endif struct __old_sigaction {__sighandler_t sa_handler;
@@ -216,7 +219,6 @@size_t ss_size; } stack_t; -#ifdef __KERNEL__struct sparc_deliver_cookie {int restart_syscall;unsigned long orig_i0;
David S. Miller
AppliedQuoted 10 lines · On Wed, 08 Dec 2004 22:00:42 -0800 Jeremy Huddleston <[email protected]>…
Quoted 4 lines · David S. Miller
Quoted 2 lines
Ok, I'll keep that in mind for next time. I was just copying the same behavior from asm-x86_64. Do you want me to update/resend the patch?
Please do, I'd like to apply your patch and have this fixed. :-)
Ok, here's the updated one. It's much cleaner now, and I also did NOT do asm-x86_64's '#include <
signal.h>' if we're !__KERNEL__. I found that to be a rather ugly kludge. It's the userland code that should change there, not us.
Applied, thanks Jeremy.
Quoted 6 lines
Quoted 4 lines
Ok, here's the updated one. It's much cleaner now, and I also did NOT do asm-x86_64's '#include <
signal.h>' if we're !__KERNEL__. I found that to be a rather ugly kludge. It's the userland code that should change there, not us.Applied, thanks Jeremy.
In changing from the glibc check to __KERNEL__, processor.h doesn't work for some userland code. Here's an update to correct this.
Signature · 1 line
Jeremy Huddleston <[email protected]>
asm-sparc/processor.h renamed from asm-sparc/processor.h.orig +9 -3
@@ -44,11 +44,13 @@struct task_struct ;#ifdef __KERNEL__ -struct fpq { +#define __fpq fpq +#endif + +struct __fpq {unsigned long *insn_addr;unsigned long insn; }; -#endif typedef struct { int seg;
@@ -67,13 +69,17 @@ struct thread_struct { unsigned long float_regs[32] __attribute__ ((aligned (8)));unsigned long fsr;unsigned long fpqdepth; -struct fpq fpqueue[16 ]; +struct __fpq fpqueue[16 ];unsigned long flags;mm_segment_t current_ds;struct exec core_exec;/* just what it says. */ int new_signal; }; +#ifdef __KERNEL__ +#undef __fpq +#endif +#define SPARC_FLAG_KTHREAD 0x1/* task is a kernel thread */ #define SPARC_FLAG_UNALIGNED 0x2/* is allowed to do unaligned accesses */
Quoted 9 lines · On Sat, 11 Dec 2004 16:06:39 -0800 Jeremy Huddleston <[email protected]>…
Quoted 6 lines
Quoted 4 lines
Ok, here's the updated one. It's much cleaner now, and I also did NOT do asm-x86_64's '#include <
signal.h>' if we're !__KERNEL__. I found that to be a rather ugly kludge. It's the userland code that should change there, not us.Applied, thanks Jeremy.
In changing from the glibc check to
__KERNEL__,processor.hdoesn't work for some userland code. Here's an update to correct this.
I don't think this is too pleasant.
Actually, I can't see much of anything that userland needs to get at inside of processor.h, so why don't you just __KERNEL__ ifdef out nearly the entire file?
Re: [PATCH] updated asm-sparc/{processor,signal,sigcontext}.h to behave nicely in userland
In reply to Jeremy HuddlestonQuoted 2 lines · On Sat, 11 Dec 2004 16:06:39 -0800 Jeremy Huddleston <[email protected]>…
Quoted 2 lines
In changing from the glibc check to
__KERNEL__,processor.hdoesn't work for some userland code. Here's an update to correct this.
Quoted 4 lines · David S. Miller
I don't think this is too pleasant.
Actually, I can't see much of anything that userland needs to get at inside ofprocessor.h, so why don't you just__KERNEL__ifdef out nearly the entire file?
I'm vaguely disinclined to take fixes for userspace inclusion of kernel headers unless, say, other arches are taking such steps and we would only penalize ourselves by not doing so.
By and large I'd prefer to discourage userspace code from using kernel headers. Does this work in a significant number of other arches as things stand now?
-- wli
Quoted 3 lines · On Mon, 27 Dec 2004 19:06:57 -0800 William Lee Irwin III <[email protected]>…
By and large I'd prefer to discourage userspace code from using kernel headers. Does this work in a significant number of other arches as things stand now?
Glibc includes them. It works for sparc64 and a lot of this is painless stuff to include.
Quoted 9 lines · David S. Miller
Quoted 3 lines · On Mon, 27 Dec 2004 19:06:57 -0800 William Lee Irwin III <[email protected]>…
By and large I'd prefer to discourage userspace code from using kernel headers. Does this work in a significant number of other arches as things stand now?
Glibc includes them. It works for sparc64 and a lot of this is painless stuff to include.
Yeah, that patch was specifically for glibc. Some other things include them as well... samba comes to mind. I agree that it's good to discourage userland code from using the kernel headers, but in some cases, it's unavoidable.
Signature · 1 line
Jeremy Huddleston <[email protected]>
Re: [PATCH] updated asm-sparc/{processor,signal,sigcontext}.h to behave nicely in userland
In reply to Jeremy HuddlestonQuoted 3 lines · On Mon, 27 Dec 2004 19:06:57 -0800 William Lee Irwin III <[email protected]>…
Quoted 3 lines
By and large I'd prefer to discourage userspace code from using kernel headers. Does this work in a significant number of other arches as things stand now?
Quoted 2 lines · David S. Miller
Glibc includes them. It works for sparc64 and a lot of this is painless stuff to include.
As long as I'm not the first to coddle glibc, I guess I can live with it.
-- wli