public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] include: undefine _LINUX_TYPES_H if including sys/capability.h
Date: Tue, 15 Oct 2019 18:15:34 +0800	[thread overview]
Message-ID: <20191015101534.17691-1-liwang@redhat.com> (raw)

In some of the libcap-devel(1.96~2.16) versions, it defines the _LINUX_TYPES_H
macro to make ltp-lib cann't include linux/types.h essentially.

    # cat -n /usr/include/sys/capability.h
    ...
    25  /*
    26   * Make sure we can be included from userland by preventing
    27   * capability.h from including other kernel headers
    28   */
    29  #define _LINUX_TYPES_H

To get rid of this compiling errors on rhel6(libcap-devel-2.16) series platform,
here undefine _LINUX_TYPES_H if included that sys/capability.h.

  == Error log ==
  In file included from ../include/tst_netlink.h:26,
                 from tst_crypto.c:13:
  /usr/include/linux/netlink.h:45: error: expected specifier-qualifier-list before ?__u16?
  /usr/include/linux/netlink.h:135: error: expected specifier-qualifier-list before ?__u16?
  tst_crypto.c: In function ?tst_crypto_recv_ack?:
  tst_crypto.c:46: error: ?struct nlmsghdr? has no member named ?nlmsg_seq?
  tst_crypto.c:47: error: ?struct nlmsghdr? has no member named ?nlmsg_type?
  tst_crypto.c:47: error: ?struct nlmsghdr? has no member named ?nlmsg_seq?
  tst_crypto.c:55: error: ?struct nlmsghdr? has no member named ?nlmsg_type?
  tst_crypto.c:58: error: ?struct nlmsghdr? has no member named ?nlmsg_type?
  tst_crypto.c:58: error: ?struct nlmsghdr? has no member named ?nlmsg_seq?
  tst_crypto.c: In function ?tst_crypto_add_alg?:
  ...
  make: *** [tst_crypto.o] Error 1

Reported-by: Ping Fang <pifang@redhat.com>
Signed-off-by: Li Wang <liwang@redhat.com>
Cc: Ping Fang <pifang@redhat.com>
Cc: Richard Palethorpe <rpalethorpe@suse.com>
---
 include/lapi/capability.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/lapi/capability.h b/include/lapi/capability.h
index dac233d84..3c2ee7937 100644
--- a/include/lapi/capability.h
+++ b/include/lapi/capability.h
@@ -10,6 +10,7 @@
 
 #ifdef HAVE_SYS_CAPABILITY_H
 # include <sys/capability.h>
+# undef _LINUX_TYPES_H
 #endif
 
 #ifndef CAP_NET_RAW
-- 
2.20.1


             reply	other threads:[~2019-10-15 10:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15 10:15 Li Wang [this message]
2019-10-15 13:02 ` [LTP] [PATCH] include: undefine _LINUX_TYPES_H if including sys/capability.h Richard Palethorpe
2019-10-16  6:57   ` Li Wang
2019-10-16  7:28     ` Richard Palethorpe

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=20191015101534.17691-1-liwang@redhat.com \
    --to=liwang@redhat.com \
    --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