public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] acct: fix version check on big endian system
Date: Thu, 10 Oct 2019 13:44:52 +0200	[thread overview]
Message-ID: <20191010114452.GC23153@dell5510> (raw)
In-Reply-To: <2126517382.5475715.1570692951519.JavaMail.zimbra@redhat.com>

Hi Jan,

> Can we incorporate ACCT_BYTEORDER into that check?

> Kernel appears to use it at least since 2.6.12-rc2. We would just need
> define it for !HAVE_STRUCT_ACCT_V3 case.

> diff --git a/include/lapi/acct.h b/include/lapi/acct.h
> index ebd65bbf4df7..112ee48d8aee 100644
> --- a/include/lapi/acct.h
> +++ b/include/lapi/acct.h
> @@ -64,6 +64,13 @@ enum {
>         ACORE = 0x08,
>         AXSIG = 0x10
>  };
> +
> +# if __BYTE_ORDER == __BIG_ENDIAN
> +# define ACCT_BYTEORDER  0x80
> +# elif __BYTE_ORDER == __LITTLE_ENDIAN
> +# define ACCT_BYTEORDER  0x00
> +# endif
> +
>  #endif /* HAVE_STRUCT_ACCT_V3 */

>  #endif /* LAPI_ACCT_H */
> diff --git a/testcases/kernel/syscalls/acct/acct02.c b/testcases/kernel/syscalls/acct/acct02.c
> index 7c2a270465c5..4d95aafec3e1 100644
> --- a/testcases/kernel/syscalls/acct/acct02.c
> +++ b/testcases/kernel/syscalls/acct/acct02.c
> @@ -142,7 +142,7 @@ static int verify_acct(void *acc, int elap_time)
>                 ret = 1;
>         }

> -       if (ACCT_MEMBER_V3(ac_version) != 3) {
> +       if (ACCT_MEMBER_V3(ac_version) != (3 | ACCT_BYTEORDER)) {
>                 tst_res(TINFO, "ac_version != 3 (%d)",
>                         ACCT_MEMBER_V3(ac_version));
>                 ret = 1;

FYI v2 merged. Sorry not adding your Suggested-by: and Acked-by: tags
(you weren't in Cc: for v2).

Kind regards,
Petr

      parent reply	other threads:[~2019-10-10 11:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10  6:37 [LTP] [PATCH] acct: fix version check on big endian system Ping Fang
2019-10-10  6:43 ` Ping Fang
2019-10-10  7:35   ` Jan Stancek
2019-10-10  8:16     ` Ping Fang
2019-10-10 11:44     ` Petr Vorel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191010114452.GC23153@dell5510 \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox