Fix NSIG.

Our sigset_t definition hasn't been tied to our NSIG definition since we
switched to uapi headers, so we can now fix it without breaking the LP32 ABI.
The kernel uapi headers define and use _NSIG, so we need to have our scripts
rename the kernel's definitions out of the way, then we can define _NSIG
and NSIG in terms of the kernel's off-by-one value.

Bug: 12938442
Change-Id: Ic7c86fd5be5ad1d822f7b2b1d88c8a0d70a1ac0f
This commit is contained in:
Elliott Hughes 2014-02-11 20:01:11 -08:00
parent 022885e2fa
commit 199346a2ab
8 changed files with 25 additions and 19 deletions

View file

@ -51,14 +51,15 @@ __BEGIN_DECLS
typedef int sig_atomic_t;
/* TODO: 64-bit: we should probably #undef the uapi NSIG and add a unit test that NSIG == _NSIG && NSIG >= 64. */
#ifndef _NSIG
# define _NSIG 64
#endif
#ifndef NSIG
# define NSIG _NSIG
/* The arm and x86 kernel header files don't define _NSIG. */
#ifndef _KERNEL__NSIG
#define _KERNEL__NSIG 64
#endif
/* Userspace's NSIG is the kernel's _NSIG + 1. */
#define _NSIG (_KERNEL__NSIG + 1)
#define NSIG _NSIG
extern const char* const sys_siglist[];
extern const char* const sys_signame[];

View file

@ -1521,7 +1521,7 @@ class BlockList:
"""replace tokens according to the given dict
"""
for b in self.blocks:
if not b.isDirective():
if (not b.isDirective()) or b.isDefine():
for tok in b.tokens:
if tok.id == tokIDENT:
if tok.value in replacements:

View file

@ -57,10 +57,15 @@ kernel_arch_token_replacements = {
"mips": {"off_t":"__kernel_off_t"},
"x86": {},
}
# Replace tokens in the output according to this mapping
kernel_token_replacements = {
"asm": "__asm__",
"__unused": "__linux_unused", # The kernel usage of __unused conflicts with the macro defined in sys/cdefs.h
# The kernel usage of __unused for unused struct fields conflicts with the macro defined in <sys/cdefs.h>.
"__unused": "__linux_unused",
# The kernel's _NSIG/NSIG are one less than the userspace value, so we need to move them aside.
"_NSIG": "_KERNEL__NSIG",
"NSIG": "_KERNEL_NSIG",
}
# this is the set of known static inline functions that we want to keep

View file

@ -21,7 +21,7 @@
#include <linux/types.h>
struct siginfo;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define NSIG 32
#define _KERNEL_NSIG 32
typedef unsigned long sigset_t;
#define SIGHUP 1
#define SIGINT 2
@ -67,7 +67,7 @@ typedef unsigned long sigset_t;
#define SIGUNUSED 31
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SIGRTMIN 32
#define SIGRTMAX _NSIG
#define SIGRTMAX _KERNEL__NSIG
#define SIGSWI 32
#define SA_NOCLDSTOP 0x00000001
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View file

@ -19,10 +19,10 @@
#ifndef _UAPI__ASM_GENERIC_SIGNAL_H
#define _UAPI__ASM_GENERIC_SIGNAL_H
#include <linux/types.h>
#define _NSIG 64
#define _KERNEL__NSIG 64
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define _NSIG_BPW __BITS_PER_LONG
#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
#define _NSIG_WORDS (_KERNEL__NSIG / _NSIG_BPW)
#define SIGHUP 1
#define SIGINT 2
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
@ -68,7 +68,7 @@
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SIGRTMIN 32
#ifndef SIGRTMAX
#define SIGRTMAX _NSIG
#define SIGRTMAX _KERNEL__NSIG
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SA_NOCLDSTOP 0x00000001

View file

@ -19,10 +19,10 @@
#ifndef _UAPI_ASM_SIGNAL_H
#define _UAPI_ASM_SIGNAL_H
#include <linux/types.h>
#define _NSIG 128
#define _KERNEL__NSIG 128
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define _NSIG_BPW (sizeof(unsigned long) * 8)
#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
#define _NSIG_WORDS (_KERNEL__NSIG / _NSIG_BPW)
typedef struct {
unsigned long sig[_NSIG_WORDS];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
@ -72,7 +72,7 @@ typedef unsigned long old_sigset_t;
#define SIGXFSZ 31
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SIGRTMIN 32
#define SIGRTMAX _NSIG
#define SIGRTMAX _KERNEL__NSIG
#define SA_ONSTACK 0x08000000
#define SA_RESETHAND 0x80000000
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View file

@ -24,7 +24,7 @@
#include <linux/time.h>
#include <linux/compiler.h>
struct siginfo;
#define NSIG 32
#define _KERNEL_NSIG 32
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
typedef unsigned long sigset_t;
#endif
@ -72,7 +72,7 @@ typedef unsigned long sigset_t;
#define SIGUNUSED 31
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SIGRTMIN 32
#define SIGRTMAX _NSIG
#define SIGRTMAX _KERNEL__NSIG
#define SA_NOCLDSTOP 0x00000001u
#define SA_NOCLDWAIT 0x00000002u
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View file

@ -102,7 +102,7 @@ struct stat {
long __linux_unused[3];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
#define INIT_STRUCT_STAT_PADDING(st) do { st.__pad0 = 0; st.__unused[0] = 0; st.__unused[1] = 0; st.__unused[2] = 0; } while (0)
#define INIT_STRUCT_STAT_PADDING(st) do { st.__pad0 = 0; st.__linux_unused[0] = 0; st.__linux_unused[1] = 0; st.__linux_unused[2] = 0; } while (0)
#endif
struct __old_kernel_stat {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */