]> granicus.if.org Git - strace/commitdiff
Simplify personality checks in msghdr.c and signal.c
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 26 Dec 2016 20:21:23 +0000 (20:21 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 27 Dec 2016 01:08:58 +0000 (01:08 +0000)
* msghdr.c: Check for [!current_wordsize] instead
of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4].
* signal.c: Likewise.

msghdr.c
signal.c

index f9264a60013e2dee6f117d6b673d0f3070809cb4..56ba54983077ba9d058f5bc62f73088ac37a2f9a 100644 (file)
--- a/msghdr.c
+++ b/msghdr.c
@@ -39,7 +39,7 @@
 #include "xlat/scmvals.h"
 #include "xlat/ip_cmsg_types.h"
 
-#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
+#ifndef current_wordsize
 struct cmsghdr32 {
        uint32_t cmsg_len;
        int cmsg_level;
@@ -50,7 +50,7 @@ struct cmsghdr32 {
 typedef union {
        char *ptr;
        struct cmsghdr *cmsg;
-#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
+#ifndef current_wordsize
        struct cmsghdr32 *cmsg32;
 #endif
 } union_cmsghdr;
@@ -260,7 +260,7 @@ decode_msg_control(struct tcb *const tcp, const kernel_ulong_t addr,
        tprints(", msg_control=");
 
        const unsigned int cmsg_size =
-#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
+#ifndef current_wordsize
                (current_wordsize < sizeof(long)) ? sizeof(struct cmsghdr32) :
 #endif
                        sizeof(struct cmsghdr);
@@ -280,17 +280,17 @@ decode_msg_control(struct tcb *const tcp, const kernel_ulong_t addr,
        tprints("[");
        while (buf_len >= cmsg_size) {
                const kernel_ulong_t cmsg_len =
-#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
+#ifndef current_wordsize
                        (current_wordsize < sizeof(long)) ? u.cmsg32->cmsg_len :
 #endif
                                u.cmsg->cmsg_len;
                const int cmsg_level =
-#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
+#ifndef current_wordsize
                        (current_wordsize < sizeof(long)) ? u.cmsg32->cmsg_level :
 #endif
                                u.cmsg->cmsg_level;
                const int cmsg_type =
-#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
+#ifndef current_wordsize
                        (current_wordsize < sizeof(long)) ? u.cmsg32->cmsg_type :
 #endif
                                u.cmsg->cmsg_type;
index 30838b2347d369f95d3487d03804c19801a7534a..ef7bed8884cda9077fd6dfd0e0b90b8380c276ba 100644 (file)
--- a/signal.c
+++ b/signal.c
@@ -310,8 +310,8 @@ decode_old_sigaction(struct tcb *const tcp, const kernel_ulong_t addr)
 {
        struct old_sigaction sa;
 
-#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
-       if (current_wordsize != sizeof(sa.sa_handler__) && current_wordsize == 4) {
+#ifndef current_wordsize
+       if (current_wordsize < sizeof(sa.sa_handler__)) {
                struct old_sigaction32 sa32;
 
                if (umove_or_printaddr(tcp, addr, &sa32))
@@ -501,8 +501,8 @@ decode_new_sigaction(struct tcb *const tcp, const kernel_ulong_t addr)
 {
        struct new_sigaction sa;
 
-#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
-       if (current_wordsize != sizeof(sa.sa_flags) && current_wordsize == 4) {
+#ifndef current_wordsize
+       if (current_wordsize < sizeof(sa.sa_handler__)) {
                struct new_sigaction32 sa32;
 
                if (umove_or_printaddr(tcp, addr, &sa32))