summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot2018-06-07 11:44:24 -0500
committerGerrit Code Review2018-06-07 11:44:24 -0500
commit59112043262a03877234b2ffc75fee273e39d9bd (patch)
tree56357573487389d04f4a6e9ee89f094695462070
parent9be5f2df0ad147160cc2b2c2566b4b09834d963e (diff)
parent246d35d02ba85784ff41187492a0ceb50a96d5b7 (diff)
downloadplatform-system-core-59112043262a03877234b2ffc75fee273e39d9bd.tar.gz
platform-system-core-59112043262a03877234b2ffc75fee273e39d9bd.tar.xz
platform-system-core-59112043262a03877234b2ffc75fee273e39d9bd.zip
Merge "libsysutils: Delete dead code: FrameworkClient"
-rw-r--r--libsysutils/include/sysutils/FrameworkClient.h21
-rw-r--r--libsysutils/src/FrameworkClient.cpp58
2 files changed, 0 insertions, 79 deletions
diff --git a/libsysutils/include/sysutils/FrameworkClient.h b/libsysutils/include/sysutils/FrameworkClient.h
deleted file mode 100644
index 4a3f0de0e..000000000
--- a/libsysutils/include/sysutils/FrameworkClient.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef _FRAMEWORK_CLIENT_H
2#define _FRAMEWORK_CLIENT_H
3
4#include "List.h"
5
6#include <pthread.h>
7
8class FrameworkClient {
9 int mSocket;
10 pthread_mutex_t mWriteMutex;
11
12public:
13 FrameworkClient(int sock);
14 virtual ~FrameworkClient() {}
15
16 int sendMsg(const char *msg);
17 int sendMsg(const char *msg, const char *data);
18};
19
20typedef android::sysutils::List<FrameworkClient *> FrameworkClientCollection;
21#endif
diff --git a/libsysutils/src/FrameworkClient.cpp b/libsysutils/src/FrameworkClient.cpp
deleted file mode 100644
index 72b3d0a36..000000000
--- a/libsysutils/src/FrameworkClient.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * Copyright (C) 2009-2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#define LOG_TAG "FrameworkClient"
18
19#include <alloca.h>
20#include <errno.h>
21#include <pthread.h>
22#include <sys/types.h>
23
24#include <android/log.h>
25#include <sysutils/FrameworkClient.h>
26
27FrameworkClient::FrameworkClient(int socket) {
28 mSocket = socket;
29 pthread_mutex_init(&mWriteMutex, NULL);
30}
31
32int FrameworkClient::sendMsg(const char *msg) {
33 int ret;
34 if (mSocket < 0) {
35 errno = EHOSTUNREACH;
36 return -1;
37 }
38
39 pthread_mutex_lock(&mWriteMutex);
40 ret = TEMP_FAILURE_RETRY(write(mSocket, msg, strlen(msg) +1));
41 if (ret < 0) {
42 SLOGW("Unable to send msg '%s' (%s)", msg, strerror(errno));
43 }
44 pthread_mutex_unlock(&mWriteMutex);
45 return 0;
46}
47
48int FrameworkClient::sendMsg(const char *msg, const char *data) {
49 size_t bufflen = strlen(msg) + strlen(data) + 1;
50 char *buffer = (char *) alloca(bufflen);
51 if (!buffer) {
52 errno = -ENOMEM;
53 return -1;
54 }
55 snprintf(buffer, bufflen, "%s%s", msg, data);
56 return sendMsg(buffer);
57}
58