From 513e9c23df4713c97c25f862ee9c140f508c5a2c Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 21 Mar 2012 14:39:22 +0100 Subject: [PATCH] simple cleanups in defs.h. No logic changes. * defs.h: Move offsetof macro definition into "libc stuff" section. Renumber TCB_foo constants (smaller constants -> sometimes smaller code). Remove uoff macro. * process.c: Move uoff macro here (sole user). Signed-off-by: Denys Vlasenko --- defs.h | 21 +++++++++------------ process.c | 2 ++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/defs.h b/defs.h index c87b97df..bf30769f 100644 --- a/defs.h +++ b/defs.h @@ -76,6 +76,11 @@ extern char *stpcpy(char *dst, const char *src); # define __attribute__(x) /*nothing*/ #endif +#ifndef offsetof +# define offsetof(type, member) \ + (((char *) &(((type *) NULL)->member)) - ((char *) (type *) NULL)) +#endif + #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) /* Configuration section */ @@ -355,10 +360,10 @@ struct tcb { #define TCB_INSYSCALL 00010 #define TCB_ATTACHED 00020 /* It is attached already */ /* Are we PROG from "strace PROG [ARGS]" invocation? */ -#define TCB_STRACE_CHILD 00040 +#define TCB_STRACE_CHILD 0040 #define TCB_BPTSET 00100 /* "Breakpoint" set after fork(2) */ -#define TCB_REPRINT 01000 /* We should reprint this syscall on exit */ -#define TCB_FILTERED 02000 /* This system call has been filtered out */ +#define TCB_REPRINT 00200 /* We should reprint this syscall on exit */ +#define TCB_FILTERED 00400 /* This system call has been filtered out */ /* x86 does not need TCB_WAITEXECVE. * It can detect SIGTRAP by looking at eax/rax. * See "not a syscall entry (eax = %ld)\n" message @@ -371,7 +376,7 @@ struct tcb { /* This tracee has entered into execve syscall. Expect post-execve SIGTRAP * to happen. (When it is detected, tracee is continued and this bit is cleared.) */ -# define TCB_WAITEXECVE 04000 +# define TCB_WAITEXECVE 01000 #endif /* qualifier flags */ @@ -411,14 +416,6 @@ extern const struct xlat open_access_modes[]; #define RVAL_STR 010 /* Print `auxstr' field after return val */ #define RVAL_NONE 020 /* Print nothing */ -#ifndef offsetof -# define offsetof(type, member) (((char *) &(((type *) NULL)->member)) - \ - ((char *) (type *) NULL)) -#endif - -/* get offset of member within a user struct */ -#define uoff(member) offsetof(struct user, member) - #define TRACE_FILE 001 /* Trace file-related syscalls. */ #define TRACE_IPC 002 /* Trace IPC-related syscalls. */ #define TRACE_NETWORK 004 /* Trace network-related syscalls. */ diff --git a/process.c b/process.c index ab667e2c..100ccd44 100644 --- a/process.c +++ b/process.c @@ -1287,6 +1287,8 @@ static const struct xlat ptrace_setoptions_flags[] = { }; #endif /* PTRACE_SETOPTIONS */ +#define uoff(member) offsetof(struct user, member) + const struct xlat struct_user_offsets[] = { #if defined(S390) || defined(S390X) { PT_PSWMASK, "psw_mask" }, -- 2.40.0