summaryrefslogtreecommitdiff
path: root/frameworks/native/native.git-4.patch
blob: 468d4983948436890d2bfd349ba875464eaaca42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
From efa820d42f8e375537b3e318ea26eb01aeac9990 Mon Sep 17 00:00:00 2001
From: Amit Pundir <amit.pundir@linaro.org>
Date: Thu, 1 Aug 2013 18:15:27 +0530
Subject: [PATCH] servicemanager: enable bctest with debug logs

Enable bctest binder test and put ioctl pass/failure logs for lava.

Change-Id: I33eb6b87d3f9efcef7334dbb0a649ce23b8b0a21
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
---
 cmds/servicemanager/Android.mk |   10 ++++++----
 cmds/servicemanager/binder.c   |   30 +++++++++++++++++++++++++++---
 2 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/cmds/servicemanager/Android.mk b/cmds/servicemanager/Android.mk
index 8840867..46a053d 100644
--- a/cmds/servicemanager/Android.mk
+++ b/cmds/servicemanager/Android.mk
@@ -1,9 +1,11 @@
 LOCAL_PATH:= $(call my-dir)
 
-#include $(CLEAR_VARS)
-#LOCAL_SRC_FILES := bctest.c binder.c
-#LOCAL_MODULE := bctest
-#include $(BUILD_EXECUTABLE)
+include $(CLEAR_VARS)
+LOCAL_SHARED_LIBRARIES := liblog
+LOCAL_CFLAGS := -DBCTEST_DEBUG=1
+LOCAL_SRC_FILES := bctest.c binder.c
+LOCAL_MODULE := bctest
+include $(BUILD_EXECUTABLE)
 
 include $(CLEAR_VARS)
 LOCAL_SHARED_LIBRARIES := liblog
diff --git a/cmds/servicemanager/binder.c b/cmds/servicemanager/binder.c
index 1985756..c45ef6d 100644
--- a/cmds/servicemanager/binder.c
+++ b/cmds/servicemanager/binder.c
@@ -136,7 +136,16 @@ void binder_close(struct binder_state *bs)
 
 int binder_become_context_manager(struct binder_state *bs)
 {
-    return ioctl(bs->fd, BINDER_SET_CONTEXT_MGR, 0);
+    int ret;
+    ret = ioctl(bs->fd, BINDER_SET_CONTEXT_MGR, 0);
+    if (ret < 0) {
+        fprintf(stderr,"binder_set_context_manager: ioctl FAIL (%s)\n", strerror(errno));
+#if BCTEST_DEBUG
+    } else {
+        fprintf(stderr,"binder_set_context_manager: ioctl PASS\n");
+#endif
+    }
+    return ret;
 }
 
 int binder_write(struct binder_state *bs, void *data, unsigned len)
@@ -151,8 +160,12 @@ int binder_write(struct binder_state *bs, void *data, unsigned len)
     bwr.read_buffer = 0;
     res = ioctl(bs->fd, BINDER_WRITE_READ, &bwr);
     if (res < 0) {
-        fprintf(stderr,"binder_write: ioctl failed (%s)\n",
+        fprintf(stderr,"binder_write: ioctl FAIL (%s)\n",
                 strerror(errno));
+#if BCTEST_DEBUG
+    } else {
+        fprintf(stderr,"binder_write: ioctl PASS\n");
+#endif
     }
     return res;
 }
@@ -339,8 +352,12 @@ int binder_call(struct binder_state *bs,
         res = ioctl(bs->fd, BINDER_WRITE_READ, &bwr);
 
         if (res < 0) {
-            fprintf(stderr,"binder: ioctl failed (%s)\n", strerror(errno));
+            fprintf(stderr,"binder: ioctl FAIL (%s)\n", strerror(errno));
             goto fail;
+#if BCTEST_DEBUG
+        } else {
+            fprintf(stderr,"binder: ioctl PASS\n");
+#endif
         }
 
         res = binder_parse(bs, reply, readbuf, bwr.read_consumed, 0);
@@ -376,7 +393,14 @@ void binder_loop(struct binder_state *bs, binder_handler func)
 
         if (res < 0) {
             ALOGE("binder_loop: ioctl failed (%s)\n", strerror(errno));
+#if BCTEST_DEBUG
+            fprintf(stderr,"binder_loop: ioctl FAIL (%s)\n", strerror(errno));
+#endif
             break;
+#if BCTEST_DEBUG
+        } else {
+            fprintf(stderr,"binder_loop: ioctl PASS\n");
+#endif
         }
 
         res = binder_parse(bs, 0, readbuf, bwr.read_consumed, func);
-- 
1.7.9.5