]> granicus.if.org Git - strace/commitdiff
net: decode Bluetooth protocol names unconditionally
authorEugene Syromyatnikov <evgsyr@gmail.com>
Wed, 11 Apr 2018 11:53:54 +0000 (13:53 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 6 May 2018 21:18:34 +0000 (21:18 +0000)
As we have all BTPROTO_* constant definitions now, there is no need
to rely on bluetooth.h header anymore.

* net.c (AF_BLUETOOTH): Provide a fallback definition.
[HAVE_BLUETOOTH_BLUETOOTH_H]: Do not include <bluetooth/bluetooth.h>.
[!HAVE_BLUETOOTH_BLUETOOTH_H]: Include "xlat/bt_protocols.h".
[!HAVE_BLUETOOTH_BLUETOOTH_H] (decode_sockbuf): Decode AF_BLUETOOTH.
(decode_sockbuf) <case AF_BLUETOOTH>: Use printxval_index.
* xlat/bt_protocols.in: Add "#value_indexed" directive.

net.c
xlat/bt_protocols.in

diff --git a/net.c b/net.c
index d7267912c9971bc516c45978a0854dcd770ebec3..db47f65a1f6e213252ac6982bb867d6f6a7d9cf6 100644 (file)
--- a/net.c
+++ b/net.c
 
 #include "xlat/inet_protocols.h"
 
-#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
-# include <bluetooth/bluetooth.h>
-# include "xlat/bt_protocols.h"
+#ifndef AF_BLUETOOTH
+# define AF_BLUETOOTH 31
 #endif
+#include "xlat/bt_protocols.h"
 
 static void
 decode_sockbuf(struct tcb *const tcp, const int fd, const kernel_ulong_t addr,
@@ -138,11 +138,9 @@ SYS_FUNC(socket)
                printxval(netlink_protocols, tcp->u_arg[2], "NETLINK_???");
                break;
 
-#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
        case AF_BLUETOOTH:
-               printxval(bt_protocols, tcp->u_arg[2], "BTPROTO_???");
+               printxval_index(bt_protocols, tcp->u_arg[2], "BTPROTO_???");
                break;
-#endif
 
        default:
                tprintf("%" PRI_klu, tcp->u_arg[2]);
index 3401eaf733139e5574e93c8b49e2228e012761cd..a0ad05653270ef4af35c01d0cea830dffb18735d 100644 (file)
@@ -1,3 +1,4 @@
+#value_indexed
 BTPROTO_L2CAP  0
 BTPROTO_HCI    1
 BTPROTO_SCO    2